iris: only bother with params if there are any...
This commit is contained in:
parent
2186d83185
commit
80c856cbee
|
@ -470,23 +470,27 @@ iris_setup_uniforms(const struct brw_compiler *compiler,
|
|||
}
|
||||
}
|
||||
|
||||
nir_foreach_block(block, impl) {
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
if (prog_data->nr_params > 0) {
|
||||
nir_foreach_block(block, impl) {
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
|
||||
nir_intrinsic_instr *load = nir_instr_as_intrinsic(instr);
|
||||
nir_intrinsic_instr *load = nir_instr_as_intrinsic(instr);
|
||||
|
||||
if (load->intrinsic != nir_intrinsic_load_ubo)
|
||||
continue;
|
||||
if (load->intrinsic != nir_intrinsic_load_ubo)
|
||||
continue;
|
||||
|
||||
if (load->src[0].ssa == temp_ubo_name) {
|
||||
load->src[0] = nir_src_for_ssa(nir_imm_int(&b, 0));
|
||||
} else if (nir_src_as_uint(load->src[0]) == 0) {
|
||||
nir_ssa_def *offset =
|
||||
nir_iadd(&b, load->src[1].ssa,
|
||||
nir_imm_int(&b, prog_data->nr_params));
|
||||
load->src[1] = nir_src_for_ssa(offset);
|
||||
b.cursor = nir_before_instr(instr);
|
||||
|
||||
if (load->src[0].ssa == temp_ubo_name) {
|
||||
load->src[0] = nir_src_for_ssa(nir_imm_int(&b, 0));
|
||||
} else if (nir_src_as_uint(load->src[0]) == 0) {
|
||||
nir_ssa_def *offset =
|
||||
nir_iadd(&b, load->src[1].ssa,
|
||||
nir_imm_int(&b, prog_data->nr_params));
|
||||
load->src[1] = nir_src_for_ssa(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2168,8 +2168,11 @@ upload_uniforms(struct iris_context *ice,
|
|||
struct iris_compiled_shader *shader = ice->shaders.prog[stage];
|
||||
struct brw_stage_prog_data *prog_data = (void *) shader->prog_data;
|
||||
|
||||
unsigned upload_size = prog_data->nr_params * sizeof(uint32_t);
|
||||
assert(upload_size >= shs->cbuf0.buffer_size);
|
||||
unsigned upload_size = prog_data->nr_params * sizeof(uint32_t) +
|
||||
shs->cbuf0.buffer_size;
|
||||
|
||||
if (upload_size == 0)
|
||||
return;
|
||||
|
||||
uint32_t *map =
|
||||
upload_state(ice->ctx.const_uploader, &cbuf->data, upload_size, 64);
|
||||
|
@ -2178,29 +2181,16 @@ upload_uniforms(struct iris_context *ice,
|
|||
uint32_t param = prog_data->param[i];
|
||||
uint32_t value = 0;
|
||||
|
||||
switch (IRIS_PARAM_DOMAIN(param)) {
|
||||
case IRIS_PARAM_DOMAIN_BUILTIN:
|
||||
assert(!"not used yet");
|
||||
break;
|
||||
case IRIS_PARAM_DOMAIN_UNIFORM:
|
||||
if (shs->cbuf0.user_buffer) {
|
||||
const uint32_t *src = shs->cbuf0.user_buffer;
|
||||
|
||||
value = src[IRIS_PARAM_VALUE(param)];
|
||||
}
|
||||
break;
|
||||
}
|
||||
printf("got a param to upload - %u\n", param);
|
||||
|
||||
*map++ = value;
|
||||
}
|
||||
|
||||
if (shs->cbuf0.user_buffer) {
|
||||
u_upload_data(ice->ctx.const_uploader, 0, shs->cbuf0.buffer_size, 32,
|
||||
shs->cbuf0.user_buffer, &cbuf->data.offset,
|
||||
&cbuf->data.res);
|
||||
|
||||
upload_ubo_surf_state(ice, cbuf, shs->cbuf0.buffer_size);
|
||||
memcpy(map, shs->cbuf0.user_buffer, shs->cbuf0.buffer_size);
|
||||
}
|
||||
|
||||
upload_ubo_surf_state(ice, cbuf, upload_size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue