v110_derivatives_only(const _mesa_glsl_parse_state *state)
{
return !state->es_shader &&
- (state->stage == MESA_SHADER_FRAGMENT ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable));
+ derivatives_only(state);
}
static bool
v130_derivatives_only(const _mesa_glsl_parse_state *state)
{
return state->is_version(130, 300) &&
- (state->stage == MESA_SHADER_FRAGMENT ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable));
+ derivatives_only(state);
}
static bool
v400_derivatives_only(const _mesa_glsl_parse_state *state)
{
return state->is_version(400, 0) &&
- (state->stage == MESA_SHADER_FRAGMENT ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable));
+ derivatives_only(state);
}
static bool
gpu_shader4_derivs_only(const _mesa_glsl_parse_state *state)
{
return state->EXT_gpu_shader4_enable &&
- (state->stage == MESA_SHADER_FRAGMENT ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable));
+ derivatives_only(state);
}
static bool
state->ctx->Extensions.EXT_texture_array));
}
-static bool
-fs_texture_array(const _mesa_glsl_parse_state *state)
-{
- return state->stage == MESA_SHADER_FRAGMENT &&
- (state->EXT_texture_array_enable ||
- (state->EXT_gpu_shader4_enable &&
- state->ctx->Extensions.EXT_texture_array));
-}
-
static bool
texture_array(const _mesa_glsl_parse_state *state)
{
state->ctx->Extensions.EXT_texture_array);
}
+static bool
+texture_array_derivs_only(const _mesa_glsl_parse_state *state)
+{
+ return derivatives_only(state) &&
+ texture_array(state);
+}
+
static bool
texture_multisample(const _mesa_glsl_parse_state *state)
{
derivatives_texture_cube_map_array(const _mesa_glsl_parse_state *state)
{
return state->has_texture_cube_map_array() &&
- (state->stage == MESA_SHADER_FRAGMENT ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable));
+ derivatives_only(state);
}
static bool
static bool
texture_query_lod(const _mesa_glsl_parse_state *state)
{
- return state->stage == MESA_SHADER_FRAGMENT &&
+ return derivatives_only(state) &&
(state->ARB_texture_query_lod_enable ||
state->EXT_texture_query_lod_enable);
}
state->is_version(0, 310));
}
-/* Desktop GL or OES_standard_derivatives + fragment shader only */
+/* Desktop GL or OES_standard_derivatives */
static bool
-fs_oes_derivatives(const _mesa_glsl_parse_state *state)
+derivatives(const _mesa_glsl_parse_state *state)
{
- return state->stage == MESA_SHADER_FRAGMENT &&
+ return derivatives_only(state) &&
(state->is_version(110, 300) ||
state->OES_standard_derivatives_enable ||
state->ctx->Const.AllowGLSLRelaxedES);
}
static bool
-derivatives(const _mesa_glsl_parse_state *state)
-{
- return fs_oes_derivatives(state) ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable);
-}
-
-static bool
-fs_derivative_control(const _mesa_glsl_parse_state *state)
+derivative_control(const _mesa_glsl_parse_state *state)
{
- return state->stage == MESA_SHADER_FRAGMENT &&
+ return derivatives_only(state) &&
(state->is_version(450, 0) ||
state->ARB_derivative_control_enable);
}
-static bool
-derivative_control(const _mesa_glsl_parse_state *state)
-{
- return fs_derivative_control(state) ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable);
-}
-
static bool
tex1d_lod(const _mesa_glsl_parse_state *state)
{
derivatives_tex3d(const _mesa_glsl_parse_state *state)
{
return (!state->es_shader || state->OES_texture_3D_enable) &&
- (state->stage == MESA_SHADER_FRAGMENT ||
- (state->stage == MESA_SHADER_COMPUTE &&
- state->NV_compute_shader_derivatives_enable));
+ derivatives_only(state);
}
static bool
add_function("texture1DArray",
_texture(ir_tex, texture_array, glsl_type::vec4_type, glsl_type::sampler1DArray_type, glsl_type::vec2_type),
- _texture(ir_txb, fs_texture_array, glsl_type::vec4_type, glsl_type::sampler1DArray_type, glsl_type::vec2_type),
+ _texture(ir_txb, texture_array_derivs_only,glsl_type::vec4_type, glsl_type::sampler1DArray_type, glsl_type::vec2_type),
_texture(ir_tex, gpu_shader4_array_integer, glsl_type::ivec4_type, glsl_type::isampler1DArray_type, glsl_type::vec2_type),
_texture(ir_txb, gpu_shader4_array_integer_derivs_only, glsl_type::ivec4_type, glsl_type::isampler1DArray_type, glsl_type::vec2_type),
_texture(ir_tex, gpu_shader4_array_integer, glsl_type::uvec4_type, glsl_type::usampler1DArray_type, glsl_type::vec2_type),
add_function("texture2DArray",
_texture(ir_tex, texture_array, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type),
- _texture(ir_txb, fs_texture_array, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type),
+ _texture(ir_txb, texture_array_derivs_only, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type),
_texture(ir_tex, gpu_shader4_array_integer, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type),
_texture(ir_txb, gpu_shader4_array_integer_derivs_only, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type),
_texture(ir_tex, gpu_shader4_array_integer, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type),
add_function("shadow1DArray",
_texture(ir_tex, texture_array, glsl_type::vec4_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type),
- _texture(ir_txb, fs_texture_array, glsl_type::vec4_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type),
+ _texture(ir_txb, texture_array_derivs_only, glsl_type::vec4_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type),
NULL);
add_function("shadow2D",
add_function("shadow2DArray",
_texture(ir_tex, texture_array, glsl_type::vec4_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type),
- _texture(ir_txb, fs_texture_array, glsl_type::vec4_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type),
+ _texture(ir_txb, texture_array_derivs_only, glsl_type::vec4_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type),
NULL);
add_function("shadow1DProj",
add_function("shadow2DArray",
_texture(ir_tex, texture_array, glsl_type::vec4_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type),
- _texture(ir_txb, fs_texture_array, glsl_type::vec4_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type),
+ _texture(ir_txb, texture_array_derivs_only, glsl_type::vec4_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type),
NULL);
add_function("shadowCube",