Skip to content

[SPIR-V] [[vk::ext_extension]] attribute causes "invalid SPIR-V" #8210

@MarijnS95

Description

@MarijnS95

Description
We are trying to confirm if SPV_EXT_opacity_micromap + RayTracingOpacityMicromapEXT are missing in one of our SPIR-V shaders, that cause crashes on specific hardware that uses opacity micromaps in acceleration structures. However, trying to simply add it with the [[vk::ext_extension]] attribute causes a very simple shader to suddenly stop compiling.

Steps to Reproduce
https://godbolt.org/z/fqGdETxxd (-T cs_6_9 -E main -spirv -Wno-hlsl-rayquery-flags)

Unsure if we really need -Wno-hlsl-rayquery-flags, SPIR-V doesn't define RAYQUERY_FLAG_ALLOW_OPACITY_MICROMAPS but DXC requires it in order to use RAY_FLAG_FORCE_OMM_2_STATE.

Commenting out [[vk::ext_extension("SPV_EXT_opacity_micromap")]] makes the shader compile successfully again, with the RAY_FLAG_FORCE_OMM_2_STATE = 1024 constant used in the ray query flags.

Actual Behavior

fatal error: generated SPIR-V is invalid: In Logical addressing, variables can only allocate a pointer to the StorageBuffer or Workgroup storage classes
  %58 = OpVariable %_ptr_Function__ptr_Uniform_type_ByteAddressBuffer Function

note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible

Compiler returned: 5

Environment

  • DXC version 1.8.2505 and trunk on Godbolt (libdxcompiler.so: 1.10(1-11951229)(1.9.0.10001)).
  • Host Operating System Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashneeds-triageAwaiting triagespirvWork related to SPIR-V

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions