glsl/es3.1: Allow interger mix built-ins in GLSL ES 3.10

v2: Add missing lexer support.  Noticed by Tapani.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> [v1]
This commit is contained in:
Ian Romanick
2015-04-28 12:50:51 -07:00
parent dd61475d56
commit ad14f44b3e
5 changed files with 55 additions and 7 deletions

View File

@@ -194,7 +194,8 @@ shader_bit_encoding(const _mesa_glsl_parse_state *state)
static bool
shader_integer_mix(const _mesa_glsl_parse_state *state)
{
return v130(state) && state->EXT_shader_integer_mix_enable;
return state->is_version(450, 310) ||
v130(state) && state->EXT_shader_integer_mix_enable;
}
static bool

View File

@@ -656,16 +656,43 @@ builtin_variable_generator::generate_constants()
if (state->has_atomic_counters()) {
add_const("gl_MaxVertexAtomicCounters",
state->Const.MaxVertexAtomicCounters);
add_const("gl_MaxGeometryAtomicCounters",
state->Const.MaxGeometryAtomicCounters);
add_const("gl_MaxFragmentAtomicCounters",
state->Const.MaxFragmentAtomicCounters);
add_const("gl_MaxCombinedAtomicCounters",
state->Const.MaxCombinedAtomicCounters);
add_const("gl_MaxAtomicCounterBindings",
state->Const.MaxAtomicBufferBindings);
add_const("gl_MaxTessControlAtomicCounters", 0);
add_const("gl_MaxTessEvaluationAtomicCounters", 0);
/* When Mesa adds support for GL_OES_geometry_shader and
* GL_OES_tessellation_shader, this will need to change.
*/
if (!state->es_shader) {
add_const("gl_MaxGeometryAtomicCounters",
state->Const.MaxGeometryAtomicCounters);
add_const("gl_MaxTessControlAtomicCounters", 0);
add_const("gl_MaxTessEvaluationAtomicCounters", 0);
}
}
if (state->is_version(420, 310)) {
add_const("gl_MaxVertexAtomicCounterBuffers",
state->Const.MaxVertexAtomicCounterBuffers);
add_const("gl_MaxFragmentAtomicCounterBuffers",
state->Const.MaxFragmentAtomicCounterBuffers);
add_const("gl_MaxCombinedAtomicCounterBuffers",
state->Const.MaxCombinedAtomicCounterBuffers);
add_const("gl_MaxAtomicCounterBufferSize",
state->Const.MaxAtomicCounterBufferSize);
/* When Mesa adds support for GL_OES_geometry_shader and
* GL_OES_tessellation_shader, this will need to change.
*/
if (!state->es_shader) {
add_const("gl_MaxGeometryAtomicCounterBuffers",
state->Const.MaxGeometryAtomicCounterBuffers);
add_const("gl_MaxTessControlAtomicCounterBuffers", 0);
add_const("gl_MaxTessEvaluationAtomicCounterBuffers", 0);
}
}
if (state->is_version(430, 0) || state->ARB_compute_shader_enable) {

View File

@@ -409,7 +409,7 @@ restrict KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store
readonly KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, READONLY);
writeonly KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, WRITEONLY);
atomic_uint KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_atomic_counters_enable, ATOMIC_UINT);
atomic_uint KEYWORD_WITH_ALT(420, 300, 420, 310, yyextra->ARB_shader_atomic_counters_enable, ATOMIC_UINT);
struct return STRUCT;
void return VOID_TOK;

View File

@@ -117,6 +117,16 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxFragmentAtomicCounters = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters;
this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters;
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
this->Const.MaxVertexAtomicCounterBuffers =
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers;
this->Const.MaxGeometryAtomicCounterBuffers =
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers;
this->Const.MaxFragmentAtomicCounterBuffers =
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers;
this->Const.MaxCombinedAtomicCounterBuffers =
ctx->Const.MaxCombinedAtomicBuffers;
this->Const.MaxAtomicCounterBufferSize =
ctx->Const.MaxAtomicBufferSize;
/* Compute shader constants */
for (unsigned i = 0; i < ARRAY_SIZE(this->Const.MaxComputeWorkGroupCount); i++)

View File

@@ -192,7 +192,7 @@ struct _mesa_glsl_parse_state {
bool has_atomic_counters() const
{
return ARB_shader_atomic_counters_enable || is_version(420, 0);
return ARB_shader_atomic_counters_enable || is_version(420, 310);
}
bool has_explicit_attrib_stream() const
@@ -353,6 +353,16 @@ struct _mesa_glsl_parse_state {
unsigned MaxCombinedAtomicCounters;
unsigned MaxAtomicBufferBindings;
/* These are also atomic counter related, but they weren't added to
* until atomic counters were added to core in GLSL 4.20 and GLSL ES
* 3.10.
*/
unsigned MaxVertexAtomicCounterBuffers;
unsigned MaxGeometryAtomicCounterBuffers;
unsigned MaxFragmentAtomicCounterBuffers;
unsigned MaxCombinedAtomicCounterBuffers;
unsigned MaxAtomicCounterBufferSize;
/* ARB_compute_shader */
unsigned MaxComputeWorkGroupCount[3];
unsigned MaxComputeWorkGroupSize[3];