pull_constant_loc[i / 4] = -1;
if (i >= max_uniform_components) {
- const float **values = &stage_prog_data->param[i];
+ const gl_constant_value **values = &stage_prog_data->param[i];
/* Try to find an existing copy of this uniform in the pull
* constants if it was part of an array access already.
this->uniform_vector_size[this->uniforms] = 1;
stage_prog_data->param =
- reralloc(NULL, stage_prog_data->param, const float *, 4);
+ reralloc(NULL, stage_prog_data->param, const gl_constant_value *, 4);
for (unsigned int i = 0; i < 4; i++) {
unsigned int slot = this->uniforms * 4 + i;
- static float zero = 0.0;
+ static gl_constant_value zero = { .f = 0.0 };
stage_prog_data->param[slot] = &zero;
}
move_push_constants_to_pull_constants();
split_virtual_grfs();
+ const char *stage_name = stage == MESA_SHADER_GEOMETRY ? "gs" : "vs";
+
+#define OPT(pass, args...) do { \
+ pass_num++; \
+ bool this_progress = pass(args); \
+ \
+ if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) { \
+ char filename[64]; \
+ snprintf(filename, 64, "%s-%04d-%02d-%02d-" #pass, \
+ stage_name, shader_prog->Name, iteration, pass_num); \
+ \
+ backend_visitor::dump_instructions(filename); \
+ } \
+ \
+ progress = progress || this_progress; \
+ } while (false)
+
+
+ if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
+ char filename[64];
+ snprintf(filename, 64, "%s-%04d-00-start",
+ stage_name, shader_prog->Name);
+
+ backend_visitor::dump_instructions(filename);
+ }
+
bool progress;
+ int iteration = 0;
do {
progress = false;
- progress = dead_code_eliminate() || progress;
- progress = dead_control_flow_eliminate(this) || progress;
- progress = opt_copy_propagation() || progress;
- progress = opt_algebraic() || progress;
- progress = opt_cse() || progress;
- progress = opt_register_coalesce() || progress;
+ iteration++;
+ int pass_num = 0;
+
+ OPT(dead_code_eliminate);
+ OPT(dead_control_flow_eliminate, this);
+ OPT(opt_copy_propagation);
+ OPT(opt_algebraic);
+ OPT(opt_cse);
+ OPT(opt_register_coalesce);
} while (progress);
}
const unsigned *assembly = NULL;
- if (brw->gen >= 8) {
- gen8_vec4_generator g(brw, prog, &c->vp->program.Base, &prog_data->base,
- mem_ctx, INTEL_DEBUG & DEBUG_VS);
- assembly = g.generate_assembly(&v.instructions, final_assembly_size);
- } else {
- vec4_generator g(brw, prog, &c->vp->program.Base, &prog_data->base,
- mem_ctx, INTEL_DEBUG & DEBUG_VS);
- assembly = g.generate_assembly(&v.instructions, final_assembly_size);
- }
+ vec4_generator g(brw, prog, &c->vp->program.Base, &prog_data->base,
+ mem_ctx, INTEL_DEBUG & DEBUG_VS);
+ assembly = g.generate_assembly(&v.instructions, final_assembly_size);
if (unlikely(brw->perf_debug) && shader) {
if (shader->compiled_once) {