Merge pull request #2722 from ZhiqianXia/GL_ARB_draw_instanced
Support the #extension GL_ARB_draw_instanced.
This commit is contained in:
		
						commit
						ae2e2707df
					
				
							
								
								
									
										18
									
								
								Test/GL_ARB_draw_instanced.vert
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Test/GL_ARB_draw_instanced.vert
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					#version 150
 | 
				
			||||||
 | 
					#extension GL_ARB_draw_instanced : require
 | 
				
			||||||
 | 
					#define ID gl_InstanceID
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uniform mat4 gtf_ModelViewProjectionMatrix;
 | 
				
			||||||
 | 
					uniform vec3 instanceOffsets[3];
 | 
				
			||||||
 | 
					in vec4 va[gl_MaxVertexAttribs];
 | 
				
			||||||
 | 
					out 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;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										189
									
								
								Test/baseResults/GL_ARB_draw_instanced.vert.out
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										189
									
								
								Test/baseResults/GL_ARB_draw_instanced.vert.out
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,189 @@
 | 
				
			|||||||
 | 
					GL_ARB_draw_instanced.vert
 | 
				
			||||||
 | 
					Shader version: 150
 | 
				
			||||||
 | 
					Requested GL_ARB_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' ( in 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' ( in 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' ( smooth out 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' ( smooth out 4-component vector of float)
 | 
				
			||||||
 | 
					0:15            indirect index ( temp 4-component vector of float)
 | 
				
			||||||
 | 
					0:15              'va' ( in 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: direct index for structure ( gl_Position 4-component vector of float Position)
 | 
				
			||||||
 | 
					0:16          'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position,  gl_PointSize float PointSize gl_PointSize,  out unsized 1-element array of float ClipDistance gl_ClipDistance})
 | 
				
			||||||
 | 
					0:16          Constant:
 | 
				
			||||||
 | 
					0:16            0 (const uint)
 | 
				
			||||||
 | 
					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: direct index for structure ( gl_PointSize float PointSize)
 | 
				
			||||||
 | 
					0:17          'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position,  gl_PointSize float PointSize gl_PointSize,  out unsized 1-element array of float ClipDistance gl_ClipDistance})
 | 
				
			||||||
 | 
					0:17          Constant:
 | 
				
			||||||
 | 
					0:17            1 (const uint)
 | 
				
			||||||
 | 
					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' ( in 64-element array of 4-component vector of float)
 | 
				
			||||||
 | 
					0:?     'color' ( smooth out 4-component vector of float)
 | 
				
			||||||
 | 
					0:?     'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position,  gl_PointSize float PointSize gl_PointSize,  out unsized 1-element array of float ClipDistance gl_ClipDistance})
 | 
				
			||||||
 | 
					0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 | 
				
			||||||
 | 
					0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Linked vertex stage:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Shader version: 150
 | 
				
			||||||
 | 
					Requested GL_ARB_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' ( in 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' ( in 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' ( smooth out 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' ( smooth out 4-component vector of float)
 | 
				
			||||||
 | 
					0:15            indirect index ( temp 4-component vector of float)
 | 
				
			||||||
 | 
					0:15              'va' ( in 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: direct index for structure ( gl_Position 4-component vector of float Position)
 | 
				
			||||||
 | 
					0:16          'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position,  gl_PointSize float PointSize gl_PointSize,  out 1-element array of float ClipDistance gl_ClipDistance})
 | 
				
			||||||
 | 
					0:16          Constant:
 | 
				
			||||||
 | 
					0:16            0 (const uint)
 | 
				
			||||||
 | 
					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: direct index for structure ( gl_PointSize float PointSize)
 | 
				
			||||||
 | 
					0:17          'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position,  gl_PointSize float PointSize gl_PointSize,  out 1-element array of float ClipDistance gl_ClipDistance})
 | 
				
			||||||
 | 
					0:17          Constant:
 | 
				
			||||||
 | 
					0:17            1 (const uint)
 | 
				
			||||||
 | 
					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' ( in 64-element array of 4-component vector of float)
 | 
				
			||||||
 | 
					0:?     'color' ( smooth out 4-component vector of float)
 | 
				
			||||||
 | 
					0:?     'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position,  gl_PointSize float PointSize gl_PointSize,  out 1-element array of float ClipDistance gl_ClipDistance})
 | 
				
			||||||
 | 
					0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 | 
				
			||||||
 | 
					0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -225,6 +225,7 @@ void TParseVersions::initializeExtensionBehavior()
 | 
				
			|||||||
    extensionBehavior[E_GL_ARB_shading_language_packing]     = EBhDisable;
 | 
					    extensionBehavior[E_GL_ARB_shading_language_packing]     = EBhDisable;
 | 
				
			||||||
    extensionBehavior[E_GL_ARB_texture_query_lod]            = EBhDisable;
 | 
					    extensionBehavior[E_GL_ARB_texture_query_lod]            = EBhDisable;
 | 
				
			||||||
    extensionBehavior[E_GL_ARB_vertex_attrib_64bit]          = EBhDisable;
 | 
					    extensionBehavior[E_GL_ARB_vertex_attrib_64bit]          = EBhDisable;
 | 
				
			||||||
 | 
					    extensionBehavior[E_GL_ARB_draw_instanced]               = EBhDisable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    extensionBehavior[E_GL_KHR_shader_subgroup_basic]            = EBhDisable;
 | 
					    extensionBehavior[E_GL_KHR_shader_subgroup_basic]            = EBhDisable;
 | 
				
			||||||
    extensionBehavior[E_GL_KHR_shader_subgroup_vote]             = EBhDisable;
 | 
					    extensionBehavior[E_GL_KHR_shader_subgroup_vote]             = EBhDisable;
 | 
				
			||||||
@ -465,6 +466,7 @@ void TParseVersions::getPreamble(std::string& preamble)
 | 
				
			|||||||
            "#define GL_ARB_shader_storage_buffer_object 1\n"
 | 
					            "#define GL_ARB_shader_storage_buffer_object 1\n"
 | 
				
			||||||
            "#define GL_ARB_texture_query_lod 1\n"
 | 
					            "#define GL_ARB_texture_query_lod 1\n"
 | 
				
			||||||
            "#define GL_ARB_vertex_attrib_64bit 1\n"
 | 
					            "#define GL_ARB_vertex_attrib_64bit 1\n"
 | 
				
			||||||
 | 
					            "#define GL_ARB_draw_instanced 1\n"
 | 
				
			||||||
            "#define GL_EXT_shader_non_constant_global_initializers 1\n"
 | 
					            "#define GL_EXT_shader_non_constant_global_initializers 1\n"
 | 
				
			||||||
            "#define GL_EXT_shader_image_load_formatted 1\n"
 | 
					            "#define GL_EXT_shader_image_load_formatted 1\n"
 | 
				
			||||||
            "#define GL_EXT_post_depth_coverage 1\n"
 | 
					            "#define GL_EXT_post_depth_coverage 1\n"
 | 
				
			||||||
 | 
				
			|||||||
@ -161,6 +161,7 @@ const char* const E_GL_ARB_shader_storage_buffer_object = "GL_ARB_shader_storage
 | 
				
			|||||||
const char* const E_GL_ARB_shading_language_packing     = "GL_ARB_shading_language_packing";
 | 
					const char* const E_GL_ARB_shading_language_packing     = "GL_ARB_shading_language_packing";
 | 
				
			||||||
const char* const E_GL_ARB_texture_query_lod            = "GL_ARB_texture_query_lod";
 | 
					const char* const E_GL_ARB_texture_query_lod            = "GL_ARB_texture_query_lod";
 | 
				
			||||||
const char* const E_GL_ARB_vertex_attrib_64bit          = "GL_ARB_vertex_attrib_64bit";
 | 
					const char* const E_GL_ARB_vertex_attrib_64bit          = "GL_ARB_vertex_attrib_64bit";
 | 
				
			||||||
 | 
					const char* const E_GL_ARB_draw_instanced               = "GL_ARB_draw_instanced";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* const E_GL_KHR_shader_subgroup_basic            = "GL_KHR_shader_subgroup_basic";
 | 
					const char* const E_GL_KHR_shader_subgroup_basic            = "GL_KHR_shader_subgroup_basic";
 | 
				
			||||||
const char* const E_GL_KHR_shader_subgroup_vote             = "GL_KHR_shader_subgroup_vote";
 | 
					const char* const E_GL_KHR_shader_subgroup_vote             = "GL_KHR_shader_subgroup_vote";
 | 
				
			||||||
 | 
				
			|||||||
@ -285,7 +285,8 @@ INSTANTIATE_TEST_SUITE_P(
 | 
				
			|||||||
        "atomicAdd.comp",
 | 
					        "atomicAdd.comp",
 | 
				
			||||||
        "GL_ARB_gpu_shader5.u2i.vert",
 | 
					        "GL_ARB_gpu_shader5.u2i.vert",
 | 
				
			||||||
        "atomicCounterARBOps.vert",
 | 
					        "atomicCounterARBOps.vert",
 | 
				
			||||||
        "GL_EXT_shader_integer_mix.vert"
 | 
					        "GL_EXT_shader_integer_mix.vert",
 | 
				
			||||||
 | 
					        "GL_ARB_draw_instanced.vert",
 | 
				
			||||||
    })),
 | 
					    })),
 | 
				
			||||||
    FileNameAsCustomTestSuffix
 | 
					    FileNameAsCustomTestSuffix
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user