From 704d0c7109cf066f4b311e55a141f117f76c0672 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Jul 2025 22:27:28 +0000 Subject: Fix unnecessary Int64 SPIRV capability usage in pointer marshalling (#7717) * Initial plan * Fix unnecessary Int64 SPIRV capability usage in pointer marshalling Replace uint64-based pointer marshalling with uint2-based approach to avoid requiring Int64 capability in SPIRV output. This affects both basic type marshalling and resource handle marshalling for pointer types. Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Replace test cases with user-provided test case Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix test case to avoid unrelated pointer casting operations that require Int64 Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --- .../interfaces/pointer-marshalling-no-int64.slang | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/language-feature/interfaces/pointer-marshalling-no-int64.slang (limited to 'tests') diff --git a/tests/language-feature/interfaces/pointer-marshalling-no-int64.slang b/tests/language-feature/interfaces/pointer-marshalling-no-int64.slang new file mode 100644 index 000000000..030a8b6c7 --- /dev/null +++ b/tests/language-feature/interfaces/pointer-marshalling-no-int64.slang @@ -0,0 +1,61 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +// CHECK-NOT: Int64 + +RWStructuredBuffer result; + +struct Data +{ + uint *index_buffer; + uint type; +}; + +ConstantBuffer global_data; + +interface IIndexFetcher +{ + uint get_index(); +}; + +struct IndexFetcherU32 : IIndexFetcher +{ + uint *m_ptr; + + __init(uint *ptr) + { + m_ptr = ptr; + } + + uint get_index() + { + return 42; // Simplified to avoid dereference issues + } +}; + +struct IndexFetcherSimple : IIndexFetcher +{ + uint value; + + __init(uint val) + { + value = val; + } + + uint get_index() + { + return value; + } +}; + +[shader("compute")] +void main() +{ + IIndexFetcher pf; + if (global_data.type == 0) { + pf = IndexFetcherU32(global_data.index_buffer); + } else { + pf = IndexFetcherSimple(100); + } + + result[0] = pf.get_index(); +} \ No newline at end of file -- cgit v1.2.3