shader: interpolate f16 parameter halves (V_INTERP_P1LL_F16, V_INTERP_P2_F16) #1792

Manually merged
github merged 1 commit from gh-pr/1792/head into gh-pr/1792/base 2026-11-26 10:05:55 +00:00
Owner

@⁠Nawid3333 on GitHub · 2026-10-21 16:38 UTC · original
Nawid3333:fix/interp-f16 → main · +181 −75 · 10 files · 1 commits · merged 2026-10-22 02:54 UTC

Anno 1800 Console Edition (PPSA04716) and Assassin's Creed: Black Flag Resynced (PPSA28138) stop with VOP3 opcode=0x342 ... is not implemented (#281). 0x342 is V_INTERP_P1LL_F16: their pixel shaders read one 16-bit half of a parameter word (the raw words in the two logs, [0xd7420015 0x000201c3] and [0xd7420004 0x00020183], decode to v_interp_p1ll_f16 v21, v0, attr3.w high and v_interp_p1ll_f16 v4, v0, attr3.z high).

Change

  • Decode the VOP3 forms of V_INTERP_P1LL_F16 (834) and V_INTERP_P2_F16 (858). SRC0 is {attr_word, attr_chan, attr} (RDNA2 ISA, "Parameter Interpolation on 16-bit data"); the operands follow the VINTRP layout plus the half in src3.
  • Translate them like the f32 forms: P1LL emits nothing, and P2_F16 interpolates the selected half itself (new IR op GetAttributeF16; its SRC2, the P1LL result, is not read) and writes it as f16 into the destination half that op_sel[3] selects; the other half is kept. The RDNA2 ISA text only mentions the low half; op_sel[3] follows LLVM (llvm/llvm-project@64190462 for GFX9, llvm/llvm-project#54793 for GFX10).
  • The host cannot interpolate two halves packed into one word, so a smooth input read this way becomes a per-vertex input and each vertex's half is weighted with the barycentrics (the existing per-vertex path, moved into two helpers that the f32 path also uses; its SPIR-V is unchanged). Flat inputs take the provoking vertex's half.
  • Other modifiers and V_INTERP_P1LV_F16 stay unsupported until a game uses them.

Tests

  • shaderCfgTests: the two instructions from the logs decode to the right VGPR, attribute, channel and half; P2_F16 with and without op_sel[3]; attribute 63 / channel 3 is not read as a literal; op_sel on P1LL, clamp, neg, omod, a source op_sel bit on P2, an SGPR I and P1LV are rejected.
  • ShaderRecompilerComputeTests: F16AttributeInterpolation and F16AttributeInterpolationFlat draw a triangle whose parameter channel 3 holds two f16 values and whose channels 0/1 hold the same values as f32. Both halves are interpolated into one VGPR (the second through op_sel[3]). Each pixel's f16 result must match the f32 interpolation to within one f16 ulp, and on interior pixels the f32 interpolation must match barycentrics computed from the vertex positions (relative error 1e-3); the flat case checks the first and the last provoking vertex exactly.

Results (Windows 11, clang-cl Release, on main 4644c529)

  • shaderCfgTests passes; on main the new decoder test does not compile (the opcodes do not exist there).
  • F16AttributeInterpolation and F16AttributeInterpolationFlat fail on main and pass with this change on an RX 9070 XT and a Ryzen 7600X iGPU, with native and 32-wide host subgroups.
  • Two deliberate breakages are caught: swapping the halves fails both cases, and dropping the per-vertex forcing stops the smooth case at the emitter's per-vertex check.
  • All 811 existing compute suite entries, the 30 graphics cases and the 16 existing checks that need rasterization give the same results with and without this change on both GPUs, and the fragment SPIR-V of the 30 graphics cases is byte-identical.
  • Fork CI: Windows, Linux and macOS build.

I don't have these games, so this is not game-tested; it removes the decoder stop that both logs show.

AI use: written with Claude Code; I reviewed the change and ran the tests above.

**@⁠Nawid3333** on GitHub · 2026-10-21 16:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792) `Nawid3333:fix/interp-f16` → `main` · +181 −75 · 10 files · 1 commits · merged 2026-10-22 02:54 UTC Anno 1800 Console Edition (PPSA04716) and Assassin's Creed: Black Flag Resynced (PPSA28138) stop with `VOP3 opcode=0x342 ... is not implemented` (#281). 0x342 is V_INTERP_P1LL_F16: their pixel shaders read one 16-bit half of a parameter word (the raw words in the two logs, `[0xd7420015 0x000201c3]` and `[0xd7420004 0x00020183]`, decode to `v_interp_p1ll_f16 v21, v0, attr3.w high` and `v_interp_p1ll_f16 v4, v0, attr3.z high`). **Change** - Decode the VOP3 forms of V_INTERP_P1LL_F16 (834) and V_INTERP_P2_F16 (858). SRC0 is `{attr_word, attr_chan, attr}` (RDNA2 ISA, "Parameter Interpolation on 16-bit data"); the operands follow the VINTRP layout plus the half in src3. - Translate them like the f32 forms: P1LL emits nothing, and P2_F16 interpolates the selected half itself (new IR op GetAttributeF16; its SRC2, the P1LL result, is not read) and writes it as f16 into the destination half that op_sel[3] selects; the other half is kept. The RDNA2 ISA text only mentions the low half; op_sel[3] follows LLVM (llvm/llvm-project@64190462 for GFX9, llvm/llvm-project#54793 for GFX10). - The host cannot interpolate two halves packed into one word, so a smooth input read this way becomes a per-vertex input and each vertex's half is weighted with the barycentrics (the existing per-vertex path, moved into two helpers that the f32 path also uses; its SPIR-V is unchanged). Flat inputs take the provoking vertex's half. - Other modifiers and V_INTERP_P1LV_F16 stay unsupported until a game uses them. **Tests** - shaderCfgTests: the two instructions from the logs decode to the right VGPR, attribute, channel and half; P2_F16 with and without op_sel[3]; attribute 63 / channel 3 is not read as a literal; op_sel on P1LL, clamp, neg, omod, a source op_sel bit on P2, an SGPR I and P1LV are rejected. - ShaderRecompilerComputeTests: `F16AttributeInterpolation` and `F16AttributeInterpolationFlat` draw a triangle whose parameter channel 3 holds two f16 values and whose channels 0/1 hold the same values as f32. Both halves are interpolated into one VGPR (the second through op_sel[3]). Each pixel's f16 result must match the f32 interpolation to within one f16 ulp, and on interior pixels the f32 interpolation must match barycentrics computed from the vertex positions (relative error 1e-3); the flat case checks the first and the last provoking vertex exactly. **Results** (Windows 11, clang-cl Release, on main 4644c529) - shaderCfgTests passes; on main the new decoder test does not compile (the opcodes do not exist there). - `F16AttributeInterpolation` and `F16AttributeInterpolationFlat` fail on main and pass with this change on an RX 9070 XT and a Ryzen 7600X iGPU, with native and 32-wide host subgroups. - Two deliberate breakages are caught: swapping the halves fails both cases, and dropping the per-vertex forcing stops the smooth case at the emitter's per-vertex check. - All 811 existing compute suite entries, the 30 graphics cases and the 16 existing checks that need rasterization give the same results with and without this change on both GPUs, and the fragment SPIR-V of the 30 graphics cases is byte-identical. - Fork CI: Windows, Linux and macOS build. I don't have these games, so this is not game-tested; it removes the decoder stop that both logs show. AI use: written with Claude Code; I reviewed the change and ran the tests above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:05:52 +00:00
github manually merged commit 9e7d67e7b7 into gh-pr/1792/base 2026-11-26 10:05:55 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 16:49 UTC · original

Review in Change Stack →

📝 Walkthrough

The change adds decoding and translation for V_INTERP_P1LL_F16 and V_INTERP_P2_F16. It adds the GetAttributeF16 IR opcode, validates its input references, and emits packed half attributes as f32 values using flat selection or smooth barycentric interpolation. Decoder tests cover supported and rejected encodings. Rasterization tests check smooth and flat results, including provoking-vertex selection.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🔵 Low · up to c447e

The new F16 interpolation support works for the standard instruction pairing used by compilers and is covered by decoder and rasterization tests. Shaders that read the P1LL result directly, or that supply non-standard interpolation coordinates, could still get stale or incorrect values. This follows the existing F32 design and is low risk, but the author should either document the limitation or reject those forms in the decoder.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 8 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: adding f16 parameter-half interpolation support for V_INTERP_P1LL_F16 and V_INTERP_P2_F16.
Description check Passed The description directly explains the decoder, translation, emitter, interpolation, unsupported cases, tests, and validation results covered by the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 8 files. (3 skipped: 1 unsupported, 2 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • 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.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 16:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6321498197) <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1792?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> The change adds decoding and translation for `V_INTERP_P1LL_F16` and `V_INTERP_P2_F16`. It adds the `GetAttributeF16` IR opcode, validates its input references, and emits packed half attributes as `f32` values using flat selection or smooth barycentric interpolation. Decoder tests cover supported and rejected encodings. Rasterization tests check smooth and flat results, including provoking-vertex selection. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"c447e145125594c4c43f2ca75d873c177512a642" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🔵 Low</strong> · up to <code>c447e</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `c447e` --> <!-- final_review_risk_coverage:{"sourceCommitId":"c447e145125594c4c43f2ca75d873c177512a642","coveredCommitId":"c447e145125594c4c43f2ca75d873c177512a642","kind":"reviewed"} --> The new F16 interpolation support works for the standard instruction pairing used by compilers and is covered by decoder and rasterization tests. Shaders that read the P1LL result directly, or that supply non-standard interpolation coordinates, could still get stale or incorrect values. This follows the existing F32 design and is low risk, but the author should either document the limitation or reject those forms in the decoder. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-inconclusive-14-v2.svg" width="14" height="14" align="middle" alt="Inconclusive" title="Inconclusive"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 inconclusive</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Inconclusive](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-inconclusive.svg) | Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 8 files. (3 skipped: … | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely identifies the main change: adding f16 parameter-half interpolation support for V_INTERP_P1LL_F16 and V_INTERP_P2_F16. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the decoder, translation, emitter, interpolation, unsupported cases, tests, and validation results covered by the changeset. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 8 files. (3 skipped: 1 unsupported, 2 too large.) **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1792)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 16:49 UTC · original · edited 2026-10-21 16:56 UTC
On src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp line 262 (outdated):

@@ -223,6 +235,38 @@ uint32_t EmitAttribute(EmitterState& state, uint32_t attr, uint32_t chan) {
 	return bits;
 }
 
+// One 16-bit half (high = upper) of a pixel parameter word, interpolated, as f32. Flat inputs take
+// the provoking vertex's half; smooth ones interpolate each vertex's half with the barycentrics.
+uint32_t EmitAttributeF16(EmitterState& state, uint32_t attr, uint32_t chan, bool high) {
+	const auto half_to_f32 = [&](uint32_t bits) {
+		if (high) {
+			const auto shifted = state.builder.AllocateId();
+			state.builder.AddFunction(spv::OpShiftRightLogical, TypeU32(state), shifted, bits,
+			                          ConstantU32(state, 16));
+			bits = shifted;
+		}
+		const auto pair  = state.builder.AllocateId();
+		const auto value = state.builder.AllocateId();
+		state.builder.AddFunction(spv::OpExtInst, TypeF32Vector(state, 2), pair, GlslStd450(state),
+		                          GLSLstd450UnpackHalf2x16, bits);
+		state.builder.AddFunction(spv::OpCompositeExtract, TypeF32(state), value, pair, 0);
+		return value;
+	};
+	const auto* input = InputBindingForParameter(state, attr);
+	if (input == nullptr || input->variable_id == 0 || PixelParameterIsFlat(state, attr)) {
+		return half_to_f32(EmitAttribute(state, attr, chan));
+	}
+	// ShaderInfoCollection makes every smooth input read this way per-vertex: the host cannot
+	// interpolate the two halves of one word, so a non-per-vertex input here is a bug.
+	EXIT_IF(!input->per_vertex);
+	return EmitBarycentricSum(state, [&](uint32_t vertex) {

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect the F16 translation and IR operands without running repository code.
rg -n -C 12 'V_INTERP_P1LL_F16|V_INTERP_P2_F16|GetAttributeF16' \
  src/graphics/shader/recompiler/frontend/translate/Vector.cpp \
  src/graphics/shader/recompiler/frontend/translate/Attribute.cpp \
  src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.inc

Repository: KytyPS5/KytyPS5

Length of output: 10791


🏁 Script executed:

set -e
printf '%s\n' '--- Attribute translation ---'
nl -ba src/graphics/shader/recompiler/frontend/translate/Attribute.cpp | sed -n '1,145p'
printf '%s\n' '--- SPIR-V backend definitions and callers ---'
rg -n -C 18 -F -e 'EmitGetAttributeF16' -e 'EmitAttributeF16' -e 'EmitBarycentricSum' -e 'GetAttributeF16' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler
printf '%s\n' '--- Decoder and interpolation operand declarations ---'
rg -n -C 16 -F -e 'V_INTERP_P1LL_F16' -e 'V_INTERP_P2_F16' -e 'struct Instruction' src/graphics/shader/recompiler | head -n 320

Repository: KytyPS5/KytyPS5

Length of output: 41914


🏁 Script executed:

set -e
printf '%s\n' '--- F16 decoder mapping and validation ---'
rg -n -C 24 -F -e 'attr_word' -e 'attr_chan' -e 'f16 attribute reference' -e 'IsNativeVop3B16' \
  src/graphics/shader/recompiler/frontend/decode src/graphics/shader/recompiler
printf '%s\n' '--- F16 backend consumer ---'
rg -n -C 18 -F -e 'EmitGetAttributeF16' -e 'GetAttributeF16' \
  src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler
printf '%s\n' '--- relevant changed diff ---'
git diff 4644c5292773095b8ee30483aaf6e017bba3c713 -- \
  src/graphics/shader/recompiler/frontend/decode \
  src/graphics/shader/recompiler/frontend/translate/Attribute.cpp \
  src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp

Repository: KytyPS5/KytyPS5

Length of output: 42026


Preserve or reject the F16 interpolation coordinates.

DecodeVop3Interpolation16 accepts the instruction's coordinate VGPR, but V_INTERP_P2_F16 drops inst.src0 and emits only the attribute, channel, and half selector. EmitAttributeF16 then uses the built-in barycentrics. A valid instruction with different coordinates can therefore produce the wrong attribute value. Preserve the coordinate through IR and SPIR-V, or reject unsupported coordinate forms in the decoder.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 16:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#discussion_r4339491370) · edited 2026-10-21 16:56 UTC On `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` line 262 (outdated): ```diff @@ -223,6 +235,38 @@ uint32_t EmitAttribute(EmitterState& state, uint32_t attr, uint32_t chan) { return bits; } +// One 16-bit half (high = upper) of a pixel parameter word, interpolated, as f32. Flat inputs take +// the provoking vertex's half; smooth ones interpolate each vertex's half with the barycentrics. +uint32_t EmitAttributeF16(EmitterState& state, uint32_t attr, uint32_t chan, bool high) { + const auto half_to_f32 = [&](uint32_t bits) { + if (high) { + const auto shifted = state.builder.AllocateId(); + state.builder.AddFunction(spv::OpShiftRightLogical, TypeU32(state), shifted, bits, + ConstantU32(state, 16)); + bits = shifted; + } + const auto pair = state.builder.AllocateId(); + const auto value = state.builder.AllocateId(); + state.builder.AddFunction(spv::OpExtInst, TypeF32Vector(state, 2), pair, GlslStd450(state), + GLSLstd450UnpackHalf2x16, bits); + state.builder.AddFunction(spv::OpCompositeExtract, TypeF32(state), value, pair, 0); + return value; + }; + const auto* input = InputBindingForParameter(state, attr); + if (input == nullptr || input->variable_id == 0 || PixelParameterIsFlat(state, attr)) { + return half_to_f32(EmitAttribute(state, attr, chan)); + } + // ShaderInfoCollection makes every smooth input read this way per-vertex: the host cannot + // interpolate the two halves of one word, so a non-per-vertex input here is a bug. + EXIT_IF(!input->per_vertex); + return EmitBarycentricSum(state, [&](uint32_t vertex) { ``` <!-- coderabbit-ai-generated:v1 --> **🎯 Functional Correctness** | **🟠 Major** | **🏗️ Heavy lift** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Inspect the F16 translation and IR operands without running repository code. rg -n -C 12 'V_INTERP_P1LL_F16|V_INTERP_P2_F16|GetAttributeF16' \ src/graphics/shader/recompiler/frontend/translate/Vector.cpp \ src/graphics/shader/recompiler/frontend/translate/Attribute.cpp \ src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.inc ``` Repository: KytyPS5/KytyPS5 Length of output: 10791 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- Attribute translation ---' nl -ba src/graphics/shader/recompiler/frontend/translate/Attribute.cpp | sed -n '1,145p' printf '%s\n' '--- SPIR-V backend definitions and callers ---' rg -n -C 18 -F -e 'EmitGetAttributeF16' -e 'EmitAttributeF16' -e 'EmitBarycentricSum' -e 'GetAttributeF16' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler printf '%s\n' '--- Decoder and interpolation operand declarations ---' rg -n -C 16 -F -e 'V_INTERP_P1LL_F16' -e 'V_INTERP_P2_F16' -e 'struct Instruction' src/graphics/shader/recompiler | head -n 320 ``` Repository: KytyPS5/KytyPS5 Length of output: 41914 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- F16 decoder mapping and validation ---' rg -n -C 24 -F -e 'attr_word' -e 'attr_chan' -e 'f16 attribute reference' -e 'IsNativeVop3B16' \ src/graphics/shader/recompiler/frontend/decode src/graphics/shader/recompiler printf '%s\n' '--- F16 backend consumer ---' rg -n -C 18 -F -e 'EmitGetAttributeF16' -e 'GetAttributeF16' \ src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler printf '%s\n' '--- relevant changed diff ---' git diff 4644c5292773095b8ee30483aaf6e017bba3c713 -- \ src/graphics/shader/recompiler/frontend/decode \ src/graphics/shader/recompiler/frontend/translate/Attribute.cpp \ src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 42026 --- </details> **Preserve or reject the F16 interpolation coordinates.** `DecodeVop3Interpolation16` accepts the instruction's coordinate VGPR, but `V_INTERP_P2_F16` drops `inst.src0` and emits only the attribute, channel, and half selector. `EmitAttributeF16` then uses the built-in barycentrics. A valid instruction with different coordinates can therefore produce the wrong attribute value. Preserve the coordinate through IR and SPIR-V, or reject unsupported coordinate forms in the decoder. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:69180d3a4e88d45d976f48d7 --> <!-- This is an auto-generated reply by CodeRabbit -->
@ -111,1 +116,3 @@
case Decoder::Opcode::V_INTERP_P1_F32: V_INTERP_P1_F32(); return;
// P2 interpolates the whole attribute, so the P1 halves have nothing to compute.
case Decoder::Opcode::V_INTERP_P1_F32:
case Decoder::Opcode::V_INTERP_P1LL_F16: return;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 16:49 UTC · original · edited 2026-10-21 16:56 UTC

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Write the P1LL intermediate to its destination.

If a shader reads the destination after V_INTERP_P1LL_F16, this return leaves the previous VGPR value in place. The ISA specifies an F32 result of P10 * I + P0. Emit that intermediate even when no P2 instruction follows. (amd.com)

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 16:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#discussion_r4339491388) · edited 2026-10-21 16:56 UTC <!-- coderabbit-ai-generated:v1 --> **🎯 Functional Correctness** | **🟠 Major** | **🏗️ Heavy lift** **Write the P1LL intermediate to its destination.** If a shader reads the destination after `V_INTERP_P1LL_F16`, this return leaves the previous VGPR value in place. The ISA specifies an F32 result of `P10 * I + P0`. Emit that intermediate even when no P2 instruction follows. ([amd.com](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:d870cdc4c37b1df72112d6e1 --> <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 16:49 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dc35d9e6-4115-46d9-8c3e-8376996056a9
📥 Commits

Reviewing files that changed from the base of the PR and between 4644c52927 and c447e145125594c4c43f2ca75d873c177512a642.

📒 Files selected for processing: 11
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h
  • src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h
  • src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp
  • src/graphics/shader/recompiler/frontend/translate/Attribute.cpp
  • src/graphics/shader/recompiler/frontend/translate/Translator.h
  • src/graphics/shader/recompiler/frontend/translate/Vector.cpp
  • src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.inc
  • src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp
  • tests/ShaderRecompilerComputeTests.cpp
  • tests/shaderCfgTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 16:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#pullrequestreview-5603150280) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `dc35d9e6-4115-46d9-8c3e-8376996056a9` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4644c5292773095b8ee30483aaf6e017bba3c713 and c447e145125594c4c43f2ca75d873c177512a642. </details> <details> <summary>📒 Files selected for processing: 11</summary> * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h` * `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h` * `src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp` * `src/graphics/shader/recompiler/frontend/translate/Attribute.cpp` * `src/graphics/shader/recompiler/frontend/translate/Translator.h` * `src/graphics/shader/recompiler/frontend/translate/Vector.cpp` * `src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.inc` * `src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=67c34e4f-8469-41f3-811d-464f2aaf4d2d attempt=42a4476a-bc50-4bca-9f22-1ef592debee0 batch=1/1 -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-21 16:55 UTC · original
On src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp line 262 (outdated):

@@ -223,6 +235,38 @@ uint32_t EmitAttribute(EmitterState& state, uint32_t attr, uint32_t chan) {
 	return bits;
 }
 
+// One 16-bit half (high = upper) of a pixel parameter word, interpolated, as f32. Flat inputs take
+// the provoking vertex's half; smooth ones interpolate each vertex's half with the barycentrics.
+uint32_t EmitAttributeF16(EmitterState& state, uint32_t attr, uint32_t chan, bool high) {
+	const auto half_to_f32 = [&](uint32_t bits) {
+		if (high) {
+			const auto shifted = state.builder.AllocateId();
+			state.builder.AddFunction(spv::OpShiftRightLogical, TypeU32(state), shifted, bits,
+			                          ConstantU32(state, 16));
+			bits = shifted;
+		}
+		const auto pair  = state.builder.AllocateId();
+		const auto value = state.builder.AllocateId();
+		state.builder.AddFunction(spv::OpExtInst, TypeF32Vector(state, 2), pair, GlslStd450(state),
+		                          GLSLstd450UnpackHalf2x16, bits);
+		state.builder.AddFunction(spv::OpCompositeExtract, TypeF32(state), value, pair, 0);
+		return value;
+	};
+	const auto* input = InputBindingForParameter(state, attr);
+	if (input == nullptr || input->variable_id == 0 || PixelParameterIsFlat(state, attr)) {
+		return half_to_f32(EmitAttribute(state, attr, chan));
+	}
+	// ShaderInfoCollection makes every smooth input read this way per-vertex: the host cannot
+	// interpolate the two halves of one word, so a non-per-vertex input here is a bug.
+	EXIT_IF(!input->per_vertex);
+	return EmitBarycentricSum(state, [&](uint32_t vertex) {

This follows the existing f32 forms on main: V_INTERP_P2_F32 also ignores the I/J VGPR and lets the host interpolate the attribute (GetAttribute), and V_INTERP_P1_F32 emits nothing (Attribute.cpp). Using the actual I/J operand (for example centroid or sample barycentrics) would change both forms, so I'd keep that out of this PR.

**@⁠Nawid3333** on GitHub · 2026-10-21 16:55 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#discussion_r4339555247) On `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` line 262 (outdated): ```diff @@ -223,6 +235,38 @@ uint32_t EmitAttribute(EmitterState& state, uint32_t attr, uint32_t chan) { return bits; } +// One 16-bit half (high = upper) of a pixel parameter word, interpolated, as f32. Flat inputs take +// the provoking vertex's half; smooth ones interpolate each vertex's half with the barycentrics. +uint32_t EmitAttributeF16(EmitterState& state, uint32_t attr, uint32_t chan, bool high) { + const auto half_to_f32 = [&](uint32_t bits) { + if (high) { + const auto shifted = state.builder.AllocateId(); + state.builder.AddFunction(spv::OpShiftRightLogical, TypeU32(state), shifted, bits, + ConstantU32(state, 16)); + bits = shifted; + } + const auto pair = state.builder.AllocateId(); + const auto value = state.builder.AllocateId(); + state.builder.AddFunction(spv::OpExtInst, TypeF32Vector(state, 2), pair, GlslStd450(state), + GLSLstd450UnpackHalf2x16, bits); + state.builder.AddFunction(spv::OpCompositeExtract, TypeF32(state), value, pair, 0); + return value; + }; + const auto* input = InputBindingForParameter(state, attr); + if (input == nullptr || input->variable_id == 0 || PixelParameterIsFlat(state, attr)) { + return half_to_f32(EmitAttribute(state, attr, chan)); + } + // ShaderInfoCollection makes every smooth input read this way per-vertex: the host cannot + // interpolate the two halves of one word, so a non-per-vertex input here is a bug. + EXIT_IF(!input->per_vertex); + return EmitBarycentricSum(state, [&](uint32_t vertex) { ``` This follows the existing f32 forms on main: `V_INTERP_P2_F32` also ignores the I/J VGPR and lets the host interpolate the attribute (`GetAttribute`), and `V_INTERP_P1_F32` emits nothing (Attribute.cpp). Using the actual I/J operand (for example centroid or sample barycentrics) would change both forms, so I'd keep that out of this PR.
@ -111,1 +116,3 @@
case Decoder::Opcode::V_INTERP_P1_F32: V_INTERP_P1_F32(); return;
// P2 interpolates the whole attribute, so the P1 halves have nothing to compute.
case Decoder::Opcode::V_INTERP_P1_F32:
case Decoder::Opcode::V_INTERP_P1LL_F16: return;
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-21 16:56 UTC · original

Same model as V_INTERP_P1_F32, which emits nothing on main either: P2 does not read the P1 result, it interpolates the whole value itself.

**@⁠Nawid3333** on GitHub · 2026-10-21 16:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#discussion_r4339557326) Same model as `V_INTERP_P1_F32`, which emits nothing on main either: P2 does not read the P1 result, it interpolates the whole value itself.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 16:56 UTC · original
On src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp line 262 (outdated):

@@ -223,6 +235,38 @@ uint32_t EmitAttribute(EmitterState& state, uint32_t attr, uint32_t chan) {
 	return bits;
 }
 
+// One 16-bit half (high = upper) of a pixel parameter word, interpolated, as f32. Flat inputs take
+// the provoking vertex's half; smooth ones interpolate each vertex's half with the barycentrics.
+uint32_t EmitAttributeF16(EmitterState& state, uint32_t attr, uint32_t chan, bool high) {
+	const auto half_to_f32 = [&](uint32_t bits) {
+		if (high) {
+			const auto shifted = state.builder.AllocateId();
+			state.builder.AddFunction(spv::OpShiftRightLogical, TypeU32(state), shifted, bits,
+			                          ConstantU32(state, 16));
+			bits = shifted;
+		}
+		const auto pair  = state.builder.AllocateId();
+		const auto value = state.builder.AllocateId();
+		state.builder.AddFunction(spv::OpExtInst, TypeF32Vector(state, 2), pair, GlslStd450(state),
+		                          GLSLstd450UnpackHalf2x16, bits);
+		state.builder.AddFunction(spv::OpCompositeExtract, TypeF32(state), value, pair, 0);
+		return value;
+	};
+	const auto* input = InputBindingForParameter(state, attr);
+	if (input == nullptr || input->variable_id == 0 || PixelParameterIsFlat(state, attr)) {
+		return half_to_f32(EmitAttribute(state, attr, chan));
+	}
+	// ShaderInfoCollection makes every smooth input read this way per-vertex: the host cannot
+	// interpolate the two halves of one word, so a non-per-vertex input here is a bug.
+	EXIT_IF(!input->per_vertex);
+	return EmitBarycentricSum(state, [&](uint32_t vertex) {

@⁠Nawid3333 Thanks for clarifying. The F16 path follows the existing F32 interpolation model. My comment treated that shared limitation as a defect specific to this PR. I withdraw the finding.

Using the actual I/J operands should be a separate change for both forms. Would you like a follow-up GitHub issue for that work?


✏️ Learnings added
Learnt from: Nawid3333
Repo: KytyPS5/KytyPS5 PR: 1792
File: src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:262-262
Timestamp: 2026-10-21T16:56:25.037Z
Learning: In src/graphics/shader/recompiler/frontend/translate/Attribute.cpp, V_INTERP_P2_F32 ignores the I/J VGPR and uses GetAttribute, while V_INTERP_P1_F32 emits nothing. F16 interpolation follows this existing host-interpolation model. Support for actual I/J operands, including centroid or sample barycentrics, should be reviewed as a shared F32/F16 enhancement rather than an F16-specific regression.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 16:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#discussion_r4339561489) On `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` line 262 (outdated): ```diff @@ -223,6 +235,38 @@ uint32_t EmitAttribute(EmitterState& state, uint32_t attr, uint32_t chan) { return bits; } +// One 16-bit half (high = upper) of a pixel parameter word, interpolated, as f32. Flat inputs take +// the provoking vertex's half; smooth ones interpolate each vertex's half with the barycentrics. +uint32_t EmitAttributeF16(EmitterState& state, uint32_t attr, uint32_t chan, bool high) { + const auto half_to_f32 = [&](uint32_t bits) { + if (high) { + const auto shifted = state.builder.AllocateId(); + state.builder.AddFunction(spv::OpShiftRightLogical, TypeU32(state), shifted, bits, + ConstantU32(state, 16)); + bits = shifted; + } + const auto pair = state.builder.AllocateId(); + const auto value = state.builder.AllocateId(); + state.builder.AddFunction(spv::OpExtInst, TypeF32Vector(state, 2), pair, GlslStd450(state), + GLSLstd450UnpackHalf2x16, bits); + state.builder.AddFunction(spv::OpCompositeExtract, TypeF32(state), value, pair, 0); + return value; + }; + const auto* input = InputBindingForParameter(state, attr); + if (input == nullptr || input->variable_id == 0 || PixelParameterIsFlat(state, attr)) { + return half_to_f32(EmitAttribute(state, attr, chan)); + } + // ShaderInfoCollection makes every smooth input read this way per-vertex: the host cannot + // interpolate the two halves of one word, so a non-per-vertex input here is a bug. + EXIT_IF(!input->per_vertex); + return EmitBarycentricSum(state, [&](uint32_t vertex) { ``` <!-- coderabbit-ai-generated:v1 --> @⁠Nawid3333 Thanks for clarifying. The F16 path follows the existing F32 interpolation model. My comment treated that shared limitation as a defect specific to this PR. I withdraw the finding. Using the actual I/J operands should be a separate change for both forms. Would you like a follow-up GitHub issue for that work? --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: Nawid3333 Repo: KytyPS5/KytyPS5 PR: 1792 File: src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:262-262 Timestamp: 2026-10-21T16:56:25.037Z Learning: In src/graphics/shader/recompiler/frontend/translate/Attribute.cpp, V_INTERP_P2_F32 ignores the I/J VGPR and uses GetAttribute, while V_INTERP_P1_F32 emits nothing. F16 interpolation follows this existing host-interpolation model. Support for actual I/J operands, including centroid or sample barycentrics, should be reviewed as a shared F32/F16 enhancement rather than an F16-specific regression. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> <!-- <review_comment_withdrawn> --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -111,1 +116,3 @@
case Decoder::Opcode::V_INTERP_P1_F32: V_INTERP_P1_F32(); return;
// P2 interpolates the whole attribute, so the P1 halves have nothing to compute.
case Decoder::Opcode::V_INTERP_P1_F32:
case Decoder::Opcode::V_INTERP_P1LL_F16: return;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 16:56 UTC · original

@⁠Nawid3333 Thanks for clarifying. V_INTERP_P2_F16 performs the full interpolation through GetAttributeF16 without reading the P1 result. Ignoring V_INTERP_P1LL_F16 matches the existing F32 lowering model. I withdraw this finding.


✏️ Learnings added
Learnt from: Nawid3333
Repo: KytyPS5/KytyPS5 PR: 1792
File: src/graphics/shader/recompiler/frontend/translate/Attribute.cpp:124-124
Timestamp: 2026-10-21T16:56:30.123Z
Learning: In KytyPS5/KytyPS5, src/graphics/shader/recompiler/frontend/translate/Attribute.cpp uses combined interpolation lowering: V_INTERP_P1_F32 and V_INTERP_P1LL_F16 emit nothing, while V_INTERP_P2_F32 and V_INTERP_P2_F16 perform the full interpolation without consuming a P1 intermediate. Evaluate these pairs against that lowering model rather than assuming P2 reads a translated P1 result.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 16:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#discussion_r4339561852) <!-- coderabbit-ai-generated:v1 --> @⁠Nawid3333 Thanks for clarifying. `V_INTERP_P2_F16` performs the full interpolation through `GetAttributeF16` without reading the P1 result. Ignoring `V_INTERP_P1LL_F16` matches the existing F32 lowering model. I withdraw this finding. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: Nawid3333 Repo: KytyPS5/KytyPS5 PR: 1792 File: src/graphics/shader/recompiler/frontend/translate/Attribute.cpp:124-124 Timestamp: 2026-10-21T16:56:30.123Z Learning: In KytyPS5/KytyPS5, src/graphics/shader/recompiler/frontend/translate/Attribute.cpp uses combined interpolation lowering: V_INTERP_P1_F32 and V_INTERP_P1LL_F16 emit nothing, while V_INTERP_P2_F32 and V_INTERP_P2_F16 perform the full interpolation without consuming a P1 intermediate. Evaluate these pairs against that lowering model rather than assuming P2 reads a translated P1 result. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> <!-- <review_comment_withdrawn> --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-21 18:39 UTC · original

@⁠Nawid3333 Going forward, we won't accept changes unless they've been properly tested in the game itself (some games use undocumented features). Thanks for understanding. I'll take a look.

**@⁠Nmzik** on GitHub · 2026-10-21 18:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6323689464) @⁠Nawid3333 Going forward, we won't accept changes unless they've been properly tested in the game itself (some games use undocumented features). Thanks for understanding. I'll take a look.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-21 20:25 UTC · original

@⁠Nmzik Understood, thanks. So you have an overview of where our PRs stand:

  • I'm leaving our open PRs as they are and checking them against games now. Where a game I can run (Demon's Souls, ASTRO BOT) or a tester's game uses a change, I'll post a before/after run on that PR.
  • Already run in a game by testers: #1733 (ASTRO BOT on an RTX 5080, no VUID-...-06479), #1609 (Ghost of Yotei: the compute shader that overflowed now translates), #1630 (Demon's Souls gets past the scalar resource reads overlap stop, tested on 099de8d; I'm re-running it on today's main next to #1747).
  • Not run in a game yet: #1554, #1565, #1566, #1567, #1568, #1570, #1573, #1587, #1588, #1598, #1603, #1613, #1619, #1620, #1622, #1679, #1686. Please review them and merge or close them as you see fit. Six of them conflict with main now (#1554, #1567, #1568, #1570, #1619, #1622); I'll rebase any you want to keep.

For this PR: I can't run Anno 1800 or AC Black Flag myself. The P2_F16 destination half (op_sel[3]) follows LLVM, not the RDNA2 ISA text, so a run of the games is the real check for it.

@⁠Crispy81 you posted both opcode=0x342 logs in #281. Could you run the two games with this PR's Windows build and post here whether they get past that error, how far they get, a screenshot, and the _kyty.txt? The build is the KytyPS5-Windows-x64 artifact of https://github.com/KytyPS5/KytyPS5/actions/runs/39636640597 (downloading it needs a GitHub login).

**@⁠Nawid3333** on GitHub · 2026-10-21 20:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6325775904) @⁠Nmzik Understood, thanks. So you have an overview of where our PRs stand: - I'm leaving our open PRs as they are and checking them against games now. Where a game I can run (Demon's Souls, ASTRO BOT) or a tester's game uses a change, I'll post a before/after run on that PR. - Already run in a game by testers: #1733 (ASTRO BOT on an RTX 5080, no `VUID-...-06479`), #1609 (Ghost of Yotei: the compute shader that overflowed now translates), #1630 (Demon's Souls gets past the `scalar resource reads overlap` stop, tested on 099de8d; I'm re-running it on today's main next to #1747). - Not run in a game yet: #1554, #1565, #1566, #1567, #1568, #1570, #1573, #1587, #1588, #1598, #1603, #1613, #1619, #1620, #1622, #1679, #1686. Please review them and merge or close them as you see fit. Six of them conflict with main now (#1554, #1567, #1568, #1570, #1619, #1622); I'll rebase any you want to keep. For this PR: I can't run Anno 1800 or AC Black Flag myself. The P2_F16 destination half (op_sel[3]) follows LLVM, not the RDNA2 ISA text, so a run of the games is the real check for it. @⁠Crispy81 you posted both `opcode=0x342` logs in #281. Could you run the two games with this PR's Windows build and post here whether they get past that error, how far they get, a screenshot, and the `_kyty.txt`? The build is the `KytyPS5-Windows-x64` artifact of https://github.com/KytyPS5/KytyPS5/actions/runs/39636640597 (downloading it needs a GitHub login).
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-21 21:52 UTC · original

Anno 1800 now goes ingame with that fork.

Screenshot 2026-10-22 084804 Screenshot 2026-10-22 084906 Screenshot 2026-10-22 085103
**@⁠Crispy81** on GitHub · 2026-10-21 21:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6327362599) Anno 1800 now goes ingame with that fork. <img width="1917" height="1107" alt="Screenshot 2026-10-22 084804" src="https://github.com/user-attachments/assets/80ae750b-2da1-4b7c-80e9-15fd3299e2f4" /> <img width="1923" height="1112" alt="Screenshot 2026-10-22 084906" src="https://github.com/user-attachments/assets/03fab52b-22dd-44af-8f92-2bd04ace4a0b" /> <img width="1920" height="1107" alt="Screenshot 2026-10-22 085103" src="https://github.com/user-attachments/assets/55b13c4f-5e34-4e47-b874-11075e8bdf23" />
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-21 21:57 UTC · original

Assassin's Creed Black Flag Resynced goes further, but crashes on:

shader resource specialization failed: sampled image descriptor 43 uses unsupported format 20: root=0 source=1 first_use_pc=0xb6c r128=false words=403d1d00,c1400000,0000c000,90900004,00000000,00700000,00000000,00000000 table_source=0 ordinal=21 dense_matches=1 first_candidate_offset=0x46880
--- Build ---
Source build 68af8de
--- Fatal Error ---
Error: condition (!ShaderRecompiler::IR::MaterializeResources( entry->second.resource_plan, runtime, entry->second.resources, entry->second.specialization)) is true in D:\a\KytyPS5\KytyPS5\src\graphics\host_gpu\renderer\pipeline\pipelineCache.cpp:451

_kyty.txt

So the missing opcodes for both games is resolved using your fork.

**@⁠Crispy81** on GitHub · 2026-10-21 21:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6327440060) Assassin's Creed Black Flag Resynced goes further, but crashes on: shader resource specialization failed: sampled image descriptor 43 uses unsupported format 20: root=0 source=1 first_use_pc=0xb6c r128=false words=403d1d00,c1400000,0000c000,90900004,00000000,00700000,00000000,00000000 table_source=0 ordinal=21 dense_matches=1 first_candidate_offset=0x46880 --- Build --- Source build 68af8de --- Fatal Error --- Error: condition (!ShaderRecompiler::IR::MaterializeResources( entry->second.resource_plan, runtime, entry->second.resources, entry->second.specialization)) is true in D:\a\KytyPS5\KytyPS5\src\graphics\host_gpu\renderer\pipeline\pipelineCache.cpp:451 [_kyty.txt](https://github.com/user-attachments/files/33790839/_kyty.txt) So the missing opcodes for both games is resolved using your fork.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-21 21:57 UTC · original

