//TEST:SIMPLE(filecheck=SPV): -target spirv // SPV: OpDecorate %resourceHeap DescriptorSet 10 // SPV: OpAccessChain {{.*}} %resourceHeap // SPV: OpImageSample uniform StructuredBuffer> t; uniform DescriptorHandle> buffer; [vk::binding(0, 10)] __DynamicResource<__DynamicResourceKind.General> resourceHeap[]; // A customized function that overrides the default behavior of fetch texture resources. export T getDescriptorFromHandle(DescriptorHandle handleValue) { __target_switch { case spirv: if (T.kind != DescriptorKind.ConstantBuffer && T.kind != DescriptorKind.StorageBuffer) return resourceHeap[((uint2)handleValue).x].asOpaqueDescriptor(); else return defaultGetDescriptorFromHandle(handleValue); default: return defaultGetDescriptorFromHandle(handleValue); } } [numthreads(1,1,1)] void computeMain() { buffer[0] = t[0]->SampleLevel(float2(0.0), 0.0); }