Fix signed/unsigned comparison warnings. Bug 15387371 Change-Id: Id4c9b54c5c0b4115479b6710c4d8c91d34e5c002 Reviewed-on: https://swiftshader-review.googlesource.com/4494 Tested-by: Nicolas Capens <capn@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/PixelProgram.cpp b/src/Shader/PixelProgram.cpp index f889cfa..bdf6b3e 100644 --- a/src/Shader/PixelProgram.cpp +++ b/src/Shader/PixelProgram.cpp
@@ -1,30 +1,30 @@ -// SwiftShader Software Renderer -// -// Copyright(c) 2015 Google Inc. -// -// All rights reserved. No part of this software may be copied, distributed, transmitted, -// transcribed, stored in a retrieval system, translated into any human or computer -// language by any means, or disclosed to third parties without the explicit written -// agreement of Google Inc. Without such an agreement, no rights or licenses, express -// or implied, including but not limited to any patent rights, are granted to you. -// - -#include "PixelProgram.hpp" -#include "Primitive.hpp" -#include "Renderer.hpp" -#include "SamplerCore.hpp" - -namespace sw -{ - extern bool postBlendSRGB; +// SwiftShader Software Renderer +// +// Copyright(c) 2015 Google Inc. +// +// All rights reserved. No part of this software may be copied, distributed, transmitted, +// transcribed, stored in a retrieval system, translated into any human or computer +// language by any means, or disclosed to third parties without the explicit written +// agreement of Google Inc. Without such an agreement, no rights or licenses, express +// or implied, including but not limited to any patent rights, are granted to you. +// + +#include "PixelProgram.hpp" +#include "Primitive.hpp" +#include "Renderer.hpp" +#include "SamplerCore.hpp" + +namespace sw +{ + extern bool postBlendSRGB; extern bool booleanFaceRegister; extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates - extern bool fullPixelPositionRegister; - - void PixelProgram::setBuiltins(PixelRoutine::Registers &rBase, Int &x, Int &y, Float4(&z)[4], Float4 &w) - { - Registers& r = *static_cast<Registers*>(&rBase); - + extern bool fullPixelPositionRegister; + + void PixelProgram::setBuiltins(PixelRoutine::Registers &rBase, Int &x, Int &y, Float4(&z)[4], Float4 &w) + { + Registers& r = *static_cast<Registers*>(&rBase); + if(shader->getVersion() >= 0x0300) { if(shader->vPosDeclared) @@ -57,11 +57,11 @@ r.vFace.z = face; r.vFace.w = face; } - } - } - + } + } + void PixelProgram::applyShader(PixelRoutine::Registers &rBase, Int cMask[4]) - { + { Registers& r = *static_cast<Registers*>(&rBase); r.enableIndex = 0; @@ -513,13 +513,13 @@ r.c[i] = r.oC[i]; } } - - Bool PixelProgram::alphaTest(PixelRoutine::Registers &rBase, Int cMask[4]) - { - Registers& r = *static_cast<Registers*>(&rBase); - + + Bool PixelProgram::alphaTest(PixelRoutine::Registers &rBase, Int cMask[4]) + { + Registers& r = *static_cast<Registers*>(&rBase); + clampColor(r.c); - + if(!state.alphaTestActive()) { return true; @@ -551,19 +551,19 @@ pass = pass | cMask[q]; } - return pass != 0x0; - } - - void PixelProgram::rasterOperation(PixelRoutine::Registers &rBase, Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]) - { - Registers& r = *static_cast<Registers*>(&rBase); - + return pass != 0x0; + } + + void PixelProgram::rasterOperation(PixelRoutine::Registers &rBase, Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]) + { + Registers& r = *static_cast<Registers*>(&rBase); + for(int index = 0; index < RENDERTARGETS; index++) { if(!state.colorWriteActive(index)) { continue; - } + } if(!postBlendSRGB && state.writeSRGB) { @@ -739,10 +739,10 @@ return enable; } - Vector4f PixelProgram::fetchRegisterF(Registers &r, const Src &src, int offset) + Vector4f PixelProgram::fetchRegisterF(Registers &r, const Src &src, unsigned int offset) { Vector4f reg; - int i = src.index + offset; + unsigned int i = src.index + offset; switch(src.type) { @@ -874,11 +874,10 @@ return mod; } - Vector4f PixelProgram::readConstant(Registers &r, const Src &src, int offset) + Vector4f PixelProgram::readConstant(Registers &r, const Src &src, unsigned int offset) { Vector4f c; - - int i = src.index + offset; + unsigned int i = src.index + offset; if(src.rel.type == Shader::PARAMETER_VOID) // Not relative { @@ -1673,5 +1672,4 @@ // FIXME: Return from function if all instances left // FIXME: Use enableLeave in other control-flow constructs } - -} +}
diff --git a/src/Shader/PixelProgram.hpp b/src/Shader/PixelProgram.hpp index 41b9c4a..847b379 100644 --- a/src/Shader/PixelProgram.hpp +++ b/src/Shader/PixelProgram.hpp
@@ -93,8 +93,8 @@ Int4 enableMask(Registers &r, const Shader::Instruction *instruction); - Vector4f fetchRegisterF(Registers &r, const Src &src, int offset = 0); - Vector4f readConstant(Registers &r, const Src &src, int offset = 0); + Vector4f fetchRegisterF(Registers &r, const Src &src, unsigned int offset = 0); + Vector4f readConstant(Registers &r, const Src &src, unsigned int offset = 0); Int relativeAddress(Registers &r, const Shader::Parameter &var); Float4 linearToSRGB(const Float4 &x);
diff --git a/src/Shader/Shader.cpp b/src/Shader/Shader.cpp index a0ece65..442e692 100644 --- a/src/Shader/Shader.cpp +++ b/src/Shader/Shader.cpp
@@ -1734,7 +1734,7 @@ } } - void Shader::markFunctionAnalysis(int functionLabel, Analysis flag) + void Shader::markFunctionAnalysis(unsigned int functionLabel, Analysis flag) { bool marker = false; for(unsigned int i = 0; i < instruction.size(); i++)
diff --git a/src/Shader/Shader.hpp b/src/Shader/Shader.hpp index 588f637..6a57ec5 100644 --- a/src/Shader/Shader.hpp +++ b/src/Shader/Shader.hpp
@@ -609,7 +609,7 @@ void analyzeSamplers(); void analyzeCallSites(); void analyzeDynamicIndexing(); - void markFunctionAnalysis(int functionLabel, Analysis flag); + void markFunctionAnalysis(unsigned int functionLabel, Analysis flag); ShaderType shaderType;
diff --git a/src/Shader/VertexProgram.cpp b/src/Shader/VertexProgram.cpp index 40c0910..e4587cc 100644 --- a/src/Shader/VertexProgram.cpp +++ b/src/Shader/VertexProgram.cpp
@@ -646,11 +646,10 @@ } } - Vector4f VertexProgram::fetchRegisterF(Registers &r, const Src &src, int offset) + Vector4f VertexProgram::fetchRegisterF(Registers &r, const Src &src, unsigned int offset) { - int i = src.index + offset; - Vector4f reg; + unsigned int i = src.index + offset; switch(src.type) { @@ -762,11 +761,10 @@ return mod; } - Vector4f VertexProgram::readConstant(Registers &r, const Src &src, int offset) + Vector4f VertexProgram::readConstant(Registers &r, const Src &src, unsigned int offset) { Vector4f c; - - int i = src.index + offset; + unsigned int i = src.index + offset; if(src.rel.type == Shader::PARAMETER_VOID) // Not relative {
diff --git a/src/Shader/VertexProgram.hpp b/src/Shader/VertexProgram.hpp index 53427a5..519ee23 100644 --- a/src/Shader/VertexProgram.hpp +++ b/src/Shader/VertexProgram.hpp
@@ -41,8 +41,8 @@ void program(Registers &r); void passThrough(Registers &r); - Vector4f fetchRegisterF(Registers &r, const Src &src, int offset = 0); - Vector4f readConstant(Registers &r, const Src &src, int offset = 0); + Vector4f fetchRegisterF(Registers &r, const Src &src, unsigned int offset = 0); + Vector4f readConstant(Registers &r, const Src &src, unsigned int offset = 0); Int relativeAddress(Registers &r, const Shader::Parameter &var); Int4 enableMask(Registers &r, const Shader::Instruction *instruction);