Merge pull request #950 from dsrbecky/shadow_samplers

Add support for GL_EXT_shadow_samplers
This commit is contained in:
John Kessenich 2017-06-26 15:50:18 -06:00 committed by GitHub
commit 102328b75f
4 changed files with 24 additions and 3 deletions

View File

@ -1333,6 +1333,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod "vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod
"vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod "vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod
"float shadow2DEXT(sampler2DShadow, vec3);" // GL_EXT_shadow_samplers
"float shadow2DProjEXT(sampler2DShadow, vec4);" // GL_EXT_shadow_samplers
"\n"); "\n");
} }
} }
@ -5324,6 +5327,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
} }
if (profile == EEsProfile) {
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
}
// Fall through // Fall through
case EShLangTessControl: case EShLangTessControl:
@ -5661,6 +5669,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
if (profile == EEsProfile) {
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
}
break; break;
case EShLangCompute: case EShLangCompute:
@ -6048,6 +6061,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("sparseTextureGatherLodOffsetsAMD", EOpSparseTextureGatherLodOffsets); symbolTable.relateToOperator("sparseTextureGatherLodOffsetsAMD", EOpSparseTextureGatherLodOffsets);
#endif #endif
} }
if (profile == EEsProfile) {
symbolTable.relateToOperator("shadow2DEXT", EOpTexture);
symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);
}
} }
switch(language) { switch(language) {

View File

@ -1113,8 +1113,10 @@ int TScanContext::tokenizeIdentifier()
case SAMPLER2DSHADOW: case SAMPLER2DSHADOW:
afterType = true; afterType = true;
if (parseContext.profile == EEsProfile && parseContext.version < 300) if (parseContext.profile == EEsProfile && parseContext.version < 300) {
reservedWord(); if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers))
reservedWord();
}
return keyword; return keyword;
case SAMPLER2DRECT: case SAMPLER2DRECT:

View File

@ -155,7 +155,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_frag_depth] = EBhDisable; extensionBehavior[E_GL_EXT_frag_depth] = EBhDisable;
extensionBehavior[E_GL_OES_EGL_image_external] = EBhDisable; extensionBehavior[E_GL_OES_EGL_image_external] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_texture_lod] = EBhDisable; extensionBehavior[E_GL_EXT_shader_texture_lod] = EBhDisable;
extensionBehavior[E_GL_EXT_shadow_samplers] = EBhDisable;
extensionBehavior[E_GL_ARB_texture_rectangle] = EBhDisable; extensionBehavior[E_GL_ARB_texture_rectangle] = EBhDisable;
extensionBehavior[E_GL_3DL_array_objects] = EBhDisable; extensionBehavior[E_GL_3DL_array_objects] = EBhDisable;
extensionBehavior[E_GL_ARB_shading_language_420pack] = EBhDisable; extensionBehavior[E_GL_ARB_shading_language_420pack] = EBhDisable;
@ -253,6 +253,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_frag_depth 1\n" "#define GL_EXT_frag_depth 1\n"
"#define GL_OES_EGL_image_external 1\n" "#define GL_OES_EGL_image_external 1\n"
"#define GL_EXT_shader_texture_lod 1\n" "#define GL_EXT_shader_texture_lod 1\n"
"#define GL_EXT_shadow_samplers 1\n"
// AEP // AEP
"#define GL_ANDROID_extension_pack_es31a 1\n" "#define GL_ANDROID_extension_pack_es31a 1\n"

View File

@ -108,6 +108,7 @@ const char* const E_GL_OES_standard_derivatives = "GL_OES_standard_deriv
const char* const E_GL_EXT_frag_depth = "GL_EXT_frag_depth"; const char* const E_GL_EXT_frag_depth = "GL_EXT_frag_depth";
const char* const E_GL_OES_EGL_image_external = "GL_OES_EGL_image_external"; const char* const E_GL_OES_EGL_image_external = "GL_OES_EGL_image_external";
const char* const E_GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod"; const char* const E_GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod";
const char* const E_GL_EXT_shadow_samplers = "GL_EXT_shadow_samplers";
const char* const E_GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle"; const char* const E_GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle";
const char* const E_GL_3DL_array_objects = "GL_3DL_array_objects"; const char* const E_GL_3DL_array_objects = "GL_3DL_array_objects";