Commit 049edfa2 by Martin Radev Committed by Commit Bot

Add volatile, coherent and restrict memory qualifiers

The patch adds support for the three remaining memory qualifiers: volatile, coherent and restrict. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: Ie662d304af2399468df1d976e04c38dada1e2cec Reviewed-on: https://chromium-review.googlesource.com/385876 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 7b8f3c9b
......@@ -511,6 +511,9 @@ enum TQualifier
// GLSL ES 3.1 memory qualifiers
EvqReadOnly,
EvqWriteOnly,
EvqCoherent,
EvqRestrict,
EvqVolatile,
// end of list
EvqLast
......@@ -613,17 +616,28 @@ struct TMemoryQualifier
// imageSize().
bool readonly;
bool writeonly;
bool coherent;
// restrict and volatile are reserved keywords in C/C++
bool restrictQualifier;
bool volatileQualifier;
static TMemoryQualifier create()
{
TMemoryQualifier memoryQualifier;
memoryQualifier.readonly = false;
memoryQualifier.writeonly = false;
memoryQualifier.readonly = false;
memoryQualifier.writeonly = false;
memoryQualifier.coherent = false;
memoryQualifier.restrictQualifier = false;
memoryQualifier.volatileQualifier = false;
return memoryQualifier;
}
bool isEmpty() { return !readonly && !writeonly; }
bool isEmpty()
{
return !readonly && !writeonly && !coherent && !restrictQualifier && !volatileQualifier;
}
};
inline const char *getWorkGroupSizeString(size_t dimension)
......
......@@ -231,6 +231,24 @@ void TOutputGLSLBase::writeVariableType(const TType &type)
out << "writeonly ";
}
if (memoryQualifier.coherent)
{
ASSERT(IsImage(type.getBasicType()));
out << "coherent ";
}
if (memoryQualifier.restrictQualifier)
{
ASSERT(IsImage(type.getBasicType()));
out << "restrict ";
}
if (memoryQualifier.volatileQualifier)
{
ASSERT(IsImage(type.getBasicType()));
out << "volatile ";
}
// Declare the struct if we have not done so already.
if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))
{
......
......@@ -1820,6 +1820,21 @@ bool TParseContext::checkIsMemoryQualifierNotSpecified(const TMemoryQualifier &m
error(location, "Only allowed with images.", "writeonly");
return false;
}
if (memoryQualifier.coherent)
{
error(location, "Only allowed with images.", "coherent");
return false;
}
if (memoryQualifier.restrictQualifier)
{
error(location, "Only allowed with images.", "restrict");
return false;
}
if (memoryQualifier.volatileQualifier)
{
error(location, "Only allowed with images.", "volatile");
return false;
}
return true;
}
......@@ -4211,6 +4226,22 @@ void TParseContext::checkImageMemoryAccessForUserDefinedFunctions(
"Function call discards the 'writeonly' qualifier from image",
arguments[i]->getAsSymbolNode()->getSymbol().c_str());
}
if (functionArgumentMemoryQualifier.coherent &&
!functionParameterMemoryQualifier.coherent)
{
error(functionCall->getLine(),
"Function call discards the 'coherent' qualifier from image",
arguments[i]->getAsSymbolNode()->getSymbol().c_str());
}
if (functionArgumentMemoryQualifier.volatileQualifier &&
!functionParameterMemoryQualifier.volatileQualifier)
{
error(functionCall->getLine(),
"Function call discards the 'volatile' qualifier from image",
arguments[i]->getAsSymbolNode()->getSymbol().c_str());
}
}
}
}
......
......@@ -393,6 +393,18 @@ bool JoinMemoryQualifier(TMemoryQualifier *joinedMemoryQualifier, TQualifier mem
case EvqWriteOnly:
joinedMemoryQualifier->writeonly = true;
break;
case EvqCoherent:
joinedMemoryQualifier->coherent = true;
break;
case EvqRestrict:
joinedMemoryQualifier->restrictQualifier = true;
break;
case EvqVolatile:
// Variables having the volatile qualifier are automatcally treated as coherent as well.
// GLSL ES 3.10, Revision 4, 4.9 Memory Access Qualifiers
joinedMemoryQualifier->volatileQualifier = true;
joinedMemoryQualifier->coherent = true;
break;
default:
UNREACHABLE();
}
......
......@@ -77,6 +77,7 @@ static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
static int ES2_ident_ES3_keyword(TParseContext *context, int token);
static int ES2_ident_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int uint_constant(TParseContext *context);
static int int_constant(TParseContext *context);
static int float_constant(yyscan_t yyscanner);
......@@ -207,10 +208,11 @@ O [0-7]
"imageCube" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGECUBE); }
"readonly" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, READONLY); }
"writeonly" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, WRITEONLY); }
"coherent" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, COHERENT); }
"restrict" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, RESTRICT); }
"volatile" { return ES2_and_ES3_reserved_ES3_1_keyword(context, VOLATILE); }
/* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
"coherent" |
"restrict" |
"resource" |
"atomic_uint" |
"noperspective" |
......@@ -285,7 +287,6 @@ O [0-7]
"inline" |
"noinline" |
"volatile" |
"public" |
"static" |
"extern" |
......@@ -503,6 +504,18 @@ int ES2_ident_ES3_keyword(TParseContext *context, int token)
return token;
}
int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token)
{
yyscan_t yyscanner = (yyscan_t) context->getScanner();
if (context->getShaderVersion() < 310)
{
return reserved_word(yyscanner);
}
return token;
}
int uint_constant(TParseContext *context)
{
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
......@@ -608,4 +621,3 @@ int glslang_scan(size_t count, const char* const string[], const int length[],
return 0;
}
......@@ -169,7 +169,7 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, void *scanner, cons
%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
%token <lex> MATRIX2x3 MATRIX3x2 MATRIX2x4 MATRIX4x2 MATRIX3x4 MATRIX4x3
%token <lex> CENTROID FLAT SMOOTH
%token <lex> READONLY WRITEONLY
%token <lex> READONLY WRITEONLY COHERENT RESTRICT VOLATILE
%token <lex> STRUCT VOID_TYPE WHILE
%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT SAMPLER2DARRAY
%token <lex> ISAMPLER2D ISAMPLER3D ISAMPLERCUBE ISAMPLER2DARRAY
......@@ -950,6 +950,15 @@ storage_qualifier
| WRITEONLY {
$$ = new TMemoryQualifierWrapper(EvqWriteOnly, @1);
}
| COHERENT {
$$ = new TMemoryQualifierWrapper(EvqCoherent, @1);
}
| RESTRICT {
$$ = new TMemoryQualifierWrapper(EvqRestrict, @1);
}
| VOLATILE {
$$ = new TMemoryQualifierWrapper(EvqVolatile, @1);
}
;
type_specifier
......
......@@ -25,96 +25,20 @@
#line 30 "./glslang_lex.cpp"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 1
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 39
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
......@@ -190,27 +114,30 @@ typedef unsigned int flex_uint32_t;
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
/* TODO: this is always defined, so inline it */
#define yyconst const
#if defined(__GNUC__) && __GNUC__ >= 3
#define yynoreturn __attribute__((__noreturn__))
#else
#define yynoreturn
#endif
#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
......@@ -218,34 +145,12 @@ typedef unsigned int flex_uint32_t;
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* An opaque pointer. */
#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void* yyscan_t;
#endif
/* For convenience, these vars (plus the bison vars far below)
are macros in the reentrant scanner. */
#define yyin yyg->yyin_r
......@@ -257,29 +162,12 @@ typedef void* yyscan_t;
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
#define yy_flex_debug yyg->yy_flex_debug_r
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN yyg->yy_start = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
......@@ -287,41 +175,23 @@ typedef void* yyscan_t;
#define YY_START ((yyg->yy_start - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart(yyin ,yyscanner )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
*/
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
......@@ -332,9 +202,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
typedef size_t yy_size_t;
#endif
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
......@@ -344,9 +211,6 @@ typedef size_t yy_size_t;
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
* access to the local variable yy_act. Since yyless() is a macro, it would break
* existing scanners that call yyless() from OUTSIDE yylex.
......@@ -369,9 +233,6 @@ typedef size_t yy_size_t;
--yylineno;\
}while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
......@@ -386,31 +247,26 @@ typedef size_t yy_size_t;
} \
while ( 0 )
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
FILE *yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
int yy_buf_size;
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
......@@ -434,7 +290,6 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
......@@ -459,10 +314,6 @@ struct yy_buffer_state
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
......@@ -473,18 +324,11 @@ struct yy_buffer_state
? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
: NULL)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
void yyrestart (FILE *input_file ,yyscan_t yyscanner );
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
......@@ -493,30 +337,22 @@ void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
void yypop_buffer_state (yyscan_t yyscanner );
static void yyensure_buffer_stack (yyscan_t yyscanner );
static void yy_load_buffer_state (yyscan_t yyscanner );
static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
void *yyalloc (yy_size_t ,yyscan_t yyscanner );
void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
void yyfree (void * ,yyscan_t yyscanner );
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
......@@ -527,8 +363,6 @@ void yyfree (void * ,yyscan_t yyscanner );
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
......@@ -539,50 +373,34 @@ void yyfree (void * ,yyscan_t yyscanner );
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
#define yywrap(yyscanner) (/*CONSTCOND*/1)
#define yywrap(yyscanner) 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
typedef int yy_state_type;
#define yytext_ptr yytext_r
static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
static int yy_get_next_buffer (yyscan_t yyscanner );
static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \
yyleng = (int) (yy_cp - yy_bp); \
yyleng = (size_t) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 240
#define YY_END_OF_BUFFER 241
/* This struct is not used in this scanner,
......@@ -611,7 +429,7 @@ static yyconst flex_int16_t yy_accept[820] =
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 199, 203, 235, 0, 189, 185, 0, 188, 182,
0, 184, 178, 195, 196, 177, 136, 177, 177, 177,
0, 184, 178, 195, 196, 177, 137, 177, 177, 177,
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
13, 177, 177, 177, 177, 177, 177, 177, 177, 177,
......@@ -623,70 +441,70 @@ static yyconst flex_int16_t yy_accept[820] =
177, 177, 177, 177, 177, 177, 177, 177, 0, 186,
0, 185, 187, 181, 177, 177, 177, 30, 177, 177,
18, 174, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 16, 139, 177, 177, 177, 177, 21, 177,
177, 143, 155, 177, 177, 177, 177, 177, 177, 177,
177, 177, 16, 140, 177, 177, 177, 177, 21, 177,
177, 144, 155, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 152, 4, 35, 36, 37,
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 142, 31, 177, 177, 28, 177,
177, 177, 177, 177, 143, 31, 177, 177, 28, 177,
177, 177, 177, 177, 177, 177, 47, 48, 49, 29,
177, 177, 177, 177, 177, 177, 10, 53, 54, 55,
177, 137, 177, 177, 7, 177, 177, 177, 177, 164,
177, 138, 177, 177, 7, 177, 177, 177, 177, 164,
165, 166, 177, 32, 177, 156, 26, 167, 168, 169,
2, 161, 162, 163, 177, 177, 177, 25, 159, 177,
177, 177, 50, 51, 52, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 177, 98, 177, 177, 177,
177, 177, 177, 177, 177, 177, 99, 177, 177, 177,
177, 177, 177, 177, 153, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 177, 138, 177, 177, 176,
56, 57, 58, 177, 177, 14, 177, 103, 177, 177,
177, 177, 101, 177, 177, 177, 154, 149, 104, 177,
177, 177, 177, 177, 177, 144, 177, 177, 177, 78,
177, 177, 177, 177, 177, 177, 139, 177, 177, 176,
56, 57, 58, 177, 177, 14, 177, 104, 177, 177,
177, 177, 102, 177, 177, 177, 154, 149, 105, 177,
177, 177, 177, 177, 177, 145, 177, 177, 177, 78,
38, 41, 43, 42, 39, 45, 44, 46, 40, 177,
177, 177, 177, 160, 135, 177, 177, 147, 177, 177,
177, 34, 99, 173, 22, 148, 77, 177, 158, 17,
177, 177, 177, 160, 136, 177, 177, 147, 177, 177,
177, 34, 100, 173, 22, 148, 77, 177, 158, 17,
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 19, 33, 177, 177, 177, 177,
177, 177, 105, 79, 85, 177, 177, 177, 177, 177,
177, 177, 106, 79, 85, 177, 177, 177, 177, 177,
3, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 140, 177, 177, 177, 177, 177, 8, 177,
177, 177, 141, 177, 177, 177, 177, 177, 8, 177,
177, 9, 177, 177, 177, 177, 20, 93, 11, 150,
106, 80, 87, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 145, 177, 177, 177, 91,
95, 94, 177, 177, 177, 177, 177, 177, 177, 141,
107, 81, 86, 177, 177, 157, 177, 146, 177, 177,
107, 80, 87, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 146, 177, 177, 177, 91,
96, 94, 177, 177, 177, 177, 177, 177, 177, 142,
108, 81, 86, 177, 177, 157, 177, 95, 177, 177,
6, 177, 177, 177, 177, 177, 177, 177, 177, 177,
90, 151, 1, 177, 177, 177, 177, 177, 175, 177,
102, 5, 170, 59, 62, 177, 177, 177, 177, 177,
103, 5, 170, 59, 62, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 177, 177, 177, 92, 177,
177, 177, 177, 88, 177, 177, 177, 177, 177, 120,
177, 177, 177, 88, 177, 177, 177, 177, 177, 121,
66, 67, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 100, 177, 177, 177, 89,
122, 70, 71, 177, 177, 96, 177, 177, 177, 177,
177, 177, 177, 115, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 129, 177, 177, 177, 177, 60,
177, 177, 177, 177, 177, 101, 177, 177, 177, 89,
123, 70, 71, 177, 177, 97, 177, 177, 177, 177,
177, 177, 177, 116, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 130, 177, 177, 177, 177, 60,
177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
177, 177, 116, 108, 177, 82, 177, 177, 177, 130,
177, 177, 117, 109, 177, 82, 177, 177, 177, 131,
177, 177, 68, 177, 177, 177, 177, 177, 177, 177,
177, 177, 177, 177, 177, 177, 117, 177, 177, 131,
177, 177, 72, 109, 83, 177, 111, 177, 112, 177,
177, 177, 177, 177, 97, 177, 177, 177, 177, 64,
177, 63, 126, 177, 177, 110, 84, 177, 177, 177,
177, 177, 177, 177, 177, 177, 177, 124, 127, 118,
177, 177, 177, 177, 177, 177, 118, 177, 177, 132,
177, 177, 72, 110, 83, 177, 112, 177, 113, 177,
177, 177, 177, 177, 98, 177, 177, 177, 177, 64,
177, 63, 127, 177, 177, 111, 84, 177, 177, 177,
177, 177, 177, 177, 177, 177, 177, 125, 128, 119,
177, 65, 177, 177, 177, 177, 177, 177, 177, 177,
125, 128, 177, 177, 121, 69, 177, 177, 171, 177,
177, 177, 74, 177, 177, 123, 73, 177, 177, 177,
177, 177, 177, 132, 177, 177, 177, 177, 177, 177,
126, 129, 177, 177, 122, 69, 177, 177, 171, 177,
177, 177, 74, 177, 177, 124, 73, 177, 177, 177,
177, 177, 177, 133, 177, 177, 177, 177, 177, 177,
133, 177, 177, 177, 75, 177, 134, 113, 114, 177,
177, 177, 61, 177, 177, 172, 119, 76, 0
134, 177, 177, 177, 75, 177, 135, 114, 115, 177,
177, 177, 61, 177, 177, 172, 120, 76, 0
} ;
static yyconst YY_CHAR yy_ec[256] =
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
......@@ -718,7 +536,7 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
static yyconst YY_CHAR yy_meta[73] =
static yyconst flex_int32_t yy_meta[73] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
......@@ -730,7 +548,7 @@ static yyconst YY_CHAR yy_meta[73] =
1, 1
} ;
static yyconst flex_uint16_t yy_base[825] =
static yyconst flex_int16_t yy_base[825] =
{ 0,
0, 0, 72, 0, 1016, 1017, 1017, 1017, 990, 120,
141, 1017, 1017, 989, 138, 1017, 137, 135, 988, 154,
......@@ -920,7 +738,7 @@ static yyconst flex_int16_t yy_def[825] =
819, 819, 819, 819
} ;
static yyconst flex_uint16_t yy_nxt[1090] =
static yyconst flex_int16_t yy_nxt[1090] =
{ 0,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 21, 21, 21, 21,
......@@ -1166,7 +984,6 @@ static yyconst flex_int16_t yy_chk[1090] =
819, 819, 819, 819, 819, 819, 819, 819, 819
} ;
/* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[241] =
{ 0,
......@@ -1242,27 +1059,17 @@ static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
static int ES2_ident_ES3_keyword(TParseContext *context, int token);
static int ES2_ident_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int uint_constant(TParseContext *context);
static int int_constant(TParseContext *context);
static int float_constant(yyscan_t yyscanner);
static int floatsuffix_check(TParseContext* context);
#define INITIAL 0
#define FIELDS 1
#define YY_EXTRA_TYPE TParseContext*
/* Holds the entire state of the reentrant scanner. */
struct yyguts_t
{
......@@ -1276,8 +1083,8 @@ struct yyguts_t
size_t yy_buffer_stack_max; /**< capacity of stack. */
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
char yy_hold_char;
int yy_n_chars;
int yyleng_r;
yy_size_t yy_n_chars;
yy_size_t yyleng_r;
char *yy_c_buf_p;
int yy_init;
int yy_start;
......@@ -1291,132 +1098,69 @@ struct yyguts_t
int yylineno_r;
int yy_flex_debug_r;
char *yytext_r;
int yy_more_flag;
int yy_more_len;
YYSTYPE * yylval_r;
YYLTYPE * yylloc_r;
}; /* end struct yyguts_t */
static int yy_init_globals (yyscan_t yyscanner );
/* This must go here because YYSTYPE and YYLTYPE are included
* from bison output in section 1.*/
# define yylval yyg->yylval_r
# define yylloc yyg->yylloc_r
int yylex_init (yyscan_t* scanner);
int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
int yylex_destroy (yyscan_t yyscanner );
int yyget_debug (yyscan_t yyscanner );
void yyset_debug (int debug_flag ,yyscan_t yyscanner );
YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
FILE *yyget_in (yyscan_t yyscanner );
void yyset_in (FILE * _in_str ,yyscan_t yyscanner );
void yyset_in (FILE * in_str ,yyscan_t yyscanner );
FILE *yyget_out (yyscan_t yyscanner );
void yyset_out (FILE * out_str ,yyscan_t yyscanner );
void yyset_out (FILE * _out_str ,yyscan_t yyscanner );
int yyget_leng (yyscan_t yyscanner );
yy_size_t yyget_leng (yyscan_t yyscanner );
char *yyget_text (yyscan_t yyscanner );
int yyget_lineno (yyscan_t yyscanner );
void yyset_lineno (int _line_number ,yyscan_t yyscanner );
void yyset_lineno (int line_number ,yyscan_t yyscanner );
int yyget_column (yyscan_t yyscanner );
void yyset_column (int _column_no ,yyscan_t yyscanner );
void yyset_column (int column_no ,yyscan_t yyscanner );
YYSTYPE * yyget_lval (yyscan_t yyscanner );
void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
YYLTYPE *yyget_lloc (yyscan_t yyscanner );
void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
......@@ -1429,12 +1173,6 @@ extern int yywrap (yyscan_t yyscanner );
#endif
#endif
#ifndef YY_NO_UNPUT
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
#endif
......@@ -1453,34 +1191,19 @@ static int input (yyscan_t yyscanner );
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
......@@ -1502,7 +1225,7 @@ static int input (yyscan_t yyscanner );
else \
{ \
errno=0; \
while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
{ \
if( errno != EINTR) \
{ \
......@@ -1517,8 +1240,6 @@ static int input (yyscan_t yyscanner );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
......@@ -1527,48 +1248,24 @@ static int input (yyscan_t yyscanner );
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
#endif
/* end tables serialization structures and prototypes */
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
extern int yylex \
(YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
......@@ -1576,7 +1273,6 @@ extern int yylex \
(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
#endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
......@@ -1584,39 +1280,27 @@ extern int yylex \
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK /*LINTED*/break;
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
/** The main scanner function which does all the work.
*/
YY_DECL
{
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylval = yylval_param;
yylloc = yylloc_param;
if ( !yyg->yy_init )
{
yyg->yy_init = 1;
......@@ -1625,8 +1309,6 @@ YY_DECL
YY_USER_INIT;
#endif
if ( ! yyg->yy_start )
yyg->yy_start = 1; /* first start state */
......@@ -1647,13 +1329,9 @@ YY_DECL
{
TParseContext* context = yyextra;
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = yyg->yy_c_buf_p;
......@@ -1669,7 +1347,7 @@ YY_DECL
yy_match:
do
{
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
......@@ -1681,7 +1359,7 @@ yy_match:
if ( yy_current_state >= 820 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_current_state != 819 );
......@@ -1693,7 +1371,6 @@ yy_find_action:
YY_DO_BEFORE_ACTION;
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
{
yy_size_t yyl;
......@@ -1706,10 +1383,8 @@ yy_find_action:
;
}
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
......@@ -2087,10 +1762,19 @@ case 92:
YY_RULE_SETUP
{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, WRITEONLY); }
YY_BREAK
/* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
case 93:
YY_RULE_SETUP
{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, COHERENT); }
YY_BREAK
case 94:
YY_RULE_SETUP
{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, RESTRICT); }
YY_BREAK
case 95:
YY_RULE_SETUP
{ return ES2_and_ES3_reserved_ES3_1_keyword(context, VOLATILE); }
YY_BREAK
/* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
case 96:
case 97:
case 98:
......@@ -2130,6 +1814,7 @@ case 131:
case 132:
case 133:
case 134:
case 135:
YY_RULE_SETUP
{
if (context->getShaderVersion() < 300) {
......@@ -2140,7 +1825,7 @@ YY_RULE_SETUP
}
YY_BREAK
/* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
case 135:
case 136:
YY_RULE_SETUP
{
if (context->getShaderVersion() >= 300)
......@@ -2153,7 +1838,6 @@ YY_RULE_SETUP
}
YY_BREAK
/* Reserved keywords */
case 136:
case 137:
case 138:
case 139:
......@@ -2600,11 +2284,6 @@ ECHO;
} /* end of user's declarations */
} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
......@@ -2615,9 +2294,9 @@ ECHO;
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = yyg->yytext_ptr;
yy_size_t number_to_move, i;
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = yyg->yytext_ptr;
register int number_to_move, i;
int ret_val;
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
......@@ -2646,7 +2325,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
......@@ -2659,8 +2338,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
{
int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - static_cast<int>(number_to_move) - 1;
yy_size_t num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
......@@ -2673,7 +2352,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
yy_size_t new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
......@@ -2686,7 +2365,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = NULL;
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
......@@ -2730,15 +2409,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
int new_size = yyg->yy_n_chars + static_cast<int>(number_to_move) + (yyg->yy_n_chars >> 1);
yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}
yyg->yy_n_chars += static_cast<int>(number_to_move);
yyg->yy_n_chars += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
......@@ -2747,21 +2426,19 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
yy_state_type yy_current_state;
char *yy_cp;
register yy_state_type yy_current_state;
register char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
......@@ -2773,13 +2450,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
if ( yy_current_state >= 820 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
......@@ -2787,11 +2463,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
int yy_is_jam;
register int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
char *yy_cp = yyg->yy_c_buf_p;
register char *yy_cp = yyg->yy_c_buf_p;
YY_CHAR yy_c = 1;
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
......@@ -2803,18 +2479,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
if ( yy_current_state >= 820 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 819);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_UNPUT
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (yyscan_t yyscanner)
......@@ -2840,7 +2511,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
{ /* need more input */
int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
++yyg->yy_c_buf_p;
switch ( yy_get_next_buffer( yyscanner ) )
......@@ -2864,7 +2535,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
case EOB_ACT_END_OF_FILE:
{
if ( yywrap(yyscanner ) )
return 0;
return EOF;
if ( ! yyg->yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
......@@ -2916,7 +2587,6 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yy_load_buffer_state(yyscanner );
}
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
* @param yyscanner The scanner object.
......@@ -2953,7 +2623,6 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yyg->yy_did_buffer_switch_on_eof = 1;
}
static void yy_load_buffer_state (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
......@@ -2977,7 +2646,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = (yy_size_t)size;
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
......@@ -2993,7 +2662,6 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
return b;
}
/** Destroy the buffer.
* @param b a buffer created with yy_create_buffer()
* @param yyscanner The scanner object.
......@@ -3014,7 +2682,6 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
yyfree((void *) b ,yyscanner );
}
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
......@@ -3039,11 +2706,8 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
b->yy_bs_column = 0;
}
b->yy_is_interactive = 0;
errno = oerrno;
}
......@@ -3108,7 +2772,6 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
yyg->yy_did_buffer_switch_on_eof = 1;
}
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
* @param yyscanner The scanner object.
......@@ -3130,13 +2793,12 @@ void yypop_buffer_state (yyscan_t yyscanner)
}
}
/* Allocates the stack if it does not exist.
* Guarantees space for at least one push.
*/
static void yyensure_buffer_stack (yyscan_t yyscanner)
{
int num_to_alloc;
yy_size_t num_to_alloc;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (!yyg->yy_buffer_stack) {
......@@ -3145,14 +2807,13 @@ static void yyensure_buffer_stack (yyscan_t yyscanner)
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
num_to_alloc = 1;
yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
if ( ! yyg->yy_buffer_stack )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
yyg->yy_buffer_stack_max = num_to_alloc;
......@@ -3163,7 +2824,7 @@ static void yyensure_buffer_stack (yyscan_t yyscanner)
if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
/* Increase the buffer to prepare for a possible push. */
yy_size_t grow_size = 8 /* arbitrary grow size */;
int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = static_cast<int>(yyg->yy_buffer_stack_max + grow_size);
yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
......@@ -3179,10 +2840,6 @@ static void yyensure_buffer_stack (yyscan_t yyscanner)
}
}
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
......@@ -3197,7 +2854,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return NULL;
return 0;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
......@@ -3206,7 +2863,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
b->yy_buf_size = static_cast<int>(size) - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = NULL;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
......@@ -3218,9 +2875,6 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
return b;
}
/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
......@@ -3232,12 +2886,9 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
{
return yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
......@@ -3245,7 +2896,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
char *buf;
......@@ -3253,7 +2904,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yysc
yy_size_t i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = (yy_size_t) _yybytes_len + 2;
n = _yybytes_len + 2;
buf = (char *) yyalloc(n ,yyscanner );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
......@@ -3275,25 +2926,13 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yysc
return b;
}
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
(void) fprintf( stderr, "%s\n", msg );
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
......@@ -3314,11 +2953,8 @@ static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
} \
while ( 0 )
/* Accessor methods (get/set functions) to struct members. */
/** Get the user-defined data for this scanner.
* @param yyscanner The scanner object.
*/
......@@ -3328,8 +2964,6 @@ YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
return yyextra;
}
/** Get the current line number.
* @param yyscanner The scanner object.
*/
......@@ -3337,16 +2971,12 @@ int yyget_lineno (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (! YY_CURRENT_BUFFER)
return 0;
return yylineno;
}
/** Get the current column number.
* @param yyscanner The scanner object.
*/
......@@ -3354,16 +2984,12 @@ int yyget_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (! YY_CURRENT_BUFFER)
return 0;
return yycolumn;
}
/** Get the input stream.
* @param yyscanner The scanner object.
*/
......@@ -3373,8 +2999,6 @@ FILE *yyget_in (yyscan_t yyscanner)
return yyin;
}
/** Get the output stream.
* @param yyscanner The scanner object.
*/
......@@ -3384,18 +3008,15 @@ FILE *yyget_out (yyscan_t yyscanner)
return yyout;
}
/** Get the length of the current token.
* @param yyscanner The scanner object.
*/
int yyget_leng (yyscan_t yyscanner)
yy_size_t yyget_leng (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyleng;
}
/** Get the current token.
* @param yyscanner The scanner object.
*/
......@@ -3406,8 +3027,6 @@ char *yyget_text (yyscan_t yyscanner)
return yytext;
}
/** Set the user-defined data. This data is never touched by the scanner.
* @param user_defined The data to be associated with this scanner.
* @param yyscanner The scanner object.
......@@ -3418,123 +3037,92 @@ void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
yyextra = user_defined ;
}
/** Set the current line number.
* @param _line_number line number
* @param line_number
* @param yyscanner The scanner object.
*/
void yyset_lineno (int _line_number , yyscan_t yyscanner)
void yyset_lineno (int line_number , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
yylineno = _line_number;
yylineno = line_number;
}
/** Set the current column.
* @param _column_no column number
* @param line_number
* @param yyscanner The scanner object.
*/
void yyset_column (int _column_no , yyscan_t yyscanner)
void yyset_column (int column_no , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
YY_FATAL_ERROR( "yyset_column called with no buffer" );
yycolumn = _column_no;
yycolumn = column_no;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param _in_str A readable stream.
* @param in_str A readable stream.
* @param yyscanner The scanner object.
* @see yy_switch_to_buffer
*/
void yyset_in (FILE * _in_str , yyscan_t yyscanner)
void yyset_in (FILE * in_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyin = _in_str ;
yyin = in_str ;
}
void yyset_out (FILE * _out_str , yyscan_t yyscanner)
void yyset_out (FILE * out_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyout = _out_str ;
yyout = out_str ;
}
int yyget_debug (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yy_flex_debug;
}
void yyset_debug (int _bdebug , yyscan_t yyscanner)
void yyset_debug (int bdebug , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_flex_debug = _bdebug ;
yy_flex_debug = bdebug ;
}
/* Accessor methods for yylval and yylloc */
YYSTYPE * yyget_lval (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yylval;
}
void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylval = yylval_param;
}
YYLTYPE *yyget_lloc (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yylloc;
}
void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylloc = yylloc_param;
}
/* User-visible API */
/* yylex_init is special because it creates the scanner itself, so it is
......@@ -3563,7 +3151,6 @@ int yylex_init(yyscan_t* ptr_yy_globals)
return yy_init_globals ( *ptr_yy_globals );
}
/* yylex_init_extra has the same functionality as yylex_init, but follows the
* convention of taking the scanner as the last argument. Note however, that
* this is a *pointer* to a scanner, as it will be allocated by this call (and
......@@ -3600,7 +3187,6 @@ int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
return yy_init_globals ( *ptr_yy_globals );
}
static int yy_init_globals (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
......@@ -3608,33 +3194,24 @@ static int yy_init_globals (yyscan_t yyscanner)
* This function is called from yylex_destroy(), so don't allocate here.
*/
yyg->yy_buffer_stack = NULL;
yyg->yy_buffer_stack = 0;
yyg->yy_buffer_stack_top = 0;
yyg->yy_buffer_stack_max = 0;
yyg->yy_c_buf_p = NULL;
yyg->yy_c_buf_p = (char *) 0;
yyg->yy_init = 0;
yyg->yy_start = 0;
yyg->yy_start_stack_ptr = 0;
yyg->yy_start_stack_depth = 0;
yyg->yy_start_stack = NULL;
/* Defined in main.c */
#ifdef YY_STDINIT
yyin = stdin;
yyout = stdout;
#else
yyin = NULL;
yyout = NULL;
yyin = (FILE *) 0;
yyout = (FILE *) 0;
#endif
/* For future reference: Set errno on error, since we are called by
......@@ -3643,7 +3220,6 @@ static int yy_init_globals (yyscan_t yyscanner)
return 0;
}
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy (yyscan_t yyscanner)
{
......@@ -3660,14 +3236,10 @@ int yylex_destroy (yyscan_t yyscanner)
yyfree(yyg->yy_buffer_stack ,yyscanner);
yyg->yy_buffer_stack = NULL;
/* Destroy the start condition stack. */
yyfree(yyg->yy_start_stack ,yyscanner );
yyg->yy_start_stack = NULL;
/* Reset the globals. This is important in a non-reentrant scanner so the next time
* yylex() is called, initialization will occur. */
yy_init_globals( yyscanner);
......@@ -3678,32 +3250,23 @@ int yylex_destroy (yyscan_t yyscanner)
return 0;
}
/*
* Internal utility routines.
*/
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
int i;
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
{
int n;
register int n;
for ( n = 0; s[n]; ++n )
;
......@@ -3711,22 +3274,13 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
}
#endif
void *yyalloc (yy_size_t size , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
return malloc(size);
return (void *) malloc( size );
}
void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
......@@ -3734,29 +3288,16 @@ void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return realloc(ptr, size);
return (void *) realloc( (char *) ptr, size );
}
void yyfree (void * ptr , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
pp::Token token;
yyget_extra(yyscanner)->getPreprocessor().lex(&token);
......@@ -3852,6 +3393,18 @@ int ES2_ident_ES3_keyword(TParseContext *context, int token)
return token;
}
int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token)
{
yyscan_t yyscanner = (yyscan_t) context->getScanner();
if (context->getShaderVersion() < 310)
{
return reserved_word(yyscanner);
}
return token;
}
int uint_constant(TParseContext *context)
{
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
......@@ -3958,4 +3511,3 @@ int glslang_scan(size_t count, const char* const string[], const int length[],
return 0;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -105,92 +105,95 @@ enum yytokentype
SMOOTH = 308,
READONLY = 309,
WRITEONLY = 310,
STRUCT = 311,
VOID_TYPE = 312,
WHILE = 313,
SAMPLER2D = 314,
SAMPLERCUBE = 315,
SAMPLER_EXTERNAL_OES = 316,
SAMPLER2DRECT = 317,
SAMPLER2DARRAY = 318,
ISAMPLER2D = 319,
ISAMPLER3D = 320,
ISAMPLERCUBE = 321,
ISAMPLER2DARRAY = 322,
USAMPLER2D = 323,
USAMPLER3D = 324,
USAMPLERCUBE = 325,
USAMPLER2DARRAY = 326,
SAMPLER3D = 327,
SAMPLER3DRECT = 328,
SAMPLER2DSHADOW = 329,
SAMPLERCUBESHADOW = 330,
SAMPLER2DARRAYSHADOW = 331,
IMAGE2D = 332,
IIMAGE2D = 333,
UIMAGE2D = 334,
IMAGE3D = 335,
IIMAGE3D = 336,
UIMAGE3D = 337,
IMAGE2DARRAY = 338,
IIMAGE2DARRAY = 339,
UIMAGE2DARRAY = 340,
IMAGECUBE = 341,
IIMAGECUBE = 342,
UIMAGECUBE = 343,
LAYOUT = 344,
IDENTIFIER = 345,
TYPE_NAME = 346,
FLOATCONSTANT = 347,
INTCONSTANT = 348,
UINTCONSTANT = 349,
BOOLCONSTANT = 350,
FIELD_SELECTION = 351,
LEFT_OP = 352,
RIGHT_OP = 353,
INC_OP = 354,
DEC_OP = 355,
LE_OP = 356,
GE_OP = 357,
EQ_OP = 358,
NE_OP = 359,
AND_OP = 360,
OR_OP = 361,
XOR_OP = 362,
MUL_ASSIGN = 363,
DIV_ASSIGN = 364,
ADD_ASSIGN = 365,
MOD_ASSIGN = 366,
LEFT_ASSIGN = 367,
RIGHT_ASSIGN = 368,
AND_ASSIGN = 369,
XOR_ASSIGN = 370,
OR_ASSIGN = 371,
SUB_ASSIGN = 372,
LEFT_PAREN = 373,
RIGHT_PAREN = 374,
LEFT_BRACKET = 375,
RIGHT_BRACKET = 376,
LEFT_BRACE = 377,
RIGHT_BRACE = 378,
DOT = 379,
COMMA = 380,
COLON = 381,
EQUAL = 382,
SEMICOLON = 383,
BANG = 384,
DASH = 385,
TILDE = 386,
PLUS = 387,
STAR = 388,
SLASH = 389,
PERCENT = 390,
LEFT_ANGLE = 391,
RIGHT_ANGLE = 392,
VERTICAL_BAR = 393,
CARET = 394,
AMPERSAND = 395,
QUESTION = 396
COHERENT = 311,
RESTRICT = 312,
VOLATILE = 313,
STRUCT = 314,
VOID_TYPE = 315,
WHILE = 316,
SAMPLER2D = 317,
SAMPLERCUBE = 318,
SAMPLER_EXTERNAL_OES = 319,
SAMPLER2DRECT = 320,
SAMPLER2DARRAY = 321,
ISAMPLER2D = 322,
ISAMPLER3D = 323,
ISAMPLERCUBE = 324,
ISAMPLER2DARRAY = 325,
USAMPLER2D = 326,
USAMPLER3D = 327,
USAMPLERCUBE = 328,
USAMPLER2DARRAY = 329,
SAMPLER3D = 330,
SAMPLER3DRECT = 331,
SAMPLER2DSHADOW = 332,
SAMPLERCUBESHADOW = 333,
SAMPLER2DARRAYSHADOW = 334,
IMAGE2D = 335,
IIMAGE2D = 336,
UIMAGE2D = 337,
IMAGE3D = 338,
IIMAGE3D = 339,
UIMAGE3D = 340,
IMAGE2DARRAY = 341,
IIMAGE2DARRAY = 342,
UIMAGE2DARRAY = 343,
IMAGECUBE = 344,
IIMAGECUBE = 345,
UIMAGECUBE = 346,
LAYOUT = 347,
IDENTIFIER = 348,
TYPE_NAME = 349,
FLOATCONSTANT = 350,
INTCONSTANT = 351,
UINTCONSTANT = 352,
BOOLCONSTANT = 353,
FIELD_SELECTION = 354,
LEFT_OP = 355,
RIGHT_OP = 356,
INC_OP = 357,
DEC_OP = 358,
LE_OP = 359,
GE_OP = 360,
EQ_OP = 361,
NE_OP = 362,
AND_OP = 363,
OR_OP = 364,
XOR_OP = 365,
MUL_ASSIGN = 366,
DIV_ASSIGN = 367,
ADD_ASSIGN = 368,
MOD_ASSIGN = 369,
LEFT_ASSIGN = 370,
RIGHT_ASSIGN = 371,
AND_ASSIGN = 372,
XOR_ASSIGN = 373,
OR_ASSIGN = 374,
SUB_ASSIGN = 375,
LEFT_PAREN = 376,
RIGHT_PAREN = 377,
LEFT_BRACKET = 378,
RIGHT_BRACKET = 379,
LEFT_BRACE = 380,
RIGHT_BRACE = 381,
DOT = 382,
COMMA = 383,
COLON = 384,
EQUAL = 385,
SEMICOLON = 386,
BANG = 387,
DASH = 388,
TILDE = 389,
PLUS = 390,
STAR = 391,
SLASH = 392,
PERCENT = 393,
LEFT_ANGLE = 394,
RIGHT_ANGLE = 395,
VERTICAL_BAR = 396,
CARET = 397,
AMPERSAND = 398,
QUESTION = 399
};
#endif
......
......@@ -3076,3 +3076,83 @@ TEST_F(MalformedShaderTest, UnsizedArrayConstructorNoParameters)
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
// Passing an image parameter as an argument to another function should not be able to discard the
// coherent qualifier.
TEST_F(MalformedFragmentShaderGLES31Test, CoherentQualifierMissingInFunctionArgument)
{
const std::string &shaderString =
"#version 310 es\n"
"precision mediump float;\n"
"precision mediump image2D;\n"
"layout(r32f) uniform coherent image2D myImage;\n"
"void myFunc(in image2D someImage) {}\n"
"void main() {\n"
" myFunc(myImage);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
// Passing an image parameter as an argument to another function should not be able to discard the
// volatile qualifier.
TEST_F(MalformedFragmentShaderGLES31Test, VolatileQualifierMissingInFunctionArgument)
{
const std::string &shaderString =
"#version 310 es\n"
"precision mediump float;\n"
"precision mediump image2D;\n"
"layout(r32f) uniform volatile image2D myImage;\n"
"void myFunc(in image2D someImage) {}\n"
"void main() {\n"
" myFunc(myImage);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
// The restrict qualifier can be discarded from a function argument.
// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
TEST_F(MalformedFragmentShaderGLES31Test, RestrictQualifierDiscardedInFunctionArgument)
{
const std::string &shaderString =
"#version 310 es\n"
"precision mediump float;\n"
"precision mediump image2D;\n"
"layout(r32f) uniform restrict image2D myImage;\n"
"void myFunc(in image2D someImage) {}\n"
"void main() {\n"
" myFunc(myImage);\n"
"}\n";
if (!compile(shaderString))
{
FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
}
}
// Function image arguments can be overqualified.
// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
TEST_F(MalformedFragmentShaderGLES31Test, OverqualifyingImageParameter)
{
const std::string &shaderString =
"#version 310 es\n"
"precision mediump float;\n"
"precision mediump image2D;\n"
"layout(r32f) uniform image2D myImage;\n"
"void myFunc(in coherent volatile image2D someImage) {}\n"
"void main() {\n"
" myFunc(myImage);\n"
"}\n";
if (!compile(shaderString))
{
FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
}
}
\ No newline at end of file
......@@ -90,7 +90,10 @@ void CheckImageDeclaration(TIntermNode *astRoot,
TBasicType imageType,
TLayoutImageInternalFormat internalFormat,
bool readonly,
bool writeonly)
bool writeonly,
bool coherent,
bool restrictQualifier,
bool volatileQualifier)
{
const TIntermSymbol *myImageNode = FindSymbolNode(astRoot, imageName, imageType);
ASSERT_NE(nullptr, myImageNode);
......@@ -101,6 +104,9 @@ void CheckImageDeclaration(TIntermNode *astRoot,
TMemoryQualifier myImageMemoryQualifier = myImageType.getMemoryQualifier();
ASSERT_EQ(readonly, myImageMemoryQualifier.readonly);
ASSERT_EQ(writeonly, myImageMemoryQualifier.writeonly);
ASSERT_EQ(coherent, myImageMemoryQualifier.coherent);
ASSERT_EQ(restrictQualifier, myImageMemoryQualifier.restrictQualifier);
ASSERT_EQ(volatileQualifier, myImageMemoryQualifier.volatileQualifier);
}
} // namespace
......@@ -156,7 +162,8 @@ TEST_F(ShaderImageTest, Image2DDeclaration)
}
CheckExportedImageUniform(mTranslator->getUniforms(), 0, GL_IMAGE_2D, "myImage");
CheckImageDeclaration(mASTRoot, "myImage", EbtImage2D, EiifRGBA32F, true, false);
CheckImageDeclaration(mASTRoot, "myImage", EbtImage2D, EiifRGBA32F, true, false, false, false,
false);
}
// Test that an image3D is properly parsed and exported as a uniform.
......@@ -175,7 +182,8 @@ TEST_F(ShaderImageTest, Image3DDeclaration)
}
CheckExportedImageUniform(mTranslator->getUniforms(), 0, GL_UNSIGNED_INT_IMAGE_3D, "myImage");
CheckImageDeclaration(mASTRoot, "myImage", EbtUImage3D, EiifRGBA32UI, true, true);
CheckImageDeclaration(mASTRoot, "myImage", EbtUImage3D, EiifRGBA32UI, true, true, false, false,
false);
}
// Check that imageLoad calls get correctly parsed.
......@@ -225,3 +233,27 @@ TEST_F(ShaderImageTest, ImageStore)
// imageStore call with image2DArray
CheckImageStoreCall(mASTRoot, "imageStore(uim2a1;vi3;vu4;", EbtUImage2DArray, 3, EbtUInt, 4);
}
// Check that memory qualifiers are correctly parsed.
TEST_F(ShaderImageTest, ImageMemoryQualifiers)
{
const std::string &shaderString =
"#version 310 es\n"
"layout(local_size_x = 4) in;"
"layout(rgba32f) uniform highp coherent readonly image2D image1;\n"
"layout(rgba32f) uniform highp volatile writeonly image2D image2;\n"
"layout(rgba32f) uniform highp volatile restrict readonly writeonly image2D image3;\n"
"void main() {\n"
"}";
if (!compile(shaderString))
{
FAIL() << "Shader compilation failed" << mInfoLog;
}
CheckImageDeclaration(mASTRoot, "image1", EbtImage2D, EiifRGBA32F, true, false, true, false,
false);
CheckImageDeclaration(mASTRoot, "image2", EbtImage2D, EiifRGBA32F, false, true, true, false,
true);
CheckImageDeclaration(mASTRoot, "image3", EbtImage2D, EiifRGBA32F, true, true, true, true,
true);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment