From: Emma Anholt Date: Wed, 18 Jan 2023 22:29:55 +0000 (-0800) Subject: zink: Fix up mismatches of memory model vs addressing model. X-Git-Tag: upstream/22.3.5~86 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=135425a3ae692d73cbed7afcceba0ee01f828c0c;p=platform%2Fupstream%2Fmesa.git zink: Fix up mismatches of memory model vs addressing model. MemoryModelVulkan was left out for CSes using it. Cc: mesa-stable Part-of: (cherry picked from commit 1e4deb3b8962a26e7eaffbde5688ee766b62a8b5) --- diff --git a/.pick_status.json b/.pick_status.json index 6f5cc02..a93ed58 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -796,7 +796,7 @@ "description": "zink: Fix up mismatches of memory model vs addressing model.", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index 80babe7..8fdf80e 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -4451,26 +4451,24 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, uint32_ ctx.explicit_lod = true; spirv_builder_emit_source(&ctx.builder, SpvSourceLanguageUnknown, 0); + SpvAddressingModel model = SpvAddressingModelLogical; if (gl_shader_stage_is_compute(s->info.stage)) { - SpvAddressingModel model; if (s->info.cs.ptr_size == 32) model = SpvAddressingModelPhysical32; else if (s->info.cs.ptr_size == 64) model = SpvAddressingModelPhysicalStorageBuffer64; else model = SpvAddressingModelLogical; + } + + if (ctx.sinfo->have_vulkan_memory_model) { + spirv_builder_emit_cap(&ctx.builder, SpvCapabilityVulkanMemoryModel); + spirv_builder_emit_cap(&ctx.builder, SpvCapabilityVulkanMemoryModelDeviceScope); spirv_builder_emit_mem_model(&ctx.builder, model, - SpvMemoryModelGLSL450); + SpvMemoryModelVulkan); } else { - if (ctx.sinfo->have_vulkan_memory_model) { - spirv_builder_emit_cap(&ctx.builder, SpvCapabilityVulkanMemoryModel); - spirv_builder_emit_cap(&ctx.builder, SpvCapabilityVulkanMemoryModelDeviceScope); - spirv_builder_emit_mem_model(&ctx.builder, SpvAddressingModelLogical, - SpvMemoryModelVulkan); - } else { - spirv_builder_emit_mem_model(&ctx.builder, SpvAddressingModelLogical, - SpvMemoryModelGLSL450); - } + spirv_builder_emit_mem_model(&ctx.builder, model, + SpvMemoryModelGLSL450); } if (s->info.stage == MESA_SHADER_FRAGMENT &&