Commit 617a5d5e by Alexis Hetu Committed by Alexis Hétu

Fixing some trivial warnings in the SwiftShader build.

BUG=18368388 Change-Id: I89038818164e04f9ae4a7e1c4526781654e83c7a Reviewed-on: https://swiftshader-review.googlesource.com/1390Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent f6ad4ef6
...@@ -55,7 +55,7 @@ struct Allocation ...@@ -55,7 +55,7 @@ struct Allocation
unsigned char *block; 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 *block = new unsigned char[bytes + sizeof(Allocation) + alignment];
unsigned char *aligned = 0; unsigned char *aligned = 0;
...@@ -72,7 +72,7 @@ void *allocate(size_t bytes, int alignment) ...@@ -72,7 +72,7 @@ void *allocate(size_t bytes, int alignment)
return aligned; return aligned;
} }
void *allocateZero(size_t bytes, int alignment) void *allocateZero(size_t bytes, size_t alignment)
{ {
void *memory = allocate(bytes, alignment); void *memory = allocate(bytes, alignment);
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
size_t memoryPageSize(); size_t memoryPageSize();
void *allocate(size_t bytes, int alignment = 16); void *allocate(size_t bytes, size_t alignment = 16);
void *allocateZero(size_t bytes, int alignment = 16); void *allocateZero(size_t bytes, size_t alignment = 16);
void deallocate(void *memory); void deallocate(void *memory);
void *allocateExecutable(size_t bytes); // Allocates memory that can be made executable using markExecutable() void *allocateExecutable(size_t bytes); // Allocates memory that can be made executable using markExecutable()
......
...@@ -424,7 +424,7 @@ public: ...@@ -424,7 +424,7 @@ public:
/// @returns the all-ones value for an APInt of the specified bit-width. /// @returns the all-ones value for an APInt of the specified bit-width.
/// @brief Get the all-ones value. /// @brief Get the all-ones value.
static APInt getAllOnesValue(unsigned numBits) { 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. /// @returns the '0' value for an APInt of the specified bit-width.
...@@ -495,7 +495,7 @@ public: ...@@ -495,7 +495,7 @@ public:
if (loBitsSet == 0) if (loBitsSet == 0)
return APInt(numBits, 0); return APInt(numBits, 0);
if (loBitsSet == APINT_BITS_PER_WORD) if (loBitsSet == APINT_BITS_PER_WORD)
return APInt(numBits, -1ULL); return APInt(numBits, _UI64_MAX);
// For small values, return quickly. // For small values, return quickly.
if (numBits < APINT_BITS_PER_WORD) if (numBits < APINT_BITS_PER_WORD)
return APInt(numBits, (1ULL << loBitsSet) - 1); return APInt(numBits, (1ULL << loBitsSet) - 1);
...@@ -1062,11 +1062,11 @@ public: ...@@ -1062,11 +1062,11 @@ public:
/// @brief Set every bit to 1. /// @brief Set every bit to 1.
void setAllBits() { void setAllBits() {
if (isSingleWord()) if (isSingleWord())
VAL = -1ULL; VAL = _UI64_MAX;
else { else {
// Set all the bits in all the words. // Set all the bits in all the words.
for (unsigned i = 0; i < getNumWords(); ++i) for (unsigned i = 0; i < getNumWords(); ++i)
pVal[i] = -1ULL; pVal[i] = _UI64_MAX;
} }
// Clear the unused ones // Clear the unused ones
clearUnusedBits(); clearUnusedBits();
...@@ -1091,10 +1091,10 @@ public: ...@@ -1091,10 +1091,10 @@ public:
/// @brief Toggle every bit to its opposite value. /// @brief Toggle every bit to its opposite value.
void flipAllBits() { void flipAllBits() {
if (isSingleWord()) if (isSingleWord())
VAL ^= -1ULL; VAL ^= _UI64_MAX;
else { else {
for (unsigned i = 0; i < getNumWords(); ++i) for (unsigned i = 0; i < getNumWords(); ++i)
pVal[i] ^= -1ULL; pVal[i] ^= _UI64_MAX;
} }
clearUnusedBits(); clearUnusedBits();
} }
......
...@@ -94,6 +94,7 @@ typedef u_int64_t uint64_t; ...@@ -94,6 +94,7 @@ typedef u_int64_t uint64_t;
#else /* _MSC_VER */ #else /* _MSC_VER */
/* Visual C++ doesn't provide standard integer headers, but it does provide /* Visual C++ doesn't provide standard integer headers, but it does provide
built-in data types. */ built-in data types. */
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include <sys/types.h> #include <sys/types.h>
......
...@@ -349,7 +349,7 @@ bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint ...@@ -349,7 +349,7 @@ bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint
} }
else else
{ {
*numConfig = passed.size(); *numConfig = static_cast<EGLint>(passed.size());
} }
return true; return true;
......
...@@ -1731,7 +1731,7 @@ void Context::applyTextures() ...@@ -1731,7 +1731,7 @@ void Context::applyTextures()
GLenum wrapT = texture->getWrapT(); GLenum wrapT = texture->getWrapT();
GLenum texFilter = texture->getMinFilter(); GLenum texFilter = texture->getMinFilter();
GLenum magFilter = texture->getMagFilter(); GLenum magFilter = texture->getMagFilter();
GLenum maxAnisotropy = texture->getMaxAnisotropy(); GLfloat maxAnisotropy = texture->getMaxAnisotropy();
device->setAddressingModeU(sw::SAMPLER_PIXEL, samplerIndex, es2sw::ConvertTextureWrap(wrapS)); device->setAddressingModeU(sw::SAMPLER_PIXEL, samplerIndex, es2sw::ConvertTextureWrap(wrapS));
device->setAddressingModeV(sw::SAMPLER_PIXEL, samplerIndex, es2sw::ConvertTextureWrap(wrapT)); device->setAddressingModeV(sw::SAMPLER_PIXEL, samplerIndex, es2sw::ConvertTextureWrap(wrapT));
......
...@@ -2040,7 +2040,7 @@ void Context::applyTextures(sw::SamplerType samplerType) ...@@ -2040,7 +2040,7 @@ void Context::applyTextures(sw::SamplerType samplerType)
GLenum wrapT = texture->getWrapT(); GLenum wrapT = texture->getWrapT();
GLenum texFilter = texture->getMinFilter(); GLenum texFilter = texture->getMinFilter();
GLenum magFilter = texture->getMagFilter(); GLenum magFilter = texture->getMagFilter();
GLenum maxAnisotropy = texture->getMaxAnisotropy(); GLfloat maxAnisotropy = texture->getMaxAnisotropy();
device->setAddressingModeU(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapS)); device->setAddressingModeU(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapS));
device->setAddressingModeV(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapT)); device->setAddressingModeV(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapT));
......
...@@ -406,7 +406,7 @@ namespace sw ...@@ -406,7 +406,7 @@ namespace sw
else ASSERT(false); else ASSERT(false);
} }
void PixelProcessor::setMaxAnisotropy(unsigned int sampler, unsigned int maxAnisotropy) void PixelProcessor::setMaxAnisotropy(unsigned int sampler, float maxAnisotropy)
{ {
if(sampler < 16) if(sampler < 16)
{ {
......
...@@ -221,7 +221,7 @@ namespace sw ...@@ -221,7 +221,7 @@ namespace sw
virtual void setReadSRGB(unsigned int sampler, bool sRGB); virtual void setReadSRGB(unsigned int sampler, bool sRGB);
virtual void setMipmapLOD(unsigned int sampler, float bias); virtual void setMipmapLOD(unsigned int sampler, float bias);
virtual void setBorderColor(unsigned int sampler, const Color<float> &borderColor); 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 setWriteSRGB(bool sRGB);
virtual void setDepthBufferEnable(bool depthBufferEnable); virtual void setDepthBufferEnable(bool depthBufferEnable);
......
...@@ -2171,7 +2171,7 @@ namespace sw ...@@ -2171,7 +2171,7 @@ namespace sw
} }
} }
void Renderer::setMaxAnisotropy(SamplerType type, int sampler, unsigned int maxAnisotropy) void Renderer::setMaxAnisotropy(SamplerType type, int sampler, float maxAnisotropy)
{ {
if(type == SAMPLER_PIXEL) if(type == SAMPLER_PIXEL)
{ {
......
...@@ -289,7 +289,7 @@ namespace sw ...@@ -289,7 +289,7 @@ namespace sw
virtual void setReadSRGB(SamplerType type, int sampler, bool sRGB); virtual void setReadSRGB(SamplerType type, int sampler, bool sRGB);
virtual void setMipmapLOD(SamplerType type, int sampler, float bias); virtual void setMipmapLOD(SamplerType type, int sampler, float bias);
virtual void setBorderColor(SamplerType type, int sampler, const Color<float> &borderColor); 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 setPointSpriteEnable(bool pointSpriteEnable);
virtual void setPointScaleEnable(bool pointScaleEnable); virtual void setPointScaleEnable(bool pointScaleEnable);
......
...@@ -270,9 +270,9 @@ namespace sw ...@@ -270,9 +270,9 @@ namespace sw
texture.borderColorF[3][0] = texture.borderColorF[3][1] = texture.borderColorF[3][2] = texture.borderColorF[3][3] = borderColor.a; 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) void Sampler::setFilterQuality(FilterType maximumFilterQuality)
......
...@@ -150,7 +150,7 @@ namespace sw ...@@ -150,7 +150,7 @@ namespace sw
void setAddressingModeW(AddressingMode addressingMode); void setAddressingModeW(AddressingMode addressingMode);
void setReadSRGB(bool sRGB); void setReadSRGB(bool sRGB);
void setBorderColor(const Color<float> &borderColor); void setBorderColor(const Color<float> &borderColor);
void setMaxAnisotropy(unsigned int maxAnisotropy); void setMaxAnisotropy(float maxAnisotropy);
static void setFilterQuality(FilterType maximumFilterQuality); static void setFilterQuality(FilterType maximumFilterQuality);
static void setMipmapQuality(MipmapType maximumFilterQuality); static void setMipmapQuality(MipmapType maximumFilterQuality);
......
...@@ -531,7 +531,7 @@ namespace sw ...@@ -531,7 +531,7 @@ namespace sw
else ASSERT(false); else ASSERT(false);
} }
void VertexProcessor::setMaxAnisotropy(unsigned int sampler, unsigned int maxAnisotropy) void VertexProcessor::setMaxAnisotropy(unsigned int sampler, float maxAnisotropy)
{ {
if(sampler < 4) if(sampler < 4)
{ {
......
...@@ -240,7 +240,7 @@ namespace sw ...@@ -240,7 +240,7 @@ namespace sw
virtual void setReadSRGB(unsigned int sampler, bool sRGB); virtual void setReadSRGB(unsigned int sampler, bool sRGB);
virtual void setMipmapLOD(unsigned int sampler, float bias); virtual void setMipmapLOD(unsigned int sampler, float bias);
virtual void setBorderColor(unsigned int sampler, const Color<float> &borderColor); 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 setPointSize(float pointSize);
virtual void setPointSizeMin(float pointSizeMin); virtual void setPointSizeMin(float pointSizeMin);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment