mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
support GL_EXT_texture_array extention.
This commit is contained in:
parent
c4d34471c4
commit
07e8220d4e
34
Test/GL_EXT_texture_array.frag
Normal file
34
Test/GL_EXT_texture_array.frag
Normal file
@ -0,0 +1,34 @@
|
||||
#version 110
|
||||
|
||||
#extension GL_EXT_texture_array : enable
|
||||
|
||||
uniform sampler1DArray s1DA;
|
||||
uniform sampler2DArray s2DA;
|
||||
uniform sampler1DArrayShadow s1DAS;
|
||||
uniform sampler2DArrayShadow s2DAS;
|
||||
|
||||
void foo()
|
||||
{
|
||||
float f;
|
||||
vec2 v2;
|
||||
vec3 v3;
|
||||
vec4 v4;
|
||||
|
||||
v4 = texture1DArray(s1DA, v2);
|
||||
v4 = texture2DArray(s2DA, v3);
|
||||
v4 = shadow1DArray(s1DAS, v3);
|
||||
v4 = shadow2DArray(s2DAS, v4);
|
||||
|
||||
v4 = texture1DArray(s1DA, v2, f);
|
||||
v4 = texture2DArray(s2DA, v3, f);
|
||||
v4 = shadow1DArray(s1DAS, v3, f);
|
||||
|
||||
v4 = texture1DArrayLod(s1DA, v2, f);
|
||||
v4 = texture2DArrayLod(s2DA, v3, f);
|
||||
v4 = shadow1DArrayLod(s1DAS, v3, f);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
foo();
|
||||
}
|
149
Test/baseResults/GL_EXT_texture_array.frag.out
Normal file
149
Test/baseResults/GL_EXT_texture_array.frag.out
Normal file
@ -0,0 +1,149 @@
|
||||
GL_EXT_texture_array.frag
|
||||
Shader version: 110
|
||||
Requested GL_EXT_texture_array
|
||||
0:? Sequence
|
||||
0:10 Function Definition: foo( ( global void)
|
||||
0:10 Function Parameters:
|
||||
0:? Sequence
|
||||
0:17 move second child to first child ( temp 4-component vector of float)
|
||||
0:17 'v4' ( temp 4-component vector of float)
|
||||
0:17 texture ( global 4-component vector of float)
|
||||
0:17 's1DA' ( uniform sampler1DArray)
|
||||
0:17 'v2' ( temp 2-component vector of float)
|
||||
0:18 move second child to first child ( temp 4-component vector of float)
|
||||
0:18 'v4' ( temp 4-component vector of float)
|
||||
0:18 texture ( global 4-component vector of float)
|
||||
0:18 's2DA' ( uniform sampler2DArray)
|
||||
0:18 'v3' ( temp 3-component vector of float)
|
||||
0:19 move second child to first child ( temp 4-component vector of float)
|
||||
0:19 'v4' ( temp 4-component vector of float)
|
||||
0:19 texture ( global 4-component vector of float)
|
||||
0:19 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:19 'v3' ( temp 3-component vector of float)
|
||||
0:20 move second child to first child ( temp 4-component vector of float)
|
||||
0:20 'v4' ( temp 4-component vector of float)
|
||||
0:20 texture ( global 4-component vector of float)
|
||||
0:20 's2DAS' ( uniform sampler2DArrayShadow)
|
||||
0:20 'v4' ( temp 4-component vector of float)
|
||||
0:22 move second child to first child ( temp 4-component vector of float)
|
||||
0:22 'v4' ( temp 4-component vector of float)
|
||||
0:22 texture ( global 4-component vector of float)
|
||||
0:22 's1DA' ( uniform sampler1DArray)
|
||||
0:22 'v2' ( temp 2-component vector of float)
|
||||
0:22 'f' ( temp float)
|
||||
0:23 move second child to first child ( temp 4-component vector of float)
|
||||
0:23 'v4' ( temp 4-component vector of float)
|
||||
0:23 texture ( global 4-component vector of float)
|
||||
0:23 's2DA' ( uniform sampler2DArray)
|
||||
0:23 'v3' ( temp 3-component vector of float)
|
||||
0:23 'f' ( temp float)
|
||||
0:24 move second child to first child ( temp 4-component vector of float)
|
||||
0:24 'v4' ( temp 4-component vector of float)
|
||||
0:24 texture ( global 4-component vector of float)
|
||||
0:24 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:24 'v3' ( temp 3-component vector of float)
|
||||
0:24 'f' ( temp float)
|
||||
0:26 move second child to first child ( temp 4-component vector of float)
|
||||
0:26 'v4' ( temp 4-component vector of float)
|
||||
0:26 textureLod ( global 4-component vector of float)
|
||||
0:26 's1DA' ( uniform sampler1DArray)
|
||||
0:26 'v2' ( temp 2-component vector of float)
|
||||
0:26 'f' ( temp float)
|
||||
0:27 move second child to first child ( temp 4-component vector of float)
|
||||
0:27 'v4' ( temp 4-component vector of float)
|
||||
0:27 textureLod ( global 4-component vector of float)
|
||||
0:27 's2DA' ( uniform sampler2DArray)
|
||||
0:27 'v3' ( temp 3-component vector of float)
|
||||
0:27 'f' ( temp float)
|
||||
0:28 move second child to first child ( temp 4-component vector of float)
|
||||
0:28 'v4' ( temp 4-component vector of float)
|
||||
0:28 textureLod ( global 4-component vector of float)
|
||||
0:28 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:28 'v3' ( temp 3-component vector of float)
|
||||
0:28 'f' ( temp float)
|
||||
0:31 Function Definition: main( ( global void)
|
||||
0:31 Function Parameters:
|
||||
0:33 Sequence
|
||||
0:33 Function Call: foo( ( global void)
|
||||
0:? Linker Objects
|
||||
0:? 's1DA' ( uniform sampler1DArray)
|
||||
0:? 's2DA' ( uniform sampler2DArray)
|
||||
0:? 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:? 's2DAS' ( uniform sampler2DArrayShadow)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 110
|
||||
Requested GL_EXT_texture_array
|
||||
0:? Sequence
|
||||
0:10 Function Definition: foo( ( global void)
|
||||
0:10 Function Parameters:
|
||||
0:? Sequence
|
||||
0:17 move second child to first child ( temp 4-component vector of float)
|
||||
0:17 'v4' ( temp 4-component vector of float)
|
||||
0:17 texture ( global 4-component vector of float)
|
||||
0:17 's1DA' ( uniform sampler1DArray)
|
||||
0:17 'v2' ( temp 2-component vector of float)
|
||||
0:18 move second child to first child ( temp 4-component vector of float)
|
||||
0:18 'v4' ( temp 4-component vector of float)
|
||||
0:18 texture ( global 4-component vector of float)
|
||||
0:18 's2DA' ( uniform sampler2DArray)
|
||||
0:18 'v3' ( temp 3-component vector of float)
|
||||
0:19 move second child to first child ( temp 4-component vector of float)
|
||||
0:19 'v4' ( temp 4-component vector of float)
|
||||
0:19 texture ( global 4-component vector of float)
|
||||
0:19 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:19 'v3' ( temp 3-component vector of float)
|
||||
0:20 move second child to first child ( temp 4-component vector of float)
|
||||
0:20 'v4' ( temp 4-component vector of float)
|
||||
0:20 texture ( global 4-component vector of float)
|
||||
0:20 's2DAS' ( uniform sampler2DArrayShadow)
|
||||
0:20 'v4' ( temp 4-component vector of float)
|
||||
0:22 move second child to first child ( temp 4-component vector of float)
|
||||
0:22 'v4' ( temp 4-component vector of float)
|
||||
0:22 texture ( global 4-component vector of float)
|
||||
0:22 's1DA' ( uniform sampler1DArray)
|
||||
0:22 'v2' ( temp 2-component vector of float)
|
||||
0:22 'f' ( temp float)
|
||||
0:23 move second child to first child ( temp 4-component vector of float)
|
||||
0:23 'v4' ( temp 4-component vector of float)
|
||||
0:23 texture ( global 4-component vector of float)
|
||||
0:23 's2DA' ( uniform sampler2DArray)
|
||||
0:23 'v3' ( temp 3-component vector of float)
|
||||
0:23 'f' ( temp float)
|
||||
0:24 move second child to first child ( temp 4-component vector of float)
|
||||
0:24 'v4' ( temp 4-component vector of float)
|
||||
0:24 texture ( global 4-component vector of float)
|
||||
0:24 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:24 'v3' ( temp 3-component vector of float)
|
||||
0:24 'f' ( temp float)
|
||||
0:26 move second child to first child ( temp 4-component vector of float)
|
||||
0:26 'v4' ( temp 4-component vector of float)
|
||||
0:26 textureLod ( global 4-component vector of float)
|
||||
0:26 's1DA' ( uniform sampler1DArray)
|
||||
0:26 'v2' ( temp 2-component vector of float)
|
||||
0:26 'f' ( temp float)
|
||||
0:27 move second child to first child ( temp 4-component vector of float)
|
||||
0:27 'v4' ( temp 4-component vector of float)
|
||||
0:27 textureLod ( global 4-component vector of float)
|
||||
0:27 's2DA' ( uniform sampler2DArray)
|
||||
0:27 'v3' ( temp 3-component vector of float)
|
||||
0:27 'f' ( temp float)
|
||||
0:28 move second child to first child ( temp 4-component vector of float)
|
||||
0:28 'v4' ( temp 4-component vector of float)
|
||||
0:28 textureLod ( global 4-component vector of float)
|
||||
0:28 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:28 'v3' ( temp 3-component vector of float)
|
||||
0:28 'f' ( temp float)
|
||||
0:31 Function Definition: main( ( global void)
|
||||
0:31 Function Parameters:
|
||||
0:33 Sequence
|
||||
0:33 Function Call: foo( ( global void)
|
||||
0:? Linker Objects
|
||||
0:? 's1DA' ( uniform sampler1DArray)
|
||||
0:? 's2DA' ( uniform sampler2DArray)
|
||||
0:? 's1DAS' ( uniform sampler1DArrayShadow)
|
||||
0:? 's2DAS' ( uniform sampler2DArrayShadow)
|
||||
|
@ -1726,6 +1726,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"vec4 shadow2DRect(sampler2DRectShadow, vec3);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 shadow2DRectProj(sampler2DRectShadow, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
|
||||
"vec4 texture1DArray(sampler1DArray, vec2);" // GL_EXT_texture_array
|
||||
"vec4 texture2DArray(sampler2DArray, vec3);" // GL_EXT_texture_array
|
||||
"vec4 shadow1DArray(sampler1DArrayShadow, vec3);" // GL_EXT_texture_array
|
||||
"vec4 shadow2DArray(sampler2DArrayShadow, vec4);" // GL_EXT_texture_array
|
||||
"vec4 texture1DArray(sampler1DArray, vec2, float);" // GL_EXT_texture_array
|
||||
"vec4 texture2DArray(sampler2DArray, vec3, float);" // GL_EXT_texture_array
|
||||
"vec4 shadow1DArray(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array
|
||||
"vec4 texture1DArrayLod(sampler1DArray, vec2, float);" // GL_EXT_texture_array
|
||||
"vec4 texture2DArrayLod(sampler2DArray, vec3, float);" // GL_EXT_texture_array
|
||||
"vec4 shadow1DArrayLod(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
@ -8002,6 +8012,18 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
|
||||
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
|
||||
}
|
||||
|
||||
// E_GL_EXT_texture_array
|
||||
if (profile != EEsProfile && spvVersion.spv == 0) {
|
||||
symbolTable.setFunctionExtensions("texture1DArray", 1, &E_GL_EXT_texture_array);
|
||||
symbolTable.setFunctionExtensions("texture2DArray", 1, &E_GL_EXT_texture_array);
|
||||
symbolTable.setFunctionExtensions("shadow1DArray", 1, &E_GL_EXT_texture_array);
|
||||
symbolTable.setFunctionExtensions("shadow2DArray", 1, &E_GL_EXT_texture_array);
|
||||
|
||||
symbolTable.setFunctionExtensions("texture1DArrayLod", 1, &E_GL_EXT_texture_array);
|
||||
symbolTable.setFunctionExtensions("texture2DArrayLod", 1, &E_GL_EXT_texture_array);
|
||||
symbolTable.setFunctionExtensions("shadow1DArrayLod", 1, &E_GL_EXT_texture_array);
|
||||
}
|
||||
// Fall through
|
||||
|
||||
case EShLangTessControl:
|
||||
@ -9967,6 +9989,17 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.relateToOperator("textureBlockMatchSADQCOM", EOpImageBlockMatchSADQCOM);
|
||||
symbolTable.relateToOperator("textureBlockMatchSSDQCOM", EOpImageBlockMatchSSDQCOM);
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && spvVersion.spv == 0) {
|
||||
symbolTable.relateToOperator("texture1DArray", EOpTexture);
|
||||
symbolTable.relateToOperator("texture2DArray", EOpTexture);
|
||||
symbolTable.relateToOperator("shadow1DArray", EOpTexture);
|
||||
symbolTable.relateToOperator("shadow2DArray", EOpTexture);
|
||||
|
||||
symbolTable.relateToOperator("texture1DArrayLod", EOpTextureLod);
|
||||
symbolTable.relateToOperator("texture2DArrayLod", EOpTextureLod);
|
||||
symbolTable.relateToOperator("shadow1DArrayLod", EOpTextureLod);
|
||||
}
|
||||
}
|
||||
|
||||
switch(language) {
|
||||
|
@ -1496,6 +1496,12 @@ int TScanContext::tokenizeIdentifier()
|
||||
case USAMPLERCUBE:
|
||||
case USAMPLER2DARRAY:
|
||||
afterType = true;
|
||||
if (keyword == SAMPLER2DARRAY || keyword == SAMPLER2DARRAYSHADOW) {
|
||||
if (!parseContext.isEsProfile() &&
|
||||
(parseContext.extensionTurnedOn(E_GL_EXT_texture_array) || parseContext.symbolTable.atBuiltInLevel())) {
|
||||
return keyword;
|
||||
}
|
||||
}
|
||||
return nonreservedKeyword(300, 130);
|
||||
|
||||
case SAMPLER3D:
|
||||
@ -1539,6 +1545,12 @@ int TScanContext::tokenizeIdentifier()
|
||||
case USAMPLER1D:
|
||||
case USAMPLER1DARRAY:
|
||||
afterType = true;
|
||||
if (keyword == SAMPLER1DARRAYSHADOW) {
|
||||
if (!parseContext.isEsProfile() &&
|
||||
(parseContext.extensionTurnedOn(E_GL_EXT_texture_array) || parseContext.symbolTable.atBuiltInLevel())) {
|
||||
return keyword;
|
||||
}
|
||||
}
|
||||
return es30ReservedFromGLSL(130);
|
||||
case ISAMPLER2DRECT:
|
||||
case USAMPLER2DRECT:
|
||||
@ -1608,7 +1620,9 @@ int TScanContext::tokenizeIdentifier()
|
||||
if (parseContext.isEsProfile() && parseContext.version == 300)
|
||||
reservedWord();
|
||||
else if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 130))
|
||||
((!parseContext.isEsProfile() && parseContext.version < 130) &&
|
||||
!parseContext.symbolTable.atBuiltInLevel() &&
|
||||
!parseContext.extensionTurnedOn(E_GL_EXT_texture_array)))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
|
@ -359,6 +359,7 @@ void TParseVersions::initializeExtensionBehavior()
|
||||
extensionBehavior[E_GL_EXT_ray_tracing_position_fetch] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_tile_image] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_shadow_lod] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_array] = EBhDisable;
|
||||
|
||||
// OVR extensions
|
||||
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
|
||||
@ -580,6 +581,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
"#define GL_EXT_shader_atomic_float2 1\n"
|
||||
|
||||
"#define GL_EXT_fragment_shader_barycentric 1\n"
|
||||
"#define GL_EXT_texture_array 1\n"
|
||||
;
|
||||
|
||||
if (spvVersion.spv == 0) {
|
||||
|
@ -215,6 +215,7 @@ const char* const E_GL_EXT_spirv_intrinsics = "GL_EXT_spirv_intr
|
||||
const char* const E_GL_EXT_fragment_shader_barycentric = "GL_EXT_fragment_shader_barycentric";
|
||||
const char* const E_GL_EXT_mesh_shader = "GL_EXT_mesh_shader";
|
||||
const char* const E_GL_EXT_opacity_micromap = "GL_EXT_opacity_micromap";
|
||||
const char* const E_GL_EXT_texture_array = "GL_EXT_texture_array";
|
||||
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
||||
|
@ -302,6 +302,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
"gl_FragCoord.frag",
|
||||
"glsl.interpOp.error.frag",
|
||||
"overflow_underflow_toinf_0.frag",
|
||||
"GL_EXT_texture_array.frag",
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user