Fixing some trivial warnings in the SwiftShader build.
BUG=18368388
Change-Id: I89038818164e04f9ae4a7e1c4526781654e83c7a
Reviewed-on: https://swiftshader-review.googlesource.com/1390
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Common/Memory.cpp b/src/Common/Memory.cpp
index 7c5a366..b091ac7 100644
--- a/src/Common/Memory.cpp
+++ b/src/Common/Memory.cpp
@@ -55,7 +55,7 @@
unsigned char *block;
};
-void *allocate(size_t bytes, int alignment)
+void *allocate(size_t bytes, size_t alignment)
{
unsigned char *block = new unsigned char[bytes + sizeof(Allocation) + alignment];
unsigned char *aligned = 0;
@@ -72,7 +72,7 @@
return aligned;
}
-void *allocateZero(size_t bytes, int alignment)
+void *allocateZero(size_t bytes, size_t alignment)
{
void *memory = allocate(bytes, alignment);
diff --git a/src/Common/Memory.hpp b/src/Common/Memory.hpp
index fe8517b..d6a115d 100644
--- a/src/Common/Memory.hpp
+++ b/src/Common/Memory.hpp
@@ -16,8 +16,8 @@
size_t memoryPageSize();
-void *allocate(size_t bytes, int alignment = 16);
-void *allocateZero(size_t bytes, int alignment = 16);
+void *allocate(size_t bytes, size_t alignment = 16);
+void *allocateZero(size_t bytes, size_t alignment = 16);
void deallocate(void *memory);
void *allocateExecutable(size_t bytes); // Allocates memory that can be made executable using markExecutable()
diff --git a/src/LLVM/include/llvm/ADT/APInt.h b/src/LLVM/include/llvm/ADT/APInt.h
index 707e0db..df1b6d6 100644
--- a/src/LLVM/include/llvm/ADT/APInt.h
+++ b/src/LLVM/include/llvm/ADT/APInt.h
@@ -424,7 +424,7 @@
/// @returns the all-ones value for an APInt of the specified bit-width.
/// @brief Get the all-ones value.
static APInt getAllOnesValue(unsigned numBits) {
- return APInt(numBits, -1ULL, true);
+ return APInt(numBits, _UI64_MAX, true);
}
/// @returns the '0' value for an APInt of the specified bit-width.
@@ -495,7 +495,7 @@
if (loBitsSet == 0)
return APInt(numBits, 0);
if (loBitsSet == APINT_BITS_PER_WORD)
- return APInt(numBits, -1ULL);
+ return APInt(numBits, _UI64_MAX);
// For small values, return quickly.
if (numBits < APINT_BITS_PER_WORD)
return APInt(numBits, (1ULL << loBitsSet) - 1);
@@ -1062,11 +1062,11 @@
/// @brief Set every bit to 1.
void setAllBits() {
if (isSingleWord())
- VAL = -1ULL;
+ VAL = _UI64_MAX;
else {
// Set all the bits in all the words.
for (unsigned i = 0; i < getNumWords(); ++i)
- pVal[i] = -1ULL;
+ pVal[i] = _UI64_MAX;
}
// Clear the unused ones
clearUnusedBits();
@@ -1091,10 +1091,10 @@
/// @brief Toggle every bit to its opposite value.
void flipAllBits() {
if (isSingleWord())
- VAL ^= -1ULL;
+ VAL ^= _UI64_MAX;
else {
for (unsigned i = 0; i < getNumWords(); ++i)
- pVal[i] ^= -1ULL;
+ pVal[i] ^= _UI64_MAX;
}
clearUnusedBits();
}
diff --git a/src/LLVM/include/llvm/Support/DataTypes.h b/src/LLVM/include/llvm/Support/DataTypes.h
index 0828815..dc3e5c1 100644
--- a/src/LLVM/include/llvm/Support/DataTypes.h
+++ b/src/LLVM/include/llvm/Support/DataTypes.h
@@ -94,6 +94,7 @@
#else /* _MSC_VER */
/* Visual C++ doesn't provide standard integer headers, but it does provide
built-in data types. */
+#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/types.h>
diff --git a/src/OpenGL/libEGL/Config.cpp b/src/OpenGL/libEGL/Config.cpp
index 981b0f5..b2f5a79 100644
--- a/src/OpenGL/libEGL/Config.cpp
+++ b/src/OpenGL/libEGL/Config.cpp
@@ -349,7 +349,7 @@
}
else
{
- *numConfig = passed.size();
+ *numConfig = static_cast<EGLint>(passed.size());
}
return true;
diff --git a/src/OpenGL/libGLES_CM/Context.cpp b/src/OpenGL/libGLES_CM/Context.cpp
index 664a046..b207594 100644
--- a/src/OpenGL/libGLES_CM/Context.cpp
+++ b/src/OpenGL/libGLES_CM/Context.cpp
@@ -1731,7 +1731,7 @@
GLenum wrapT = texture->getWrapT();
GLenum texFilter = texture->getMinFilter();
GLenum magFilter = texture->getMagFilter();
- GLenum maxAnisotropy = texture->getMaxAnisotropy();
+ GLfloat maxAnisotropy = texture->getMaxAnisotropy();
device->setAddressingModeU(sw::SAMPLER_PIXEL, samplerIndex, es2sw::ConvertTextureWrap(wrapS));
device->setAddressingModeV(sw::SAMPLER_PIXEL, samplerIndex, es2sw::ConvertTextureWrap(wrapT));
diff --git a/src/OpenGL/libGLESv2/Context.cpp b/src/OpenGL/libGLESv2/Context.cpp
index 55dfd06..9e070cc 100644
--- a/src/OpenGL/libGLESv2/Context.cpp
+++ b/src/OpenGL/libGLESv2/Context.cpp
@@ -2040,7 +2040,7 @@
GLenum wrapT = texture->getWrapT();
GLenum texFilter = texture->getMinFilter();
GLenum magFilter = texture->getMagFilter();
- GLenum maxAnisotropy = texture->getMaxAnisotropy();
+ GLfloat maxAnisotropy = texture->getMaxAnisotropy();
device->setAddressingModeU(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapS));
device->setAddressingModeV(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapT));
diff --git a/src/Renderer/PixelProcessor.cpp b/src/Renderer/PixelProcessor.cpp
index 5a45e48..132f692 100644
--- a/src/Renderer/PixelProcessor.cpp
+++ b/src/Renderer/PixelProcessor.cpp
@@ -406,7 +406,7 @@
else ASSERT(false);
}
- void PixelProcessor::setMaxAnisotropy(unsigned int sampler, unsigned int maxAnisotropy)
+ void PixelProcessor::setMaxAnisotropy(unsigned int sampler, float maxAnisotropy)
{
if(sampler < 16)
{
diff --git a/src/Renderer/PixelProcessor.hpp b/src/Renderer/PixelProcessor.hpp
index 143a834..e6c9c24 100644
--- a/src/Renderer/PixelProcessor.hpp
+++ b/src/Renderer/PixelProcessor.hpp
@@ -221,7 +221,7 @@
virtual void setReadSRGB(unsigned int sampler, bool sRGB);
virtual void setMipmapLOD(unsigned int sampler, float bias);
virtual void setBorderColor(unsigned int sampler, const Color<float> &borderColor);
- virtual void setMaxAnisotropy(unsigned int sampler, unsigned int maxAnisotropy);
+ virtual void setMaxAnisotropy(unsigned int sampler, float maxAnisotropy);
virtual void setWriteSRGB(bool sRGB);
virtual void setDepthBufferEnable(bool depthBufferEnable);
diff --git a/src/Renderer/Renderer.cpp b/src/Renderer/Renderer.cpp
index 20038bd..da4e372 100644
--- a/src/Renderer/Renderer.cpp
+++ b/src/Renderer/Renderer.cpp
@@ -2171,7 +2171,7 @@
}
}
- void Renderer::setMaxAnisotropy(SamplerType type, int sampler, unsigned int maxAnisotropy)
+ void Renderer::setMaxAnisotropy(SamplerType type, int sampler, float maxAnisotropy)
{
if(type == SAMPLER_PIXEL)
{
diff --git a/src/Renderer/Renderer.hpp b/src/Renderer/Renderer.hpp
index 3a867a4..0211e69 100644
--- a/src/Renderer/Renderer.hpp
+++ b/src/Renderer/Renderer.hpp
@@ -289,7 +289,7 @@
virtual void setReadSRGB(SamplerType type, int sampler, bool sRGB);
virtual void setMipmapLOD(SamplerType type, int sampler, float bias);
virtual void setBorderColor(SamplerType type, int sampler, const Color<float> &borderColor);
- virtual void setMaxAnisotropy(SamplerType type, int sampler, unsigned int maxAnisotropy);
+ virtual void setMaxAnisotropy(SamplerType type, int sampler, float maxAnisotropy);
virtual void setPointSpriteEnable(bool pointSpriteEnable);
virtual void setPointScaleEnable(bool pointScaleEnable);
diff --git a/src/Renderer/Sampler.cpp b/src/Renderer/Sampler.cpp
index a292267..3d73ceb 100644
--- a/src/Renderer/Sampler.cpp
+++ b/src/Renderer/Sampler.cpp
@@ -270,9 +270,9 @@
texture.borderColorF[3][0] = texture.borderColorF[3][1] = texture.borderColorF[3][2] = texture.borderColorF[3][3] = borderColor.a;
}
- void Sampler::setMaxAnisotropy(unsigned int maxAnisotropy)
+ void Sampler::setMaxAnisotropy(float maxAnisotropy)
{
- texture.maxAnisotropy = (float)maxAnisotropy;
+ texture.maxAnisotropy = maxAnisotropy;
}
void Sampler::setFilterQuality(FilterType maximumFilterQuality)
diff --git a/src/Renderer/Sampler.hpp b/src/Renderer/Sampler.hpp
index 180a4b8..f51229c 100644
--- a/src/Renderer/Sampler.hpp
+++ b/src/Renderer/Sampler.hpp
@@ -150,7 +150,7 @@
void setAddressingModeW(AddressingMode addressingMode);
void setReadSRGB(bool sRGB);
void setBorderColor(const Color<float> &borderColor);
- void setMaxAnisotropy(unsigned int maxAnisotropy);
+ void setMaxAnisotropy(float maxAnisotropy);
static void setFilterQuality(FilterType maximumFilterQuality);
static void setMipmapQuality(MipmapType maximumFilterQuality);
diff --git a/src/Renderer/VertexProcessor.cpp b/src/Renderer/VertexProcessor.cpp
index dec0e9c..46518fe 100644
--- a/src/Renderer/VertexProcessor.cpp
+++ b/src/Renderer/VertexProcessor.cpp
@@ -531,7 +531,7 @@
else ASSERT(false);
}
- void VertexProcessor::setMaxAnisotropy(unsigned int sampler, unsigned int maxAnisotropy)
+ void VertexProcessor::setMaxAnisotropy(unsigned int sampler, float maxAnisotropy)
{
if(sampler < 4)
{
diff --git a/src/Renderer/VertexProcessor.hpp b/src/Renderer/VertexProcessor.hpp
index 5f30f1a..81aa451 100644
--- a/src/Renderer/VertexProcessor.hpp
+++ b/src/Renderer/VertexProcessor.hpp
@@ -240,7 +240,7 @@
virtual void setReadSRGB(unsigned int sampler, bool sRGB);
virtual void setMipmapLOD(unsigned int sampler, float bias);
virtual void setBorderColor(unsigned int sampler, const Color<float> &borderColor);
- virtual void setMaxAnisotropy(unsigned int stage, unsigned int maxAnisotropy);
+ virtual void setMaxAnisotropy(unsigned int stage, float maxAnisotropy);
virtual void setPointSize(float pointSize);
virtual void setPointSizeMin(float pointSizeMin);