@⁠Crispy81 thanks! For @⁠Nmzik: that build is this PR's CI build (68af8de = c447e14 merged into main 4644c52), and with it Anno 1800 gets past the opcode=0x342 stop into the game (menus and the first island in the screenshots above).

@⁠Crispy81 if you get a chance, AC Black Flag with the same build would cover the second log.

**@⁠Nawid3333** on GitHub · 2026-10-21 21:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6327450844) @⁠Crispy81 thanks! For @⁠Nmzik: that build is this PR's CI build (68af8de = c447e14 merged into main 4644c52), and with it Anno 1800 gets past the `opcode=0x342` stop into the game (menus and the first island in the screenshots above). @⁠Crispy81 if you get a chance, AC Black Flag with the same build would cover the second log.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-21 21:58 UTC · original

@⁠Crispy81 our comments crossed, thanks for both. So with this PR both games get past the opcode=0x342 stop: Anno 1800 into the game, AC Black Flag up to a different error (sampled image descriptor 43 uses unsupported format 20, a 32-bit uint image format). That one isn't part of this PR; I'll look at it separately.

**@⁠Nawid3333** on GitHub · 2026-10-21 21:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6327469400) @⁠Crispy81 our comments crossed, thanks for both. So with this PR both games get past the `opcode=0x342` stop: Anno 1800 into the game, AC Black Flag up to a different error (`sampled image descriptor 43 uses unsupported format 20`, a 32-bit uint image format). That one isn't part of this PR; I'll look at it separately.
Author
Owner

@⁠Nmzik on GitHub · 2026-10-22 02:53 UTC · original

@⁠Nawid3333 Thanks for PR
@⁠Crispy81 Thanks for real test

**@⁠Nmzik** on GitHub · 2026-10-22 02:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6331519422) @⁠Nawid3333 Thanks for PR @⁠Crispy81 Thanks for real test
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-22 21:12 UTC · original

@⁠Crispy81 thanks, that log helps. The last shader it compiles before the stop is pixel shader 0x079e2c9885c6ba38, so that's most likely the one. Its image 43 is a 4x4 texture in format 20 (32-bit unsigned integer, from the descriptor words in your message). MaterializeResources refuses a sampled integer image in two cases: when the format has no numeric class, which isn't the case here, or when the shader samples it with a depth comparison. So my guess is that the shader does a shadow-compare sample on this small integer texture, but I can't confirm that without the shader itself.

Could you run it once more with --graphics-debug-dump and attach this one file (zipped)? It's in _Shaders/original/, and its name ends in _new_shader_ps_079e2c9885c6ba38.bin. It's the game's original shader binary, a small file. If it isn't there, a zip of the whole _Shaders/original folder works too. With it I can see exactly how image 43 is used.

**@⁠Nawid3333** on GitHub · 2026-10-22 21:12 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6351421708) @⁠Crispy81 thanks, that log helps. The last shader it compiles before the stop is pixel shader `0x079e2c9885c6ba38`, so that's most likely the one. Its image 43 is a 4x4 texture in format 20 (32-bit unsigned integer, from the descriptor words in your message). `MaterializeResources` refuses a sampled integer image in two cases: when the format has no numeric class, which isn't the case here, or when the shader samples it with a depth comparison. So my guess is that the shader does a shadow-compare sample on this small integer texture, but I can't confirm that without the shader itself. Could you run it once more with `--graphics-debug-dump` and attach this one file (zipped)? It's in `_Shaders/original/`, and its name ends in `_new_shader_ps_079e2c9885c6ba38.bin`. It's the game's original shader binary, a small file. If it isn't there, a zip of the whole `_Shaders/original` folder works too. With it I can see exactly how image 43 is used.
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-22 21:38 UTC · original

