Implement GL_ARB_derivative_control.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27713 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
265f5fb80e
commit
13fd6c9dd7
12 changed files with 331 additions and 4 deletions
|
|
@ -208,6 +208,12 @@ enum TOperator {
|
|||
EOpDPdx, // Fragment only
|
||||
EOpDPdy, // Fragment only
|
||||
EOpFwidth, // Fragment only
|
||||
EOpDPdxFine, // Fragment only
|
||||
EOpDPdyFine, // Fragment only
|
||||
EOpFwidthFine, // Fragment only
|
||||
EOpDPdxCoarse, // Fragment only
|
||||
EOpDPdyCoarse, // Fragment only
|
||||
EOpFwidthCoarse, // Fragment only
|
||||
|
||||
EOpMatrixTimesMatrix,
|
||||
EOpOuterProduct,
|
||||
|
|
|
|||
|
|
@ -451,6 +451,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EOpDPdx:
|
||||
case EOpDPdy:
|
||||
case EOpFwidth:
|
||||
case EOpDPdxFine:
|
||||
case EOpDPdyFine:
|
||||
case EOpFwidthFine:
|
||||
case EOpDPdxCoarse:
|
||||
case EOpDPdyCoarse:
|
||||
case EOpFwidthCoarse:
|
||||
// The derivatives are all mandated to create a constant 0.
|
||||
newConstArray[i].setDConst(0.0);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -933,6 +933,45 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
|
||||
"\n");
|
||||
|
||||
// GL_ARB_derivative_control
|
||||
if (profile != EEsProfile && version >= 400) {
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"float dFdxFine(float p);"
|
||||
"vec2 dFdxFine(vec2 p);"
|
||||
"vec3 dFdxFine(vec3 p);"
|
||||
"vec4 dFdxFine(vec4 p);"
|
||||
|
||||
"float dFdyFine(float p);"
|
||||
"vec2 dFdyFine(vec2 p);"
|
||||
"vec3 dFdyFine(vec3 p);"
|
||||
"vec4 dFdyFine(vec4 p);"
|
||||
|
||||
"float fwidthFine(float p);"
|
||||
"vec2 fwidthFine(vec2 p);"
|
||||
"vec3 fwidthFine(vec3 p);"
|
||||
"vec4 fwidthFine(vec4 p);"
|
||||
|
||||
"\n");
|
||||
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"float dFdxCoarse(float p);"
|
||||
"vec2 dFdxCoarse(vec2 p);"
|
||||
"vec3 dFdxCoarse(vec3 p);"
|
||||
"vec4 dFdxCoarse(vec4 p);"
|
||||
|
||||
"float dFdyCoarse(float p);"
|
||||
"vec2 dFdyCoarse(vec2 p);"
|
||||
"vec3 dFdyCoarse(vec3 p);"
|
||||
"vec4 dFdyCoarse(vec4 p);"
|
||||
|
||||
"float fwidthCoarse(float p);"
|
||||
"vec2 fwidthCoarse(vec2 p);"
|
||||
"vec3 fwidthCoarse(vec3 p);"
|
||||
"vec4 fwidthCoarse(vec4 p);"
|
||||
|
||||
"\n");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Standard Uniforms
|
||||
|
|
@ -2383,6 +2422,16 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
symbolTable.setFunctionExtensions("atomicCounter" , 1, &GL_ARB_shader_atomic_counters);
|
||||
}
|
||||
|
||||
// GL_ARB_derivative_control
|
||||
if (profile != EEsProfile && version < 450) {
|
||||
symbolTable.setFunctionExtensions("dFdxFine", 1, &GL_ARB_derivative_control);
|
||||
symbolTable.setFunctionExtensions("dFdyFine", 1, &GL_ARB_derivative_control);
|
||||
symbolTable.setFunctionExtensions("fwidthFine", 1, &GL_ARB_derivative_control);
|
||||
symbolTable.setFunctionExtensions("dFdxCoarse", 1, &GL_ARB_derivative_control);
|
||||
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &GL_ARB_derivative_control);
|
||||
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &GL_ARB_derivative_control);
|
||||
}
|
||||
|
||||
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &GL_EXT_frag_depth);
|
||||
break;
|
||||
|
||||
|
|
@ -2512,6 +2561,14 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
symbolTable.relateToOperator("dFdx", EOpDPdx);
|
||||
symbolTable.relateToOperator("dFdy", EOpDPdy);
|
||||
symbolTable.relateToOperator("fwidth", EOpFwidth);
|
||||
if (profile != EEsProfile && version >= 400) {
|
||||
symbolTable.relateToOperator("dFdxFine", EOpDPdxFine);
|
||||
symbolTable.relateToOperator("dFdyFine", EOpDPdyFine);
|
||||
symbolTable.relateToOperator("fwidthFine", EOpFwidthFine);
|
||||
symbolTable.relateToOperator("dFdxCoarse", EOpDPdxCoarse);
|
||||
symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse);
|
||||
symbolTable.relateToOperator("fwidthCoarse", EOpFwidthCoarse);
|
||||
}
|
||||
break;
|
||||
|
||||
case EShLangCompute:
|
||||
|
|
|
|||
|
|
@ -3347,7 +3347,7 @@ void TParseContext::layoutObjectCheck(TSourceLoc loc, const TSymbol& symbol)
|
|||
error(loc, "cannot specify on a variable declaration", "offset", "");
|
||||
if (qualifier.hasOffset() && ! qualifier.hasBinding() && type.getBasicType() == EbtAtomicUint)
|
||||
error(loc, "a binding is required", "offset", "");
|
||||
if (qualifier.hasBinding() && qualifier.layoutBinding >= resources.maxAtomicCounterBindings && type.getBasicType() == EbtAtomicUint)
|
||||
if (qualifier.hasBinding() && (int)qualifier.layoutBinding >= resources.maxAtomicCounterBindings && type.getBasicType() == EbtAtomicUint)
|
||||
error(loc, "cannot be greater-than-or-equal to gl_MaxAtomicCounterBindings", "binding", "");
|
||||
// "The align qualifier can only be used on blocks or block members..."
|
||||
if (qualifier.hasAlign())
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ void TParseContext::initializeExtensionBehavior()
|
|||
extensionBehavior[GL_ARB_explicit_attrib_location] = EBhDisablePartial; // "index" for fragment outputs is missing
|
||||
extensionBehavior[GL_ARB_shader_image_load_store] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shader_atomic_counters] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_derivative_control] = EBhDisable;
|
||||
}
|
||||
|
||||
// Get code that is not part of a shared symbol table, is specific to this shader,
|
||||
|
|
@ -207,7 +208,9 @@ const char* TParseContext::getPreamble()
|
|||
"#define GL_ARB_shader_texture_lod 1\n"
|
||||
"#define GL_ARB_explicit_attrib_location 1\n"
|
||||
"#define GL_ARB_shader_image_load_store 1\n"
|
||||
"#define GL_ARB_shader_atomic_counters 1\n";
|
||||
"#define GL_ARB_shader_atomic_counters 1\n"
|
||||
"#define GL_ARB_derivative_control 1\n"
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ const char* const GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod";
|
|||
const char* const GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location";
|
||||
const char* const GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store";
|
||||
const char* const GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters";
|
||||
const char* const GL_ARB_derivative_control = "GL_ARB_derivative_control";
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
|
|
|
|||
|
|
@ -250,6 +250,12 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpDPdx: out.debug << "dPdx"; break;
|
||||
case EOpDPdy: out.debug << "dPdy"; break;
|
||||
case EOpFwidth: out.debug << "fwidth"; break;
|
||||
case EOpDPdxFine: out.debug << "dPdxFine"; break;
|
||||
case EOpDPdyFine: out.debug << "dPdyFine"; break;
|
||||
case EOpFwidthFine: out.debug << "fwidthFine"; break;
|
||||
case EOpDPdxCoarse: out.debug << "dPdxCoarse"; break;
|
||||
case EOpDPdyCoarse: out.debug << "dPdyCoarse"; break;
|
||||
case EOpFwidthCoarse: out.debug << "fwidthCoarse"; break;
|
||||
case EOpDeterminant: out.debug << "determinant"; break;
|
||||
case EOpMatrixInverse: out.debug << "inverse"; break;
|
||||
case EOpTranspose: out.debug << "transpose"; break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue