Skip to content

Commit

Permalink
Merge pull request KhronosGroup#2847 from jeremy-lunarg/hayes-fix-iss…
Browse files Browse the repository at this point in the history
…ue-2846

Unblock unsized error from assert
  • Loading branch information
greg-lunarg authored Jan 5, 2022
2 parents 3515080 + 95e1536 commit 17232d2
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
35 changes: 35 additions & 0 deletions Test/baseResults/xfbUnsizedArray.error.tese.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
xfbUnsizedArray.error.tese
ERROR: 0:4: 'xfb_offset' : unsized array in buffer 0
ERROR: 1 compilation errors. No code generated.


Shader version: 430
Requested GL_ARB_enhanced_layouts
in xfb mode
input primitive = isolines
vertex spacing = none
triangle order = none
using point mode
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
0:6 Function Parameters:
0:? Linker Objects
0:? 'unsized' (layout( xfb_buffer=0 xfb_offset=0) out unsized 1-element array of 4-component vector of float)


Linked tessellation evaluation stage:


Shader version: 430
Requested GL_ARB_enhanced_layouts
in xfb mode
input primitive = isolines
vertex spacing = equal_spacing
triangle order = ccw
using point mode
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
0:6 Function Parameters:
0:? Linker Objects
0:? 'unsized' (layout( xfb_buffer=0 xfb_offset=0) out 1-element array of 4-component vector of float)

8 changes: 8 additions & 0 deletions Test/xfbUnsizedArray.error.tese
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#version 430 core
#extension GL_ARB_enhanced_layouts : require
layout(isolines, point_mode) in;
layout (xfb_offset = 0) out vec4 unsized[]; // error: unsized array

void main()
{
}
10 changes: 6 additions & 4 deletions glslang/MachineIndependent/ParseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6210,11 +6210,13 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)

#ifndef GLSLANG_WEB
if (qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()) {
int repeated = intermediate.addXfbBufferOffset(type);
if (repeated >= 0)
error(loc, "overlapping offsets at", "xfb_offset", "offset %d in buffer %d", repeated, qualifier.layoutXfbBuffer);
if (type.isUnsizedArray())
if (type.isUnsizedArray()) {
error(loc, "unsized array", "xfb_offset", "in buffer %d", qualifier.layoutXfbBuffer);
} else {
int repeated = intermediate.addXfbBufferOffset(type);
if (repeated >= 0)
error(loc, "overlapping offsets at", "xfb_offset", "offset %d in buffer %d", repeated, qualifier.layoutXfbBuffer);
}

// "The offset must be a multiple of the size of the first component of the first
// qualified variable or block member, or a compile-time error results. Further, if applied to an aggregate
Expand Down
2 changes: 1 addition & 1 deletion glslang/MachineIndependent/linkValidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
return size;
}

int numComponents;
int numComponents {0};
if (type.isScalar())
numComponents = 1;
else if (type.isVector())
Expand Down
1 change: 1 addition & 0 deletions gtests/AST.FromFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ INSTANTIATE_TEST_SUITE_P(
"noMatchingFunction.frag",
"constantUnaryConversion.comp",
"xfbUnsizedArray.error.vert",
"xfbUnsizedArray.error.tese",
"glsl.140.layoutOffset.error.vert",
"glsl.430.layoutOffset.error.vert",
"glsl.450.subgroup.frag",
Expand Down

0 comments on commit 17232d2

Please sign in to comment.