Skip to content

fix: Codex review findings on #480, #484, #485, #490 (relinker prefixes, Metal depth retirement, null degamma images) - #498

Merged
RINNECODER merged 5 commits into
mainfrom
fix/codex-review-metal
Oct 14, 2026
Merged

RINNECODER merged 5 commits into
mainfrom
fix/codex-review-metal

Conversation

@RINNECODER

@RINNECODER RINNECODER commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Triage of unaddressed Codex connector findings on merged PRs #480, #484, #485 and #490. None of them was fixed upstream: upstream main has no Metal backend and no materializeForcedDegamma, and #480 is fork-only. Each real finding first got a test that failed on main.

PR Path Finding Verdict Fix commit / reason
#480 core/relinker/codegen/src/x86/ScalarCompareOperands.cpp Scalar compare behind an address-size prefix (67 C5 FA C2 ..., 67 F3 0F C2 ...) is not decoded real a763f66. The decoder now reads segment, 67 and F2/F3 prefixes in any order, and the last F2/F3 is the mandatory one. Before the fix, these compares were left un-isolated in their Rosetta block. They were not misdecoded, so the original load-loss hazard could come back. The moved stub keeps the EIP-relative target. Test: amd64_only_converter_tests (decode + matcher relocation).
#484 core/libs/prx/libSceAgcDriver/Graphics/Metal/MetalDraw.mm (~688) The MSAA color overlap range must cover all fragments real 10bfba7. A color target now retires depth surfaces over bytes * samples, the same footprint MetalColorSurface::OverlapsMappings uses. Test: metal_utility_tests DepthResource. It failed on the old range.
#484 core/libs/prx/libSceAgcDriver/Graphics/Metal/MetalDraw.mm (~684) Retire the surfaces overlapped by every layered depth slice real 10bfba7. Each extra slice now retires the surfaces over its depth and stencil planes, not only a surface at exactly its depth address. Test: metal_utility_tests DepthResource.
#485 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp (~512) Skip null descriptors before forced-degamma validation real b905cdd. Null T#s are skipped. Test: ImagePlaneBiasOnSingleLevelVolume draws a TYPE=0 RGBA8_UINT image under FORCE_DEGAMMA and reads zero. It threw "requires a one-slice volume" on main.
#490 core/libs/prx/libSceAgcDriver/Graphics/Metal/MetalShaderResources.mm (~685) The parent swizzle is applied twice in the sRGB view not real fd6737b (test + comment only). Measured on an Apple M5 Pro, macOS 27: a Metal view of a view takes its swizzle relative to the root texture and does not compose it with the parent's. With swizzle:view.swizzle, an R/B-swapped UNORM T# under FORCE_DEGAMMA samples correctly swapped. The suggested identity swizzle drops the mapping: the new test fails with R reading B's value. The test now pins that behaviour.
#498 (this PR, Codex review) core/libs/prx/libSceAgcDriver/Graphics/Metal/MetalDraw.mm (~699) The layered-slice loop gives a stencil-only target a fabricated depth address, and range retirement then evicts unrelated surfaces real 37aa5ed. The new DepthArraySlice keeps an absent plane at zero. Test: metal_utility_tests DepthResource. It failed without the guard.

Verification: amd64_only_converter_tests, decoder_length_tests (relinker-only config); metal_utility_tests, all anyps5_metal_driver_semantics_*, anyps5_metal_render_state, anyps5_metal_msaa_depth (Metal guest-replay config); rosetta_engine + rosetta_cpuid_tests (x86_64 Rosetta config). All pass. One 300 s map smoke reached the 3D map (map generation started by about 86 s) with no fault, and the last frame renders terrain and HUD.

🤖 Generated with Claude Code

RINNECODER and others added 4 commits October 14, 2026 11:34
… prefixes

A scalar compare carrying an address-size override (67 C5 FA C2 ..., 67 F3 0F C2 ...)
or with F2/F3 on either side of another legacy prefix was not decoded, so it stayed in
its Rosetta block and could still lose the later load of its destination. Legacy
prefixes are now read in any order, the last F2/F3 being the mandatory one; F2/F3
before a VEX escape is still not a compare.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yered slice on Metal

A multisampled color target now retires the depth surfaces over all of its fragments
(bytes * samples), as MetalColorSurface::OverlapsMappings already measures it. Each
extra slice of a layered depth draw retires the surfaces over its depth and stencil
planes, not only one at exactly its depth address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A null T# (TYPE=0 or zero base) reads zero whatever its other words say, so a null
image left with an RGBA8_UINT format under a FORCE_DEGAMMA sampler no longer fails
the one-slice-volume check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An R/B-swapped UNORM and sRGB texture sampled under FORCE_DEGAMMA keeps its mapping
once. Measured: a Metal view of a view takes its swizzle relative to the root texture,
so passing the parent's swizzle is right and an identity swizzle drops the mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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-14T16:57:56.722517Z fd6737b 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: cfefc56f-ce91-4f9d-846c-bc2b65543c4c
  • 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: fd6737bd1c

ℹ️ 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".

slice.slice += layer;
auto surface = depthCache->Acquire(slice);
std::erase_if(depthSurfaces, [&](const auto& other) { return other != surface && other->Target().address == slice.address; });
RetireDepthSurfaces(depthSurfaces, slice, surface.get());

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 Preserve the absent depth plane for stencil-only slices

When a layered stencil-only target is used (DB_Z_INFO.FORMAT == 0), its depth address starts at zero, but the loop above unconditionally offsets it for each extra slice; this new range-based retirement then treats that fabricated low address as a real depth plane and can evict unrelated resident depth surfaces whose ranges overlap it. Keep a zero depth address unchanged and skip retirement for that absent plane, as is already done for a zero stencil address.

Useful? React with 👍 / 👎.

…ts layered slices

The extra slices of a layered draw offset the depth address even when it is zero (a
stencil-only target), and the range retirement then treated that fabricated address as
a depth plane. DepthArraySlice leaves an absent plane at zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RINNECODER
RINNECODER merged commit 1eee7d2 into main Oct 14, 2026
5 checks passed
@RINNECODER
RINNECODER deleted the fix/codex-review-metal branch October 14, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant