Fix #10045: Add missing parameter categories and resource shapes to r…#10053
Fix #10045: Add missing parameter categories and resource shapes to r…#10053szihs wants to merge 2 commits intoshader-slang:masterfrom
Conversation
… shapes to reflection JSON Add handling for SUBPASS, RAY_PAYLOAD, HIT_ATTRIBUTES, CALLABLE_PAYLOAD, SHADER_RECORD, EXISTENTIAL_TYPE_PARAM, EXISTENTIAL_OBJECT_PARAM, METAL_ATTRIBUTE, and METAL_PAYLOAD parameter categories in the reflection JSON binding kind switch. Also add TEXTURE_SUBPASS to the resource base shape switch and result type emission.
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughExtends JSON reflection output by adding new cases to string-ification switches in three functions within Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates Slang’s reflection JSON emission to recognize additional parameter binding categories and resource shapes, addressing gaps that previously produced "unknown" kinds (and could trigger assertions) for newer language/target features.
Changes:
- Add missing
SlangParameterCategorycases (e.g., ray tracing payload/attributes, subpass, existential params, Metal attribute/payload) to the JSONbinding.kindswitch. - Add
SLANG_TEXTURE_SUBPASShandling to resourcebaseShapeJSON emission. - Ensure
SLANG_TEXTURE_SUBPASSresources participate inresultTypeemission for resource type JSON.
…PI and add regression test - Add SubpassInputType dispatch in spReflectionType_GetKind, GetResourceShape, GetResourceAccess, and GetResourceResultType in slang-reflection-api.cpp so SubpassInput is correctly reflected as a resource type with shape SLANG_TEXTURE_SUBPASS and its element type. - Add regression test tests/reflection/subpass-input-reflection.slang that validates binding kind, base shape, and result type in the JSON reflection output for SubpassInput<float4>.
…eflection JSON
Add handling for SUBPASS, RAY_PAYLOAD, HIT_ATTRIBUTES, CALLABLE_PAYLOAD, SHADER_RECORD, EXISTENTIAL_TYPE_PARAM, EXISTENTIAL_OBJECT_PARAM, METAL_ATTRIBUTE, and METAL_PAYLOAD parameter categories in the reflection JSON binding kind switch. Also add TEXTURE_SUBPASS to the resource base shape switch and result type emission.
Summary
This PR extends the Slang shader compiler's JSON reflection output to support additional parameter categories and resource shapes that were previously not being stringified in the reflection metadata.
Changes
File Modified:
source/slang/slang-reflection-json.cpp(+11 lines)The changes add support for nine previously unhandled parameter categories in the reflection JSON binding kind switch:
inputAttachmentIndex)Additionally, TEXTURE_SUBPASS resource shape support is added to:
subpassInput)Compiler Impact
include/slang.handinclude/slang-com-helper.hremain unchangedThe parameter categories and resource shapes being handled are already part of the existing public API and fully supported by the compiler's IR and legalization stages; this PR simply extends the JSON reflection output to properly stringify these cases that were previously missing from the metadata output.