Skip to content

Upstream PR batch 1 U7: tessellation and draw-state keys - #483

Merged
RINNECODER merged 8 commits into
mainfrom
upr1/draw-state-keys
Oct 14, 2026
Merged

RINNECODER merged 8 commits into
mainfrom
upr1/draw-state-keys

Conversation

@RINNECODER

@RINNECODER RINNECODER commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Upstream PR batch 1, unit U7: tessellation and draw-state keys (non-stacked part). One commit per upstream PR, in the order 5234, 5402, 4723, 5457 (partial), 5314, 5500. Upstream boykopovar/AnyPS5 was only read.

Ported

  • fix(agc): accept integer tessellation partitioning boykopovar/AnyPS5#5234 integer tessellation partitioning: decodes VGT_TF_PARAM.PARTITIONING 0, equal spacing, factors bounded at 64. Adapted to main's triangle-only, fractional-odd-only path.
  • fix(agc): accept fractional-even tessellation partitioning boykopovar/AnyPS5#5402 fractional-even partitioning (partitioning 3): fractional-even spacing, factors bounded at 64. Same adaptation.
  • fix(shader): place hull input components by their offset in the control-point slot boykopovar/AnyPS5#4723 hull input component placement: uses the offset inside the control-point slot.
  • fix(shader): lower hulls with one input or one output control point boykopovar/AnyPS5#5457, 3 of its 5 commits: hull exec masks restored through phis lowered to own lane bits, hull input stride from the patch term when one control point is read, hulls with one output control point per patch.
  • fix(shader): honour SPI_BARYC_CNTL.FRONT_FACE_ALL_BITS for the front-face input boykopovar/AnyPS5#5314 SPI_BARYC_CNTL.FRONT_FACE_ALL_BITS for the front-face input: SPI_BARYC_CNTL joins the draw key range and request key, request serialization goes to version 24.
  • fix(shader): propagate color view slice to pixel ancillary input boykopovar/AnyPS5#5500 color view slice into the pixel ancillary word (LayerBase): added to pixel info, draw compare, request key, shader info, shader disk cache and the specialization constants. It reuses version 24, so the serializer is bumped once (23 to 24). Shader disk cache FormatVersion 36 to 37 (main's Upstream PR batch 1 U8a: Metal image-mode views #485 took 36; history line added) and the ShaderInfo field-count assertion 23 to 24.
  • Technical debt notes added to docs/dev/TechnicalDebt.md for 5234, 5402, 5314 and 5500 (title identifier removed from the 5314 text).
  • Tests. Upstream's Vulkan execution tests need a device and are not carried, except tests/execution/FrontFaceAllBits.cpp (from 5314). Equivalent SPIR-V-level tests that need no device are added to tests/ShaderMemory.cpp:
    • spacing execution mode (equal, fractional-even, fractional-odd) and the factor bound (64 for partitioning 0 and 3, 63 for 2) from compiled domain and hull programs (upstream's HasSpacing, HasLevelBound);
    • partitioning 1, 4 and 7 refused by ShaderInputInfoBuilder;
    • the 4723 AccessChain fix, with a 24-byte control-point slot and a read at byte 32 of a one-output hull, which lands on attribute/component (0,2),(0,3),(1,0),(1,1) only with constant % stride % 16u;
    • round trip of frontFaceAllBits and layerBase through the v24 serializer, and the request prefix now expects version 24.
  • PixelAncillary.cpp: two rows with non-zero layerBase (exported and not exported layer) and two whole-word rows, so the exportedLayer + LayerBase add is checked.
  • PixelLayerBase(const State&) is extracted from DrawDecode.cpp and tested in tests/Graphics.cpp. It differs from upstream on purpose: upstream takes the color view slice as is, here it is 0 for layered draws (the vertex stage exports the layer, adding the view slice would double count it) and for draws with no color target.
  • The ShaderMemory.cpp additions beyond serializer assertions (domain and half-wave reduction assertions, from 5457's hull exec-mask work) are in the diff; the stale version-19 expectation is fixed to 24 and the unsupported-version probe moved from 20 to 25.

Skipped, with reasons

Metal

Metal still refuses guest tessellation draws (MetalRenderState.mm requires no tessellation stage). Everything about partitioning (5234, 5402), the hull AccessChain slot placement (4723), the 64 vs 63 factor bound and the builder's partitioning check therefore matters only off Metal; their tests are SPIR-V-level. Front-face and layerBase also reach Metal through the shared request key. The new LayerBase constant flows through the existing specialization path to Metal.

Testing

  • Metal configuration (arm64, shader bridge + guest replay + bridge tests), after merging main: ctest 59/59 passed.
  • pixel_ancillary_tests (x86_64 default configuration): passed.
  • agc_shader_memory_tests: does not build on macOS as the tree stands (GuestMemory.cpp uses pthread_getattr_np, atomic_ref<const T> and a Linux page query). I ran it with a local, uncommitted macOS shim of GuestMemory.cpp (x86_64 under Rosetta): passed. The new tests were checked to fail when the 64 bound, the AccessChain fix or the builder's partitioning check is removed.
  • Not run: agc_driver_graphics_tests (needs linux/udmabuf.h; tests/Graphics.cpp also has compile errors on macOS already on main), so the PixelLayerBase and partitioning-decode assertions there are unverified, and the Vulkan execution tests.
  • Game smoke (tools/smoke.sh, 130 s, Rosetta build) was run before the merge and the test-only changes; it reached the first movie, main menu and leader select with no fault. Not rerun: the later changes are tests, a pure extraction (PixelLayerBase) and the merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj

RINNECODER and others added 6 commits October 13, 2026 21:34
Ported from upstream PR boykopovar#5234, adapted to our triangle/fractional-odd
only tessellation path: VGT_TF_PARAM.PARTITIONING 0 decodes, emits equal
spacing and bounds factors at 64. Metal still refuses guest tessellation
draws in MetalRenderState.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
Ported from upstream PR boykopovar#5402 (its integer-partitioning base commit is
the previous commit), adapted to our triangle-only tessellation path:
VGT_TF_PARAM.PARTITIONING 3 decodes, emits fractional-even spacing and
bounds factors at 64. Metal still refuses guest tessellation draws.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
…ol-point slot

Ported from upstream PR boykopovar#4723 (shader hunk; its Vulkan execution test is
not ported).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
…partial)

