Commit 7b4ed86f authored by Andres Gomez's avatar Andres Gomez

arb_program_interface_query: redefine built-ins with SSOs

From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60
spec:

  " To use any built-in input or output in the gl_PerVertex block in
    separable program objects, shader code must redeclare that block
    prior to use. A separable program will fail to link if:

      * it contains multiple shaders of a single type with different
        redeclarations of this built-in block; or

      * any shader uses a built-in block member not found in the
        redeclaration of that block.

    There is one exception to this rule described below.

    As described above, an exact interface match requires matching
    built-in input and output blocks. At an interface between two
    non-fragment shader stages, the gl_PerVertex input and output
    blocks are considered to match if and only if the block members
    match exactly in name, type, qualification, and declaration order.
    At an interface involving the fragment shader stage, the presence
    or absence of any built-in output does not affect interface
    matching."
Signed-off-by: Andres Gomez's avatarAndres Gomez <agomez@igalia.com>
Reviewed-by: Tapani Pälli's avatarTapani Pälli <tapani.palli@intel.com>
Reviewed-by: default avatarMartin Peres <martin.peres@linux.intel.com>
parent 93fdb8c5
......@@ -74,6 +74,9 @@ static const char vs_std[] =
"uniform vs_struct sa[2];\n"
"in vec4 vs_input0;\n"
"in vec4 vs_input1;\n"
"out gl_PerVertex {\n"
" vec4 gl_Position;\n"
"};\n"
"out vec4 vs_output1;\n"
"void main() {\n"
" gl_Position = vs_input0 * vs_test * vs_input1 + sa[0].a[1] +"
......@@ -88,6 +91,9 @@ const char gs_std[] =
"uniform gs_uniform_block {\n"
" vec4 gs_test;\n"
"};\n"
"in gl_PerVertex {\n"
" vec4 gl_Position;\n"
"} gl_in[];\n"
"in vec4 vs_output1[3];\n"
"out vec4 fs_input1;\n"
"void main() {\n"
......@@ -259,6 +265,9 @@ static const char vs_sub[] =
"#extension GL_ARB_shader_subroutine : require\n"
"in vec4 vs_input0;\n"
"out vec4 vs_output1;\n"
"out gl_PerVertex {\n"
" vec4 gl_Position;\n"
"};\n"
"subroutine vec4 vs_offset();\n"
"subroutine uniform vs_offset VERTEX;\n"
"subroutine (vs_offset) vec4 vss() { return vec4(1, 0, 0, 0); }\n"
......@@ -291,6 +300,9 @@ static const char gs_sub[] =
"subroutine vec4 gs_offset();\n"
"subroutine uniform gs_offset GEOMETRY;\n"
"subroutine (gs_offset) vec4 gss() { return vec4(1, 0, 0, 0); }\n"
"in gl_PerVertex {\n"
" vec4 gl_Position;\n"
"} gl_in[];\n"
"in vec4 vs_output1[3];\n"
"void main() {\n"
" for (int i = 0; i < 6; i++) {\n"
......@@ -318,7 +330,13 @@ static const char tcs_sub[] =
"uniform tcs_uniform_block {\n"
" vec4 tcs_test;\n"
"};\n"
"out gl_PerVertex {\n"
" vec4 gl_Position;\n"
"} gl_out[];\n"
"out vec4 tes_input1[3];\n"
"in gl_PerVertex {\n"
" vec4 gl_Position;\n"
"} gl_in[gl_MaxPatchVertices];\n"
"in vec4 vs_output1[gl_MaxPatchVertices];\n"
"patch out vec4 tcs_patch;\n"
"subroutine vec4 tcs_offset();\n"
......@@ -340,6 +358,9 @@ static const char tes_sub[] =
" vec4 tes_test;\n"
"};\n"
"out vec4 tes_output1;\n"
"in gl_PerVertex {\n"
" vec4 gl_Position;\n"
"} gl_in[gl_MaxPatchVertices];\n"
"in vec4 vs_output1[gl_MaxPatchVertices];\n"
"subroutine vec4 tes_offset();\n"
"subroutine uniform tes_offset TESS_EVALUATION;\n"
......@@ -358,7 +379,13 @@ static const char tes_in[] =
"uniform tes_uniform_block {\n"
" vec4 tes_test;\n"
"};\n"
"out gl_PerVertex {\n"
" vec4 gl_Position;\n"
"};\n"
"out vec4 vs_output1;\n"
"in gl_PerVertex {\n"
" vec4 gl_Position;\n"
"} gl_in[gl_MaxPatchVertices];\n"
"in vec4 tes_input1[gl_MaxPatchVertices];\n"
"subroutine vec4 tes_offset();\n"
"subroutine uniform tes_offset TESS_EVALUATION;\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment