Fixed some warnings
- Changing "char*" to "const char*" when a
function can receive string literals
- Removed some unused variables and members
- Fixed some signed vs unsigned comparisons
- Added braces for safety on code like:
if(...) if(...) ... else ...
to make it:
if(...) { if(...) ... else ... }
otherwise the else is ambiguous
- Reordered some member initializations to
fit the declaration order in the class
- OutDir must end with a backslash in VS
Change-Id: I903bd7afac882090841da0c0f4ebb30db0a5dd37
Reviewed-on: https://swiftshader-review.googlesource.com/3501
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp
index cee93c1..bc8a881 100644
--- a/src/Shader/SamplerCore.cpp
+++ b/src/Shader/SamplerCore.cpp
@@ -916,10 +916,10 @@
{
sampleTexel(c[i][j][k], u[i][j][k], v[i][j][k], s[i][j][k], mipmap, buffer);
- if(componentCount >= 1) if(hasUnsignedTextureComponent(0)) c[i][j][k].x = MulHigh(As<UShort4>(c[i][j][k].x), f[1 - i][1 - j][1 - k]); else c[i][j][k].x = MulHigh(c[i][j][k].x, fs[1 - i][1 - j][1 - k]);
- if(componentCount >= 2) if(hasUnsignedTextureComponent(1)) c[i][j][k].y = MulHigh(As<UShort4>(c[i][j][k].y), f[1 - i][1 - j][1 - k]); else c[i][j][k].y = MulHigh(c[i][j][k].y, fs[1 - i][1 - j][1 - k]);
- if(componentCount >= 3) if(hasUnsignedTextureComponent(2)) c[i][j][k].z = MulHigh(As<UShort4>(c[i][j][k].z), f[1 - i][1 - j][1 - k]); else c[i][j][k].z = MulHigh(c[i][j][k].z, fs[1 - i][1 - j][1 - k]);
- if(componentCount >= 4) if(hasUnsignedTextureComponent(3)) c[i][j][k].w = MulHigh(As<UShort4>(c[i][j][k].w), f[1 - i][1 - j][1 - k]); else c[i][j][k].w = MulHigh(c[i][j][k].w, fs[1 - i][1 - j][1 - k]);
+ if(componentCount >= 1) { if(hasUnsignedTextureComponent(0)) c[i][j][k].x = MulHigh(As<UShort4>(c[i][j][k].x), f[1 - i][1 - j][1 - k]); else c[i][j][k].x = MulHigh(c[i][j][k].x, fs[1 - i][1 - j][1 - k]); }
+ if(componentCount >= 2) { if(hasUnsignedTextureComponent(1)) c[i][j][k].y = MulHigh(As<UShort4>(c[i][j][k].y), f[1 - i][1 - j][1 - k]); else c[i][j][k].y = MulHigh(c[i][j][k].y, fs[1 - i][1 - j][1 - k]); }
+ if(componentCount >= 3) { if(hasUnsignedTextureComponent(2)) c[i][j][k].z = MulHigh(As<UShort4>(c[i][j][k].z), f[1 - i][1 - j][1 - k]); else c[i][j][k].z = MulHigh(c[i][j][k].z, fs[1 - i][1 - j][1 - k]); }
+ if(componentCount >= 4) { if(hasUnsignedTextureComponent(3)) c[i][j][k].w = MulHigh(As<UShort4>(c[i][j][k].w), f[1 - i][1 - j][1 - k]); else c[i][j][k].w = MulHigh(c[i][j][k].w, fs[1 - i][1 - j][1 - k]); }
if(i != 0 || j != 0 || k != 0)
{
diff --git a/src/Shader/Shader.hpp b/src/Shader/Shader.hpp
index d4fd609..8713040 100644
--- a/src/Shader/Shader.hpp
+++ b/src/Shader/Shader.hpp
@@ -367,7 +367,7 @@
};
};
- Parameter() : type(PARAMETER_VOID), index(0)
+ Parameter() : index(0), type(PARAMETER_VOID)
{
rel.type = PARAMETER_VOID;
rel.index = 0;
diff --git a/src/Shader/VertexProgram.cpp b/src/Shader/VertexProgram.cpp
index 5a516c4..d0c7715 100644
--- a/src/Shader/VertexProgram.cpp
+++ b/src/Shader/VertexProgram.cpp
@@ -104,9 +104,6 @@
Src src2 = instruction->src[2];
bool predicate = instruction->predicate;
- int size = shader->size(opcode);
- Usage usage = instruction->usage;
- unsigned char usageIndex = instruction->usageIndex;
Control control = instruction->control;
bool integer = dst.type == Shader::PARAMETER_ADDR;
bool pp = dst.partialPrecision;
@@ -540,7 +537,6 @@
for(int i = 0; i < 12; i++)
{
unsigned char usage = shader->output[i][0].usage;
- unsigned char index = shader->output[i][0].index;
switch(usage)
{
diff --git a/src/Shader/VertexRoutine.hpp b/src/Shader/VertexRoutine.hpp
index e023992..26663d7 100644
--- a/src/Shader/VertexRoutine.hpp
+++ b/src/Shader/VertexRoutine.hpp
@@ -25,8 +25,8 @@
struct Registers
{
Registers(const VertexShader *shader) :
- r(shader && shader->dynamicallyIndexedTemporaries),
v(shader && shader->dynamicallyIndexedInput),
+ r(shader && shader->dynamicallyIndexedTemporaries),
o(shader && shader->dynamicallyIndexedOutput)
{
loopDepth = -1;
diff --git a/src/Shader/VertexShader.cpp b/src/Shader/VertexShader.cpp
index 7bb7f0a..fab6b17 100644
--- a/src/Shader/VertexShader.cpp
+++ b/src/Shader/VertexShader.cpp
@@ -78,7 +78,6 @@
}
unsigned short version = (unsigned short)(token[0] & 0x0000FFFF);
- unsigned char minorVersion = (unsigned char)(token[0] & 0x000000FF);
unsigned char majorVersion = (unsigned char)((token[0] & 0x0000FF00) >> 8);
ShaderType shaderType = (ShaderType)((token[0] & 0xFFFF0000) >> 16);