Commit 681956a6 authored by Martin Schultz's avatar Martin Schultz

fixed shader compile error on amd cards osx, thanks to kschuster

parent 3e4cb250
......@@ -1338,11 +1338,11 @@ void ShaderProgGenerator::buildTessControlShader()
// add simple io passthrough mapper
{
mainCode.push_back("void sg_MapIO(const int inIdx)");
mainCode.push_back("{");
// Write function as macro so that compiler knows there is no index indirection (thx AMD)
mainCode.push_back("#define sg_MapIO(inIdx) do {\\");
// built-in IO
mainCode.push_back("gl_out[gl_InvocationID].gl_Position = gl_in[inIdx].gl_Position;");
mainCode.push_back("gl_out[gl_InvocationID].gl_Position = gl_in[inIdx].gl_Position;\\");
// custom IO
for (int i = 0; i < tessControl_->getNumInputs(); ++i)
......@@ -1350,12 +1350,13 @@ void ShaderProgGenerator::buildTessControlShader()
QString inputName = tessControl_->getInputName(i);
QString outputName = tessControl_->getIOMapName(i);
QString outputAssignCode = outputName + QString("[gl_InvocationID] = ") + inputName + QString("[inIdx];");
QString outputAssignCode = outputName + QString("[gl_InvocationID] = ") + inputName + QString("[inIdx];\\");
mainCode.push_back(outputAssignCode);
}
mainCode.push_back("}");
// Enforce semicolon when using macro
mainCode.push_back("} while(false)");
}
......@@ -1608,12 +1609,12 @@ void ShaderProgGenerator::buildGeometryShader()
// add simple io passthrough mapper
{
mainCode.push_back("void sg_MapIO(const int inIdx)");
mainCode.push_back("{");
// Write function as macro so that compiler knows there is no index indirection (thx AMD)
mainCode.push_back("#define sg_MapIO(inIdx) do {\\");
// built-in IO
mainCode.push_back("gl_Position = gl_in[inIdx].gl_Position;");
mainCode.push_back("gl_PrimitiveID = gl_PrimitiveIDIn;");
mainCode.push_back("gl_Position = gl_in[inIdx].gl_Position;\\");
mainCode.push_back("gl_PrimitiveID = gl_PrimitiveIDIn;\\");
// built-in gl_ClipDistance[]
......@@ -1630,7 +1631,7 @@ void ShaderProgGenerator::buildGeometryShader()
for (int i = 0; i < maxClipDistances; ++i)
{
if (desc_.clipDistanceMask & (1 << i))
mainCode.push_back(QString("gl_ClipDistance[%1] = gl_in[inIdx].gl_ClipDistance[%1];").arg(i));
mainCode.push_back(QString("gl_ClipDistance[%1] = gl_in[inIdx].gl_ClipDistance[%1];\\").arg(i));
}
// custom IO
......@@ -1639,12 +1640,13 @@ void ShaderProgGenerator::buildGeometryShader()
QString inputName = geometry_->getInputName(i);
QString outputName = geometry_->getIOMapName(i);
QString outputAssignCode = outputName + QString(" = ") + inputName + QString("[inIdx];");
QString outputAssignCode = outputName + QString(" = ") + inputName + QString("[inIdx];\\");
mainCode.push_back(outputAssignCode);
}
mainCode.push_back("}");
// Enforce semicolon when using macro
mainCode.push_back("} while(false)");
}
......
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