Skip to content

-fvk-bind-sampler-heap <set> <binding> is backwards #8017

@JackiBackiBoy

Description

@JackiBackiBoy

Description
It appears that the compiler argument -fvk-bind-sampler-heap <set> <binding> should actually be backwards, i.e. -fvk-bind-sampler-heap <binding> <set>. This is confirmed by the fact that Vulkan validation layers interprets it this way:
Validation Error: [ VUID-VkGraphicsPipelineCreateInfo-layout-07990 ] Object 0: handle = 0x9f9b41000000003c, type = VK_OBJECT_TYPE_SHADER_MODULE; Object 1: handle = 0x59ffe0000000003d, type = VK_OBJECT_TYPE_PIPELINE_LAYOUT; | MessageID = 0xef65bb29 | vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[1] SPIR-V (VK_SHADER_STAGE_FRAGMENT_BIT) uses descriptor [Set 1, Binding 0, variable "SamplerDescriptorHeap"] of type VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER but expected VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER.

Even though I can confirm that the following arguments are passed to DXC compile (in order):

const WCHAR* args[32];
UINT32 argCount = 0;
args[argCount++] = L"-HV";
args[argCount++] = L"2021";
args[argCount++] = L"-I";
args[argCount++] = wDirStr;
args[argCount++] = L"-E";
args[argCount++] = wEntryPointStr;
args[argCount++] = L"-T";
args[argCount++] = wProfileStr;
args[argCount++] = DXC_ARG_PACK_MATRIX_COLUMN_MAJOR;
args[argCount++] = DXC_ARG_WARNINGS_ARE_ERRORS;
args[argCount++] = DXC_ARG_ALL_RESOURCES_BOUND;
args[argCount++] = L"-spirv";
args[argCount++] = L"-fspv-target-env=vulkan1.3";
args[argCount++] = L"-fvk-use-dx-layout";
args[argCount++] = L"-fvk-bind-resource-heap";
args[argCount++] = L"0"; // set
args[argCount++] = L"0"; // binding
args[argCount++] = L"-fvk-bind-sampler-heap";
args[argCount++] = L"0"; // set
args[argCount++] = L"1"; // binding

It does work if I flip the set and binding in the compiler arguments, which makes me think that the order should be reversed. Although there isn't official documentation for this (from what I can find), it is mentioned in the merged pull request #6650 that:

3 flags will be added: -fvk-bind-[resource,sampler,counter]-heap <set> <binding>, which allow the user to fix the binding/set pair, allowing aliasing resources.

However, this does not seem to be the case as per the Vulkan validation layer output shown before.

Environment

  • DXC version: dxcompiler.dll: 1.9 - 1.8.2505.32 (b106a96); dxil.dll: 1.9(1.8.2505.32)
  • Host Operating System Windows 11 Version 25H2

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashneeds-triageAwaiting triage

Type

No type

Projects

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions