Repository navigation
feat(agc): apply the color logic operation of CB_COLOR_CONTROL - #9348
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
AMD run and a source for the ROP3 reading. Head Host: Windows 11 (10.0.26300), Ryzen 5 9600X, WinLibs GCC 15.2.0, Release. GPUs: NVIDIA RTX 5070 Ti (617.42) and AMD Radeon RDNA2 iGPU
On the reading of the code ("no register documentation confirms the pattern operand is the source color"):
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
@wachi35676 thank you for the AMD run, the negative control and the register reference. Both points are in ce5950d (rebased onto main a6646f8).
Rerun on main a6646f8 with this head (RTX 5090, validation layer 1.4.363 on the four tests marked V): AI-assisted: yes. Written with AI assistance and reviewed by me. |
b142ad1 to
ce5950d
Compare
The driver refused every ROP3 code but copy, so a draw that asks for a logic operation stopped the process. The code is decoded into the draw state, keyed in the pipeline cache and the pipeline journal, and applied through the Vulkan logic operation of the color blend state. The field accepts the 28 codes of the source and destination form and of the brush and destination form, where the brush is the shader color; both keep their function in bits 0, 1, 6 and 7. A code that combines source and brush, blending together with a logic operation, a device without the logicOp feature, and a color target that is not a normalized or integer format throw. The pipeline journal format moves to 7. AI-assisted: yes. Written with AI assistance and reviewed by me.
ce5950d to
191ddda
Compare
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head 191ddda. The ROP3 decoding is confined to the documented source/brush forms; pipeline state, cache key, register decode key, and journal codec all include the operation, and unsupported blend/format/device combinations fail explicitly. The added tests exercise the logic-op byte results, code mapping/refusal, and journal format; the PR reports zero Vulkan validation VUIDs on the listed Windows/NVIDIA runs. Local diff check, conventions, and test-registration checks pass. I could not run the AGC executable in this host: the available older AnyPS5 test binary aborts before startup because this CPU lacks required x86 extensions. The PR reports the new tests cannot be built on main because State::colorRop is absent there; hosted product jobs are skipped. The Cyberpunk title behavior remains unverified, as the PR states.
encodeState and decodeState carry colorRop, which changes the recipe codec. Main's journal format is already 9, so the bump to 9 this branch made is a no-op; use 10.
The pipeline journal guards State and ShaderStages, which this branch extends. The recipe codec and canonical state now carry the hull wave size, the geometry stage after tessellation, the merged hull flag (TessellationConfiguration keeps its size, so its guard can't see it) and rasterizer discard, and the journal format becomes 12 (main took 5 for the recipe codec change of boykopovar#5656, 6 for the polygon modes of boykopovar#7869, 7 for the truncated coverage of boykopovar#8115, 8 for the point lists of boykopovar#6801 9 for the 4_4_4_4 UNORM target merges of boykopovar#8564 and 10 for the colour logic operation of boykopovar#9348; boykopovar#8365 uses 11, and the number is set to main+1 when this lands). A draw's tessellation capture validates against that draw's capture buffers, which a replay doesn't have, so it isn't journaled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pipeline journal guards State and ShaderStages, which this branch extends. The recipe codec and canonical state now carry the hull wave size, the geometry stage after tessellation, the merged hull flag (TessellationConfiguration keeps its size, so its guard can't see it) and rasterizer discard, and the journal format becomes 12 (main took 5 for the recipe codec change of boykopovar#5656, 6 for the polygon modes of boykopovar#7869, 7 for the truncated coverage of boykopovar#8115, 8 for the point lists of boykopovar#6801 9 for the 4_4_4_4 UNORM target merges of boykopovar#8564 and 10 for the colour logic operation of boykopovar#9348; boykopovar#8365 uses 11, and the number is set to main+1 when this lands). A draw's tessellation capture validates against that draw's capture buffers, which a replay doesn't have, so it isn't journaled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pipeline journal guards State and ShaderStages, which this branch extends. The recipe codec and canonical state now carry the hull wave size, the geometry stage after tessellation, the merged hull flag (TessellationConfiguration keeps its size, so its guard can't see it) and rasterizer discard, and the journal format becomes 12 (main took 5 for the recipe codec change of boykopovar#5656, 6 for the polygon modes of boykopovar#7869, 7 for the truncated coverage of boykopovar#8115, 8 for the point lists of boykopovar#6801 9 for the 4_4_4_4 UNORM target merges of boykopovar#8564 and 10 for the colour logic operation of boykopovar#9348; boykopovar#8365 uses 11, and the number is set to main+1 when this lands). A draw's tessellation capture validates against that draw's capture buffers, which a replay doesn't have, so it isn't journaled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Module records are SPIR-V and take almost all of a journal's bytes, so APS5_PIPELINE_JOURNAL_MAX_MIB fills with modules and later pipelines are not recorded (boykopovar#8309). A module record now keeps its identity, stage and encoded size, followed by a zstd frame (level 1) of the encoded result; EncodeModule writes it, and loading and replay expand it before decoding. The journal format becomes 11: main is at 10 (8 for the point lists of boykopovar#6801, 9 for the 4_4_4_4 UNORM targets of boykopovar#8564, 10 for the colour logic operation of boykopovar#9348). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Module records are SPIR-V and take almost all of a journal's bytes, so APS5_PIPELINE_JOURNAL_MAX_MIB fills with modules and later pipelines are not recorded (boykopovar#8309). A module record now keeps its identity, stage and encoded size, followed by a zstd frame (level 1) of the encoded result; EncodeModule writes it, and loading and replay expand it before decoding. The journal format becomes 11: main is at 10 (8 for the point lists of boykopovar#6801, 9 for the 4_4_4_4 UNORM targets of boykopovar#8564, 10 for the colour logic operation of boykopovar#9348). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
CB_COLOR_CONTROLcarries a ROP3 code in bits 16 to 23. The driver accepted only the copy code (0xcc) and threw for every other one, so a draw that asks for a color logic operation stopped the process. The code is now decoded into the draw state (State::colorRop), keyed in the pipeline cache key and in the pipeline journal, and applied through the Vulkan logic operation of the color blend state. The device enables thelogicOpfeature when it has it.Cyberpunk 2077 (PPSA03974) stops with this about 31 minutes into a session, after character creation:
AGC graphics: only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x005a0010, mode normal)ROP3 0x5a with mode normal.
Reading of the code:
CB_COLOR_CONTROL.ROP3takes 28 codes, in two forms: source and destination (pqrspqrs, 0xcc is copy) or brush and destination (pqpqrsrs, the brush is the shader color), as the R6xx 3D register reference describes the field and Mesa'sROP3enum lists (both quoted by wachi35676 in this PR; I could not open them myself). In both forms bits 7:6 and 1:0 hold the same function, soLogicOpFromRopreads bits 0, 1, 6 and 7. That makes 0xcc copy, 0x66 and 0x5a XOR, 0x88 and 0xa0 AND, 0xee and 0xfa OR.Throws rather than guessing:
logicOpfeatureThe pipeline journal file format moves from 6 to 7 because the state it stores gains a field. #8365 and #8542 change the line that holds that constant, so whichever of them merges second needs a trivial rebase.
Tested
Windows 11 (10.0.26200), NVIDIA GeForce RTX 5090, driver 617.42, WinLibs GCC 15.2.0, Release, on
maina6646f8. Vulkan validation layer 1.4.363 (VK_LAYER_KHRONOS_validation, inserted for the instance in the run),ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1.agc_driver_color_logic_op(tests/execution/ColorLogicOp.cpp): fills a 64x16 R8G8B8A8 target with a byte pattern, draws a covering triangle that exports (0.2, 0.4, 0.6, 0.8) (bytes 0x33, 0x66, 0x99, 0xcc) with ROP 0xcc, 0x5a, 0x88, 0xee and 0xcc again, and checks every byte against copy, XOR, AND, OR and copy. Passes. It skips on a device withoutlogicOp.agc_driver_graphics: new decode cases (0x5a0010 decodes tocolorRop0x5a andVK_LOGIC_OP_XOR, the copy code decodes as copy, fourteen ROP3 codes map to the expected operation, exactly 28 of the 256 codes are accepted, 0x5b is refused, a logic operation with blending throws). Passes. The existing check thatCB_COLOR_CONTROL0xcc0013 is refused with "copy ROP" still passes.agc_driver_color1555_target,agc_driver_packed_unorm_color_target,agc_driver_dual_source_blend,agc_driver_reversed_order_blend. All pass.agc_driver_graphics,agc_driver_color_logic_op,agc_driver_color1555_targetandagc_driver_dual_source_blendproduced 0VUID-.mainthe new tests cannot be built becauseState::colorRopdoes not exist. Whatmaindoes with the draw is the message above, taken from the game log.agc_pipeline_journal,agc_pipeline_journal_long_pathsandagc_pipeline_journal_extended_paths(journal format 7): pass.python tools/check_conventions.py --base origin/main: passed.I have not run the game on this build yet, so I do not claim it gets past the stop in the title or that the XOR output looks right there; the tests show the logic operation is applied to the target bytes as specified.
Checklist
main; no other open PR implements the same functions (the overlap check lists file overlaps only).mdfiles or images added to the repositoryAI-assisted: yes. Written with AI assistance and reviewed by me.