diff options
| author | Copilot <198982749+Copilot@users.noreply.github.com> | 2025-10-03 12:52:50 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-03 19:52:50 +0000 |
| commit | 2491ac5f42d78d082d4afa6416906fad9b32ea80 (patch) | |
| tree | 410520b10dfec0742f5747ed6787863c152c086f /source/core | |
| parent | 6a2cf239a89340ed2985d04609499e8c4a2d8f89 (diff) | |
Add direct usage support for gl_DrawID (#8594)
- [x] Add `gl_DrawID` property declaration in
`source/slang/glsl.meta.slang` similar to `gl_BaseVertex` and
`gl_BaseInstance`
- [x] Ensure it maps to `SV_DrawIndex` semantic
- [x] Add extension requirements in `slang-ir-glsl-legalize.cpp` (GLSL
460 and GL_ARB_shader_draw_parameters)
- [x] Create test case to verify SPIRV output contains `DrawIndex`
decoration
- [x] Run formatting script before committing
- [x] Verify existing tests still pass
- [x] Remove accidentally committed temp files (1.glsl, 3.spv-asm)
- [x] Update .gitignore to prevent similar files from being committed
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Missing direct usage support for gl_DrawID</issue_title>
> <issue_description># Problem Description
> Because DirectX does not have support for DrawIndex like vulkan does,
i add the support in d3d12 by emulating it and storing it in a root
constant. In vulkan though, i should be able to use it directly, but
because now i store it as a global variable, i cannot use the
SV_DrawIndex semantic either.
>
> # Preferred Solution
> I'd like to be able to use gl_DrawID like you how can use
gl_BaseVertex and gl_BaseInstance.
> </issue_description>
>
> <agent_instructions>You can just edit glsl.meta.slang and add a
declaration for gl_DrawID in a similar way to gl_BaseVertex, and map it
to SV_DrawIndex.
>
> Create a `//TEST:SIMPLE(filecheck=SPIRV): -target spirv` test case,
and use filecheck to verify the output contains the correct SPIRV
`DrawIndex` decoration.</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
Fixes shader-slang/slang#8548
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/shader-slang/slang/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Diffstat (limited to 'source/core')
0 files changed, 0 insertions, 0 deletions
