* order we'd walk the type, so walk the list of storage and find anything
* with our name, or the prefix of a component that starts with our name.
*/
- unsigned params_before = stage_prog_data->nr_params;
+ unsigned params_before = uniforms;
for (unsigned u = 0; u < shader_prog->NumUserUniformStorage; u++) {
struct gl_uniform_storage *storage = &shader_prog->UniformStorage[u];
slots *= storage->array_elements;
for (unsigned i = 0; i < slots; i++) {
- stage_prog_data->param[stage_prog_data->nr_params++] =
- &storage->storage[i].f;
+ stage_prog_data->param[uniforms++] = &storage->storage[i].f;
}
}
/* Make sure we actually initialized the right amount of stuff here. */
- assert(params_before + ir->type->component_slots() ==
- stage_prog_data->nr_params);
+ assert(params_before + ir->type->component_slots() == uniforms);
(void)params_before;
}
break;
last_swiz = swiz;
- stage_prog_data->param[stage_prog_data->nr_params++] =
+ stage_prog_data->param[uniforms++] =
&fp->Base.Parameters->ParameterValues[index][swiz].f;
}
}
void
fs_visitor::assign_curb_setup()
{
- c->prog_data.curb_read_length = ALIGN(stage_prog_data->nr_params, 8) / 8;
if (dispatch_width == 8) {
c->prog_data.first_curbe_grf = c->nr_payload_regs;
+ stage_prog_data->nr_params = uniforms;
} else {
c->prog_data.first_curbe_grf_16 = c->nr_payload_regs;
+ /* Make sure we didn't try to sneak in an extra uniform */
+ assert(uniforms == 0);
}
+ c->prog_data.curb_read_length = ALIGN(stage_prog_data->nr_params, 8) / 8;
+
/* Map the offsets in the UNIFORM file to fixed HW regs. */
foreach_list(node, &this->instructions) {
fs_inst *inst = (fs_inst *)node;
fs_visitor::remove_dead_constants()
{
if (dispatch_width == 8) {
- this->params_remap = ralloc_array(mem_ctx, int, stage_prog_data->nr_params);
- this->nr_params_remap = stage_prog_data->nr_params;
+ this->params_remap = ralloc_array(mem_ctx, int, uniforms);
+ this->nr_params_remap = uniforms;
- for (unsigned int i = 0; i < stage_prog_data->nr_params; i++)
+ for (unsigned int i = 0; i < uniforms; i++)
this->params_remap[i] = -1;
/* Find which params are still in use. */
* "Out-of-bounds reads return undefined values, which include
* values from other variables of the active program or zero."
*/
- if (constant_nr < 0 ||
- constant_nr >= (int)stage_prog_data->nr_params) {
+ if (constant_nr < 0 || constant_nr >= (int)uniforms) {
constant_nr = 0;
}
* now we don't care.
*/
unsigned int new_nr_params = 0;
- for (unsigned int i = 0; i < stage_prog_data->nr_params; i++) {
+ for (unsigned int i = 0; i < uniforms; i++) {
if (this->params_remap[i] != -1) {
this->params_remap[i] = new_nr_params++;
}
}
/* Update the list of params to be uploaded to match our new numbering. */
- for (unsigned int i = 0; i < stage_prog_data->nr_params; i++) {
+ for (unsigned int i = 0; i < uniforms; i++) {
int remapped = this->params_remap[i];
if (remapped == -1)
stage_prog_data->param[remapped] = stage_prog_data->param[i];
}
- stage_prog_data->nr_params = new_nr_params;
+ uniforms = new_nr_params;
} else {
/* This should have been generated in the SIMD8 pass already. */
assert(this->params_remap);
void
fs_visitor::move_uniform_array_access_to_pull_constants()
{
- int pull_constant_loc[stage_prog_data->nr_params];
+ int pull_constant_loc[uniforms];
- for (unsigned int i = 0; i < stage_prog_data->nr_params; i++) {
+ for (unsigned int i = 0; i < uniforms; i++) {
pull_constant_loc[i] = -1;
}
{
/* Only allow 16 registers (128 uniform components) as push constants. */
unsigned int max_uniform_components = 16 * 8;
- if (stage_prog_data->nr_params <= max_uniform_components)
+ if (uniforms <= max_uniform_components)
return;
if (dispatch_width == 16) {
*/
unsigned int pull_uniform_base = max_uniform_components;
- int pull_constant_loc[stage_prog_data->nr_params];
- for (unsigned int i = 0; i < stage_prog_data->nr_params; i++) {
+ int pull_constant_loc[uniforms];
+ for (unsigned int i = 0; i < uniforms; i++) {
if (i < pull_uniform_base) {
pull_constant_loc[i] = -1;
} else {
}
}
}
- stage_prog_data->nr_params = pull_uniform_base;
+ uniforms = pull_uniform_base;
foreach_list(node, &this->instructions) {
fs_inst *inst = (fs_inst *)node;
fs_visitor::run()
{
sanity_param_count = fp->Base.Parameters->NumParameters;
- uint32_t orig_nr_params = stage_prog_data->nr_params;
bool allocated_without_spills;
assign_binding_table_offsets();
if (!allocated_without_spills)
schedule_instructions(SCHEDULE_POST);
- if (dispatch_width == 8) {
+ if (dispatch_width == 8)
c->prog_data.reg_blocks = brw_register_blocks(grf_used);
- } else {
+ else
c->prog_data.reg_blocks_16 = brw_register_blocks(grf_used);
- /* Make sure we didn't try to sneak in an extra uniform */
- assert(orig_nr_params == stage_prog_data->nr_params);
- (void) orig_nr_params;
- }
-
/* If any state parameters were appended, then ParameterValues could have
* been realloced, in which case the driver uniform storage set up by
* _mesa_associate_uniform_storage() would point to freed memory. Make
}
}
} else if (ir->data.mode == ir_var_uniform) {
- int param_index = stage_prog_data->nr_params;
+ int param_index = uniforms;
/* Thanks to the lower_ubo_reference pass, we will see only
* ir_binop_ubo_load expressions and not ir_dereference_variable for UBO
return coordinate;
}
- scale_x = fs_reg(UNIFORM, stage_prog_data->nr_params);
- scale_y = fs_reg(UNIFORM, stage_prog_data->nr_params + 1);
+ scale_x = fs_reg(UNIFORM, uniforms);
+ scale_y = fs_reg(UNIFORM, uniforms + 1);
GLuint index = _mesa_add_state_reference(params,
(gl_state_index *)tokens);
- stage_prog_data->param[stage_prog_data->nr_params++] =
+ stage_prog_data->param[uniforms++] =
&prog->Parameters->ParameterValues[index][0].f;
- stage_prog_data->param[stage_prog_data->nr_params++] =
+ stage_prog_data->param[uniforms++] =
&prog->Parameters->ParameterValues[index][1].f;
}
this->live_intervals = NULL;
this->regs_live_at_ip = NULL;
+ this->uniforms = 0;
this->params_remap = NULL;
this->nr_params_remap = 0;