diff --git a/Test/baseResults/link.tesselation.tese.out b/Test/baseResults/link.tesselation.tese.out new file mode 100644 index 000000000..056459f5d --- /dev/null +++ b/Test/baseResults/link.tesselation.tese.out @@ -0,0 +1,254 @@ +link.tesselation.tese +Shader version: 440 +input primitive = triangles +vertex spacing = fractional_odd_spacing +triangle order = cw +0:? Sequence +0:15 Function Definition: main( ( global void) +0:15 Function Parameters: +0:17 Sequence +0:17 Sequence +0:17 move second child to first child ( temp float) +0:17 'u' ( temp float) +0:17 direct index ( temp float) +0:17 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:17 Constant: +0:17 0 (const int) +0:18 Sequence +0:18 move second child to first child ( temp float) +0:18 'v' ( temp float) +0:18 direct index ( temp float) +0:18 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:18 Constant: +0:18 1 (const int) +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'w' ( temp float) +0:19 direct index ( temp float) +0:19 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:19 Constant: +0:19 2 (const int) +0:21 Sequence +0:21 move second child to first child ( temp 2-component vector of float) +0:21 'newUv' ( temp 2-component vector of float) +0:21 Construct vec2 ( temp 2-component vector of float) +0:21 add ( temp 2-component vector of float) +0:21 add ( temp 2-component vector of float) +0:21 vector-scale ( temp 2-component vector of float) +0:21 'u' ( temp float) +0:21 texCoord: direct index for structure ( in 2-component vector of float) +0:21 direct index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:21 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 0 (const int) +0:21 vector-scale ( temp 2-component vector of float) +0:21 'v' ( temp float) +0:21 texCoord: direct index for structure ( in 2-component vector of float) +0:21 direct index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:21 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 0 (const int) +0:21 vector-scale ( temp 2-component vector of float) +0:21 'w' ( temp float) +0:21 texCoord: direct index for structure ( in 2-component vector of float) +0:21 direct index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:21 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:21 Constant: +0:21 2 (const int) +0:21 Constant: +0:21 0 (const int) +0:22 move second child to first child ( temp 2-component vector of float) +0:22 texCoord: direct index for structure ( out 2-component vector of float) +0:22 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +0:22 Constant: +0:22 0 (const int) +0:22 'newUv' ( temp 2-component vector of float) +0:23 move second child to first child ( temp 4-component vector of float) +0:23 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:23 '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:23 Constant: +0:23 0 (const uint) +0:23 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:23 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_PatchVerticesIn' ( in int PatchVertices) +0:23 Constant: +0:23 0 (const int) +0:? Linker Objects +0:? 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:? 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +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}) + +link.tesselation.tesc +Shader version: 440 +vertices = 3 +0:? Sequence +0:14 Function Definition: main( ( global void) +0:14 Function Parameters: +0:16 Sequence +0:16 move second child to first child ( temp 2-component vector of float) +0:16 texCoord: direct index for structure ( out 2-component vector of float) +0:16 indirect index (layout( location=0) temp block{ out 2-component vector of float texCoord}) +0:16 'OUT' (layout( location=0) out 3-element array of block{ out 2-component vector of float texCoord}) +0:16 'gl_InvocationID' ( in int InvocationID) +0:16 Constant: +0:16 0 (const int) +0:16 texCoord: direct index for structure ( in 2-component vector of float) +0:16 indirect index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:16 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:16 'gl_InvocationID' ( in int InvocationID) +0:16 Constant: +0:16 0 (const int) +0:18 Sequence +0:18 move second child to first child ( temp float) +0:18 'tessLevel' ( temp float) +0:18 Constant: +0:18 10.000000 +0:19 move second child to first child ( temp float) +0:19 indirect index ( patch temp float TessLevelOuter) +0:19 'gl_TessLevelOuter' ( patch out 4-element array of float TessLevelOuter) +0:19 'gl_InvocationID' ( in int InvocationID) +0:19 'tessLevel' ( temp float) +0:20 move second child to first child ( temp float) +0:20 direct index ( patch temp float TessLevelInner) +0:20 'gl_TessLevelInner' ( patch out 2-element array of float TessLevelInner) +0:20 Constant: +0:20 0 (const int) +0:20 'tessLevel' ( temp float) +0:? Linker Objects +0:? 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:? 'OUT' (layout( location=0) out 3-element array of block{ out 2-component vector of float texCoord}) + + +Linked tessellation control stage: + + +Linked tessellation evaluation stage: + + +Shader version: 440 +vertices = 3 +0:? Sequence +0:14 Function Definition: main( ( global void) +0:14 Function Parameters: +0:16 Sequence +0:16 move second child to first child ( temp 2-component vector of float) +0:16 texCoord: direct index for structure ( out 2-component vector of float) +0:16 indirect index (layout( location=0) temp block{ out 2-component vector of float texCoord}) +0:16 'OUT' (layout( location=0) out 3-element array of block{ out 2-component vector of float texCoord}) +0:16 'gl_InvocationID' ( in int InvocationID) +0:16 Constant: +0:16 0 (const int) +0:16 texCoord: direct index for structure ( in 2-component vector of float) +0:16 indirect index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:16 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:16 'gl_InvocationID' ( in int InvocationID) +0:16 Constant: +0:16 0 (const int) +0:18 Sequence +0:18 move second child to first child ( temp float) +0:18 'tessLevel' ( temp float) +0:18 Constant: +0:18 10.000000 +0:19 move second child to first child ( temp float) +0:19 indirect index ( patch temp float TessLevelOuter) +0:19 'gl_TessLevelOuter' ( patch out 4-element array of float TessLevelOuter) +0:19 'gl_InvocationID' ( in int InvocationID) +0:19 'tessLevel' ( temp float) +0:20 move second child to first child ( temp float) +0:20 direct index ( patch temp float TessLevelInner) +0:20 'gl_TessLevelInner' ( patch out 2-element array of float TessLevelInner) +0:20 Constant: +0:20 0 (const int) +0:20 'tessLevel' ( temp float) +0:? Linker Objects +0:? 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:? 'OUT' (layout( location=0) out 3-element array of block{ out 2-component vector of float texCoord}) +Shader version: 440 +input primitive = triangles +vertex spacing = fractional_odd_spacing +triangle order = cw +0:? Sequence +0:15 Function Definition: main( ( global void) +0:15 Function Parameters: +0:17 Sequence +0:17 Sequence +0:17 move second child to first child ( temp float) +0:17 'u' ( temp float) +0:17 direct index ( temp float) +0:17 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:17 Constant: +0:17 0 (const int) +0:18 Sequence +0:18 move second child to first child ( temp float) +0:18 'v' ( temp float) +0:18 direct index ( temp float) +0:18 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:18 Constant: +0:18 1 (const int) +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'w' ( temp float) +0:19 direct index ( temp float) +0:19 'gl_TessCoord' ( in 3-component vector of float TessCoord) +0:19 Constant: +0:19 2 (const int) +0:21 Sequence +0:21 move second child to first child ( temp 2-component vector of float) +0:21 'newUv' ( temp 2-component vector of float) +0:21 Construct vec2 ( temp 2-component vector of float) +0:21 add ( temp 2-component vector of float) +0:21 add ( temp 2-component vector of float) +0:21 vector-scale ( temp 2-component vector of float) +0:21 'u' ( temp float) +0:21 texCoord: direct index for structure ( in 2-component vector of float) +0:21 direct index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:21 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 0 (const int) +0:21 vector-scale ( temp 2-component vector of float) +0:21 'v' ( temp float) +0:21 texCoord: direct index for structure ( in 2-component vector of float) +0:21 direct index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:21 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 0 (const int) +0:21 vector-scale ( temp 2-component vector of float) +0:21 'w' ( temp float) +0:21 texCoord: direct index for structure ( in 2-component vector of float) +0:21 direct index (layout( location=0) temp block{ in 2-component vector of float texCoord}) +0:21 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:21 Constant: +0:21 2 (const int) +0:21 Constant: +0:21 0 (const int) +0:22 move second child to first child ( temp 2-component vector of float) +0:22 texCoord: direct index for structure ( out 2-component vector of float) +0:22 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +0:22 Constant: +0:22 0 (const int) +0:22 'newUv' ( temp 2-component vector of float) +0:23 move second child to first child ( temp 4-component vector of float) +0:23 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:23 '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:23 Constant: +0:23 0 (const uint) +0:23 gl_Position: direct index for structure ( in 4-component vector of float Position) +0:23 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_PatchVerticesIn' ( in int PatchVertices) +0:23 Constant: +0:23 0 (const int) +0:? Linker Objects +0:? 'IN' (layout( location=0) in 32-element array of block{ in 2-component vector of float texCoord}) +0:? 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +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}) + diff --git a/Test/baseResults/link.tesselation.vert.out b/Test/baseResults/link.tesselation.vert.out new file mode 100644 index 000000000..d56c3402a --- /dev/null +++ b/Test/baseResults/link.tesselation.vert.out @@ -0,0 +1,94 @@ +link.tesselation.vert +Shader version: 440 +0:? Sequence +0:11 Function Definition: main( ( global void) +0:11 Function Parameters: +0:13 Sequence +0:13 move second child to first child ( temp 4-component vector of float) +0:13 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:13 '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:13 Constant: +0:13 0 (const uint) +0:13 'i_Pos' (layout( location=0) in 4-component vector of float) +0:14 move second child to first child ( temp 2-component vector of float) +0:14 texCoord: direct index for structure ( out 2-component vector of float) +0:14 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +0:14 Constant: +0:14 0 (const int) +0:14 'i_Tex' (layout( location=1) in 2-component vector of float) +0:? Linker Objects +0:? 'i_Pos' (layout( location=0) in 4-component vector of float) +0:? 'i_Tex' (layout( location=1) in 2-component vector of float) +0:? 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +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) + +link.tesselation.frag +Shader version: 440 +0:? Sequence +0:12 Function Definition: main( ( global void) +0:12 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 'oColor' (layout( location=0) out 4-component vector of float) +0:14 texture ( global 4-component vector of float) +0:14 'mytex' (layout( binding=0) uniform sampler2D) +0:14 texCoord: direct index for structure ( in 2-component vector of float) +0:14 'IN' (layout( location=0) in block{ in 2-component vector of float texCoord}) +0:14 Constant: +0:14 0 (const int) +0:? Linker Objects +0:? 'IN' (layout( location=0) in block{ in 2-component vector of float texCoord}) +0:? 'oColor' (layout( location=0) out 4-component vector of float) +0:? 'mytex' (layout( binding=0) uniform sampler2D) + + +Linked vertex stage: + + +Linked fragment stage: + + +Shader version: 440 +0:? Sequence +0:11 Function Definition: main( ( global void) +0:11 Function Parameters: +0:13 Sequence +0:13 move second child to first child ( temp 4-component vector of float) +0:13 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) +0:13 '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:13 Constant: +0:13 0 (const uint) +0:13 'i_Pos' (layout( location=0) in 4-component vector of float) +0:14 move second child to first child ( temp 2-component vector of float) +0:14 texCoord: direct index for structure ( out 2-component vector of float) +0:14 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +0:14 Constant: +0:14 0 (const int) +0:14 'i_Tex' (layout( location=1) in 2-component vector of float) +0:? Linker Objects +0:? 'i_Pos' (layout( location=0) in 4-component vector of float) +0:? 'i_Tex' (layout( location=1) in 2-component vector of float) +0:? 'OUT' (layout( location=0) out block{ out 2-component vector of float texCoord}) +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) +Shader version: 440 +0:? Sequence +0:12 Function Definition: main( ( global void) +0:12 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 'oColor' (layout( location=0) out 4-component vector of float) +0:14 texture ( global 4-component vector of float) +0:14 'mytex' (layout( binding=0) uniform sampler2D) +0:14 texCoord: direct index for structure ( in 2-component vector of float) +0:14 'IN' (layout( location=0) in block{ in 2-component vector of float texCoord}) +0:14 Constant: +0:14 0 (const int) +0:? Linker Objects +0:? 'IN' (layout( location=0) in block{ in 2-component vector of float texCoord}) +0:? 'oColor' (layout( location=0) out 4-component vector of float) +0:? 'mytex' (layout( binding=0) uniform sampler2D) + diff --git a/Test/link.tesselation.frag b/Test/link.tesselation.frag new file mode 100644 index 000000000..420384db0 --- /dev/null +++ b/Test/link.tesselation.frag @@ -0,0 +1,15 @@ +#version 440 + +layout(location = 0) in Primitive +{ + vec2 texCoord; +} IN; + +layout(location = 0) out vec4 oColor; + +layout(binding = 0) uniform sampler2D mytex; + +void main() +{ + oColor = texture(mytex, IN.texCoord); +} diff --git a/Test/link.tesselation.tesc b/Test/link.tesselation.tesc new file mode 100644 index 000000000..c47d2ad66 --- /dev/null +++ b/Test/link.tesselation.tesc @@ -0,0 +1,21 @@ +#version 440 + +layout(location = 0) in Primitive +{ + vec2 texCoord; +} IN[]; + +layout(location = 0) out Primitive +{ + vec2 texCoord; +} OUT[]; + +layout(vertices = 3) out; +void main() +{ + OUT[gl_InvocationID].texCoord = IN[gl_InvocationID].texCoord; + + float tessLevel = 10.0; + gl_TessLevelOuter[gl_InvocationID] = tessLevel; + gl_TessLevelInner[0] = tessLevel; +} diff --git a/Test/link.tesselation.tese b/Test/link.tesselation.tese new file mode 100644 index 000000000..e11129201 --- /dev/null +++ b/Test/link.tesselation.tese @@ -0,0 +1,26 @@ +#version 440 + +layout(location = 0) in Primitive +{ + vec2 texCoord; +} IN[]; + +layout(location = 0) out Primitive +{ + vec2 texCoord; +} OUT; + +layout(triangles, fractional_odd_spacing) in; +layout(cw) in; +void main() +{ + float u = gl_TessCoord.x; + float v = gl_TessCoord.y; + float w = gl_TessCoord.z; + + vec2 newUv = vec2( u * IN[0].texCoord + v * IN[1].texCoord + w * IN[2].texCoord); + OUT.texCoord = newUv; + gl_Position = gl_in[gl_PatchVerticesIn].gl_Position; +} + + diff --git a/Test/link.tesselation.vert b/Test/link.tesselation.vert new file mode 100644 index 000000000..daf35372f --- /dev/null +++ b/Test/link.tesselation.vert @@ -0,0 +1,16 @@ +#version 440 + +layout(location = 0) in vec4 i_Pos; +layout(location = 1) in vec2 i_Tex; + +layout(location = 0) out Primitive +{ + vec2 texCoord; +} OUT; + +void main() +{ + gl_Position = i_Pos; + OUT.texCoord = i_Tex; +} + diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index 42b416dba..cec94fc81 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -2158,8 +2158,9 @@ int TIntermediate::computeBufferReferenceTypeSize(const TType& type) bool TIntermediate::isIoResizeArray(const TType& type, EShLanguage language) { return type.isArray() && ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) || - (language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && + (language == EShLangTessControl && (type.getQualifier().storage == EvqVaryingIn || type.getQualifier().storage == EvqVaryingOut) && ! type.getQualifier().patch) || + (language == EShLangTessEvaluation && type.getQualifier().storage == EvqVaryingIn) || (language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn && type.getQualifier().pervertexNV) || (language == EShLangMeshNV && type.getQualifier().storage == EvqVaryingOut && diff --git a/gtests/Link.FromFile.cpp b/gtests/Link.FromFile.cpp index 29590c02a..a83d49d91 100644 --- a/gtests/Link.FromFile.cpp +++ b/gtests/Link.FromFile.cpp @@ -106,6 +106,8 @@ INSTANTIATE_TEST_SUITE_P( {"link.multiAnonBlocksValid.0.0.vert", "link.multiAnonBlocksValid.0.1.vert"}, {"link.multiBlocksInvalid.0.0.vert", "link.multiBlocksInvalid.0.1.vert"}, {"link.multiBlocksValid.1.0.vert", "link.multiBlocksValid.1.1.vert"}, + {"link.tesselation.vert", "link.tesselation.frag"}, + {"link.tesselation.tese", "link.tesselation.tesc"}, })) ); // clang-format on