diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 38 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 28 |
2 files changed, 30 insertions, 36 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 731a3d7a347..773d4e5ebb3 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -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; - - nir_intrinsic_instr *load = nir_instr_as_intrinsic(instr); - - 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); + 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); + + if (load->intrinsic != nir_intrinsic_load_ubo) + continue; + + 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); + } } } } diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 862cb4853c3..c6e90b979c0 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -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); } /** |