Unblock unsized error from assert

Fix issue #2846.
This commit is contained in:
Jeremy Hayes 2021-12-23 14:53:44 -07:00
parent ca13951205
commit 95e15366e7
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()) {
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);
if (type.isUnsizedArray())
error(loc, "unsized array", "xfb_offset", "in buffer %d", 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

@ -235,6 +235,7 @@ INSTANTIATE_TEST_SUITE_P(
"findFunction.frag",
"constantUnaryConversion.comp",
"xfbUnsizedArray.error.vert",
"xfbUnsizedArray.error.tese",
"glsl.140.layoutOffset.error.vert",
"glsl.430.layoutOffset.error.vert",
"glsl.450.subgroup.frag",