/* Move the references to the data */
for (int j = 0; j < size; j++) {
- c->prog_data.param[dst * 4 + new_chan[src] + j] =
- c->prog_data.param[src * 4 + j];
+ prog_data->param[dst * 4 + new_chan[src] + j] =
+ prog_data->param[src * 4 + j];
}
this->uniform_vector_size[dst] += size;
prog_data->urb_read_length = (nr_attributes + 1) / 2;
- unsigned vue_entries = MAX2(nr_attributes, c->prog_data.vue_map.num_slots);
+ unsigned vue_entries = MAX2(nr_attributes, prog_data->vue_map.num_slots);
if (intel->gen == 6)
- c->prog_data.urb_entry_size = ALIGN(vue_entries, 8) / 8;
+ prog_data->urb_entry_size = ALIGN(vue_entries, 8) / 8;
else
- c->prog_data.urb_entry_size = ALIGN(vue_entries, 4) / 4;
+ prog_data->urb_entry_size = ALIGN(vue_entries, 4) / 4;
return payload_reg + nr_attributes;
}
for (unsigned int i = 0; i < 4; i++) {
unsigned int slot = this->uniforms * 4 + i;
static float zero = 0.0;
- c->prog_data.param[slot] = &zero;
+ prog_data->param[slot] = &zero;
}
this->uniforms++;
reg += ALIGN(uniforms, 2) / 2;
}
- c->prog_data.nr_params = this->uniforms * 4;
+ prog_data->nr_params = this->uniforms * 4;
- c->prog_data.curb_read_length = reg - 1;
+ prog_data->curb_read_length = reg - 1;
return reg;
}
brw_vs_emit(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_vs_compile *c,
+ struct brw_vs_prog_data *prog_data,
void *mem_ctx,
unsigned *final_assembly_size)
{
}
}
- vec4_visitor v(brw, c, prog, shader, mem_ctx);
+ vec4_visitor v(brw, c, prog_data, prog, shader, mem_ctx);
if (!v.run()) {
prog->LinkStatus = false;
ralloc_strcat(&prog->InfoLog, v.fail_msg);
public:
vec4_visitor(struct brw_context *brw,
struct brw_vs_compile *c,
+ struct brw_vs_prog_data *prog_data,
struct gl_shader_program *shader_prog,
struct brw_shader *shader,
void *mem_ctx);
int i;
for (i = 0; i < uniform_vector_size[uniforms]; i++) {
- c->prog_data.param[uniforms * 4 + i] = &components->f;
+ prog_data->param[uniforms * 4 + i] = &components->f;
components++;
}
for (; i < 4; i++) {
static float zero = 0;
- c->prog_data.param[uniforms * 4 + i] = &zero;
+ prog_data->param[uniforms * 4 + i] = &zero;
}
uniforms++;
this->userplane[compacted_clipplane_index] = dst_reg(UNIFORM, this->uniforms);
this->userplane[compacted_clipplane_index].type = BRW_REGISTER_TYPE_F;
for (int j = 0; j < 4; ++j) {
- c->prog_data.param[this->uniforms * 4 + j] = &clip_planes[i][j];
+ prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
}
++compacted_clipplane_index;
++this->uniforms;
this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
this->userplane[i].type = BRW_REGISTER_TYPE_F;
for (int j = 0; j < 4; ++j) {
- c->prog_data.param[this->uniforms * 4 + j] = &clip_planes[i][j];
+ prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
}
++this->uniforms;
}
int swiz = GET_SWZ(slots[i].swizzle, j);
last_swiz = swiz;
- c->prog_data.param[this->uniforms * 4 + j] = &values[swiz];
+ prog_data->param[this->uniforms * 4 + j] = &values[swiz];
if (swiz <= last_swiz)
this->uniform_vector_size[this->uniforms]++;
}
vec4_visitor::emit_psiz_and_flags(struct brw_reg reg)
{
if (intel->gen < 6 &&
- ((c->prog_data.vue_map.slots_valid & VARYING_BIT_PSIZ) ||
+ ((prog_data->vue_map.slots_valid & VARYING_BIT_PSIZ) ||
c->key.userclip_active || brw->has_negative_rhw_bug)) {
dst_reg header1 = dst_reg(this, glsl_type::uvec4_type);
dst_reg header1_w = header1;
emit(MOV(header1, 0u));
- if (c->prog_data.vue_map.slots_valid & VARYING_BIT_PSIZ) {
+ if (prog_data->vue_map.slots_valid & VARYING_BIT_PSIZ) {
src_reg psiz = src_reg(output_reg[VARYING_SLOT_PSIZ]);
current_annotation = "Point size";
emit(MOV(retype(reg, BRW_REGISTER_TYPE_UD), 0u));
} else {
emit(MOV(retype(reg, BRW_REGISTER_TYPE_D), src_reg(0)));
- if (c->prog_data.vue_map.slots_valid & VARYING_BIT_PSIZ) {
+ if (prog_data->vue_map.slots_valid & VARYING_BIT_PSIZ) {
emit(MOV(brw_writemask(reg, WRITEMASK_W),
src_reg(output_reg[VARYING_SLOT_PSIZ])));
}
* if the user wrote to it; otherwise we use gl_Position.
*/
gl_varying_slot clip_vertex = VARYING_SLOT_CLIP_VERTEX;
- if (!(c->prog_data.vue_map.slots_valid & VARYING_BIT_CLIP_VERTEX)) {
+ if (!(prog_data->vue_map.slots_valid & VARYING_BIT_CLIP_VERTEX)) {
clip_vertex = VARYING_SLOT_POS;
}
/* Set up the VUE data for the first URB write */
int slot;
- for (slot = 0; slot < c->prog_data.vue_map.num_slots; ++slot) {
- emit_urb_slot(mrf++, c->prog_data.vue_map.slot_to_varying[slot]);
+ for (slot = 0; slot < prog_data->vue_map.num_slots; ++slot) {
+ emit_urb_slot(mrf++, prog_data->vue_map.slot_to_varying[slot]);
/* If this was max_usable_mrf, we can't fit anything more into this URB
* WRITE.
}
}
- bool eot = slot >= c->prog_data.vue_map.num_slots;
+ bool eot = slot >= prog_data->vue_map.num_slots;
if (eot) {
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
emit_shader_time_end();
if (!inst->eot) {
mrf = base_mrf + 1;
- for (; slot < c->prog_data.vue_map.num_slots; ++slot) {
+ for (; slot < prog_data->vue_map.num_slots; ++slot) {
assert(mrf < max_usable_mrf);
- emit_urb_slot(mrf++, c->prog_data.vue_map.slot_to_varying[slot]);
+ emit_urb_slot(mrf++, prog_data->vue_map.slot_to_varying[slot]);
}
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
vec4_visitor::vec4_visitor(struct brw_context *brw,
struct brw_vs_compile *c,
+ struct brw_vs_prog_data *prog_data,
struct gl_shader_program *shader_prog,
struct brw_shader *shader,
void *mem_ctx)
this->c = c;
this->prog = &c->vp->program.Base;
- this->prog_data = &c->prog_data;
+ this->prog_data = prog_data;
this->variable_ht = hash_table_ctor(0,
hash_table_pointer_hash,
const struct gl_program_parameter_list *params = c->vp->program.Base.Parameters;
unsigned i;
for (i = 0; i < params->NumParameters * 4; i++) {
- c->prog_data.pull_param[i] = ¶ms->ParameterValues[i / 4][i % 4].f;
+ prog_data->pull_param[i] = ¶ms->ParameterValues[i / 4][i % 4].f;
}
- c->prog_data.nr_pull_params = i;
+ prog_data->nr_pull_params = i;
}
}
this->uniform_size[this->uniforms] = 1; /* 1 vec4 */
this->uniform_vector_size[this->uniforms] = components;
for (unsigned i = 0; i < 4; i++) {
- c->prog_data.param[this->uniforms * 4 + i] = i >= components ? 0 :
+ prog_data->param[this->uniforms * 4 + i] = i >= components ? 0 :
&plist->ParameterValues[p][i].f;
}
this->uniforms++; /* counted in vec4 units */
}
/* PROGRAM_OUTPUT */
- for (int slot = 0; slot < c->prog_data.vue_map.num_slots; slot++) {
- int varying = c->prog_data.vue_map.slot_to_varying[slot];
+ for (int slot = 0; slot < prog_data->vue_map.num_slots; slot++) {
+ int varying = prog_data->vue_map.slot_to_varying[slot];
if (varying == VARYING_SLOT_PSIZ)
output_reg[varying] = dst_reg(this, glsl_type::float_type);
else
GLuint program_size;
const GLuint *program;
struct brw_vs_compile c;
+ struct brw_vs_prog_data prog_data;
void *mem_ctx;
int i;
struct gl_shader *vs = NULL;
memset(&c, 0, sizeof(c));
memcpy(&c.key, key, sizeof(*key));
+ memset(&prog_data, 0, sizeof(prog_data));
mem_ctx = ralloc_context(NULL);
/* We also upload clip plane data as uniforms */
param_count += MAX_CLIP_PLANES * 4;
- c.prog_data.param = rzalloc_array(NULL, const float *, param_count);
- c.prog_data.pull_param = rzalloc_array(NULL, const float *, param_count);
+ prog_data.param = rzalloc_array(NULL, const float *, param_count);
+ prog_data.pull_param = rzalloc_array(NULL, const float *, param_count);
GLbitfield64 outputs_written = vp->program.Base.OutputsWritten;
- c.prog_data.inputs_read = vp->program.Base.InputsRead;
+ prog_data.inputs_read = vp->program.Base.InputsRead;
if (c.key.copy_edgeflag) {
outputs_written |= BITFIELD64_BIT(VARYING_SLOT_EDGE);
- c.prog_data.inputs_read |= VERT_BIT_EDGEFLAG;
+ prog_data.inputs_read |= VERT_BIT_EDGEFLAG;
}
if (intel->gen < 6) {
}
}
- brw_compute_vue_map(brw, &c.prog_data.vue_map, outputs_written,
+ brw_compute_vue_map(brw, &prog_data.vue_map, outputs_written,
c.key.userclip_active);
if (0) {
/* Emit GEN4 code.
*/
- program = brw_vs_emit(brw, prog, &c, mem_ctx, &program_size);
+ program = brw_vs_emit(brw, prog, &c, &prog_data, mem_ctx, &program_size);
if (program == NULL) {
ralloc_free(mem_ctx);
return false;
}
- if (c.prog_data.nr_pull_params)
- c.prog_data.num_surfaces = 1;
+ if (prog_data.nr_pull_params)
+ prog_data.num_surfaces = 1;
if (c.vp->program.Base.SamplersUsed)
- c.prog_data.num_surfaces = SURF_INDEX_VS_TEXTURE(BRW_MAX_TEX_UNIT);
+ prog_data.num_surfaces = SURF_INDEX_VS_TEXTURE(BRW_MAX_TEX_UNIT);
if (prog &&
prog->_LinkedShaders[MESA_SHADER_VERTEX]->NumUniformBlocks) {
- c.prog_data.num_surfaces =
+ prog_data.num_surfaces =
SURF_INDEX_VS_UBO(prog->_LinkedShaders[MESA_SHADER_VERTEX]->NumUniformBlocks);
}
"Try reducing the number of live vec4 values to "
"improve performance.\n");
- c.prog_data.total_scratch = brw_get_scratch_size(c.last_scratch*REG_SIZE);
+ prog_data.total_scratch = brw_get_scratch_size(c.last_scratch*REG_SIZE);
brw_get_scratch_bo(intel, &brw->vs.scratch_bo,
- c.prog_data.total_scratch * brw->max_vs_threads);
+ prog_data.total_scratch * brw->max_vs_threads);
}
brw_upload_cache(&brw->cache, BRW_VS_PROG,
&c.key, sizeof(c.key),
program, program_size,
- &c.prog_data, sizeof(c.prog_data),
+ &prog_data, sizeof(prog_data),
&brw->vs.prog_offset, &brw->vs.prog_data);
ralloc_free(mem_ctx);
struct brw_vs_compile {
struct brw_vs_prog_key key;
- struct brw_vs_prog_data prog_data;
struct brw_vertex_program *vp;
const unsigned *brw_vs_emit(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_vs_compile *c,
+ struct brw_vs_prog_data *prog_data,
void *mem_ctx,
unsigned *program_size);
bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog);
shader_prog = ralloc(NULL, struct gl_shader_program);
- v = new vec4_visitor(brw, c, shader_prog, NULL, NULL);
+ v = new vec4_visitor(brw, c, NULL, shader_prog, NULL, NULL);
_mesa_init_vertex_program(ctx, &c->vp->program, GL_VERTEX_SHADER, 0);