[PATCH vkd3d 03/12] vkd3d: Do not call vkCmdPushConstants() with a count of zero (KHRONOS_validation).

Zebediah Figura zfigura at codeweavers.com
Wed Apr 20 12:50:43 CDT 2022


On 4/20/22 10:40, Henri Verbeet wrote:
> On Mon, 18 Apr 2022 at 08:34, Giovanni Mascellani
> <gmascellani at codeweavers.com> wrote:
>> @@ -4657,8 +4657,9 @@ static void d3d12_command_list_set_root_constants(struct d3d12_command_list *lis
>>       const struct d3d12_root_constant *c;
>>
>>       c = root_signature_get_32bit_constants(root_signature, index);
>> -    VK_CALL(vkCmdPushConstants(list->vk_command_buffer, root_signature->vk_pipeline_layout,
>> -            c->stage_flags, c->offset + offset * sizeof(uint32_t), count * sizeof(uint32_t), data));
>> +    if (count)
>> +        VK_CALL(vkCmdPushConstants(list->vk_command_buffer, root_signature->vk_pipeline_layout,
>> +                c->stage_flags, c->offset + offset * sizeof(uint32_t), count * sizeof(uint32_t), data));
>>   }
> 
> Is calling SetGraphicsRoot32BitConstants()/SetComputeRoot32BitConstants()
> valid d3d12? If not, we should be fixing the callers instead.
> 

Right, I believe I received the same feedback when submitting this patch 
before, and never found the time to properly look into it, which is why 
it has remained in my tree without being resubmitted.

Looking into it now, I don't see any indication that a zero count is 
invalid, either from the "specification" [1] or in the function 
documentation themselves [2] [3], and in practice it's worked on (AMD) 
Windows when I've tried it. I haven't tried with the debug layer, 
though, and I don't know of any other things I could check.

[1] 
https://microsoft.github.io/DirectX-Specs/d3d/ResourceBinding.html#setting-constants-in-the-root-arguments

[2] 
https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-setgraphicsroot32bitconstants

[3] 
https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-setcomputeroot32bitconstants



More information about the wine-devel mailing list