Ported from upstream PR boykopovar#5457, commits 1, 4 and 5 of 5 (hull exec masks
restored through phis, input stride from the patch term, one output
control point per patch). Vulkan execution-test hunks are not ported.

Skipped from boykopovar#5457, with reasons:
- relative patch index rebuilt as data: needs GE_CNTL.PRIM_GRP_SIZE and
  BREAK_WAVE_AT_EOI in TessellationConfiguration, VGT_LS_HS_CONFIG
  patchesPerGroup and the request key/serializer additions. None of
  these exist on main, which only lowers triangle fractional-odd hulls.
- recording BDA faults in hull programs: drops a refusal whose safety
  rests on upstream hull work we lack; the refusal stays.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
…face input

Ported from upstream PR boykopovar#5314. Tracks SPI_BARYC_CNTL in the draw key and
shader request key, and bumps the request serialization to version 24
(shared with the following slice-offset port, which adds no second bump).

Not ported: the ShaderMemory serializer-version assertions of the PR,
which build on upstream test scaffolding absent from main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
Ported from upstream PR boykopovar#5500, adapted to main: the draw decode sets the
color view slice as layerBase (the layer-export decode this PR also
touches does not exist on main, so its diagnostic and layers hunks are
skipped). layerBase is added to the pixel info, request key, shader info,
disk cache and pipeline specialization constants. The request
serialization stays at version 24, bumped once by the front-face commit.
The shader disk cache format is bumped to 36.

Not ported: unrelated hunks the upstream commit carried in Recompiler.cpp
(dot-product capability option) and its ShaderMemory serializer tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
@RINNECODER RINNECODER added the upstream-sync Upstream boykopovar/AnyPS5 intake label Oct 14, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T02:55:12.245135Z aacc6d8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 295a174b-76a7-445f-a32b-62f9a93dae6e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aacc6d831a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

state.module.AddFunction(spv::OpFOrdGreaterThan, TypeBool(state), inside, floating, lower);
const auto clamped = state.module.AllocateId();
state.module.AddFunction(spv::OpExtInst, TypeF32(state), clamped, GlslStd450(state), GLSLstd450FMin, floating, ConstantF32Value(state, 63.0f));
state.module.AddFunction(spv::OpExtInst, TypeF32(state), clamped, GlslStd450(state), GLSLstd450FMin, floating, ConstantF32Value(state, state.inputInfo.vertex->tess.partitioning == 2u ? 63.0f : 64.0f));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require a 64-wide clamp for the new partition modes

For integer or fractional-even tessellation, this emits factors up to 64, but DecodeShaderStages still accepts VGT_HOS_MAX_TESS_LEVEL values as low as 63. A draw with one of the newly accepted partition modes, a maximum clamp below 64, and a factor above that clamp therefore reaches the host tessellator with a larger factor than the guest hardware permits, changing segment counts or fractional spacing. Require a maximum of at least 64 for partitioning 0/3, or specialize this clamp from the decoded register.

Useful? React with 👍 / 👎.

RINNECODER and others added 2 commits October 13, 2026 22:41
…rsion 37)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
…ayerBase and serializer v24

Fix the stale serialization version expectation in the shader memory test,
add pixel ancillary rows with a non-zero layerBase, extract PixelLayerBase
for a derivation test, and point the FrontFace note at TechnicalDebt.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DgW4n3qYgi5jAAohEmXRQj
@RINNECODER
RINNECODER merged commit 304c53c into main Oct 14, 2026
5 checks passed
@RINNECODER
RINNECODER deleted the upr1/draw-state-keys branch October 14, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream-sync Upstream boykopovar/AnyPS5 intake

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants