SPV: Implement Vulkan version of GLSL (KHR_vulkan_glsl).
This commit is contained in:
parent
019f08fcd8
commit
6c292d3ba7
200 changed files with 7841 additions and 5577 deletions
|
|
@ -148,6 +148,24 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
|
||||
%token <lex> SAMPLEREXTERNALOES
|
||||
|
||||
// pure sampler
|
||||
%token <lex> SAMPLER SAMPLERSHADOW
|
||||
|
||||
// texture without sampler
|
||||
%token <lex> TEXTURE1D TEXTURE2D TEXTURE3D TEXTURECUBE
|
||||
%token <lex> TEXTURE1DARRAY TEXTURE2DARRAY
|
||||
%token <lex> ITEXTURE1D ITEXTURE2D ITEXTURE3D ITEXTURECUBE
|
||||
%token <lex> ITEXTURE1DARRAY ITEXTURE2DARRAY UTEXTURE1D UTEXTURE2D UTEXTURE3D
|
||||
%token <lex> UTEXTURECUBE UTEXTURE1DARRAY UTEXTURE2DARRAY
|
||||
%token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
|
||||
%token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
|
||||
%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
|
||||
%token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
|
||||
%token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
|
||||
|
||||
// input attachments
|
||||
%token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
|
||||
|
||||
%token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D
|
||||
%token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D
|
||||
%token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT
|
||||
|
|
@ -503,6 +521,7 @@ equality_expression
|
|||
| equality_expression EQ_OP relational_expression {
|
||||
parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
|
||||
parseContext.opaqueCheck($2.loc, $1->getType(), "==");
|
||||
parseContext.specializationCheck($2.loc, $1->getType(), "==");
|
||||
$$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3);
|
||||
if ($$ == 0)
|
||||
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
|
||||
|
|
@ -510,6 +529,7 @@ equality_expression
|
|||
| equality_expression NE_OP relational_expression {
|
||||
parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
|
||||
parseContext.opaqueCheck($2.loc, $1->getType(), "!=");
|
||||
parseContext.specializationCheck($2.loc, $1->getType(), "!=");
|
||||
$$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3);
|
||||
if ($$ == 0)
|
||||
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
|
||||
|
|
@ -597,6 +617,7 @@ assignment_expression
|
|||
| unary_expression assignment_operator assignment_expression {
|
||||
parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment");
|
||||
parseContext.opaqueCheck($2.loc, $1->getType(), "=");
|
||||
parseContext.specializationCheck($2.loc, $1->getType(), "=");
|
||||
parseContext.lValueErrorCheck($2.loc, "assign", $1);
|
||||
parseContext.rValueErrorCheck($2.loc, "assign", $3);
|
||||
$$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc);
|
||||
|
|
@ -1201,11 +1222,13 @@ storage_qualifier
|
|||
$$.qualifier.writeonly = true;
|
||||
}
|
||||
| SUBROUTINE {
|
||||
parseContext.spvRemoved($1.loc, "subroutine");
|
||||
parseContext.globalCheck($1.loc, "subroutine");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqUniform;
|
||||
}
|
||||
| SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN {
|
||||
parseContext.spvRemoved($1.loc, "subroutine");
|
||||
parseContext.globalCheck($1.loc, "subroutine");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqUniform;
|
||||
|
|
@ -1242,11 +1265,11 @@ array_specifier
|
|||
$$.arraySizes = new TArraySizes;
|
||||
$$.arraySizes->addInnerSize();
|
||||
}
|
||||
| LEFT_BRACKET constant_expression RIGHT_BRACKET {
|
||||
| LEFT_BRACKET conditional_expression RIGHT_BRACKET {
|
||||
$$.loc = $1.loc;
|
||||
$$.arraySizes = new TArraySizes;
|
||||
|
||||
int size;
|
||||
TArraySize size;
|
||||
parseContext.arraySizeCheck($2->getLoc(), $2, size);
|
||||
$$.arraySizes->addInnerSize(size);
|
||||
}
|
||||
|
|
@ -1254,10 +1277,10 @@ array_specifier
|
|||
$$ = $1;
|
||||
$$.arraySizes->addInnerSize();
|
||||
}
|
||||
| array_specifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
|
||||
| array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET {
|
||||
$$ = $1;
|
||||
|
||||
int size;
|
||||
TArraySize size;
|
||||
parseContext.arraySizeCheck($3->getLoc(), $3, size);
|
||||
$$.arraySizes->addInnerSize(size);
|
||||
}
|
||||
|
|
@ -1504,6 +1527,7 @@ type_specifier_nonarray
|
|||
$$.setMatrix(4, 4);
|
||||
}
|
||||
| ATOMIC_UINT {
|
||||
parseContext.vulkanRemoved($1.loc, "atomic counter types");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtAtomicUint;
|
||||
}
|
||||
|
|
@ -1707,6 +1731,181 @@ type_specifier_nonarray
|
|||
$$.basicType = EbtSampler;
|
||||
$$.sampler.set(EbtUint, Esd2D, true, false, true);
|
||||
}
|
||||
| SAMPLER {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setPureSampler(false);
|
||||
}
|
||||
| SAMPLERSHADOW {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setPureSampler(true);
|
||||
}
|
||||
| TEXTURE1D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, Esd1D);
|
||||
}
|
||||
| TEXTURE2D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, Esd2D);
|
||||
}
|
||||
| TEXTURE3D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, Esd3D);
|
||||
}
|
||||
| TEXTURECUBE {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, EsdCube);
|
||||
}
|
||||
| TEXTURE1DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, Esd1D, true);
|
||||
}
|
||||
| TEXTURE2DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, Esd2D, true);
|
||||
}
|
||||
| TEXTURECUBEARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, EsdCube, true);
|
||||
}
|
||||
| ITEXTURE1D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, Esd1D);
|
||||
}
|
||||
| ITEXTURE2D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, Esd2D);
|
||||
}
|
||||
| ITEXTURE3D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, Esd3D);
|
||||
}
|
||||
| ITEXTURECUBE {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, EsdCube);
|
||||
}
|
||||
| ITEXTURE1DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, Esd1D, true);
|
||||
}
|
||||
| ITEXTURE2DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, Esd2D, true);
|
||||
}
|
||||
| ITEXTURECUBEARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, EsdCube, true);
|
||||
}
|
||||
| UTEXTURE1D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, Esd1D);
|
||||
}
|
||||
| UTEXTURE2D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, Esd2D);
|
||||
}
|
||||
| UTEXTURE3D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, Esd3D);
|
||||
}
|
||||
| UTEXTURECUBE {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, EsdCube);
|
||||
}
|
||||
| UTEXTURE1DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, Esd1D, true);
|
||||
}
|
||||
| UTEXTURE2DARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, Esd2D, true);
|
||||
}
|
||||
| UTEXTURECUBEARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, EsdCube, true);
|
||||
}
|
||||
| TEXTURE2DRECT {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, EsdRect);
|
||||
}
|
||||
| ITEXTURE2DRECT {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, EsdRect);
|
||||
}
|
||||
| UTEXTURE2DRECT {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, EsdRect);
|
||||
}
|
||||
| TEXTUREBUFFER {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, EsdBuffer);
|
||||
}
|
||||
| ITEXTUREBUFFER {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, EsdBuffer);
|
||||
}
|
||||
| UTEXTUREBUFFER {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, EsdBuffer);
|
||||
}
|
||||
| TEXTURE2DMS {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, Esd2D, false, false, true);
|
||||
}
|
||||
| ITEXTURE2DMS {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, Esd2D, false, false, true);
|
||||
}
|
||||
| UTEXTURE2DMS {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, Esd2D, false, false, true);
|
||||
}
|
||||
| TEXTURE2DMSARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtFloat, Esd2D, true, false, true);
|
||||
}
|
||||
| ITEXTURE2DMSARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtInt, Esd2D, true, false, true);
|
||||
}
|
||||
| UTEXTURE2DMSARRAY {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setTexture(EbtUint, Esd2D, true, false, true);
|
||||
}
|
||||
| IMAGE1D {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
|
|
@ -1878,6 +2077,42 @@ type_specifier_nonarray
|
|||
$$.sampler.set(EbtFloat, Esd2D);
|
||||
$$.sampler.external = true;
|
||||
}
|
||||
| SUBPASSINPUT {
|
||||
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setSubpass(EbtFloat);
|
||||
}
|
||||
| SUBPASSINPUTMS {
|
||||
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setSubpass(EbtFloat, true);
|
||||
}
|
||||
| ISUBPASSINPUT {
|
||||
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setSubpass(EbtInt);
|
||||
}
|
||||
| ISUBPASSINPUTMS {
|
||||
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setSubpass(EbtInt, true);
|
||||
}
|
||||
| USUBPASSINPUT {
|
||||
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setSubpass(EbtUint);
|
||||
}
|
||||
| USUBPASSINPUTMS {
|
||||
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtSampler;
|
||||
$$.sampler.setSubpass(EbtUint, true);
|
||||
}
|
||||
| struct_specifier {
|
||||
$$ = $1;
|
||||
$$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue