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<NNNN>' is an object and cannot be used as a type parameter a.k.a. SpirvType as T` of SpirvType #7015

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

Follow up to #5092 as requested by @s-perron

Steps to Reproduce

Declare one SpirvOpaqueType (or even SpirvType) and shove it in another opaque type, examples:

  • image type, inside combined sampler image
template<typename SampledType, spv::Dim dim, uint32_t Depth, uint32_t Arrayed, uint32_t MS, uint32_t Sampled, spv::ImageFormat Format=spv::ImageFormatUnknown, spv::AccessQualifier AccessQualifier=spv::AccessQualifierMax>
using image = vk::SpirvOpaqueType<
    /*spv::OpTypeImage*/ 25,
    SampledType,
    vk::Literal<vk::integral_constant<uint,dim> >,
    vk::Literal<vk::integral_constant<uint,Depth> >,
    vk::Literal<vk::integral_constant<uint,Arrayed> >,
    vk::Literal<vk::integral_constant<uint,MS> >,
    vk::Literal<vk::integral_constant<uint,Sampled> >,
    vk::Literal<vk::integral_constant<uint,Format> >
// TODO: use `nbl::hlsl::conditional_t<AccessQualifier==Max` to choose between two SpirvOpaqueTypes
>;

template<typename Image>
using sampledImage = vk::SpirvOpaqueType</*spv::OpTypeSampledImage*/ 27,Image>;

// %type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown
// %type_sampled_image = OpTypeSampledImage %type_2d_image
// %_ptr_UniformConstant_type_2d_image_0 = OpTypePointer UniformConstant %type_2d_image_0
using sampler2D = spirv::pointer<spv::StorageClassUniformConstant,spirv::sampledImage<spirv::image<float,spv::Dim2D,2,0,0,1> > >;
  • Acceleration Structure Type inside pointer type
using pointer_t = vk::SpirvOpaqueType<spv::OpTypePointer,vk::Literal<vk::integral_constant<uint32_t,StorageClass> >,T>;

using RayQueryKHR = vk::SpirvOpaqueType<spv::OpTypeRayQueryKHR>;

using RayQueryEXT = pointer_t<spv::StorageClassFunction,RayQueryKHR>;
  • obtaining a Spir-V pointer of a HLSL object / casting to native Spir-V type
using pointer_t = vk::SpirvOpaqueType<spv::OpTypePointer,vk::Literal<vk::integral_constant<uint32_t,StorageClass> >,T>;

template<uint32_t StorageClass, typename T, typename U>
[[vk::ext_instruction(spv::OpCopyObject)]]
pointer_t<StorageClass,T> copyObject([[vk::ext_reference]] U v);

Actual Behavior

Always some variation of

vk::SpirvOpaqueType<NNNN>' is an object and cannot be used as a type parameter

Environment

  • DXC version: commit ac36a79
  • 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