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