Commit 520acc67 by Nicolas Capens

Fix Clang errors on Linux.

Change-Id: I8bc812cd6c25a60dc73abc2177e8eb4a3841af21 Reviewed-on: https://swiftshader-review.googlesource.com/4551Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 81f1830d
...@@ -466,7 +466,7 @@ namespace glsl ...@@ -466,7 +466,7 @@ namespace glsl
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(); const TType &resultType = node->getType();
switch(node->getOp()) switch(node->getOp())
{ {
case EOpAssign: case EOpAssign:
...@@ -1218,7 +1218,7 @@ namespace glsl ...@@ -1218,7 +1218,7 @@ namespace glsl
{ {
TIntermTyped *argument = arguments[i]->getAsTyped(); TIntermTyped *argument = arguments[i]->getAsTyped();
TIntermTyped *out = arg[i]->getAsTyped(); TIntermTyped *out = arg[i]->getAsTyped();
if(argument->getQualifier() == EvqOut || if(argument->getQualifier() == EvqOut ||
argument->getQualifier() == EvqInOut) argument->getQualifier() == EvqInOut)
{ {
...@@ -1284,7 +1284,7 @@ namespace glsl ...@@ -1284,7 +1284,7 @@ namespace glsl
Instruction *bias = emit(sw::Shader::OPCODE_MOV, &proj, arg[textureFunction.offset ? 3 : 2]); Instruction *bias = emit(sw::Shader::OPCODE_MOV, &proj, arg[textureFunction.offset ? 3 : 2]);
bias->dst.mask = 0x8; bias->dst.mask = 0x8;
Instruction *tex = emit(textureFunction.offset ? sw::Shader::OPCODE_TEXOFFSET : sw::Shader::OPCODE_TEX, Instruction *tex = emit(textureFunction.offset ? sw::Shader::OPCODE_TEXOFFSET : sw::Shader::OPCODE_TEX,
result, &proj, arg[0], offset); // FIXME: Implement an efficient TEXLDB instruction result, &proj, arg[0], offset); // FIXME: Implement an efficient TEXLDB instruction
tex->bias = true; tex->bias = true;
} }
...@@ -1725,7 +1725,7 @@ namespace glsl ...@@ -1725,7 +1725,7 @@ namespace glsl
TIntermTyped *condition = node->getCondition(); TIntermTyped *condition = node->getCondition();
TIntermTyped *expression = node->getExpression(); TIntermTyped *expression = node->getExpression();
TIntermNode *body = node->getBody(); TIntermNode *body = node->getBody();
if(node->getType() == ELoopDoWhile) if(node->getType() == ELoopDoWhile)
{ {
Temporary iterate(this); Temporary iterate(this);
...@@ -1997,7 +1997,7 @@ namespace glsl ...@@ -1997,7 +1997,7 @@ namespace glsl
{ {
return registers * type.registerSize(); return registers * type.registerSize();
} }
UNREACHABLE(0); UNREACHABLE(0);
return 0; return 0;
} }
...@@ -2029,7 +2029,7 @@ namespace glsl ...@@ -2029,7 +2029,7 @@ namespace glsl
for(TFieldList::const_iterator field = fields.begin(); field != fields.end(); field++) for(TFieldList::const_iterator field = fields.begin(); field != fields.end(); field++)
{ {
const TType &fieldType = *((*field)->type()); const TType &fieldType = *((*field)->type());
if(fieldType.totalRegisterCount() <= registers) if(fieldType.totalRegisterCount() <= registers)
{ {
registers -= fieldType.totalRegisterCount(); registers -= fieldType.totalRegisterCount();
...@@ -2045,7 +2045,7 @@ namespace glsl ...@@ -2045,7 +2045,7 @@ namespace glsl
{ {
return registerSize(type, 0); return registerSize(type, 0);
} }
UNREACHABLE(0); UNREACHABLE(0);
return 0; return 0;
} }
...@@ -2166,7 +2166,7 @@ namespace glsl ...@@ -2166,7 +2166,7 @@ namespace glsl
if(binary && binary->getOp() == EOpIndexIndirect && dst->isScalar()) if(binary && binary->getOp() == EOpIndexIndirect && dst->isScalar())
{ {
Instruction *insert = new Instruction(sw::Shader::OPCODE_INSERT); Instruction *insert = new Instruction(sw::Shader::OPCODE_INSERT);
Temporary address(this); Temporary address(this);
lvalue(insert->dst, address, dst); lvalue(insert->dst, address, dst);
...@@ -2183,7 +2183,7 @@ namespace glsl ...@@ -2183,7 +2183,7 @@ namespace glsl
for(int offset = 0; offset < dst->totalRegisterCount(); offset++) for(int offset = 0; offset < dst->totalRegisterCount(); offset++)
{ {
Instruction *mov = new Instruction(sw::Shader::OPCODE_MOV); Instruction *mov = new Instruction(sw::Shader::OPCODE_MOV);
Temporary address(this); Temporary address(this);
int swizzle = lvalue(mov->dst, address, dst); int swizzle = lvalue(mov->dst, address, dst);
mov->dst.index += offset; mov->dst.index += offset;
...@@ -2223,7 +2223,7 @@ namespace glsl ...@@ -2223,7 +2223,7 @@ namespace glsl
if(left->isRegister()) if(left->isRegister())
{ {
int leftMask = dst.mask; int leftMask = dst.mask;
dst.mask = 1; dst.mask = 1;
while((leftMask & dst.mask) == 0) while((leftMask & dst.mask) == 0)
{ {
...@@ -2232,7 +2232,7 @@ namespace glsl ...@@ -2232,7 +2232,7 @@ namespace glsl
int element = swizzleElement(leftSwizzle, rightIndex); int element = swizzleElement(leftSwizzle, rightIndex);
dst.mask = 1 << element; dst.mask = 1 << element;
return element; return element;
} }
else if(left->isArray() || left->isMatrix()) else if(left->isArray() || left->isMatrix())
...@@ -2346,7 +2346,7 @@ namespace glsl ...@@ -2346,7 +2346,7 @@ namespace glsl
rightMask = rightMask | (1 << element); rightMask = rightMask | (1 << element);
swizzle = swizzle | swizzleElement(leftSwizzle, i) << (element * 2); swizzle = swizzle | swizzleElement(leftSwizzle, i) << (element * 2);
} }
dst.mask = leftMask & rightMask; dst.mask = leftMask & rightMask;
return swizzle; return swizzle;
...@@ -2399,7 +2399,7 @@ namespace glsl ...@@ -2399,7 +2399,7 @@ namespace glsl
case EvqVertexOut: return sw::Shader::PARAMETER_OUTPUT; case EvqVertexOut: return sw::Shader::PARAMETER_OUTPUT;
case EvqFragmentIn: return sw::Shader::PARAMETER_INPUT; case EvqFragmentIn: return sw::Shader::PARAMETER_INPUT;
case EvqInvariantVaryingIn: return sw::Shader::PARAMETER_INPUT; // FIXME: Guarantee invariance at the backend case EvqInvariantVaryingIn: return sw::Shader::PARAMETER_INPUT; // FIXME: Guarantee invariance at the backend
case EvqInvariantVaryingOut: return sw::Shader::PARAMETER_OUTPUT; // FIXME: Guarantee invariance at the backend case EvqInvariantVaryingOut: return sw::Shader::PARAMETER_OUTPUT; // FIXME: Guarantee invariance at the backend
case EvqSmooth: return sw::Shader::PARAMETER_OUTPUT; case EvqSmooth: return sw::Shader::PARAMETER_OUTPUT;
case EvqFlat: return sw::Shader::PARAMETER_OUTPUT; case EvqFlat: return sw::Shader::PARAMETER_OUTPUT;
case EvqCentroidOut: return sw::Shader::PARAMETER_OUTPUT; case EvqCentroidOut: return sw::Shader::PARAMETER_OUTPUT;
...@@ -2600,7 +2600,7 @@ namespace glsl ...@@ -2600,7 +2600,7 @@ namespace glsl
return 0; return 0;
} }
int OutputASM::temporaryRegister(TIntermTyped *temporary) int OutputASM::temporaryRegister(TIntermTyped *temporary)
{ {
return allocate(temporaries, temporary); return allocate(temporaries, temporary);
...@@ -2689,7 +2689,7 @@ namespace glsl ...@@ -2689,7 +2689,7 @@ namespace glsl
const TType &type = varying->getType(); const TType &type = varying->getType();
const char *name = varying->getAsSymbolNode()->getSymbol().c_str(); const char *name = varying->getAsSymbolNode()->getSymbol().c_str();
VaryingList &activeVaryings = shaderObject->varyings; VaryingList &activeVaryings = shaderObject->varyings;
// Check if this varying has been declared before without having a register assigned // Check if this varying has been declared before without having a register assigned
for(VaryingList::iterator v = activeVaryings.begin(); v != activeVaryings.end(); v++) for(VaryingList::iterator v = activeVaryings.begin(); v != activeVaryings.end(); v++)
{ {
...@@ -2704,7 +2704,7 @@ namespace glsl ...@@ -2704,7 +2704,7 @@ namespace glsl
return; return;
} }
} }
activeVaryings.push_back(glsl::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0)); activeVaryings.push_back(glsl::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0));
} }
} }
...@@ -3227,7 +3227,7 @@ namespace glsl ...@@ -3227,7 +3227,7 @@ namespace glsl
return matrix->getSecondarySize(); return matrix->getSecondarySize();
} }
// Returns ~0 if no loop count could be determined // Returns ~0u if no loop count could be determined
unsigned int OutputASM::loopCount(TIntermLoop *node) unsigned int OutputASM::loopCount(TIntermLoop *node)
{ {
// Parse loops of the form: // Parse loops of the form:
...@@ -3353,16 +3353,16 @@ namespace glsl ...@@ -3353,16 +3353,16 @@ namespace glsl
else UNIMPLEMENTED(); // Falls through else UNIMPLEMENTED(); // Falls through
} }
return ~0; return ~0u;
} }
bool DetectLoopDiscontinuity::traverse(TIntermNode *node) bool DetectLoopDiscontinuity::traverse(TIntermNode *node)
{ {
loopDepth = 0; loopDepth = 0;
loopDiscontinuity = false; loopDiscontinuity = false;
node->traverse(this); node->traverse(this);
return loopDiscontinuity; return loopDiscontinuity;
} }
...@@ -3391,7 +3391,7 @@ namespace glsl ...@@ -3391,7 +3391,7 @@ namespace glsl
{ {
return true; return true;
} }
switch(node->getFlowOp()) switch(node->getFlowOp())
{ {
case EOpKill: case EOpKill:
......
...@@ -62,7 +62,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex ...@@ -62,7 +62,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex
unsigned int streamOffset = 0; unsigned int streamOffset = 0;
char *output = nullptr; char *output = nullptr;
if(vertexBuffer) if(vertexBuffer)
{ {
output = (char*)vertexBuffer->map(attribute, attribute.typeSize() * count, &streamOffset); output = (char*)vertexBuffer->map(attribute, attribute.typeSize() * count, &streamOffset);
...@@ -71,7 +71,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex ...@@ -71,7 +71,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex
if(!output) if(!output)
{ {
ERR("Failed to map vertex buffer."); ERR("Failed to map vertex buffer.");
return UINT_MAX; return ~0u;
} }
const char *input = nullptr; const char *input = nullptr;
...@@ -134,7 +134,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -134,7 +134,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
} }
mStreamingBuffer->reserveRequiredSpace(); mStreamingBuffer->reserveRequiredSpace();
// Perform the vertex data translations // Perform the vertex data translations
for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++) for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
{ {
...@@ -163,7 +163,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -163,7 +163,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
{ {
unsigned int streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]); unsigned int streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]);
if(streamOffset == UINT_MAX) if(streamOffset == ~0u)
{ {
return GL_OUT_OF_MEMORY; return GL_OUT_OF_MEMORY;
} }
...@@ -248,7 +248,7 @@ ConstantVertexBuffer::ConstantVertexBuffer(float x, float y, float z, float w) : ...@@ -248,7 +248,7 @@ ConstantVertexBuffer::ConstantVertexBuffer(float x, float y, float z, float w) :
if(mVertexBuffer) if(mVertexBuffer)
{ {
float *vector = (float*)mVertexBuffer->lock(sw::PUBLIC); float *vector = (float*)mVertexBuffer->lock(sw::PUBLIC);
vector[0] = x; vector[0] = x;
vector[1] = y; vector[1] = y;
vector[2] = z; vector[2] = z;
...@@ -286,7 +286,7 @@ void *StreamingVertexBuffer::map(const VertexAttribute &attribute, unsigned int ...@@ -286,7 +286,7 @@ void *StreamingVertexBuffer::map(const VertexAttribute &attribute, unsigned int
{ {
// We can use a private lock because we never overwrite the content // We can use a private lock because we never overwrite the content
mapPtr = (char*)mVertexBuffer->lock(sw::PRIVATE) + mWritePosition; mapPtr = (char*)mVertexBuffer->lock(sw::PRIVATE) + mWritePosition;
*offset = mWritePosition; *offset = mWritePosition;
mWritePosition += requiredSpace; mWritePosition += requiredSpace;
} }
......
...@@ -63,7 +63,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex ...@@ -63,7 +63,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex
unsigned int streamOffset = 0; unsigned int streamOffset = 0;
char *output = nullptr; char *output = nullptr;
if(vertexBuffer) if(vertexBuffer)
{ {
output = (char*)vertexBuffer->map(attribute, attribute.typeSize() * count, &streamOffset); output = (char*)vertexBuffer->map(attribute, attribute.typeSize() * count, &streamOffset);
...@@ -72,7 +72,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex ...@@ -72,7 +72,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex
if(!output) if(!output)
{ {
ERR("Failed to map vertex buffer."); ERR("Failed to map vertex buffer.");
return UINT_MAX; return ~0u;
} }
const char *input = nullptr; const char *input = nullptr;
...@@ -131,7 +131,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -131,7 +131,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
} }
mStreamingBuffer->reserveRequiredSpace(); mStreamingBuffer->reserveRequiredSpace();
// Perform the vertex data translations // Perform the vertex data translations
for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++) for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
{ {
...@@ -158,7 +158,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -158,7 +158,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
{ {
unsigned int streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]); unsigned int streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]);
if(streamOffset == UINT_MAX) if(streamOffset == ~0u)
{ {
return GL_OUT_OF_MEMORY; return GL_OUT_OF_MEMORY;
} }
...@@ -242,7 +242,7 @@ ConstantVertexBuffer::ConstantVertexBuffer(float x, float y, float z, float w) : ...@@ -242,7 +242,7 @@ ConstantVertexBuffer::ConstantVertexBuffer(float x, float y, float z, float w) :
if(mVertexBuffer) if(mVertexBuffer)
{ {
float *vector = (float*)mVertexBuffer->lock(sw::PUBLIC); float *vector = (float*)mVertexBuffer->lock(sw::PUBLIC);
vector[0] = x; vector[0] = x;
vector[1] = y; vector[1] = y;
vector[2] = z; vector[2] = z;
......
...@@ -62,7 +62,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex ...@@ -62,7 +62,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex
unsigned int streamOffset = 0; unsigned int streamOffset = 0;
char *output = nullptr; char *output = nullptr;
if(vertexBuffer) if(vertexBuffer)
{ {
output = (char*)vertexBuffer->map(attribute, attribute.typeSize() * count, &streamOffset); output = (char*)vertexBuffer->map(attribute, attribute.typeSize() * count, &streamOffset);
...@@ -71,7 +71,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex ...@@ -71,7 +71,7 @@ unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertex
if(!output) if(!output)
{ {
ERR("Failed to map vertex buffer."); ERR("Failed to map vertex buffer.");
return UINT_MAX; return ~0u;
} }
const char *input = nullptr; const char *input = nullptr;
...@@ -135,7 +135,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -135,7 +135,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
} }
mStreamingBuffer->reserveRequiredSpace(); mStreamingBuffer->reserveRequiredSpace();
// Perform the vertex data translations // Perform the vertex data translations
for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++) for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
{ {
...@@ -171,7 +171,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -171,7 +171,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
{ {
unsigned int streamOffset = writeAttributeData(mStreamingBuffer, firstVertexIndex, isInstanced ? 1 : count, attrib); unsigned int streamOffset = writeAttributeData(mStreamingBuffer, firstVertexIndex, isInstanced ? 1 : count, attrib);
if(streamOffset == UINT_MAX) if(streamOffset == ~0u)
{ {
return GL_OUT_OF_MEMORY; return GL_OUT_OF_MEMORY;
} }
...@@ -256,7 +256,7 @@ ConstantVertexBuffer::ConstantVertexBuffer(float x, float y, float z, float w) : ...@@ -256,7 +256,7 @@ ConstantVertexBuffer::ConstantVertexBuffer(float x, float y, float z, float w) :
if(mVertexBuffer) if(mVertexBuffer)
{ {
float *vector = (float*)mVertexBuffer->lock(sw::PUBLIC); float *vector = (float*)mVertexBuffer->lock(sw::PUBLIC);
vector[0] = x; vector[0] = x;
vector[1] = y; vector[1] = y;
vector[2] = z; vector[2] = z;
......
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