mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
Support GL_EXT_draw_instanced extension.
This commit is contained in:
parent
07e8220d4e
commit
a7785ea1ff
18
Test/GL_EXT_draw_instanced.vert
Normal file
18
Test/GL_EXT_draw_instanced.vert
Normal file
@ -0,0 +1,18 @@
|
||||
#version 120
|
||||
#extension GL_EXT_draw_instanced : require
|
||||
#define ID gl_InstanceID
|
||||
|
||||
uniform mat4 gtf_ModelViewProjectionMatrix;
|
||||
uniform vec3 instanceOffsets[3];
|
||||
uniform vec4 va[gl_MaxVertexAttribs];
|
||||
vec4 color;
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 vertex = vec4(va[0].xy / 3.0, va[0].zw) + vec4(instanceOffsets[ID], 1.0);
|
||||
color = vec4(0, 0, 0, 0);
|
||||
for (int i = 1; i < gl_MaxVertexAttribs; i++)
|
||||
color += va[i];
|
||||
gl_Position = gtf_ModelViewProjectionMatrix * vertex;
|
||||
gl_PointSize = 1.0;
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
130.vert
|
||||
ERROR: 0:59: 'gl_InstanceID' : undeclared identifier
|
||||
ERROR: 0:59: '=' : cannot convert from ' temp float' to ' temp int'
|
||||
ERROR: 0:59: 'gl_InstanceID' : required extension not requested: GL_EXT_draw_instanced
|
||||
ERROR: 0:61: 'texelFetch' : no matching overloaded function found
|
||||
ERROR: 0:61: 'assign' : cannot convert from ' const float' to ' temp int'
|
||||
ERROR: 4 compilation errors. No code generated.
|
||||
ERROR: 3 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 130
|
||||
@ -120,7 +119,11 @@ ERROR: node is still EOpNull!
|
||||
0:46 0.300000
|
||||
0:57 Function Definition: foo88( ( global void)
|
||||
0:57 Function Parameters:
|
||||
0:? Sequence
|
||||
0:59 Sequence
|
||||
0:59 Sequence
|
||||
0:59 move second child to first child ( temp int)
|
||||
0:59 'id' ( temp int)
|
||||
0:59 'gl_InstanceID' ( gl_InstanceId int InstanceId)
|
||||
0:61 'id' ( temp int)
|
||||
0:63 'gl_ClipVertex' ( gl_ClipVertex 4-component vector of float ClipVertex)
|
||||
0:64 'gl_Color' ( in 4-component vector of float Color)
|
||||
|
173
Test/baseResults/GL_EXT_draw_instanced.vert.out
Normal file
173
Test/baseResults/GL_EXT_draw_instanced.vert.out
Normal file
@ -0,0 +1,173 @@
|
||||
GL_EXT_draw_instanced.vert
|
||||
Shader version: 120
|
||||
Requested GL_EXT_draw_instanced
|
||||
0:? Sequence
|
||||
0:10 Function Definition: main( ( global void)
|
||||
0:10 Function Parameters:
|
||||
0:12 Sequence
|
||||
0:12 Sequence
|
||||
0:12 move second child to first child ( temp 4-component vector of float)
|
||||
0:12 'vertex' ( temp 4-component vector of float)
|
||||
0:12 add ( temp 4-component vector of float)
|
||||
0:12 Construct vec4 ( temp 4-component vector of float)
|
||||
0:12 divide ( temp 2-component vector of float)
|
||||
0:12 vector swizzle ( temp 2-component vector of float)
|
||||
0:12 direct index ( temp 4-component vector of float)
|
||||
0:12 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:12 Constant:
|
||||
0:12 0 (const int)
|
||||
0:12 Sequence
|
||||
0:12 Constant:
|
||||
0:12 0 (const int)
|
||||
0:12 Constant:
|
||||
0:12 1 (const int)
|
||||
0:12 Constant:
|
||||
0:12 3.000000
|
||||
0:12 vector swizzle ( temp 2-component vector of float)
|
||||
0:12 direct index ( temp 4-component vector of float)
|
||||
0:12 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:12 Constant:
|
||||
0:12 0 (const int)
|
||||
0:12 Sequence
|
||||
0:12 Constant:
|
||||
0:12 2 (const int)
|
||||
0:12 Constant:
|
||||
0:12 3 (const int)
|
||||
0:12 Construct vec4 ( temp 4-component vector of float)
|
||||
0:12 indirect index ( temp 3-component vector of float)
|
||||
0:12 'instanceOffsets' ( uniform 3-element array of 3-component vector of float)
|
||||
0:12 'gl_InstanceID' ( gl_InstanceId int InstanceId)
|
||||
0:12 Constant:
|
||||
0:12 1.000000
|
||||
0:13 move second child to first child ( temp 4-component vector of float)
|
||||
0:13 'color' ( global 4-component vector of float)
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:14 Sequence
|
||||
0:14 Sequence
|
||||
0:14 move second child to first child ( temp int)
|
||||
0:14 'i' ( temp int)
|
||||
0:14 Constant:
|
||||
0:14 1 (const int)
|
||||
0:14 Loop with condition tested first
|
||||
0:14 Loop Condition
|
||||
0:14 Compare Less Than ( temp bool)
|
||||
0:14 'i' ( temp int)
|
||||
0:14 Constant:
|
||||
0:14 64 (const int)
|
||||
0:14 Loop Body
|
||||
0:15 add second child into first child ( temp 4-component vector of float)
|
||||
0:15 'color' ( global 4-component vector of float)
|
||||
0:15 indirect index ( temp 4-component vector of float)
|
||||
0:15 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:15 'i' ( temp int)
|
||||
0:14 Loop Terminal Expression
|
||||
0:14 Post-Increment ( temp int)
|
||||
0:14 'i' ( temp int)
|
||||
0:16 move second child to first child ( temp 4-component vector of float)
|
||||
0:16 'gl_Position' ( gl_Position 4-component vector of float Position)
|
||||
0:16 matrix-times-vector ( temp 4-component vector of float)
|
||||
0:16 'gtf_ModelViewProjectionMatrix' ( uniform 4X4 matrix of float)
|
||||
0:16 'vertex' ( temp 4-component vector of float)
|
||||
0:17 move second child to first child ( temp float)
|
||||
0:17 'gl_PointSize' ( gl_PointSize float PointSize)
|
||||
0:17 Constant:
|
||||
0:17 1.000000
|
||||
0:? Linker Objects
|
||||
0:? 'gtf_ModelViewProjectionMatrix' ( uniform 4X4 matrix of float)
|
||||
0:? 'instanceOffsets' ( uniform 3-element array of 3-component vector of float)
|
||||
0:? 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:? 'color' ( global 4-component vector of float)
|
||||
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 120
|
||||
Requested GL_EXT_draw_instanced
|
||||
0:? Sequence
|
||||
0:10 Function Definition: main( ( global void)
|
||||
0:10 Function Parameters:
|
||||
0:12 Sequence
|
||||
0:12 Sequence
|
||||
0:12 move second child to first child ( temp 4-component vector of float)
|
||||
0:12 'vertex' ( temp 4-component vector of float)
|
||||
0:12 add ( temp 4-component vector of float)
|
||||
0:12 Construct vec4 ( temp 4-component vector of float)
|
||||
0:12 divide ( temp 2-component vector of float)
|
||||
0:12 vector swizzle ( temp 2-component vector of float)
|
||||
0:12 direct index ( temp 4-component vector of float)
|
||||
0:12 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:12 Constant:
|
||||
0:12 0 (const int)
|
||||
0:12 Sequence
|
||||
0:12 Constant:
|
||||
0:12 0 (const int)
|
||||
0:12 Constant:
|
||||
0:12 1 (const int)
|
||||
0:12 Constant:
|
||||
0:12 3.000000
|
||||
0:12 vector swizzle ( temp 2-component vector of float)
|
||||
0:12 direct index ( temp 4-component vector of float)
|
||||
0:12 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:12 Constant:
|
||||
0:12 0 (const int)
|
||||
0:12 Sequence
|
||||
0:12 Constant:
|
||||
0:12 2 (const int)
|
||||
0:12 Constant:
|
||||
0:12 3 (const int)
|
||||
0:12 Construct vec4 ( temp 4-component vector of float)
|
||||
0:12 indirect index ( temp 3-component vector of float)
|
||||
0:12 'instanceOffsets' ( uniform 3-element array of 3-component vector of float)
|
||||
0:12 'gl_InstanceID' ( gl_InstanceId int InstanceId)
|
||||
0:12 Constant:
|
||||
0:12 1.000000
|
||||
0:13 move second child to first child ( temp 4-component vector of float)
|
||||
0:13 'color' ( global 4-component vector of float)
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:14 Sequence
|
||||
0:14 Sequence
|
||||
0:14 move second child to first child ( temp int)
|
||||
0:14 'i' ( temp int)
|
||||
0:14 Constant:
|
||||
0:14 1 (const int)
|
||||
0:14 Loop with condition tested first
|
||||
0:14 Loop Condition
|
||||
0:14 Compare Less Than ( temp bool)
|
||||
0:14 'i' ( temp int)
|
||||
0:14 Constant:
|
||||
0:14 64 (const int)
|
||||
0:14 Loop Body
|
||||
0:15 add second child into first child ( temp 4-component vector of float)
|
||||
0:15 'color' ( global 4-component vector of float)
|
||||
0:15 indirect index ( temp 4-component vector of float)
|
||||
0:15 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:15 'i' ( temp int)
|
||||
0:14 Loop Terminal Expression
|
||||
0:14 Post-Increment ( temp int)
|
||||
0:14 'i' ( temp int)
|
||||
0:16 move second child to first child ( temp 4-component vector of float)
|
||||
0:16 'gl_Position' ( gl_Position 4-component vector of float Position)
|
||||
0:16 matrix-times-vector ( temp 4-component vector of float)
|
||||
0:16 'gtf_ModelViewProjectionMatrix' ( uniform 4X4 matrix of float)
|
||||
0:16 'vertex' ( temp 4-component vector of float)
|
||||
0:17 move second child to first child ( temp float)
|
||||
0:17 'gl_PointSize' ( gl_PointSize float PointSize)
|
||||
0:17 Constant:
|
||||
0:17 1.000000
|
||||
0:? Linker Objects
|
||||
0:? 'gtf_ModelViewProjectionMatrix' ( uniform 4X4 matrix of float)
|
||||
0:? 'instanceOffsets' ( uniform 3-element array of 3-component vector of float)
|
||||
0:? 'va' ( uniform 64-element array of 4-component vector of float)
|
||||
0:? 'color' ( global 4-component vector of float)
|
||||
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
|
||||
|
@ -5256,7 +5256,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"int gl_VertexID;" // needs qualifier fixed later
|
||||
);
|
||||
if (version >= 140 && spvVersion.vulkan == 0)
|
||||
if (spvVersion.vulkan == 0)
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"int gl_InstanceID;" // needs qualifier fixed later
|
||||
);
|
||||
@ -5311,6 +5311,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"highp vec4 gl_Position;" // needs qualifier fixed later
|
||||
"mediump float gl_PointSize;" // needs qualifier fixed later
|
||||
"highp int gl_InstanceID;" // needs qualifier fixed later
|
||||
);
|
||||
} else {
|
||||
if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed)
|
||||
@ -7861,6 +7862,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
if (spvVersion.vulkan == 0) {
|
||||
SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable);
|
||||
SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable);
|
||||
if (version < 140)
|
||||
symbolTable.setVariableExtensions("gl_InstanceID", 1, &E_GL_EXT_draw_instanced);
|
||||
}
|
||||
|
||||
if (spvVersion.vulkan > 0 && spvVersion.vulkanRelaxed) {
|
||||
|
@ -2855,10 +2855,9 @@ void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguag
|
||||
//}
|
||||
|
||||
if (language == EShLangVertex) {
|
||||
// the names won't be found in the symbol table unless the versions are right,
|
||||
// so version logic does not need to be repeated here
|
||||
addSymbolLinkageNode(linkage, symbolTable, "gl_VertexID");
|
||||
addSymbolLinkageNode(linkage, symbolTable, "gl_InstanceID");
|
||||
if ((version < 140 && requestedExtensions.find(E_GL_EXT_draw_instanced) != requestedExtensions.end()) || version >= 140)
|
||||
addSymbolLinkageNode(linkage, symbolTable, "gl_InstanceID");
|
||||
}
|
||||
|
||||
// Add a child to the root node for the linker objects
|
||||
|
@ -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_draw_instanced] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_array] = EBhDisable;
|
||||
|
||||
// OVR extensions
|
||||
|
@ -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_draw_instanced = "GL_EXT_draw_instanced";
|
||||
const char* const E_GL_EXT_texture_array = "GL_EXT_texture_array";
|
||||
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
@ -301,6 +301,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
"coord_conventions.frag",
|
||||
"gl_FragCoord.frag",
|
||||
"glsl.interpOp.error.frag",
|
||||
"GL_EXT_draw_instanced.vert",
|
||||
"overflow_underflow_toinf_0.frag",
|
||||
"GL_EXT_texture_array.frag",
|
||||
})),
|
||||
|
Loading…
Reference in New Issue
Block a user