0

我有一个相当简单的 HLSL 着色器,它正在使用 DirectxShaderCompiler 编译成 SPIR-V。但是,使用标量布局会导致验证层错误。我VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME在创建 VkDevice 时启用了扩展。它是一个验证层,还是 dxc 错误,还是我需要一个额外的标志来生成 SPIR-V?

生成 SPIR-V 的命令:

COMMAND $ENV{VULKAN_SDK}/bin/dxc -spirv -fvk-use-scalar-layout -fvk-invert-y -T vs_6_0 -E ${vertexEntry} ${file} -Fo ${CMAKE_SOURCE_DIR}/Assets/${vertexEntry}.spv

验证层错误:

Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x1e320175dc0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Structure id 7 decorated as BufferBlock for variable in Uniform storage class must follow relaxed storage buffer layout rules: member 1 is an improperly straddling vector at offset 12
  %Vertex = OpTypeStruct %v3float %v3float %v2float
4

0 回答 0