Support the #extension GL_ARB_fragment_coord_conventions.

Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
This commit is contained in:
ZhiqianXia 2021-08-02 13:24:11 +08:00
parent bb5b357550
commit 50a6a51625
5 changed files with 175 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#version 140
#extension GL_ARB_fragment_coord_conventions: require
#extension GL_ARB_explicit_attrib_location : enable
#if !defined GL_ARB_fragment_coord_conventions
# error GL_ARB_fragment_coord_conventions is not defined
#elif GL_ARB_fragment_coord_conventions != 1
# error GL_ARB_fragment_coord_conventions is not equal to 1
#endif
layout (location = 0) in vec4 pos;
out vec4 i;
uniform float gtf_windowWidth;
uniform float gtf_windowHeight;
uniform float n;
uniform float f;
void main()
{
gl_Position = pos;
i = vec4((pos.x+1.0)*0.5*gtf_windowWidth, (pos.y+1.0)*0.5*gtf_windowHeight, (f-n)*0.5*pos.z + (f+n)*0.5, pos.w);
}

View File

@ -0,0 +1,143 @@
GL_ARB_fragment_coord_conventions.vert
Shader version: 140
Requested GL_ARB_explicit_attrib_location
Requested GL_ARB_fragment_coord_conventions
0:? Sequence
0:22 Function Definition: main( ( global void)
0:22 Function Parameters:
0:24 Sequence
0:24 move second child to first child ( temp 4-component vector of float)
0:24 'gl_Position' ( gl_Position 4-component vector of float Position)
0:24 'pos' (layout( location=0) in 4-component vector of float)
0:25 move second child to first child ( temp 4-component vector of float)
0:25 'i' ( smooth out 4-component vector of float)
0:25 Construct vec4 ( temp 4-component vector of float)
0:25 component-wise multiply ( temp float)
0:25 component-wise multiply ( temp float)
0:25 add ( temp float)
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 0 (const int)
0:25 Constant:
0:25 1.000000
0:25 Constant:
0:25 0.500000
0:25 'gtf_windowWidth' ( uniform float)
0:25 component-wise multiply ( temp float)
0:25 component-wise multiply ( temp float)
0:25 add ( temp float)
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 1 (const int)
0:25 Constant:
0:25 1.000000
0:25 Constant:
0:25 0.500000
0:25 'gtf_windowHeight' ( uniform float)
0:25 add ( temp float)
0:25 component-wise multiply ( temp float)
0:25 component-wise multiply ( temp float)
0:25 subtract ( temp float)
0:25 'f' ( uniform float)
0:25 'n' ( uniform float)
0:25 Constant:
0:25 0.500000
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 2 (const int)
0:25 component-wise multiply ( temp float)
0:25 add ( temp float)
0:25 'f' ( uniform float)
0:25 'n' ( uniform float)
0:25 Constant:
0:25 0.500000
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 3 (const int)
0:? Linker Objects
0:? 'pos' (layout( location=0) in 4-component vector of float)
0:? 'i' ( smooth out 4-component vector of float)
0:? 'gtf_windowWidth' ( uniform float)
0:? 'gtf_windowHeight' ( uniform float)
0:? 'n' ( uniform float)
0:? 'f' ( uniform float)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
Linked vertex stage:
Shader version: 140
Requested GL_ARB_explicit_attrib_location
Requested GL_ARB_fragment_coord_conventions
0:? Sequence
0:22 Function Definition: main( ( global void)
0:22 Function Parameters:
0:24 Sequence
0:24 move second child to first child ( temp 4-component vector of float)
0:24 'gl_Position' ( gl_Position 4-component vector of float Position)
0:24 'pos' (layout( location=0) in 4-component vector of float)
0:25 move second child to first child ( temp 4-component vector of float)
0:25 'i' ( smooth out 4-component vector of float)
0:25 Construct vec4 ( temp 4-component vector of float)
0:25 component-wise multiply ( temp float)
0:25 component-wise multiply ( temp float)
0:25 add ( temp float)
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 0 (const int)
0:25 Constant:
0:25 1.000000
0:25 Constant:
0:25 0.500000
0:25 'gtf_windowWidth' ( uniform float)
0:25 component-wise multiply ( temp float)
0:25 component-wise multiply ( temp float)
0:25 add ( temp float)
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 1 (const int)
0:25 Constant:
0:25 1.000000
0:25 Constant:
0:25 0.500000
0:25 'gtf_windowHeight' ( uniform float)
0:25 add ( temp float)
0:25 component-wise multiply ( temp float)
0:25 component-wise multiply ( temp float)
0:25 subtract ( temp float)
0:25 'f' ( uniform float)
0:25 'n' ( uniform float)
0:25 Constant:
0:25 0.500000
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 2 (const int)
0:25 component-wise multiply ( temp float)
0:25 add ( temp float)
0:25 'f' ( uniform float)
0:25 'n' ( uniform float)
0:25 Constant:
0:25 0.500000
0:25 direct index ( temp float)
0:25 'pos' (layout( location=0) in 4-component vector of float)
0:25 Constant:
0:25 3 (const int)
0:? Linker Objects
0:? 'pos' (layout( location=0) in 4-component vector of float)
0:? 'i' ( smooth out 4-component vector of float)
0:? 'gtf_windowWidth' ( uniform float)
0:? 'gtf_windowHeight' ( uniform float)
0:? 'n' ( uniform float)
0:? 'f' ( uniform float)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)

View File

@ -226,6 +226,8 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_texture_query_lod] = EBhDisable;
extensionBehavior[E_GL_ARB_vertex_attrib_64bit] = EBhDisable;
extensionBehavior[E_GL_ARB_draw_instanced] = EBhDisable;
extensionBehavior[E_GL_ARB_fragment_coord_conventions] = EBhDisable;
extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable;
extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable;
@ -467,6 +469,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_texture_query_lod 1\n"
"#define GL_ARB_vertex_attrib_64bit 1\n"
"#define GL_ARB_draw_instanced 1\n"
"#define GL_ARB_fragment_coord_conventions 1\n"
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
"#define GL_EXT_shader_image_load_formatted 1\n"
"#define GL_EXT_post_depth_coverage 1\n"

View File

@ -162,6 +162,7 @@ const char* const E_GL_ARB_shading_language_packing = "GL_ARB_shading_langua
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_draw_instanced = "GL_ARB_draw_instanced";
const char* const E_GL_ARB_fragment_coord_conventions = "GL_ARB_fragment_coord_conventions";
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";

View File

@ -287,6 +287,7 @@ INSTANTIATE_TEST_SUITE_P(
"atomicCounterARBOps.vert",
"GL_EXT_shader_integer_mix.vert",
"GL_ARB_draw_instanced.vert",
"GL_ARB_fragment_coord_conventions.vert"
})),
FileNameAsCustomTestSuffix
);