[PR #1480] rdna2spirv: explicit-gradient samples with compare or offset (SHADER-… #1510

Open
opened 2026-11-26 20:21:29 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1480
Author: @vsking2000
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: shader-sample-grad-forms


📝 Commits (1)

  • a768a65 rdna2spirv: explicit-gradient samples with compare or offset (SHADER-SAMPLE-GRAD-FORMS)

📊 Changes

3 files changed (+322 additions, -11 deletions)

View changed files

📝 docs/design.md (+3 -2)
➕ tests/semantic/test_sample_grad_forms.py (+283 -0)
📝 tools/rdna2spirv.py (+36 -9)

📄 Description

…SAMPLE-GRAD-FORMS)

image_sample_c_d, image_sample_c_d_cl, image_sample_d_o, image_sample_d_cl_o, image_sample_c_d_o and image_sample_c_d_cl_o were refused by name. They combine pieces the translator already has as GPU-tested rules (depth compare, explicit gradients, _o offsets, the min-LOD clamp): address order offset, z-compare, dP/dx, dP/dy, coordinates, clamp, as LLVM (AMDGPUSampleVariants, lowerImage) and Mesa ACO both emit it. The sample is OpImageSample(Dref)ExplicitLod with Grad, Offset and MinLod in that order; a16 keeps the compare and the f32 gradients whole.

Refused with a reason: compare on a 3D image, 3D gradient forms with tfe/lwe, and the _o forms under --texel-offset-fallback (the shifted level is not computed from explicit gradients). The _cd and g16 forms stay refused. docs/design.md gets a row; the two rows that listed these as refused now point to it. Not run on a GPU.

Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf

Claimed in the coordination issue as:

Depends on:

Fixes:

What and why

Tested

GPUs tested:

AI-assisted:

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1480 **Author:** [@vsking2000](https://github.com/vsking2000) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `shader-sample-grad-forms` --- ### 📝 Commits (1) - [`a768a65`](https://github.com/ubiquitarianism/leonida/commit/a768a6501a9e517440a00cd93853034976d5eb98) rdna2spirv: explicit-gradient samples with compare or offset (SHADER-SAMPLE-GRAD-FORMS) ### 📊 Changes **3 files changed** (+322 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+3 -2) ➕ `tests/semantic/test_sample_grad_forms.py` (+283 -0) 📝 `tools/rdna2spirv.py` (+36 -9) </details> ### 📄 Description …SAMPLE-GRAD-FORMS) image_sample_c_d, image_sample_c_d_cl, image_sample_d_o, image_sample_d_cl_o, image_sample_c_d_o and image_sample_c_d_cl_o were refused by name. They combine pieces the translator already has as GPU-tested rules (depth compare, explicit gradients, _o offsets, the min-LOD clamp): address order offset, z-compare, dP/dx, dP/dy, coordinates, clamp, as LLVM (AMDGPUSampleVariants, lowerImage) and Mesa ACO both emit it. The sample is OpImageSample(Dref)ExplicitLod with Grad, Offset and MinLod in that order; a16 keeps the compare and the f32 gradients whole. Refused with a reason: compare on a 3D image, 3D gradient forms with tfe/lwe, and the _o forms under --texel-offset-fallback (the shifted level is not computed from explicit gradients). The _cd and g16 forms stay refused. docs/design.md gets a row; the two rows that listed these as refused now point to it. Not run on a GPU. Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf Claimed in the coordination issue as: <!-- the item ID from the open "Coordinating who works on what" issue, for example TEST-17, or a link to your claim --> Depends on: <!-- #N for every pull request this one builds on or conflicts with (the coordination issue's Commands section, AGENTS.md); delete the line if it builds on none and conflicts with none --> Fixes: <!-- #N for each issue this closes (GitHub closes it on merge); delete the line if it closes none --> ### What and why <!-- What this changes and the problem it solves. --> ### Tested <!-- What you ran and on which GPU and driver (CONTRIBUTING.md). For the shader translator: how many shaders translate and pass spirv-val, before and after. --> GPUs tested: <!-- vendor, model, driver and OS of each GPU the GPU tests ran on, or n/a --> AI-assisted: <!-- yes or no (AGENTS.md asks a coding agent to say so) --> ### Checklist - [ ] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [ ] One topic; follow-up work goes in a new pull request. - [ ] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1510
No description provided.