zink: do not require vulkan memory model for shader-images

The claim that we require vulkan memory model's MakeAvailable and
MakeVisible semantics for image writes isn't accurate. This would be
required *if* we were already using the Vulkan memory model.

But we're using the GLSL450 memory model in those cases, which has no
such requirements.

This means that any problems on RADV due to the lack of these semantics
are RADV bugs, and should be fixed in RADV instead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10345>
This commit is contained in:
Erik Faye-Lund 2021-04-20 12:45:44 +02:00 committed by Marge Bot
parent 874535752b
commit 95d9d811c9
5 changed files with 5 additions and 16 deletions

View file

@ -110,7 +110,6 @@ supported:
* Device extensions:
* `VK_KHR_maintenance2`_
* `VK_KHR_vulkan_memory_model`
* Formats requiring ``VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT``:
@ -260,7 +259,6 @@ questions, don't hesitate to visit `#zink on FreeNode
.. _VK_EXT_conditional_rendering: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_conditional_rendering.html
.. _VK_EXT_vertex_attribute_divisor: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_vertex_attribute_divisor.html
.. _VK_KHR_maintenance2: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_maintenance2.html
.. _VK_KHR_vulkan_memory_model: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_vulkan_memory_model.html
.. _VK_KHR_shader_draw_parameters: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_shader_draw_parameters.html
.. _VK_KHR_draw_indirect_count: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_draw_indirect_count.html
.. _VK_KHR_sampler_mirror_clamp_to_edge: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_sampler_mirror_clamp_to_edge.html

View file

@ -3511,14 +3511,7 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info)
ctx.GLSL_std_450 = spirv_builder_import(&ctx.builder, "GLSL.std.450");
spirv_builder_emit_source(&ctx.builder, SpvSourceLanguageUnknown, 0);
if (s->info.num_images) {
/* this is required for correct io semantics */
spirv_builder_emit_extension(&ctx.builder, "SPV_KHR_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 if (s->info.stage == MESA_SHADER_COMPUTE) {
if (s->info.stage == MESA_SHADER_COMPUTE) {
SpvAddressingModel model;
if (s->info.cs.ptr_size == 32)
model = SpvAddressingModelPhysical32;

View file

@ -1486,7 +1486,7 @@ spirv_builder_emit_memory_barrier(struct spirv_builder *b, SpvScope scope, SpvMe
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 3);
spirv_buffer_emit_word(&b->instructions, SpvOpMemoryBarrier | (3 << 16));
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, scope));
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, semantics | SpvMemorySemanticsMakeAvailableMask | SpvMemorySemanticsMakeVisibleMask));
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, semantics));
}
void
@ -1496,7 +1496,7 @@ spirv_builder_emit_control_barrier(struct spirv_builder *b, SpvScope scope, SpvS
spirv_buffer_emit_word(&b->instructions, SpvOpControlBarrier | (4 << 16));
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, scope));
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, mem_scope));
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, semantics | SpvMemorySemanticsMakeAvailableMask | SpvMemorySemanticsMakeVisibleMask));
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, semantics));
}
SpvId

View file

@ -64,7 +64,6 @@ EXTENSIONS = [
Extension("VK_KHR_maintenance2"),
Extension("VK_KHR_external_memory"),
Extension("VK_KHR_external_memory_fd"),
Extension("VK_KHR_vulkan_memory_model"),
Extension("VK_EXT_shader_viewport_index_layer"),
Extension("VK_EXT_post_depth_coverage"),
Extension("VK_KHR_driver_properties",

View file

@ -752,10 +752,9 @@ zink_get_shader_param(struct pipe_screen *pscreen,
return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI);
case PIPE_SHADER_CAP_MAX_SHADER_IMAGES:
if (screen->info.have_KHR_vulkan_memory_model &&
(screen->info.feats.features.shaderStorageImageExtendedFormats ||
if (screen->info.feats.features.shaderStorageImageExtendedFormats ||
(screen->info.feats.features.shaderStorageImageWriteWithoutFormat &&
screen->info.feats.features.shaderStorageImageReadWithoutFormat)))
screen->info.feats.features.shaderStorageImageReadWithoutFormat))
return MIN2(screen->info.props.limits.maxPerStageDescriptorStorageImages,
PIPE_MAX_SHADER_IMAGES);
return 0;