From 61872b52408d2731715d53c6dc71498bb0cc95ee Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Tue, 28 Dec 2021 13:45:26 -0800 Subject: [PATCH] microsoft/compiler: Emit GL images in descriptor space 1 with driver_location instead of binding Reviewed-by: Sil Vilerino Part-of: --- src/microsoft/compiler/nir_to_dxil.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 81c84b600c9..65ef019a32a 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -976,8 +976,19 @@ emit_uav(struct ntd_context *ctx, unsigned binding, unsigned space, unsigned cou static bool emit_uav_var(struct ntd_context *ctx, nir_variable *var, unsigned count) { - unsigned binding = var->data.binding; - unsigned space = var->data.descriptor_set; + unsigned binding, space; + if (ctx->opts->environment == DXIL_ENVIRONMENT_GL) { + /* For GL, the image intrinsics are already lowered, using driver_location + * as the 0-based image index. Use space 1 so that we can keep using these + * NIR constants without having to remap them, and so they don't overlap + * SSBOs, which are also 0-based UAV bindings. + */ + binding = var->data.driver_location; + space = 1; + } else { + binding = var->data.binding; + space = var->data.descriptor_set; + } enum dxil_component_type comp_type = dxil_get_comp_type(var->type); enum dxil_resource_kind res_kind = dxil_get_resource_kind(var->type); const char *name = var->name;