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
}
-
-}
+}