Merge pull request #2847 from jeremy-lunarg/hayes-fix-issue-2846

Unblock unsized error from assert
This commit is contained in:
Greg Fischer 2022-01-05 11:34:32 -07:00 committed by GitHub
commit 17232d21d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 5 deletions

View File

@ -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)

View File

@ -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()
{
}

View File

@ -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

View File

@ -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())

View File

@ -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",