I don't understand what you mean by --graphics-debug-dump. Where's that option in the launcher gui?

**@⁠Crispy81** on GitHub · 2026-10-22 21:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6351883495) I don't understand what you mean by --graphics-debug-dump. Where's that option in the launcher gui?
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-22 21:41 UTC · original

@⁠Crispy81 sorry, my mistake: --graphics-debug-dump is a command-line option of the emulator, and the launcher doesn't have it. There's an easier way that the launcher does have:

  1. In the configuration window, open the Debug tab and set Shader logging: to File (it's Silent in your current log).
  2. Run the game to the same crash.
  3. The log then contains the decoded instructions of every shader it compiles. The one I need is the last decoded RDNA2 block in the file, right before the line ShaderRecompiler PS phase begin: stage=PS hash=0x079e2c9885c6ba38 CFG BuildGraph. You can attach the whole _kyty.txt zipped (it gets bigger with this setting), or just copy that block.

No hurry, though: I'm getting the game myself too, so if it's a hassle, skip it.

**@⁠Nawid3333** on GitHub · 2026-10-22 21:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6351939691) @⁠Crispy81 sorry, my mistake: `--graphics-debug-dump` is a command-line option of the emulator, and the launcher doesn't have it. There's an easier way that the launcher does have: 1. In the configuration window, open the **Debug** tab and set **Shader logging:** to **File** (it's Silent in your current log). 2. Run the game to the same crash. 3. The log then contains the decoded instructions of every shader it compiles. The one I need is the last `decoded RDNA2` block in the file, right before the line `ShaderRecompiler PS phase begin: stage=PS hash=0x079e2c9885c6ba38 CFG BuildGraph`. You can attach the whole `_kyty.txt` zipped (it gets bigger with this setting), or just copy that block. No hurry, though: I'm getting the game myself too, so if it's a hassle, skip it.
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-22 21:43 UTC · original

No, no hassle at all. Do I do this on main or the fork you created? I noticed when I set the log for shaders as file, there is no _Shaders folder created, does it need to be manually created?

**@⁠Crispy81** on GitHub · 2026-10-22 21:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6351968806) No, no hassle at all. Do I do this on main or the fork you created? I noticed when I set the log for shaders as file, there is no _Shaders folder created, does it need to be manually created?
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-22 21:48 UTC · original

