Skip to content

fix(shader): normalize negative color compare wrap indices - #1262

Closed
MarcZX10 wants to merge 5 commits into
boykopovar:mainfrom
MarcZX10:fix/agc-emulated-color-compare-wrap
Closed

MarcZX10 wants to merge 5 commits into
boykopovar:mainfrom
MarcZX10:fix/agc-emulated-color-compare-wrap

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

What

Normalize negative texel indices into the image extent when emulating color-texture comparison sampling with wrap addressing. Add point-filtered wrap coverage alongside the existing bilinear wrap checks.

Tested

  • Reproduced the failure on Debian Linux with llvmpipe (LLVM 15.0.6): negative coordinates returned 0 where point wrap expected 1 and bilinear wrap expected 0.35.
  • Built agc_driver_emulated_color_compare_tests with GCC 12.2.
  • Focused CTest agc_driver_emulated_color_compare: passed, including point and bilinear wrap, offsets, border modes, and unsupported-mode rejection checks.
  • tools/check_conventions.py --base upstream/main: passed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@MarcZX10
MarcZX10 force-pushed the fix/agc-emulated-color-compare-wrap branch 4 times, most recently from 5ae8eed to 8ce2cff Compare October 7, 2026 20:25
@MarcZX10
MarcZX10 force-pushed the fix/agc-emulated-color-compare-wrap branch from 8ce2cff to ae76329 Compare October 7, 2026 20:26
@github-actions github-actions Bot added shader core/shader agc libSceAgc* labels Oct 7, 2026
…lor-compare-wrap

# Conflicts:
#	docs/dev/TechnicalDebt.md
@github-actions github-actions Bot added docs and removed needs rebase Conflicts with main, rebase needed labels Oct 8, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR. Two issues:

  • The new point, wrap row passes without the change: reverting SpirvImageEmitter.cpp and rebuilding agc_driver_emulated_color_compare_tests, the test still passes on RADV and on the lavapipe CI installs (Mesa 25.2.8, LLVM 20). A test that passes on main doesn't cover the fix.
  • SPIR-V defines OpSMod as taking the sign of operand 2 (extent, always positive here), so OpSMod and the OpSRem + correction give the same result on any conformant driver. This reads as a workaround for a bug in llvmpipe/LLVM 15, not a semantic fix.

Please show a conformant driver (version and output) where OpSMod returns a wrong value for these inputs, and make the test fail on main in Linux CI, or drop the PR. If it is a driver bug, say so in the TechnicalDebt entry instead of describing it as an unmeasured hardware behaviour.

@MarcZX10

MarcZX10 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing for now. The reported failure reproduces on llvmpipe LLVM 15.0.6, but the change is a workaround for that driver behavior rather than a SPIR-V semantic fix, and the added test passes on the current Linux CI driver without the change. I do not have evidence of incorrect OpSMod behavior on a conformant driver. I will reopen if that evidence becomes available or if this is retained explicitly as a driver-specific workaround.

@MarcZX10 MarcZX10 closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants