radv: Update to new VK_EXT_vertex_attribute_divisor to version 2.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 23 Jul 2018 14:24:02 +0000 (16:24 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 14 Aug 2018 20:13:09 +0000 (22:13 +0200)
Behavior wrt firstInstance got changed, and a divisor of 0 has been
disallowed.

The new version of the ext got published in specification 1.1.81.

Sending to stable since the only known user is DXVK, which needs
this for correctness.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
CC: 18.2 <mesa-stable@lists.freedesktop.org>
src/amd/vulkan/radv_extensions.py
src/amd/vulkan/radv_nir_to_llvm.c

index 8b5eee867ac20fcfe04880532abe3cd4e9e9d2be..b5b9c137927ea2e794dab2f53262963fca5ca9ed 100644 (file)
@@ -105,7 +105,7 @@ EXTENSIONS = [
     Extension('VK_EXT_sampler_filter_minmax',             1, 'device->rad_info.chip_class >= CIK'),
     Extension('VK_EXT_shader_viewport_index_layer',       1, True),
     Extension('VK_EXT_shader_stencil_export',             1, True),
-    Extension('VK_EXT_vertex_attribute_divisor',          1, True),
+    Extension('VK_EXT_vertex_attribute_divisor',          2, True),
     Extension('VK_AMD_draw_indirect_count',               1, True),
     Extension('VK_AMD_gcn_shader',                        1, True),
     Extension('VK_AMD_rasterization_order',               1, 'device->has_out_of_order_rast'),
index 64b6522cd93a672db7f05f555c562622677a4756..bfd8b562e5c01ca80780b555653d23ca27b11067 100644 (file)
@@ -1991,8 +1991,7 @@ handle_vs_input_decl(struct radv_shader_context *ctx,
                        uint32_t divisor = ctx->options->key.vs.instance_rate_divisors[attrib_index];
 
                        if (divisor) {
-                               buffer_index = LLVMBuildAdd(ctx->ac.builder, ctx->abi.instance_id,
-                                                           ctx->abi.start_instance, "");
+                               buffer_index = ctx->abi.instance_id;
 
                                if (divisor != 1) {
                                        buffer_index = LLVMBuildUDiv(ctx->ac.builder, buffer_index,
@@ -2007,8 +2006,10 @@ handle_vs_input_decl(struct radv_shader_context *ctx,
                                                MAX2(1, ctx->shader_info->vs.vgpr_comp_cnt);
                                }
                        } else {
-                               buffer_index = ctx->ac.i32_0;
+                               unreachable("Invalid vertex attribute divisor of 0.");
                        }
+
+                       buffer_index = LLVMBuildAdd(ctx->ac.builder, ctx->abi.start_instance, buffer_index, "");
                } else
                        buffer_index = LLVMBuildAdd(ctx->ac.builder, ctx->abi.vertex_id,
                                                    ctx->abi.base_vertex, "");