Implement extension GL_AMD_gpu_shader_int16
- Add int16 types (int16_t, uint16_t, i16vec, u16vec). - Add int16 support to GLSL operators. - Add int16 type conversions (to int16, from int16). - Add int16 built-in functions.
This commit is contained in:
parent
4d5bcd3162
commit
cabbb788b4
28 changed files with 8560 additions and 5521 deletions
|
|
@ -121,7 +121,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%expect 1 // One shift reduce conflict because of if | else
|
||||
|
||||
%token <lex> ATTRIBUTE VARYING
|
||||
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T FLOAT16_T
|
||||
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T INT16_T UINT16_T FLOAT16_T
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE
|
||||
%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 I64VEC2 I64VEC3 I64VEC4 UVEC2 UVEC3 UVEC4 U64VEC2 U64VEC3 U64VEC4 VEC2 VEC3 VEC4
|
||||
%token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT
|
||||
|
|
@ -129,6 +129,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
|
||||
%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
|
||||
%token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
|
||||
%token <lex> I16VEC2 I16VEC3 I16VEC4 U16VEC2 U16VEC3 U16VEC4
|
||||
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT __EXPLICITINTERPAMD
|
||||
|
||||
%token <lex> MAT2X2 MAT2X3 MAT2X4
|
||||
|
|
@ -188,7 +189,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> STRUCT VOID WHILE
|
||||
|
||||
%token <lex> IDENTIFIER TYPE_NAME
|
||||
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT FLOAT16CONSTANT
|
||||
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT INT16CONSTANT UINT16CONSTANT BOOLCONSTANT FLOAT16CONSTANT
|
||||
%token <lex> LEFT_OP RIGHT_OP
|
||||
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
|
||||
%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
|
||||
|
|
@ -273,6 +274,18 @@ primary_expression
|
|||
parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
|
||||
}
|
||||
| INT16CONSTANT {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true);
|
||||
#endif
|
||||
}
|
||||
| UINT16CONSTANT {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
|
||||
#endif
|
||||
}
|
||||
| FLOATCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
|
||||
}
|
||||
|
|
@ -1363,6 +1376,20 @@ type_specifier_nonarray
|
|||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint64;
|
||||
}
|
||||
| INT16_T {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
#endif
|
||||
}
|
||||
| UINT16_T {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
#endif
|
||||
}
|
||||
| BOOL {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtBool;
|
||||
|
|
@ -1472,6 +1499,30 @@ type_specifier_nonarray
|
|||
$$.basicType = EbtInt64;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| I16VEC2 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
$$.setVector(2);
|
||||
#endif
|
||||
}
|
||||
| I16VEC3 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
$$.setVector(3);
|
||||
#endif
|
||||
}
|
||||
| I16VEC4 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
$$.setVector(4);
|
||||
#endif
|
||||
}
|
||||
| UVEC2 {
|
||||
parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
|
|
@ -1508,6 +1559,30 @@ type_specifier_nonarray
|
|||
$$.basicType = EbtUint64;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| U16VEC2 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
$$.setVector(2);
|
||||
#endif
|
||||
}
|
||||
| U16VEC3 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
$$.setVector(3);
|
||||
#endif
|
||||
}
|
||||
| U16VEC4 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
$$.setVector(4);
|
||||
#endif
|
||||
}
|
||||
| MAT2 {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtFloat;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue