This makes the code a bit easier to read, as well as reduces repetition,
especially when we add support for EXT_shader_implicit_conversions.
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
}
case GLSL_TYPE_UINT:
- if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable
- && !state->MESA_shader_integer_functions_enable)
+ if (!state->has_implicit_uint_to_int_conversion())
return (ir_expression_operation)0;
switch (from->base_type) {
case GLSL_TYPE_INT: return ir_unop_i2u;
return is_version(120, 0);
}
+ bool has_implicit_uint_to_int_conversion() const
+ {
+ return ARB_gpu_shader5_enable ||
+ MESA_shader_integer_functions_enable ||
+ is_version(400, 0);
+ }
+
void process_version_directive(YYLTYPE *locp, int version,
const char *ident);
* state-dependent checks have already happened though, so allow anything
* that's allowed in any shader version.
*/
- if ((!state || state->is_version(400, 0) || state->ARB_gpu_shader5_enable ||
- state->MESA_shader_integer_functions_enable) &&
+ if ((!state || state->has_implicit_uint_to_int_conversion()) &&
desired->base_type == GLSL_TYPE_UINT && this->base_type == GLSL_TYPE_INT)
return true;