summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2021-04-09 14:39:44 -0700
committerMarge Bot <eric+marge@anholt.net>2021-04-16 17:08:17 +0000
commit15de7122706e08da39582e74785ea34615058d4c (patch)
tree8ecb8a1fc5e5ee5f33ec74870f4d39cd156e0e80
parentdebdc81ccf385f5f75750a5ec0d6c2b31a35dd94 (diff)
microsoft/compiler: Emit CBVs via variables for Vulkan
The resources need to be emitted in a particular order, so CBVs have to be emitted first and can't be emitted as we iterate through instructions. Reviewed-by: Enrico Galli <enrico.galli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10149>
-rw-r--r--src/microsoft/compiler/nir_to_dxil.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index 53467e5d76a..792aa834ea5 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -3209,12 +3209,6 @@ emit_load_vulkan_descriptor(struct ntd_context *ctx, nir_intrinsic_instr *intr)
switch (nir_intrinsic_desc_type(intr)) {
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: {
- if (ctx->cbv_handles[binding])
- break;
- char name[64];
- snprintf(name, sizeof(name), "__ubo%d", binding);
- if (!emit_cbv(ctx, binding, 16384 /*4096 vec4's*/, 1, name))
- return false;
break;
}
default:
@@ -4008,7 +4002,7 @@ prepare_phi_values(struct ntd_context *ctx, nir_shader *shader)
static bool
emit_cbvs(struct ntd_context *ctx, nir_shader *s)
{
- if (s->info.stage == MESA_SHADER_KERNEL) {
+ if (s->info.stage == MESA_SHADER_KERNEL || ctx->opts->vulkan_environment) {
nir_foreach_variable_with_modes(var, s, nir_var_mem_ubo) {
if (!emit_ubo_var(ctx, var))
return false;
@@ -4099,9 +4093,8 @@ emit_module(struct ntd_context *ctx, nir_shader *s, const struct nir_to_dxil_opt
sort_uniforms_by_binding_and_remove_structs(s);
/* CBVs */
- if(!opts->vulkan_environment)
- if (!emit_cbvs(ctx, s))
- return false;
+ if (!emit_cbvs(ctx, s, opts))
+ return false;
/* Samplers */
binding = 0;