@⁠Crispy81 thanks! Use the same build as before (68af8de), so it stops at the same place. Main has #1792 since today too, but it also has other changes since then that could move the stop.

You don't need the _Shaders folder: with this setting the instructions go into _kyty.txt, the same log as before. _Shaders is only written by that command-line dump option, so it's normal that it isn't created.

**@⁠Nawid3333** on GitHub · 2026-10-22 21:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6352054679) @⁠Crispy81 thanks! Use the same build as before (68af8de), so it stops at the same place. Main has #1792 since today too, but it also has other changes since then that could move the stop. You don't need the `_Shaders` folder: with this setting the instructions go into `_kyty.txt`, the same log as before. `_Shaders` is only written by that command-line dump option, so it's normal that it isn't created.
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-22 21:52 UTC · original

_kyty.zip

**@⁠Crispy81** on GitHub · 2026-10-22 21:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6352117224) [_kyty.zip](https://github.com/user-attachments/files/33846167/_kyty.zip)
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-23 17:16 UTC · original

@⁠Crispy81 I have a fix for the Black Flag stop from your log (sampled image descriptor 43 uses unsupported format 20): PR #1867.

The shader at 0xb6c does a depth-compare sample (image_sample_c_lz, like a shadow lookup) on a 4x4 texture whose format is 32-bit unsigned integer (format 20). Kyty only allowed compares on float textures, so it stopped. With the fix it compares the texel bits as a 32-bit float depth, the same way it handles float depth textures. A test that uses the format, size and tiling words from your log (words 1-3 of the descriptor) fails without the change with the same unsupported format 20 error and passes with it, on an RX 9070 XT and a Ryzen iGPU.

I couldn't check it in the game myself: on my copy (01.006.038, same as yours) it hung on the first-launch image calibration page, so I never got past it.

Test build (upstream main 9dcff95 + the fix): https://github.com/Nawid3333/KytyPS5/actions/runs/39988770637
The Windows download is the KytyPS5-Windows-x64 artifact at the bottom of that page (needs a GitHub login). The window title shows Fork build Nawid3333/KytyPS5 b586514.

Could you start a new game with it and say where it stops now (the last Shaders: line and the error, or how far you get)?

**@⁠Nawid3333** on GitHub · 2026-10-23 17:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6370571972) @⁠Crispy81 I have a fix for the Black Flag stop from your log (`sampled image descriptor 43 uses unsupported format 20`): PR #1867. The shader at 0xb6c does a depth-compare sample (`image_sample_c_lz`, like a shadow lookup) on a 4x4 texture whose format is 32-bit unsigned integer (format 20). Kyty only allowed compares on float textures, so it stopped. With the fix it compares the texel bits as a 32-bit float depth, the same way it handles float depth textures. A test that uses the format, size and tiling words from your log (words 1-3 of the descriptor) fails without the change with the same `unsupported format 20` error and passes with it, on an RX 9070 XT and a Ryzen iGPU. I couldn't check it in the game myself: on my copy (01.006.038, same as yours) it hung on the first-launch image calibration page, so I never got past it. Test build (upstream main 9dcff95 + the fix): https://github.com/Nawid3333/KytyPS5/actions/runs/39988770637 The Windows download is the `KytyPS5-Windows-x64` artifact at the bottom of that page (needs a GitHub login). The window title shows `Fork build Nawid3333/KytyPS5 b586514`. Could you start a new game with it and say where it stops now (the last `Shaders:` line and the error, or how far you get)?
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-23 20:02 UTC · original

Gets the menus now. Selected my options, then it gets to the loading screen, then just exits, with no error message.

Screenshot 2026-10-24 070018

_kyty.zip

**@⁠Crispy81** on GitHub · 2026-10-23 20:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1792#issuecomment-6373640320) Gets the menus now. Selected my options, then it gets to the loading screen, then just exits, with no error message. <img width="1920" height="1110" alt="Screenshot 2026-10-24 070018" src="https://github.com/user-attachments/assets/fb854bbc-9692-462e-bcc0-4d18d93b8243" /> [_kyty.zip](https://github.com/user-attachments/files/33889145/_kyty.zip)
This discussion has been locked. Commenting is limited to contributors.
No description provided.