Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPIR-V] vk::SpirvOpaqueType as a descriptor , always gets placed in $Globals #7014

Open
devshgraphicsprogramming opened this issue Nov 20, 2024 · 0 comments
Labels
bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V

Comments

@devshgraphicsprogramming

Description

Suppose

Steps to Reproduce

My custom Godbolt

#include "nbl/builtin/hlsl/spirv_intrinsics/core.hlsl"

namespace nbl
{
namespace hlsl
{
namespace spirv
{
//[[vk::ext_capability(spv::CapabilityRayQueryKHR)]]
using RayQueryKHR = vk::SpirvOpaqueType<spv::OpTypeRayQueryKHR>;

//[[vk::ext_capability(spv::CapabilityRayQueryKHR)]]
using AccelerationStructureKHR = vk::SpirvOpaqueType<spv::OpTypeAccelerationStructureKHR>;

//using RayQueryEXT = pointer_t<>;


[[vk::ext_capability(spv::CapabilityRayQueryKHR)]]
[[vk::ext_instruction(spv::OpRayQueryInitializeKHR)]]
void rayQueryInitializeKHR([[vk::ext_reference]] RayQueryKHR query, [[vk::ext_reference]] AccelerationStructureKHR AS, uint32_t flags, uint32_t cull_mask, float32_t3 origin, float32_t tmin, float32_t3 direction, float32_t tmax);
}
}
}


using namespace nbl::hlsl;

[[vk::binding(0,0)]] spirv::AccelerationStructureKHR topLevelAS;

[numthreads(64,1,1)]
void main()
{
    spirv::RayQueryKHR rq;
    spirv::rayQueryInitializeKHR(rq,topLevelAS,0x0,0x0,float32_t3(1.f,2.f,3.f),0.125f,float32_t3(0.f,0.f,1.f),2048.f);
}

The funny thing is that if I replace with

[[vk::binding(0,0)]] static spirv::AccelerationStructureKHR topLevelAS;

if compiles and codegens completely wrong SPIR-V, (the variable is not in Uniform class, doesn't have the binding decorations, etc.

Actual Behavior

<source>:28:3: error: variable 'topLevelAS' will be placed in $Globals so cannot have vk::binding attribute
[[vk::binding(0,0)]] spirv::AccelerationStructureKHR topLevelAS;
  ^

Compiler returned: 3221225477

Environment

  • DXC version: trunk from Novemeber
  • Host Operating System: Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V
Projects
Status: For Google
Development

No branches or pull requests

1 participant