Skip to content

Comments

Fix #10045: Add missing parameter categories and resource shapes to r…#10053

Open
szihs wants to merge 2 commits intoshader-slang:masterfrom
szihs:haaggarwal/fix-reflection-json-subpass-input
Open

Fix #10045: Add missing parameter categories and resource shapes to r…#10053
szihs wants to merge 2 commits intoshader-slang:masterfrom
szihs:haaggarwal/fix-reflection-json-subpass-input

Conversation

@szihs
Copy link
Collaborator

@szihs szihs commented Feb 17, 2026

…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:

  • RAY_PAYLOAD, HIT_ATTRIBUTES, CALLABLE_PAYLOAD, SHADER_RECORD
  • EXISTENTIAL_TYPE_PARAM, EXISTENTIAL_OBJECT_PARAM
  • SUBPASS (mapped to inputAttachmentIndex)
  • METAL_ATTRIBUTE, METAL_PAYLOAD

Additionally, TEXTURE_SUBPASS resource shape support is added to:

  • The resource base shape switch (mapped to subpassInput)
  • Result type emission for resource types

Compiler Impact

  • Affected Stage: Reflection/Metadata analysis phase only (not core compilation stages like lexer, parser, semantic analysis, or code generation)
  • No Backend Impact: SPIRV, HLSL, GLSL, Metal, CUDA, and WGSL codegen are unaffected
  • No Public API Changes: include/slang.h and include/slang-com-helper.h remain unchanged

The 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.

… 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.
Copilot AI review requested due to automatic review settings February 17, 2026 09:18
@szihs szihs requested a review from a team as a code owner February 17, 2026 09:18
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Extends JSON reflection output by adding new cases to string-ification switches in three functions within slang-reflection-json.cpp. Maps additional shader resource types including RAY_PAYLOAD, HIT_ATTRIBUTES, CALLABLE_PAYLOAD, SHADER_RECORD, EXISTENTIAL variants, and SUBPASS. Also handles TEXTURE_SUBPASS resource type with optional resultType emission.

Changes

Cohort / File(s) Summary
JSON Reflection Extensions
source/slang/slang-reflection-json.cpp
Added case mappings in emitReflectionVarBindingInfoJSON for shader binding kinds (RAY_PAYLOAD, HIT_ATTRIBUTES, CALLABLE_PAYLOAD, SHADER_RECORD, EXISTENTIAL_TYPE_PARAM, EXISTENTIAL_OBJECT_PARAM, SUBPASS, METAL_ATTRIBUTE, METAL_PAYLOAD); extended emitReflectionResourceTypeBaseInfoJSON with TEXTURE_SUBPASS→subpassInput mapping; enhanced emitReflectionTypeInfoJSON resource case to handle SLANG_TEXTURE_SUBPASS with optional resultType output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding missing parameter categories and resource shapes to reflection JSON output, directly addressing issue #10045.

✏️ 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 @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SlangParameterCategory cases (e.g., ray tracing payload/attributes, subpass, existential params, Metal attribute/payload) to the JSON binding.kind switch.
  • Add SLANG_TEXTURE_SUBPASS handling to resource baseShape JSON emission.
  • Ensure SLANG_TEXTURE_SUBPASS resources participate in resultType emission for resource type JSON.

@szihs szihs added the pr: non-breaking PRs without breaking changes label Feb 18, 2026
…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>.
@szihs szihs requested a review from csyonghe February 18, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: non-breaking PRs without breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant