GLSL: Fix #1229: merge array sizes in parameter declarations.

This commit is contained in:
John Kessenich 2018-02-02 12:39:47 -07:00
parent 98e733cb58
commit b3f9e0a334
5 changed files with 30 additions and 5 deletions

View File

@ -113,3 +113,9 @@ out float outArray[2][3]; // ERROR
uniform ubaa {
int a;
} ubaaname[2][3]; // ERROR
vec3 func(in mat3[2] x[3])
{
mat3 a0 = x[2][1];
return a0[2];
}

View File

@ -317,6 +317,25 @@ ERROR: node is still EOpNull!
0:99 0 (const int)
0:99 Constant:
0:99 1 (const int)
0:117 Function Definition: func(mf33[3][2]; ( global highp 3-component vector of float)
0:117 Function Parameters:
0:117 'x' ( in 3-element array of 2-element array of highp 3X3 matrix of float)
0:119 Sequence
0:119 Sequence
0:119 move second child to first child ( temp highp 3X3 matrix of float)
0:119 'a0' ( temp highp 3X3 matrix of float)
0:119 direct index ( temp highp 3X3 matrix of float)
0:119 direct index ( temp 2-element array of highp 3X3 matrix of float)
0:119 'x' ( in 3-element array of 2-element array of highp 3X3 matrix of float)
0:119 Constant:
0:119 2 (const int)
0:119 Constant:
0:119 1 (const int)
0:120 Branch: Return with expression
0:120 direct index ( temp highp 3-component vector of float)
0:120 'a0' ( temp highp 3X3 matrix of float)
0:120 Constant:
0:120 2 (const int)
0:? Linker Objects
0:? 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v})
0:? 'uname' (layout( column_major shared) uniform 3-element array of block{layout( column_major shared) uniform highp float u, layout( column_major shared) uniform implicitly-sized array of highp 4-component vector of float v})

View File

@ -3103,7 +3103,7 @@ void TParseContext::arrayDimCheck(const TSourceLoc& loc, const TType* type, cons
//
void TParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes)
{
if (sizes)
if (sizes != nullptr)
type.addArrayOuterSizes(*sizes);
}

View File

@ -902,9 +902,9 @@ parameter_declarator
parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes);
parseContext.reservedErrorCheck($2.loc, *$2.string);
$1.arraySizes = $3.arraySizes;
TParameter param = { $2.string, new TType($1)};
parseContext.arrayDimMerge(*param.type, $3.arraySizes);
$$.loc = $2.loc;
$$.param = param;
}

View File

@ -4433,9 +4433,9 @@ yyreduce:
parseContext.arraySizeRequiredCheck((yyvsp[0].interm).loc, *(yyvsp[0].interm).arraySizes);
parseContext.reservedErrorCheck((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string);
(yyvsp[-2].interm.type).arraySizes = (yyvsp[0].interm).arraySizes;
TParameter param = { (yyvsp[-1].lex).string, new TType((yyvsp[-2].interm.type))};
parseContext.arrayDimMerge(*param.type, (yyvsp[0].interm).arraySizes);
(yyval.interm).loc = (yyvsp[-1].lex).loc;
(yyval.interm).param = param;
}