diff options
author | Connor Abbott <[email protected]> | 2020-06-16 14:02:24 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-17 13:13:05 +0000 |
commit | 6f2981176d96984288e1df57b84140096057eadb (patch) | |
tree | 6ad35a744a19927e0b291a0a7942c20918606f84 | |
parent | 89c8393a1632720ed0dec82cb9529c5c487fb86d (diff) |
ir3: Pass reserved_user_consts to ir3_shader_from_nir()
ir3_shader_from_nir() calls ir3_optimize_nir(), which currently sets up
the const state. However, we need to know the number of user consts
reserved by the driver before setting up the const state, which means
that this information needs to be passed into ir3_shader_from_nir()
somehow rather than being set in the shader.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5500>
-rw-r--r-- | src/freedreno/ir3/ir3_shader.c | 3 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_shader.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_gallium.c | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index ddb2c997baf..c0f33263e88 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -335,7 +335,7 @@ ir3_setup_used_key(struct ir3_shader *shader) struct ir3_shader * ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir, - struct ir3_stream_output_info *stream_output) + unsigned reserved_user_consts, struct ir3_stream_output_info *stream_output) { struct ir3_shader *shader = CALLOC_STRUCT(ir3_shader); @@ -345,6 +345,7 @@ ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir, shader->type = nir->info.stage; if (stream_output) memcpy(&shader->stream_output, stream_output, sizeof(shader->stream_output)); + shader->const_state.num_reserved_user_consts = reserved_user_consts; if (nir->info.stage == MESA_SHADER_GEOMETRY) NIR_PASS_V(nir, ir3_nir_lower_gs); diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index 9fc175595ba..2fe79ea7a0f 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -646,7 +646,7 @@ void * ir3_shader_assemble(struct ir3_shader_variant *v, uint32_t gpu_id); struct ir3_shader_variant * ir3_shader_get_variant(struct ir3_shader *shader, struct ir3_shader_key *key, bool binning_pass, bool *created); struct ir3_shader * ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir, - struct ir3_stream_output_info *stream_output); + unsigned reserved_user_consts, struct ir3_stream_output_info *stream_output); void ir3_shader_destroy(struct ir3_shader *shader); void ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out); uint64_t ir3_shader_outputs(const struct ir3_shader *so); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index 5544e0e50c7..cc986f3dc4e 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -168,7 +168,7 @@ ir3_shader_create(struct ir3_compiler *compiler, struct ir3_stream_output_info stream_output; copy_stream_out(&stream_output, &cso->stream_output); - struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, &stream_output); + struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, 0, &stream_output); /* Compile standard variants immediately to try to avoid draw-time stalls * to run the compiler. @@ -234,7 +234,7 @@ ir3_shader_create_compute(struct ir3_compiler *compiler, nir = tgsi_to_nir(cso->prog, screen, false); } - struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, NULL); + struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, 0, NULL); /* Immediately compile a standard variant. We have so few variants in our * shaders, that doing so almost eliminates draw-time recompiles. (This |