[Mesa-dev] [PATCH] radv: Update to new VK_EXT_vertex_attribute_divisor to version 2.

Jason Ekstrand jason at jlekstrand.net
Wed Aug 15 15:14:51 UTC 2018


On August 15, 2018 09:28:36 Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl> wrote:

> On Wed, Aug 15, 2018 at 11:49 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>> On Tue, Aug 14, 2018 at 7:20 AM Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> wrote:
>>>
>>> Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>>
>>> On 7/23/18 4:24 PM, Bas Nieuwenhuizen wrote:
>>>> 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.
>>>> ---
>>>> src/amd/vulkan/radv_extensions.py | 2 +-
>>>> src/amd/vulkan/radv_nir_to_llvm.c | 7 ++++---
>>>> 2 files changed, 5 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/src/amd/vulkan/radv_extensions.py
>>>> b/src/amd/vulkan/radv_extensions.py
>>>> index a5fbffac33b..d02042e5647 100644
>>>> --- a/src/amd/vulkan/radv_extensions.py
>>>> +++ b/src/amd/vulkan/radv_extensions.py
>>>> @@ -104,7 +104,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'),
>>>> diff --git a/src/amd/vulkan/radv_nir_to_llvm.c
>>>> b/src/amd/vulkan/radv_nir_to_llvm.c
>>>> index c7d772fa652..d12ef09c9f3 100644
>>>> --- a/src/amd/vulkan/radv_nir_to_llvm.c
>>>> +++ b/src/amd/vulkan/radv_nir_to_llvm.c
>>>> @@ -1984,8 +1984,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,
>>>> @@ -2000,8 +1999,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.");
>>
>>
>> You'll want to leave this alone.  zero is coming back...  Yeah, I know it's
>> annoying but I'm really trying to get this settled out as quickly as
>> possible.  In the mean time, reports are that zero is useful for some DXVK
>> apps so it's best to just silently support it rather than breaking stuff.
>
> Is the behavior of zero going to be the same as it was in version 1?

Almost. There base instance will be added in but instance is never 
incremented beyond that. Look at Khronos MR 2771.

>
>>
>>>
>>>>                 }
>>>> +
>>>> +                     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,
>>>> "");
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev





More information about the mesa-dev mailing list