Repository navigation
asahi/apple9: native OpenGL ES 3.1 on M4 - #6
Open
LiamTheCreat0r wants to merge 1517 commits into
Open
LiamTheCreat0r wants to merge 1517 commits into
LiamTheCreat0r wants to merge 1517 commits into
Conversation
GL clamps integer texels to the range of the packed type on readback, but the formatless download FS stored the texel unclamped. An image store of an integer the format can't represent is undefined in Vulkan and wraps on Honeykrisp (Zink: KHR-GL46.packed_pixels.pbo_rectangle integer formats, e.g. 145 read as GL_BYTE gave -111, not 127). When a source component can exceed a destination component, use a download FS keyed by the storing format and clamp to its component ranges, as the compute download path already does. This also adds the clamp to the format-keyed download shaders used by drivers without formatless stores, so integer PBO downloads change for every gallium driver: spec-correct, since GL clamps on readback. Generated-by: LLM
…ring format's range st/pbo: integer downloads through the PBO compute/fragment path now clamp to the destination format's range instead of wrapping. On Zink this fixes the 19 integer PBO readback cases in the Zink CTS run. Evidence: merge gate PASS, candidate 9c6da17c70e = e51cc0a + this patch + tc-split-zs-load, same patch IDs as the branch tips. Integer PBO 19/19 fixed on candidate only; 0 base-Pass -> candidate-non-Pass on Zink (7,932 -> 7,952 Pass) and native (3,197 = 3,197); 0 new hard kernel lines.
…s driver render splits gallium/tc: when a driver splits a render pass, a full depth clear no longer leaves the following part depending on a load of the old contents, so the clear stays writable. Updates u_tc_renderpass_test accordingly. Fixes the Zink depth-blit case in the CTS. Evidence: merge gate PASS, tested together with st-pbo-int-clamp as 9c6da17c70e; same patch IDs. Depth blit 1/1 fixed on candidate only; no base-Pass -> candidate-non-Pass changes on Zink or native; 0 new hard kernel lines.
Render merging keeps a render open across a barrier that only orders attachment access, as tiles already order it. It also counted input attachment reads as attachment access, excluding only depth/stencil, whose comment notes they are not read from the tilebuffer. Neither is colour: hk lowers all input attachments to image reads. A colour-output -> input-attachment barrier then left the render open, and the next pass, continuing it, read its input attachment from memory the tiles had not stored yet. Zink emulates KHR_blend_equation_advanced with framebuffer fetch through input attachments, so a draw followed by a blend barrier and an advanced-blend draw read stale contents (dEQP-GLES3 draw_buffers_indexed.overwrite_* with advanced equations, failing or passing depending on whether a folded clear left the render open; on device tests/fbfetch read the attachment's old white instead of the clear and draw). End the open render for any input attachment read. hk-pregfx-recording used that barrier as its kept-barrier example; it now keeps a colour attachment read barrier. hk-render-merge checks the colour case. Generated-by: LLM
hk_defer_empty_barriers defers barriers after a clear-only render kept open, so the next matching render consumes the clears in tiles. It ran before hk_cmd_sync_barrier and ignored access masks, so a colour -> input attachment barrier was deferred and the input attachment's image read missed the clear: the HK_APPLE9_FOLD_EMPTY_CLEARS path of the Zink advanced-blend failures. Do not defer a barrier whose destination scope includes input attachment reads, directly or as a fragment-stage memory read; the render-merge check uses the same filtered test. hk-empty-clear-barriers checks both forms end the clear-only render. Generated-by: LLM
hk: construct native null descriptors without legacy translation (afafdbbb403), and hk/tests: compare native null descriptor bytes through every writer (df6cc2c4737), cherry-picked from apple9/native-null-descriptors-20261023 onto integration-next. Only the two null paths change: missing image planes in hk_apple9_pack_sampled_image, and null uniform texel buffers. The branch's dfe0f4fefba and 98237199960 are left out: they repair the same integration breaks e51cc0a already fixed here. Device evidence (PASS on 98237199960): 411 CTS cases per arm identical (315 Pass, 96 NotSupported), no warnings, status changes or faults; null-update CPU sampled 1.63-1.68x, texel 1.70-2.20x faster, UBO unchanged; ER frame CPU neutral within noise.
…ting prep_fb_attachment records whether the depth attachment is in the read-only layout, which zink_clear checks before clearing depth inside a render. Attachments prepared while blitting returned early and left the flag describing the previous depth buffer. With explicit layouts (Honeykrisp, or ZINK_DEBUG=nogeneral elsewhere), a deferred scissored depth clear flushed into such a render then saw a stale read-only flag, left the render pass from inside zink_batch_rp, and crashed (KHR-GLES3.framebuffer_blit.multisampled_to_singlesampled_blit_depth_config_test: SIGSEGV on hk; the general_layout assertion in zink_clear on lavapipe with ZINK_DEBUG=nogeneral). Update the flag from the attached image in the blitting path too. Generated-by: LLM
hk: separate draw table updates from raster preparation (14248d1). When only the descriptor root changes, a cached draw now updates its resource tables in place through agx_apple9_update_draw_tables_alloc. It rebuilds only the affected stage launches and copies the canonical PPP record to a fresh allocation only when the fragment launch changed. Previously it copied the whole prepared draw and re-ran full raster preparation. GPU allocations stay immutable; CPU state commits only after every allocation succeeds. Evidence: - host: 60/60 release + assertion suites; new unit test, 1,920 updates byte-identical to full preparation (allocation order included) and 1,200 failure cases; 158/158 Vulkan command/BO captures and 33/33 GL command buffers byte-identical; strict instruction + APPLE9_INFO identity for 7,008 shaders + 11 state-only entries. - device: all 2,304 pixel checks pass, every normal comparison completed. Normal CPU is neutral to slightly better (Zink main thread -0.01 ms/frame of 1.35). The diagnostic stage failed its own baseline counter-window check (harness, not candidate), so no diagnostic timing is claimed. Merged as a structural refactor on correctness evidence; there is no measurable device CPU win at this scale.
…e blitting zink: keep zsbuf_readonly current for attachments prepared while blitting (56fa7ce). prep_fb_attachment's blitting early return left zsbuf_readonly describing the previous depth buffer. With explicit layouts (hk always), a deferred scissored depth clear flushed into the blit render saw a stale read-only flag and left the render pass from inside zink_batch_rp: the class E SIGSEGV in KHR-GLES3.framebuffer_blit.multisampled_to_singlesampled_blit_depth_config_test. Evidence: base crashes 5/5, candidate passes 5/5; 0 regressions in 2,423 cases (one base crash fixed); no hard kernel lines. Host: lavapipe ZINK_DEBUG=nogeneral asserts before and passes after; 750 blit/clear/msaa cases pass in default and nogeneral modes.
Every Apple9 draw stored its draw index in the root descriptor table and marked the root dirty when it changed. A multi-draw therefore re-uploaded the whole root (776 bytes) for each of its draws even when no shader reads the draw index. Zink turns consecutive identical GL draws into vkCmdDrawMultiIndexedEXT through the threaded context, so dEQP-GLES2.performance.blend's 100k+ draws per frame spent most of its main command pool on roots and hit the 3 GiB cap with frames in flight (native GL: 0.4 KB per draw; hk: about 1.5 KB on device). Record per API shader whether it reads the draw index (scanned from its NIR at creation, serialized with the other per-object fields), and update the root's draw index only when a bound graphics stage reads it, in the cached, full and software-stage draw paths. Mesh draws keep writing it. Unread roots then compare equal and reuse the last upload. Host (no-op shim): drawstorm 10k identical draws, main pool 7.77 MB -> 10 KB; with gl_DrawIDARB read, the root is still updated per draw. Generated-by: LLM
hk: end a kept-open render at colour input attachment barriers (c54e182) and hk: do not defer input attachment barriers after clear-only renders (898aa10). hk lowers input attachments to image reads, never tile reads. Render merging kept a render open across a colour-output -> input-attachment barrier, and the empty-clear fold deferred such a barrier after a clear-only render, so the continuing pass read memory the tiles had not stored. Any barrier whose filtered destination scope includes input attachment reads now ends the open render and is never deferred. Fixes Zink's framebuffer-fetch emulation of advanced blending (dEQP-GLES3 draw_buffers_indexed.overwrite_* with advanced equations; tests/fbfetch draw variants). Evidence: default 108/108 both arms; HK_APPLE9_FOLD_EMPTY_CLEARS=0 3/3 reps: base fails all 6 advanced-blend cases, candidate passes all 6 and all 6 fbfetch variants; 0 base-Pass -> candidate-non-Pass, no hard kernel lines. Air VK input-attachment run PASS, 0 blockers, 0 unstable of 1,664.
With primitive restart, direct indexed draws count input-assembly vertices and primitives in libagx_increment_ia_restart, which reads the first index from the third word of the draw descriptor as in VkDrawIndexedIndirectCommand. hk uploaded 0 there, so the kernel scanned the indices from the start of the bound range instead of the draw's own (KHR-GL46.pipeline_statistics_query_tests_ARB.functional_primitives_vertices_submitted_and_clipping_input_output_primitives on Zink: 7 vertices submitted instead of 6 with restart enabled, for every primitive type and indexed draw call). Pass the draw's first index. Generated-by: LLM
Apple9 advertised 128 geometry input components but at most 122 vertex and evaluation output components, the hardware export budget. A geometry shader sized to the input limit then needs a producer that cannot link: KHR-GL46/GLES31/GLES32 geometry_shader.limits.max_input_components on Zink failed with "31 > 30" vertex output vectors. Advertise maxGeometryInputComponents equal to the output limit (Vulkan and GL require 64). On the host shim the CTS case now links and reaches its result check. Generated-by: LLM
…ss H) hk: keep the root draw index unless a bound stage reads it (a3668e4). Every Apple9 draw stored its draw index in the root table and dirtied it, so a multi-draw re-uploaded the 776-byte root per draw even when nothing read it. Zink turns identical GL draws into vkCmdDrawMultiIndexedEXT, so dEQP-GLES2.performance.blend ran out of command memory. Per-shader reads_draw_id is recorded at creation and serialized; the root draw index is updated only when a bound stage reads it (value-compared, so readers always see the right index). Evidence: perf.blend 10/10 OOM at 3 GiB on base -> 10/10 Pass at ~2.1 GB; drawstorm peaks 2-5x lower; regress 411/411 both arms. Air vk-drawid PASS (0 blockers of 9,152). The gate's FAIL is tests/drawid single-draw mode failing 3/3 on both arms (pre-existing; multi-draw passes 3/3 on both), followed up separately.
hk: count restart-aware IA statistics from the draw's first index (ba4f4d2). libagx_increment_ia_restart reads the first index from word 2 of the draw descriptor, as in VkDrawIndexedIndirectCommand; direct draws uploaded 0, so the scan started at the bound range's base. Evidence: the KHR-GL46 pipeline_statistics restart targets pass 3/3 on candidate, 0/3 on base, 0 regressions; Air CTS portion 2,838 = 2,838. Not complete for native VK: vkstats (firstIndex 8, six indices plus one restart) counts 0 on base and 7 on candidate (expected 6); the restart marker is still counted. Follow-up.
hk: limit Apple9 geometry inputs to what a producer can export (c830936). maxGeometryInputComponents now equals the 122-component VS/TES export limit instead of 128, so a GS sized to the input limit has a producer that links (geometry_shader.limits.max_input_components on GL46/GLES31/GLES32). Evidence: targets pass 3/3 on candidate, 0/3 on base, 0 regressions; Air CTS portion clean.
zink_set_last_vertex_key() only set last_vertex_stage_dirty, which does not make a draw update the program, so a changed push_drawid or clip_halfz was applied only once something else dirtied the shaders Generated-by: LLM cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45224> (cherry picked from commit f043b2c)
libagx_increment_ia_restart bounds its loads by agx_draw_index_range_el, which for direct draws counts from the draw's first index, so the index pointer must also start there (agx_draw_index_buffer), with first index 0 in the descriptor. ba4f4d2 instead put the first index in the descriptor and kept the binding base, so loads past the start-relative range read the binding's first element: with firstIndex 8 and restart padding before it, native Vulkan counted all 7 indices of a restart draw (tests/vk/vkstats on the Air: 7 IA vertices, expected 6). Indirect draws already pass the binding base, a full range and firstIndex in word 2. Fixes: ba4f4d2 ("hk: count restart-aware IA statistics from the draw's first index") Generated-by: LLM
Upstream cherry-pick f043b2c (Mike Blumenkrantz, mesa-stable) as c09d7ab, authorship kept. zink_set_last_vertex_key only set last_vertex_stage_dirty, which does not make the next draw update the program; when the threaded context merged separate glDrawElements into a multi-draw, a push_drawid flip left the DrawIndex-reading VS bound and gl_DrawID read hk's incrementing draw index (tests/drawid single mode). Evidence: mini PASS (tests/drawid single and multi); host lavapipe single and multi pass.
Use the native Apple9 shaders, descriptors and dispatch path for G17P. Place its caller render-state arena above the initial Neo TVB reservation, and identify native test devices by chip and device type. Protected Neo a6883c3 and shared ea8c2e772 pass native render controls and identical cold Vulkan compute, uncompressed draw and sampling tests. Document the compressed-rendering failure reproduced on both kernels; this is not full Vulkan qualification. (cherry picked from commit f2c1ef83973c19b3c7fb0fdc5779fb9e1712ddf3) [port to integration-next: kept integration-next code in the 5 conflicted files and renamed every agx_is_g16() use to agx_is_apple9(), folding the explicit G17P alternatives into it.]
(cherry picked from commit 6eab39bc91e99a2eeb0c77ae334136f7ffb6d53d) [port to integration-next: kept the new entry flush ahead of integration-next's pre-graphics sync-event insertion in hk_cmd_buffer_get_cs_general.]
Allow instance counts and repeated fenced submissions while retaining the same command buffer, device, queue, and resources. Poison readback for every generation and check every pixel. Optional FIFO gating permits controlled two-client submission tests; defaults retain the original workload. (cherry picked from commit 7e6ee44fb6863037d88e0cfc156850fde5130e04)
Accept the truthful S variant and use the compact 4 GiB render-context window shared with G16C. Classify Pro with the existing G16C ISA and graphics implementation instead of spoofing G. Validation: complete ARM64 Vulkan/Zink build; updated Mesa on M4 Max with two-client DMA-BUF/DCP presentation at 119.5 fps, native PB pressure and full-copy checks. Pro hardware is untested. (cherry picked from commit 4c576f3559acf3bf6513af7b4d654d42d1219e38) [port to integration-next: chip selection moved earlier in agx_open_device; applied the S variant there.]
The full CDM barrier at every compute stream entry fixed compressed readback after rendering on G17P. G16 has no known failure that needs it, and the barrier includes the drain bit, so keep G16 streams as before. Generated-by: LLM
Bring the release-only changes back so the next release cut from integration-next keeps them: the Apple9 Vulkan device is exposed by default, the driconf-defaults warning, the compiler knob cleanups and the research-harness removal. Conflict in hk_physical_device.c: keep integration-next's agx_is_apple9() family check (G16C/G16S/G17P) with the release line's default-on HK_EXPERIMENTAL_APPLE9, and use the same family check for the defaults warning.
A context keeps each submitted batch, with its encoders and pools, until the batch is reaped. New batches take unused slots before reaping, and a submit reaped at most two completed batches, so a context that ever had many batches in flight kept up to AGX_MAX_BATCHES (128) of them. Each held a 512 KiB VDM encoder and three 256 KiB pool slabs (the Apple9 context pool adds the third), while a typical desktop batch uses about 130 bytes of VDM stream and 17 KiB of pool memory. A Plasma shell context settled at ~100 retained batches, about 125 MiB pinned per context. - Pools grow geometrically from 16 KiB to 256 KiB slabs instead of allocating a 256 KiB slab up front, as turnip's and freedreno's growable streams do. - VDM encoders start at 16 KiB; full streams already link to continuation buffers. CDM encoders keep 512 KiB because compute batches flush when their stream is full. - After a submit, reap every completed batch instead of at most two. Generated-by: LLM
GL batch pools grow from 16 KiB to 256 KiB slabs instead of starting at 256 KiB, VDM encoders start at 16 KiB (CDM keeps 512 KiB), and a submit reaps every completed batch rather than at most two. Plasma shell drops from 43-128 MB to about 5 MB of GPU memory. Driver-side only; codegen identity unchanged.
On Apple9 the texture transfer mode is DEFAULT, so glReadPixels and texture maps of imported buffers read the BO directly from the CPU. agx_prepare_for_map only synced this context's writers, so a reader in another process could see a buffer another process was still rendering. KRdp hit this: it downloads each KWin screencast dma-buf with glReadPixels right after KWin's glFlush, and under GPU load from a game it captured frames with an unfinished, tile-ragged band (popups missing, the window below showing through). Wait on the dma-buf's implicit fences for shared BOs: writers before a CPU read, writers and readers before a CPU write. Generated-by: LLM
…ae2d7b) Fixes torn KRdp/screencast captures: CPU readback of a shared dma-buf now waits for its implicit fences.
… memory hk_defer_render_wait() lets a render's tiling start before earlier renders' fragment work finishes when its pre-rasterization stages cannot observe that work. The rule assumed vertex pipelines never store, but vertexPipelineStoresAndAtomics is exposed on G16 (and to DXVK/vkd3d), and the classifier only looks at loads. A vertex, task or mesh shader that stores or runs atomics after a FRAGMENT_SHADER -> VERTEX_SHADER barrier could then overwrite memory an earlier render's fragment shader had not yet read (write-after-read) or written (write-after-write). Mark draws whose bound pre-rasterization shaders write memory and never elide their render's tiling wait. Transform feedback, tessellation and geometry already keep it. HK_TILING_ELISION_STATS counts these renders as "stores". Generated-by: LLM
Render 1's fragment shader spins and then reads a buffer into its attachment; after a FRAGMENT_SHADER -> VERTEX_SHADER barrier, render 2's vertex shader stores to that buffer. Every pixel must see the old value. Each round uses a fresh device, since the first render pair of a queue is the one the tiling-wait elision could reorder. On the M4 mini, 8 of 20 rounds failed before the tiling-wait fix and 0 of 20 after it, and 0 of 20 with the elision disabled. Generated-by: LLM
asahi-agx2-fails.txt is upstream's expected-failure list for M1-class CI. Restore its upstream content and move the M4 (G16) expectations to asahi-m4-fails.txt, which the M4 runner now reads instead, so nothing carried here changes M1 CI expectations. Generated-by: LLM
Every process that enumerated Vulkan devices (vulkaninfo, Steam, every game) printed "WARNING: experimental Apple9 Honeykrisp; not conformant" to stderr. The conformance version in VkPhysicalDeviceDriverProperties already reports that the implementation is not conformant. Generated-by: LLM
DXVK and vkd3d run with border emulation disabled (driconf), so the first sampler with a custom border colour printed six lines to stderr saying the border would be wrong. On G16 the hardware applies a custom border with a known format natively, so the warning is false there. Print it only when the border really needed emulation. Generated-by: LLM
HK_ABORT_BEFORE_SUBMIT and HK_NULL_SUBMIT were looked up in the environment on every queue submit. Read each once, as the other hk debug options are. Generated-by: LLM
-Dhk-gpu-busy-counters defaulted to true, so every build carried the collector, although its documentation says the option defaults off. With HK_GPU_BUSY_FILE unset every entry point already returns before touching a command or allocating anything, so compiling the counters out does not change what the driver records or submits. Default the option to false; measurement builds keep enabling it with -Dhk-gpu-busy-counters=true. Generated-by: LLM
Scalar exports complete in the publication namespace. A GPR instruction which overwrites one of their borrowed inputs must not consume that completion through its own GPR dependency field. Check publication consumers before the generic ordering-only shortcut. This emits a standalone wait before GPR reuse while keeping folded waits for the matching varying, grid-export and coverage consumers. Exercise the physical completion pass and packer with both scalar export forms, ALU and load overwrites, and one through six pending publications. Keep the physical allocation fixed and retain shared inputs between the publishers so allocation cannot hide the missing handoff. Generated-by: LLM
Apple9 compute resources carry only base addresses, so GL shaders that
take the length of an unsized SSBO array were rejected by the bounded
compiler ("buffer compiler encountered unsupported NIR") and the draw
aborted.
Lower get_ssbo_size to a load from a small per-dispatch table of bound
SSBO range sizes, bound as the internal UBO AGX_APPLE9_SSBO_SIZE_BINDING
(65) next to the graphics sysval binding. The table is uploaded only for
dispatches whose compiled profile references it.
dEQP-GLES31 (MESA_GLES_VERSION_OVERRIDE=3.1, T8132):
ssbo.array_length + compute.basic.*unsized*: 4/10 -> 10/10
compute + ssbo + atomic_counter: 2538 -> 2545 pass, no new failures
(remaining 9 crashes are storage images and the empty dispatch)
meson test --suite asahi: 113/113
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gallium handed the Apple9 compute compiler unlowered image_load, image_store, image_atomic and image_size intrinsics, which it rejects, so every compute shader using a storage image aborted the draw. Lower them in gallium before compiling, following Honeykrisp's hk_apple9_lower_storage_image: texel addresses come from libagx and a legacy PBE descriptor, bounds from the texture descriptor, and accesses become bounds-checked global loads, stores and atomics. Out-of-bounds loads return zero (one in missing alpha), stores are dropped and atomics return zero. Image barriers become global-memory barriers. Each dispatch uploads a table of per-slot (texture, PBE, buffer record) entries, published through the internal UBO binding AGX_APPLE9_IMAGE_TABLE_BINDING (66). Apple9 buffers live in the USC aperture, beyond the legacy descriptors' 40-bit address field, so buffer images use the record (64-bit address, element count) instead. Unused parts of a slot are null so a binding of the wrong kind fails the bounds check rather than reaching memory. The software addressing does not decode lossless compression, so Apple9 now also decompresses compressed images bound for reading, not only for writing. dEQP-GLES31 (MESA_GLES_VERSION_OVERRIDE=3.1, T8132): image_load_store: 0/747 -> 735/747 (12 skips: early_fragment_tests need fragment-stage images) compute: 186/195 -> 194/195 (remaining: basic.empty) compute, ssbo, atomic_counter, image_load_store, synchronization, stencil_texturing: no new failures, no kernel faults meson test --suite asahi: 113/113 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Apple9 compute compiler reports agx_apple9_compute_without_effects for a program with no stores, atomics or other observable effects. Gallium treated it as a compile failure and the dispatch aborted. Honeykrisp instead keeps an empty shader and runs nothing. Do the same: compile such a shader to an empty part and return early from agx_launch_grid. Storage image accesses are lowered to global memory before this check, so image-writing shaders are not mistaken for effect-free ones. dEQP-GLES31 (MESA_GLES_VERSION_OVERRIDE=3.1, T8132): compute: 194/195 -> 195/195 compute, ssbo, atomic_counter, image_load_store, stencil_texturing, synchronization, draw_indirect: 3607 pass, 33 skip, 0 fail/crash, no GPU faults Co-Authored-By: Claude Opus 5.5 <[email protected]>
bcd5c9b disabled framebuffer_no_attachment along with other features during Apple9 bring-up. Zero-attachment renders have since taken the empty-tile path (README.apple9-es3.md): fragment launches accept zero color tile bytes and no dummy color resource is allocated. Expose the capability. It is required for GLES 3.1. dEQP-GLES31 (MESA_GLES_VERSION_OVERRIDE=3.1, T8132): fbo.no_attachments: 0/72 -> 72/72 (verified with occlusion queries inside and outside the default size, including multisampled defaults); whole fbo group: 77 pass, 41 skips that need unadvertised extensions dEQP-GLES3 fbo + occlusion_query (no override): identical to the unmodified driver, 2143 cases Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stencil-only sampler views sample the separate S8_UINT resource (agx_create_sampler_view), which the Apple9 texture path supports, but agx_is_format_supported checked the logical X24S8_UINT/X32_S8X24_UINT view format against the Apple9 sampler formats and rejected it. That hid ARB_stencil_texturing (required for GLES 3.1), ARB_texture_stencil8 and OES_texture_stencil8. Check the format actually sampled instead. dEQP-GLES31 (MESA_GLES_VERSION_OVERRIDE=3.1, T8132), against the unmodified base built with the same options: stencil_texturing: 11 pass, 3 skip -> 14/14 fbo + texture + stencil_texturing: no regressions; 6 border_clamp cases on stencil formats now pass dEQP-GLES3 (no override): identical to the unmodified driver except a timing-dependent flush_finish warning Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a geometry shader can emit nothing (max_vertices = 0, or fewer input
vertices than one primitive needs), the rasterization draw that follows
the GS compute pass has zero vertices or instances. Apple9 direct render
cannot encode that and asserts in agx_draw_vbo_inner. The GS has already
run for transform feedback and queries, so return before the raster draw.
Reachable from desktop GL 3.3 as well. With GLES 3.1 exposed,
dEQP-GLES31.functional.geometry_shading.emit.*_emit_0_* and
input.triangle_strip_adjacency.vertex_count_{1..5}: 20 Crash -> Pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Apple9 rasterizer delivers the layer to the fragment layer system
value rather than as a varying, and the bounded render signature check
rejected fragment shaders reading VARYING_SLOT_LAYER. Lower such reads to
load_layer_id & 0xffff, as Honeykrisp's hk_apple9_lower_layer_viewport_fs
does, handling both deref and lowered-IO forms since the gallium Apple9
fragment path compiles the early (variable-based) NIR.
With GLES 3.1 exposed, dEQP-GLES31.functional.geometry_shading.layered.
fragment_layer_{2d_array,3d,cubemap}: 3 Fail -> Pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS and GL_MAX_GEOMETRY_ATOMIC_COUNTER*
were gated on the desktop ARB_shader_storage_buffer_object and
ARB_shader_atomic_counters extensions. ES 3.1 has both features in core
even when a driver exposes them only for compute (so the ARB extensions,
which need fragment-stage support, stay off), and OES_geometry_shader
defines these queries. Accept ES 3.1 too, matching what
EXTRA_EXT_SHADER_IMAGE_GS already does for MAX_GEOMETRY_IMAGE_UNIFORMS.
Fixes GL_INVALID_ENUM in dEQP-GLES31.functional.geometry_shading.query.
max_geometry_{shader_storage_blocks,atomic_counters,atomic_counter_buffers}
and shaders.builtin_constants.geometry_shader.max_geometry_atomic_counter*
on asahi Apple9 (ES 3.1 with compute-only storage).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Vertex and fragment shaders already report zero SSBOs and images on Apple9, but geometry shaders inherited the full limits. Storage in the emulated GS path is not wired up: dEQP-GLES31.functional.shaders. opaque_type_indexing.atomic_counter.const_*_geometry read back wrong counter values once the GS limits became queryable. Report none for the geometry stage too until graphics-stage storage is implemented. Desktop GL 3.3 does not expose SSBOs or images, so this only affects ES 3.1 with OES_geometry_shader, where zero is a valid limit. The affected dEQP cases (GS storage indexing, and program_interface_query reflection cases that use GS storage) now report NotSupported instead of failing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Raise essl_feature_level to 310. The ES 3.1 rule in version.c needs storage buffers, images and atomic counters only in compute shaders, which the Apple9 GL compute path now supports (earlier commits in this series); vertex, fragment and geometry stages report none, which ES 3.1 allows. framebuffer_no_attachments and stencil texturing are already exposed. Desktop GL stays at 3.3. ES 3.1 also enables OES_geometry_shader, OES_texture_buffer, OES_texture_cube_map_array, OES_shader_io_blocks and OES_primitive_bounding_box, which require ES 3.1; the geometry-shader issues this uncovered are fixed earlier in the series. Full dEQP-GLES31 (aosp mustpass, 37802 cases), this series natively vs. the unmodified driver with MESA_GLES_VERSION_OVERRIDE=3.1 / MESA_GLSL_VERSION_OVERRIDE=310: base: Pass 27805, Fail 197, Crash 1132, Skip 8668 new: Pass 30550, Fail 102, Crash 338, Skip 6812 Skip -> Pass 1856, Crash -> Pass 794, Fail -> Pass 95, no regressions. The remaining crashes are all texture buffers (a pre-existing assertion: the Apple8 texture path packs USC-aperture buffer addresses into a 40-bit descriptor field) and the remaining failures are texture.border_clamp; both fail identically on the unmodified driver. dEQP-GLES2 is identical to the unmodified driver, and dEQP-GLES3 matches the installed system driver. No asahi kernel faults during the runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Native OpenGL ES 3.1 on M4 (G16G) through the gallium Apple9 path. Desktop GL stays at 3.3.
Stacking
This PR is stacked on #4 and #5:
2e1aa7e.New commits
ES 3.1 also turns on extensions that require it:
OES_geometry_shader,OES_texture_buffer,OES_texture_cube_map_array,OES_shader_io_blocksandOES_primitive_bounding_box. Geometry shaders had been reachable only from desktop GL 3.3, and dEQP-GLES31 found the following:a02abbaskip empty Apple9 geometry-shader raster draws: a GS that can emit nothing produced a zero-vertex raster draw, which Apple9 direct render asserts on. This is reachable from desktop GL 3.3 too. 20 Crash→Pass.518eeablower fragment gl_Layer reads on Apple9 GL: the layer reaches fragment shaders as the layer system value, not a varying, as in Honeykrisp'shk_apple9_lower_layer_viewport_fs. 3 Fail→Pass.442d392mesa: allow GS SSBO and atomic limit queries on ES 3.1: these queries were gated on the desktop ARB extensions, which stay off when storage exists only in compute. The change matches whatEXTRA_EXT_SHADER_IMAGE_GSalready does. It's a generic core fix and may be worth sending to freedesktop Mesa.d620b48report no geometry-stage storage on Apple9 GL: storage in the emulated GS path isn't wired up (GS atomic counters read back wrong values), so GS now reports zero SSBOs and images, like VS and FS. ES 3.1 allows zero.49fd993expose GLES 3.1 on Apple9 GL: setsessl_feature_level = 310.Testing
Tested on a J713 (MacBook Air M4, T8132), Gravity Linux 44.
Full dEQP-GLES31 (AOSP mustpass, 37,802 cases): this branch running natively, compared with the unmodified
f66f380(assertions on) forced to ES 3.1 withMESA_GLES_VERSION_OVERRIDE=3.1 MESA_GLSL_VERSION_OVERRIDE=310:f66f380+ overridetexture.border_clamp.f66f380.Other checks:
meson test --suite asahipasses 113/113.kwin_waylandsession.🤖 Generated with Claude Code