Repository navigation
pvr/g5p: A8 follow-ups: float ge select, gl_FragCoord.z/w, R8 LOAD, cube samples - #19
Merged
Merged
Conversation
A float ge select was the lt compare/write with the ge relation extension (`.. 59 61 00 10`) and an inverse move. No A8 capture from Apple's compiler has that extension, and the A8 ignores it: on the iPod touch 6 a fragment select of a >= b (a varying against a constant, and step(0.0, gl_FragCoord.x)) gave the lt result at every pixel, while the plain lt select next to it in the same program was right. On the A8, compare lt and swap the two selected values, as the integer ge select already does, in both stages. With this, every ge case of a 33-case set of small GLES programs (varying, uniform and gl_FragCoord operands, mix() of a boolean, step() in the vertex stage) reads back right on the iPod touch 6; the one remaining failure reads gl_FragCoord.z/w (next commit). An unordered compare now selects the true value, where ge selects the false one. PVR_A8_FGE_SWAP=0 gives the extension form back. Generated-by: LLM
gl_FragCoord.z and .w were read with the A9's position iterator (`08 09 ..`). No A8 capture has it, and on the iPod touch 6 it reads 0: gl_FragCoord.w, gl_FragCoord.z, and WebRender's clipped text (do_clip(), uv times gl_FragCoord.w) all came out 0. Apple's A8 compiler (iOS 12.4, Metal fragment functions returning position.w, position.z, both, and a perspective varying times position.w) reads them with the ordinary A8 varying iterator, screen linear (no perspective bit), from the same W/Z coefficient sets. Each captured program drew the expected value on the A8. The PDS DOUTI items and TA_OUTPUT_SEL in those captures are the words we already emit, so only the USC instruction changes: set 0 (W, or Z alone): 18 09 DD 00 Apple's W read, byte for byte set 1 (Z after W): 18 09 DD 01 04 00 inferred The set-1 f32 form is not captured: Apple reads Z and W there as one f16 pair (`18 11 ..`). Ours is the f32 screen-linear shape that Apple's varying reads at other sets take (byte 3 bit 0 announcing the slot byte set << 2). Both components are kept in f32. A read of both sets in one instruction is refused by name on the A8; nothing emits it. The captured set-0 form has not yet been run under this driver on the device; the device check is the same programs that read 0 before. PVR_A8_POS_ITER=0 gives the A9 form back. Generated-by: LLM
Apple's load program for an R8Unorm target with loadAction Load (iOS 12.4, AGXMetalA8) is the BGRA8 load program up to the wait after its sample, then a zero into half 1 (88 01 01 01 01 01 20 01 28 01 39 00) and the one-word emitpix (1c 11 00 09 00 82) and END, as R8's clear and fragment programs end. Its background data is the BGRA8 load's: the target's texture state, the read sampler 00000fff 02022400 and the identity matrix, by the same three DOUTDs (10000004 10008004 90010006), common store size 14. The end-of-tile word (0x002f0002) and PBE swizzle (0x968) are R8's store ones. The program is uploaded on first use, so the device's other allocations keep their addresses. A linear R8 target and RG8 stay refused. PVR_A8_R8_LOAD=0 refuses the R8 LOAD as before. Generated-by: LLM
Apple compiles a cube sample whose result feeds arithmetic (iOS 12.4, AGXMetalA8, sample * constant) as the narrow cube sample with byte 1 0x79, the 32-bit result form of the 2D sample: 1a 79 00 41 00 01 c8 01 00 01 00 80, then the wait 4d 00 and the ALU reading the four 32-bit results. The direction setup before it is the narrow form's. Take it in Apple's single-image layout (image at common dword 0, sampler at dword 4). A cube sample in the multi-image layout is refused by name with its image and sampler positions: that form is not captured. PVR_A8_CUBE_ALU=0 refuses the 32-bit form as before. Generated-by: LLM
Apple compiles a fragment program that samples a 2D texture and a cube through one shared sampler (iOS 12.4, AGXMetalA8, 2D at texture 0, cube at texture 1, sampler 0) in its multi-image layout: the two image states DMA'd to common 0..7 by one eight-dword DOUTD (10000008), the sampler to 8..11 (10010004). The samples are 1a b9 00 41 00 01 88 01 00 01 00 80 2D, image dword 0, sampler slot 2 4d 04 1a b9 0a 41 08 01 c8 01 08 01 00 80 cube, image dword 4, sampler slot 2 4d 00 so the cube sample in this form is the 2D multi-image sample with mode 4 in byte 6 (0xc8 over 0x88), as the single-image form carries it over 0x80. Byte 8 is the coordinate register in both, byte 2 the result. Take it when a program that samples a cube names one sampler for every image (a separate sampler): the images in their four-dword slots, that sampler in the slot after them, the cube sample in the slot form. The cube path now orders samples of different images as the 2D path does (4d 04 before a sample of another image while one is outstanding); where our schedule already waited with 4d 00, it stays 4d 00. One cube after other common data (images from slot 1) takes the same rule. Programs without a cube keep their layout. A sampler per texture with a cube, and a narrow cube result in this layout, are not captured and stay refused by name. PVR_A8_CUBE_SLOTS=0 refuses it as before. Generated-by: LLM
Apple compiles a fragment program that samples a 2D texture and a cube, each through its own sampler (iOS 12.4, AGXMetalA8, 2D at texture 0, cube at texture 1, samplers 0 and 1 with distinct states), in its multi-image layout with a sampler per texture: the two image states DMA'd to common 0..7 by one eight-dword DOUTD (10000008), the two samplers to 8..15 by another (10010008). The samples are 1a b9 00 41 00 01 88 01 00 01 00 80 2D, image dword 0, sampler slot 2 4d 04 1a f9 0a 41 08 01 c8 01 08 01 00 80 cube, image dword 4, sampler slot 3 4d 00 so the cube sample names its own sampler's slot exactly as a 2D sample in this layout does; slot and mode fields compose. This is the shape GL programs take through Zink (a combined sampler per texture). Take a cube in the per-texture form the planner already uses for 2D programs (texture j's sampler in slot N + j). A narrow cube result in the multi-image layout, and the planner's shared fallback (texture 0's sampler for images that name distinct samplers), stay refused by name. PVR_A8_CUBE_SLOTS=0 refuses it as before. Generated-by: LLM
henrikklee
marked this pull request as ready for review
November 24, 2026 15:18
Contributor
|
Merged, thanks Berkay! All six commits landed as they were, so the A8 now gets the float I took it out of draft to merge it: the switches give the old behaviour back, and the R8 and cube forms only replace refusals. The device runs you listed are still open, though. Could you run the gl_FragCoord.z/w, R8 LOAD and cube programs on the iPod touch 6 from main and tell us how they went? If one of them misbehaves, a follow-up PR is fine. Nothing was changed on top. Your head is tagged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups for the A8 (Apple T7000, iPod touch 6) after #18. Each change replaces a form that the A8 runs wrongly, or that was refused, with the form Apple's A8 compiler emits (iOS 12.4). Each is on by default on the A8 only, with a
PVR_A8_*=0switch back to the old behaviour, as the existing A8 forms have. Every change is under the A8's flags. The A9 and A10 paths are unchanged by source; there was no A9 run.Fixes:
PVR_A8_FGE_SWAP)... 59 61 00 10), which no A8 capture contains. A>=select ran as<on the iPod touch 6.PVR_A8_POS_ITER).08 09 ..) reads 0 on the A8.18 09 DD 00, byte for byte as captured. The DOUTI items and TA_OUTPUT_SEL already match Apple's.18 09 DD 01 04 00). Apple reads that set as an f16 pair. WebRender never reads.z.New forms (previously refused):
PVR_A8_R8_LOAD): Apple's R8 load program and background, from a capture of an R8Unorm target with loadAction Load. A linear R8 target and RG8 stay refused.PVR_A8_CUBE_ALU): Apple's 32-bit result form of the cube sample (byte 10x79), in the single-image layout.PVR_A8_CUBE_SLOTS): Apple's multi-image layout, with one shared sampler or one sampler per texture, which is the shape GL programs take through Zink. The cube sample is the 2D slot form with mode 4 (0xc8). A capture with three 2D textures and a cube at texture 3 confirms the high-slot form. Shapes beyond the two captured ones (more images, other slots) compose fields that are each captured elsewhere. A narrow cube result next to other images stays refused by name.Testing:
mainon 252 workloads: Qt Quick and WebRender shaders, GLES smoke tests, texture/PBO/vertex-texture checks, and Vulkan cube rungs.Generated-by: LLM
Draft until the iPod touch 6 run of the gl_FragCoord.z/w, R8 LOAD and cube forms is in.
🤖 Generated with Claude Code