From: Kenneth Graunke Date: Fri, 9 Nov 2018 07:19:53 +0000 (-0800) Subject: iris: add param domain defines X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3e8ff143dd5c629329cb9b9e0875b365be394b3;p=mesa.git iris: add param domain defines --- diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 68d2991ddd6..87757ab0869 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -242,6 +242,15 @@ struct iris_compiled_shader { uint8_t derived_data[0]; }; +enum iris_param_domain { + IRIS_PARAM_DOMAIN_BUILTIN, + IRIS_PARAM_DOMAIN_UNIFORM, +}; + +#define IRIS_PARAM(domain, val) (IRIS_PARAM_DOMAIN_##domain << 24 | (val)) +#define IRIS_PARAM_DOMAIN(param) ((uint32_t)(param) >> 24) +#define IRIS_PARAM_VALUE(param) ((uint32_t)(param) & 0x00ffffff) + /** * Constant buffer (UBO) information. See iris_set_const_buffer(). */ diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 4d75348a06d..862cb4853c3 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2165,6 +2165,34 @@ upload_uniforms(struct iris_context *ice, { struct iris_shader_state *shs = &ice->state.shaders[stage]; struct iris_const_buffer *cbuf = &shs->constbuf[0]; + 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); + + uint32_t *map = + upload_state(ice->ctx.const_uploader, &cbuf->data, upload_size, 64); + + for (int i = 0; i < prog_data->nr_params; i++) { + 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; + } + + *map++ = value; + } if (shs->cbuf0.user_buffer) { u_upload_data(ice->ctx.const_uploader, 0, shs->cbuf0.buffer_size, 32,