Add partial support for GL_ARB_shader_texture_lod.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26945 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-06-03 19:28:48 +00:00
Родитель 9dedb13447
Коммит 3591930f23
5 изменённых файлов: 180 добавлений и 16 удалений

Просмотреть файл

@ -171,3 +171,31 @@ void matConst()
mat3 m3a1[2] = mat3[2](m3s, m3s);
mat3 m3a2[2] = mat3[2](m3s, m3s, m3s); // ERROR, too many args
}
uniform sampler3D s3D;
uniform sampler1D s1D;
uniform sampler2DShadow s2DS;
void foo2323()
{
vec4 v;
vec2 v2;
float f;
v = texture2DLod(s2D, v2, f); // ERROR
v = texture3DProjLod(s3D, v, f); // ERROR
v = texture1DProjLod(s1D, v, f); // ERROR
v = shadow2DProjLod(s2DS, v, f); // ERROR
}
#extension GL_ARB_shader_texture_lod : require
void foo2324()
{
vec4 v;
vec2 v2;
float f;
v = texture2DLod(s2D, v2, f);
v = texture3DProjLod(s3D, v, f);
v = texture1DProjLod(s1D, v, f);
v = shadow2DProjLod(s2DS, v, f);
}

Просмотреть файл

@ -42,10 +42,16 @@ ERROR: 0:165: 'constructor' : matrix constructed from matrix can only have one a
ERROR: 0:166: 'constructor' : matrix constructed from matrix can only have one argument
ERROR: 0:172: 'constructor' : array constructor needs one argument per array element
ERROR: 0:172: '=' : cannot convert from 'const float' to '2-element array of 3X3 matrix of float'
ERROR: 43 compilation errors. No code generated.
ERROR: 0:184: 'texture2DLod' : required extension not requested: GL_ARB_shader_texture_lod
ERROR: 0:185: 'texture3DProjLod' : required extension not requested: GL_ARB_shader_texture_lod
ERROR: 0:186: 'texture1DProjLod' : required extension not requested: GL_ARB_shader_texture_lod
ERROR: 0:187: 'shadow2DProjLod' : required extension not requested: GL_ARB_shader_texture_lod
WARNING: 0:190: '#extension' : extension is only partially supported: GL_ARB_shader_texture_lod
ERROR: 47 compilation errors. No code generated.
Shader version: 120
Requested GL_ARB_shader_texture_lod
ERROR: node is still EOpNull!
0:21 Function Definition: main( (void)
0:21 Function Parameters:
@ -437,6 +443,60 @@ ERROR: node is still EOpNull!
0:171 Construct mat3 (2-element array of 3X3 matrix of float)
0:171 'm3s' (3X3 matrix of float)
0:171 'm3s' (3X3 matrix of float)
0:179 Function Definition: foo2323( (void)
0:179 Function Parameters:
0:? Sequence
0:184 move second child to first child (4-component vector of float)
0:184 'v' (4-component vector of float)
0:184 Function Call: texture2DLod(s21;vf2;f1; (4-component vector of float)
0:184 's2D' (uniform sampler2D)
0:184 'v2' (2-component vector of float)
0:184 'f' (float)
0:185 move second child to first child (4-component vector of float)
0:185 'v' (4-component vector of float)
0:185 Function Call: texture3DProjLod(s31;vf4;f1; (4-component vector of float)
0:185 's3D' (uniform sampler3D)
0:185 'v' (4-component vector of float)
0:185 'f' (float)
0:186 move second child to first child (4-component vector of float)
0:186 'v' (4-component vector of float)
0:186 Function Call: texture1DProjLod(s11;vf4;f1; (4-component vector of float)
0:186 's1D' (uniform sampler1D)
0:186 'v' (4-component vector of float)
0:186 'f' (float)
0:187 move second child to first child (4-component vector of float)
0:187 'v' (4-component vector of float)
0:187 Function Call: shadow2DProjLod(sS21;vf4;f1; (4-component vector of float)
0:187 's2DS' (uniform sampler2DShadow)
0:187 'v' (4-component vector of float)
0:187 'f' (float)
0:192 Function Definition: foo2324( (void)
0:192 Function Parameters:
0:? Sequence
0:197 move second child to first child (4-component vector of float)
0:197 'v' (4-component vector of float)
0:197 Function Call: texture2DLod(s21;vf2;f1; (4-component vector of float)
0:197 's2D' (uniform sampler2D)
0:197 'v2' (2-component vector of float)
0:197 'f' (float)
0:198 move second child to first child (4-component vector of float)
0:198 'v' (4-component vector of float)
0:198 Function Call: texture3DProjLod(s31;vf4;f1; (4-component vector of float)
0:198 's3D' (uniform sampler3D)
0:198 'v' (4-component vector of float)
0:198 'f' (float)
0:199 move second child to first child (4-component vector of float)
0:199 'v' (4-component vector of float)
0:199 Function Call: texture1DProjLod(s11;vf4;f1; (4-component vector of float)
0:199 's1D' (uniform sampler1D)
0:199 'v' (4-component vector of float)
0:199 'f' (float)
0:200 move second child to first child (4-component vector of float)
0:200 'v' (4-component vector of float)
0:200 Function Call: shadow2DProjLod(sS21;vf4;f1; (4-component vector of float)
0:200 's2DS' (uniform sampler2DShadow)
0:200 'v' (4-component vector of float)
0:200 'f' (float)
0:? Linker Objects
0:? 'lowp' (float)
0:? 'mediump' (float)
@ -460,6 +520,9 @@ ERROR: node is still EOpNull!
0:? 'm42' (4X2 matrix of float)
0:? 'm43' (4X3 matrix of float)
0:? 'm44' (4X4 matrix of float)
0:? 's3D' (uniform sampler3D)
0:? 's1D' (uniform sampler1D)
0:? 's2DS' (uniform sampler2DShadow)
Linked fragment stage:
@ -468,6 +531,7 @@ ERROR: Linking fragment stage: Recursion detected:
foo(f1; calling foo(f1;
Shader version: 120
Requested GL_ARB_shader_texture_lod
ERROR: node is still EOpNull!
0:21 Function Definition: main( (void)
0:21 Function Parameters:
@ -859,6 +923,60 @@ ERROR: node is still EOpNull!
0:171 Construct mat3 (2-element array of 3X3 matrix of float)
0:171 'm3s' (3X3 matrix of float)
0:171 'm3s' (3X3 matrix of float)
0:179 Function Definition: foo2323( (void)
0:179 Function Parameters:
0:? Sequence
0:184 move second child to first child (4-component vector of float)
0:184 'v' (4-component vector of float)
0:184 Function Call: texture2DLod(s21;vf2;f1; (4-component vector of float)
0:184 's2D' (uniform sampler2D)
0:184 'v2' (2-component vector of float)
0:184 'f' (float)
0:185 move second child to first child (4-component vector of float)
0:185 'v' (4-component vector of float)
0:185 Function Call: texture3DProjLod(s31;vf4;f1; (4-component vector of float)
0:185 's3D' (uniform sampler3D)
0:185 'v' (4-component vector of float)
0:185 'f' (float)
0:186 move second child to first child (4-component vector of float)
0:186 'v' (4-component vector of float)
0:186 Function Call: texture1DProjLod(s11;vf4;f1; (4-component vector of float)
0:186 's1D' (uniform sampler1D)
0:186 'v' (4-component vector of float)
0:186 'f' (float)
0:187 move second child to first child (4-component vector of float)
0:187 'v' (4-component vector of float)
0:187 Function Call: shadow2DProjLod(sS21;vf4;f1; (4-component vector of float)
0:187 's2DS' (uniform sampler2DShadow)
0:187 'v' (4-component vector of float)
0:187 'f' (float)
0:192 Function Definition: foo2324( (void)
0:192 Function Parameters:
0:? Sequence
0:197 move second child to first child (4-component vector of float)
0:197 'v' (4-component vector of float)
0:197 Function Call: texture2DLod(s21;vf2;f1; (4-component vector of float)
0:197 's2D' (uniform sampler2D)
0:197 'v2' (2-component vector of float)
0:197 'f' (float)
0:198 move second child to first child (4-component vector of float)
0:198 'v' (4-component vector of float)
0:198 Function Call: texture3DProjLod(s31;vf4;f1; (4-component vector of float)
0:198 's3D' (uniform sampler3D)
0:198 'v' (4-component vector of float)
0:198 'f' (float)
0:199 move second child to first child (4-component vector of float)
0:199 'v' (4-component vector of float)
0:199 Function Call: texture1DProjLod(s11;vf4;f1; (4-component vector of float)
0:199 's1D' (uniform sampler1D)
0:199 'v' (4-component vector of float)
0:199 'f' (float)
0:200 move second child to first child (4-component vector of float)
0:200 'v' (4-component vector of float)
0:200 Function Call: shadow2DProjLod(sS21;vf4;f1; (4-component vector of float)
0:200 's2DS' (uniform sampler2DShadow)
0:200 'v' (4-component vector of float)
0:200 'f' (float)
0:? Linker Objects
0:? 'lowp' (float)
0:? 'mediump' (float)
@ -882,4 +1000,7 @@ ERROR: node is still EOpNull!
0:? 'm42' (4X2 matrix of float)
0:? 'm43' (4X3 matrix of float)
0:? 'm44' (4X4 matrix of float)
0:? 's3D' (uniform sampler3D)
0:? 's1D' (uniform sampler1D)
0:? 's2DS' (uniform sampler2DShadow)

Просмотреть файл

@ -752,7 +752,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
// Original-style texture Functions with lod.
//
TString* s;
if (version < 130)
if (version == 100)
s = &stageBuiltins[EShLangVertex];
else
s = &commonBuiltins;
@ -761,12 +761,12 @@ void TBuiltIns::initialize(int version, EProfile profile)
(profile == ECoreProfile && version < 420) ||
profile == ENoProfile) {
s->append(
"vec4 texture2DLod(sampler2D, vec2, float);"
"vec4 texture2DProjLod(sampler2D, vec3, float);"
"vec4 texture2DProjLod(sampler2D, vec4, float);"
"vec4 texture3DLod(sampler3D, vec3, float);" // OES_texture_3D, but caught by keyword check
"vec4 texture3DProjLod(sampler3D, vec4, float);" // OES_texture_3D, but caught by keyword check
"vec4 textureCubeLod(samplerCube, vec3, float);"
"vec4 texture2DLod(sampler2D, vec2, float);" // ARB_shader_texture_lod
"vec4 texture2DProjLod(sampler2D, vec3, float);" // ARB_shader_texture_lod
"vec4 texture2DProjLod(sampler2D, vec4, float);" // ARB_shader_texture_lod
"vec4 texture3DLod(sampler3D, vec3, float);" // ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
"vec4 texture3DProjLod(sampler3D, vec4, float);" // ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
"vec4 textureCubeLod(samplerCube, vec3, float);" // ARB_shader_texture_lod
"\n");
}
@ -774,13 +774,13 @@ void TBuiltIns::initialize(int version, EProfile profile)
(profile == ECoreProfile && version < 420) ||
profile == ENoProfile) {
s->append(
"vec4 texture1DLod(sampler1D, float, float);"
"vec4 texture1DProjLod(sampler1D, vec2, float);"
"vec4 texture1DProjLod(sampler1D, vec4, float);"
"vec4 shadow1DLod(sampler1DShadow, vec3, float);"
"vec4 shadow2DLod(sampler2DShadow, vec3, float);"
"vec4 shadow1DProjLod(sampler1DShadow, vec4, float);"
"vec4 shadow2DProjLod(sampler2DShadow, vec4, float);"
"vec4 texture1DLod(sampler1D, float, float);" // ARB_shader_texture_lod
"vec4 texture1DProjLod(sampler1D, vec2, float);" // ARB_shader_texture_lod
"vec4 texture1DProjLod(sampler1D, vec4, float);" // ARB_shader_texture_lod
"vec4 shadow1DLod(sampler1DShadow, vec3, float);" // ARB_shader_texture_lod
"vec4 shadow2DLod(sampler2DShadow, vec3, float);" // ARB_shader_texture_lod
"vec4 shadow1DProjLod(sampler1DShadow, vec4, float);" // ARB_shader_texture_lod
"vec4 shadow2DProjLod(sampler2DShadow, vec4, float);" // ARB_shader_texture_lod
"\n");
}
@ -2195,6 +2195,18 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &GL_EXT_shader_texture_lod);
} else if (version < 130) {
symbolTable.setFunctionExtensions("texture1DLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("texture2DLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("texture3DLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("textureCubeLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("texture1DProjLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("texture2DProjLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("texture3DProjLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("shadow1DLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("shadow2DLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &GL_ARB_shader_texture_lod);
}
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &GL_EXT_frag_depth);
break;

Просмотреть файл

@ -154,6 +154,7 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[GL_EXT_frag_depth] = EBhDisable;
extensionBehavior[GL_OES_EGL_image_external] = EBhDisable;
extensionBehavior[GL_EXT_shader_texture_lod] = EBhDisable;
extensionBehavior[GL_ARB_shader_texture_lod] = EBhDisablePartial;
extensionBehavior[GL_ARB_texture_rectangle] = EBhDisable;
extensionBehavior[GL_3DL_array_objects] = EBhDisable;
@ -199,7 +200,8 @@ const char* TParseContext::getPreamble()
"#define GL_ARB_separate_shader_objects 1\n"
"#define GL_ARB_tessellation_shader 1\n"
"#define GL_ARB_enhanced_layouts 1\n"
"#define GL_ARB_texture_cube_map_array 1\n";
"#define GL_ARB_texture_cube_map_array 1\n"
"#define GL_ARB_shader_texture_lod 1\n";
}
}

Просмотреть файл

@ -88,6 +88,7 @@ const char* const GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_obje
const char* const GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader";
const char* const GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts";
const char* const GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array";
const char* const GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod";
} // end namespace glslang