diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 4df32f9a65..5ddfda0ee0 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -6025,24 +6025,21 @@ static bool CombineObjectTypes(ArBasicKind Target, ArBasicKind Source, } switch (Target) { - AR_BASIC_ROBJECT_CASES: - if (Source == AR_OBJECT_STATEBLOCK) { + AR_BASIC_TEXTURE_CASES: + if (Source == AR_OBJECT_HEAP_RESOURCE) { AssignOpt(Target, pCombined); return true; } break; - - AR_BASIC_TEXTURE_CASES: - AR_BASIC_NON_CMP_SAMPLER_CASES: - if (Source == AR_OBJECT_SAMPLER || Source == AR_OBJECT_STATEBLOCK) { + if (Source == AR_OBJECT_SAMPLER || Source == AR_OBJECT_HEAP_SAMPLER) { AssignOpt(Target, pCombined); return true; } break; case AR_OBJECT_SAMPLERCOMPARISON: - if (Source == AR_OBJECT_STATEBLOCK) { + if (Source == AR_OBJECT_HEAP_SAMPLER) { AssignOpt(Target, pCombined); return true; } diff --git a/tools/clang/test/HLSLFileCheck/hlsl/intrinsics/createHandleFromHeap/DescriptorHeapParams.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/intrinsics/createHandleFromHeap/DescriptorHeapParams.hlsl new file mode 100644 index 0000000000..3e55ac0d15 --- /dev/null +++ b/tools/clang/test/HLSLFileCheck/hlsl/intrinsics/createHandleFromHeap/DescriptorHeapParams.hlsl @@ -0,0 +1,16 @@ +// RUN: %dxc -T ps_6_6 %s | %FileCheck %s + +// Tests using descriptor heap elements directly as parameters to intrinsics +// Previously, the overload matching rejected this before it had a chance +// to add the implicit cast. + +FeedbackTexture2D feedbackMinMip; + +Texture2D texture2D; +SamplerState samp; + +float4 main(uint texIdx : TI, uint sampIdx : SI, float2 coord : C) : SV_Target { + Texture2D tex = ResourceDescriptorHeap[texIdx]; + feedbackMinMip.WriteSamplerFeedback(ResourceDescriptorHeap[texIdx], samp, coord, 4); + return tex.Sample(SamplerDescriptorHeap[sampIdx], coord) * tex.SampleCmp(SamplerDescriptorHeap[sampIdx + 1], coord, 1.0); +} \ No newline at end of file