Commit 7208e932 by Alexis Hetu Committed by Alexis Hétu

Moved or removed unused variables

Some variables were either unused or only used in certain contexts, like debug or tracing, so these were either removed (when unused) or moved to the right scope (when used conditionally). Also fixed a string format warning and a missing case warning. Change-Id: I2d130faa992b5dc06fb332d7404a8aebc7c121ef Reviewed-on: https://swiftshader-review.googlesource.com/5462Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 58df2f60
...@@ -184,7 +184,6 @@ namespace sw ...@@ -184,7 +184,6 @@ namespace sw
void Configurator::addValue(string const keyName, string const valueName, string const value) void Configurator::addValue(string const keyName, string const valueName, string const value)
{ {
int keyID = findKey(keyName); int keyID = findKey(keyName);
bool create = true;
if(keyID == -1) if(keyID == -1)
{ {
......
...@@ -522,7 +522,7 @@ namespace sw ...@@ -522,7 +522,7 @@ namespace sw
} }
sprintf(header, "Content-Type: text/html; charset=UTF-8\r\n" sprintf(header, "Content-Type: text/html; charset=UTF-8\r\n"
"Content-Length: %d\r\n" "Content-Length: %zd\r\n"
"Host: localhost\r\n" "Host: localhost\r\n"
"\r\n", body.size()); "\r\n", body.size());
......
...@@ -496,7 +496,6 @@ namespace glsl ...@@ -496,7 +496,6 @@ namespace glsl
TIntermTyped *right = node->getRight(); TIntermTyped *right = node->getRight();
const TType &leftType = left->getType(); const TType &leftType = left->getType();
const TType &rightType = right->getType(); const TType &rightType = right->getType();
const TType &resultType = node->getType();
if(isSamplerRegister(result)) if(isSamplerRegister(result))
{ {
...@@ -1270,8 +1269,8 @@ namespace glsl ...@@ -1270,8 +1269,8 @@ namespace glsl
if(argumentCount == 2 || (textureFunction.offset && argumentCount == 3)) if(argumentCount == 2 || (textureFunction.offset && argumentCount == 3))
{ {
Instruction *tex = emit(textureFunction.offset ? sw::Shader::OPCODE_TEXOFFSET : sw::Shader::OPCODE_TEX, emit(textureFunction.offset ? sw::Shader::OPCODE_TEXOFFSET : sw::Shader::OPCODE_TEX,
result, &coord, arg[0], offset); result, &coord, arg[0], offset);
} }
else if(argumentCount == 3 || (textureFunction.offset && argumentCount == 4)) // bias else if(argumentCount == 3 || (textureFunction.offset && argumentCount == 4)) // bias
{ {
...@@ -1398,7 +1397,7 @@ namespace glsl ...@@ -1398,7 +1397,7 @@ namespace glsl
{ {
for(int i = 0; i < outCols; i++) for(int i = 0; i < outCols; i++)
{ {
Instruction *init = emit(sw::Shader::OPCODE_MOV, result, i, &zero); emit(sw::Shader::OPCODE_MOV, result, i, &zero);
Instruction *mov = emitCast(result, i, arg0, 0); Instruction *mov = emitCast(result, i, arg0, 0);
mov->dst.mask = 1 << i; mov->dst.mask = 1 << i;
ASSERT(mov->src[0].swizzle == 0x00); ASSERT(mov->src[0].swizzle == 0x00);
...@@ -1415,7 +1414,7 @@ namespace glsl ...@@ -1415,7 +1414,7 @@ namespace glsl
{ {
// Initialize to identity matrix // Initialize to identity matrix
Constant col((i == 0 ? 1.0f : 0.0f), (i == 1 ? 1.0f : 0.0f), (i == 2 ? 1.0f : 0.0f), (i == 3 ? 1.0f : 0.0f)); Constant col((i == 0 ? 1.0f : 0.0f), (i == 1 ? 1.0f : 0.0f), (i == 2 ? 1.0f : 0.0f), (i == 3 ? 1.0f : 0.0f));
Instruction *mov = emitCast(result, i, &col, 0); emitCast(result, i, &col, 0);
} }
if(i < inCols) if(i < inCols)
......
...@@ -655,8 +655,6 @@ bool TParseContext::structQualifierErrorCheck(const TSourceLoc &line, const TPub ...@@ -655,8 +655,6 @@ bool TParseContext::structQualifierErrorCheck(const TSourceLoc &line, const TPub
return true; return true;
// check for layout qualifier issues // check for layout qualifier issues
const TLayoutQualifier layoutQualifier = pType.layoutQualifier;
if (pType.qualifier != EvqVertexIn && pType.qualifier != EvqFragmentOut && if (pType.qualifier != EvqVertexIn && pType.qualifier != EvqFragmentOut &&
layoutLocationErrorCheck(line, pType.layoutQualifier)) layoutLocationErrorCheck(line, pType.layoutQualifier))
{ {
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include "InitializeParseContext.h" #include "InitializeParseContext.h"
#include "ParseHelper.h" #include "ParseHelper.h"
static const int kTraceBufferLen = 1024;
#ifdef TRACE_ENABLED #ifdef TRACE_ENABLED
extern "C" { extern "C" {
void Trace(const char *format, ...) { void Trace(const char *format, ...) {
...@@ -31,6 +29,7 @@ void Trace(const char *format, ...) { ...@@ -31,6 +29,7 @@ void Trace(const char *format, ...) {
TParseContext* parseContext = GetGlobalParseContext(); TParseContext* parseContext = GetGlobalParseContext();
if (parseContext) { if (parseContext) {
const int kTraceBufferLen = 1024;
char buf[kTraceBufferLen]; char buf[kTraceBufferLen];
va_list args; va_list args;
va_start(args, format); va_start(args, format);
......
...@@ -42,8 +42,6 @@ namespace es2 ...@@ -42,8 +42,6 @@ namespace es2
Uniform::BlockInfo::BlockInfo(const glsl::Uniform& uniform, int blockIndex) Uniform::BlockInfo::BlockInfo(const glsl::Uniform& uniform, int blockIndex)
{ {
static unsigned int registerSizeStd140 = 4; // std140 packing requires dword alignment
if(blockIndex >= 0) if(blockIndex >= 0)
{ {
index = blockIndex; index = blockIndex;
......
...@@ -1523,7 +1523,6 @@ namespace sw ...@@ -1523,7 +1523,6 @@ namespace sw
DrawCall &draw = *drawList[primitiveProgress[unit].drawCall % DRAW_COUNT]; DrawCall &draw = *drawList[primitiveProgress[unit].drawCall % DRAW_COUNT];
SetupProcessor::State &state = draw.setupState; SetupProcessor::State &state = draw.setupState;
SetupProcessor::RoutinePointer setupRoutine = draw.setupPointer;
const Vertex &v0 = triangle[0].v0; const Vertex &v0 = triangle[0].v0;
const Vertex &v1 = triangle[0].v1; const Vertex &v1 = triangle[0].v1;
......
...@@ -3687,7 +3687,6 @@ namespace sw ...@@ -3687,7 +3687,6 @@ namespace sw
void *source = internal.lockRect(0, 0, 0, LOCK_READWRITE); void *source = internal.lockRect(0, 0, 0, LOCK_READWRITE);
int quality = internal.depth;
int width = internal.width; int width = internal.width;
int height = internal.height; int height = internal.height;
int pitch = internal.pitchB; int pitch = internal.pitchB;
......
...@@ -1407,7 +1407,6 @@ namespace sw ...@@ -1407,7 +1407,6 @@ namespace sw
int rgbaWriteMask = state.colorWriteActive(index); int rgbaWriteMask = state.colorWriteActive(index);
int bgraWriteMask = (rgbaWriteMask & 0x0000000A) | (rgbaWriteMask & 0x00000001) << 2 | (rgbaWriteMask & 0x00000004) >> 2; int bgraWriteMask = (rgbaWriteMask & 0x0000000A) | (rgbaWriteMask & 0x00000001) << 2 | (rgbaWriteMask & 0x00000004) >> 2;
int brgaWriteMask = (rgbaWriteMask & 0x00000008) | (rgbaWriteMask & 0x00000001) << 1 | (rgbaWriteMask & 0x00000002) << 1 | (rgbaWriteMask & 0x00000004) >> 2;
switch(state.targetFormat[index]) switch(state.targetFormat[index])
{ {
...@@ -1978,20 +1977,13 @@ namespace sw ...@@ -1978,20 +1977,13 @@ namespace sw
Short4 c23; Short4 c23;
Float4 one; Float4 one;
switch(state.targetFormat[index]) if(Surface::isFloatFormat(state.targetFormat[index]))
{ {
case FORMAT_R32I:
case FORMAT_G32R32I:
one = As<Float4>(Int4(0x7FFFFFFF));
break;
case FORMAT_R32UI:
case FORMAT_G32R32UI:
one = As<Float4>(Int4(0xFFFFFFFF));
break;
case FORMAT_R32F:
case FORMAT_G32R32F:
one = Float4(1.0f); one = Float4(1.0f);
break; }
else if(Surface::isNonNormalizedInteger(state.targetFormat[index]))
{
one = As<Float4>(Surface::isUnsignedComponent(state.targetFormat[index], 0) ? Int4(0xFFFFFFFF) : Int4(0x7FFFFFFF));
} }
switch(state.targetFormat[index]) switch(state.targetFormat[index])
......
...@@ -68,7 +68,7 @@ namespace sw ...@@ -68,7 +68,7 @@ namespace sw
} }
unsigned short version = (unsigned short)(token[0] & 0x0000FFFF); unsigned short version = (unsigned short)(token[0] & 0x0000FFFF);
unsigned char minorVersion = (unsigned char)(token[0] & 0x000000FF); // unsigned char minorVersion = (unsigned char)(token[0] & 0x000000FF);
unsigned char majorVersion = (unsigned char)((token[0] & 0x0000FF00) >> 8); unsigned char majorVersion = (unsigned char)((token[0] & 0x0000FF00) >> 8);
ShaderType shaderType = (ShaderType)((token[0] & 0xFFFF0000) >> 16); ShaderType shaderType = (ShaderType)((token[0] & 0xFFFF0000) >> 16);
...@@ -230,7 +230,6 @@ namespace sw ...@@ -230,7 +230,6 @@ namespace sw
if(instruction[i]->dst.type == Shader::PARAMETER_TEXTURE) if(instruction[i]->dst.type == Shader::PARAMETER_TEXTURE)
{ {
int index = instruction[i]->dst.index + 2; int index = instruction[i]->dst.index + 2;
int mask = instruction[i]->dst.mask;
switch(instruction[i]->opcode) switch(instruction[i]->opcode)
{ {
......
...@@ -251,12 +251,12 @@ namespace sw ...@@ -251,12 +251,12 @@ namespace sw
if(state.multiSample == 1) if(state.multiSample == 1)
{ {
For(yMin, yMin < yMax && *Pointer<Short>(leftEdge + yMin * sizeof(Primitive::Span)) == *Pointer<Short>(rightEdge + yMin * sizeof(Primitive::Span)), yMin++) For(, yMin < yMax && *Pointer<Short>(leftEdge + yMin * sizeof(Primitive::Span)) == *Pointer<Short>(rightEdge + yMin * sizeof(Primitive::Span)), yMin++)
{ {
// Increments yMin // Increments yMin
} }
For(yMax, yMax > yMin && *Pointer<Short>(leftEdge + (yMax - 1) * sizeof(Primitive::Span)) == *Pointer<Short>(rightEdge + (yMax - 1) * sizeof(Primitive::Span)), yMax--) For(, yMax > yMin && *Pointer<Short>(leftEdge + (yMax - 1) * sizeof(Primitive::Span)) == *Pointer<Short>(rightEdge + (yMax - 1) * sizeof(Primitive::Span)), yMax--)
{ {
// Decrements yMax // Decrements yMax
} }
......
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