bool progress = false;
bool condition_flags[${len(condition_list)}];
const nir_shader_compiler_options *options = shader->options;
+ const shader_info *info = &shader->info;
(void) options;
+ (void) info;
% for index, condition in enumerate(condition_list):
condition_flags[${index}] = ${condition};
((op, ('bcsel(is_used_once)', a, '#b', c), '#d'), ('bcsel', a, (op, b, d), (op, c, d)))
]
+# For derivatives in compute shaders, GLSL_NV_compute_shader_derivatives
+# states:
+#
+# If neither layout qualifier is specified, derivatives in compute shaders
+# return zero, which is consistent with the handling of built-in texture
+# functions like texture() in GLSL 4.50 compute shaders.
+for op in ['fddx', 'fddx_fine', 'fddx_coarse',
+ 'fddy', 'fddy_fine', 'fddy_coarse']:
+ optimizations += [
+ ((op, 'a'), 0.0, 'info->stage == MESA_SHADER_COMPUTE && info->cs.derivative_group == DERIVATIVE_GROUP_NONE')
+]
+
# This section contains "late" optimizations that should be run before
# creating ffmas and calling regular optimizations for the final time.
# Optimizations should go here if they help code generation and conflict