Skip to content

wrapper: emulate VK_EXT_depth_clip_enable and expose the EXT name of rasterization order attachment access for GL - #66

Merged
utkarshdalal merged 2 commits into
wrapper-25from
wrapper-depth-clip-enable
Nov 20, 2026
Merged

utkarshdalal merged 2 commits into
wrapper-25from
wrapper-depth-clip-enable

Conversation

@utkarshdalal

@utkarshdalal utkarshdalal commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On Mali-G615 (driver r44p1, Vulkan 1.3.247, Vivo T4x 5G) zink gives OpenGL 3.1 only, and 3.2 core and compatibility context requests fail. The one GL 3.2 requirement missing there is GL_ARB_depth_clamp: Mesa maps it to PIPE_CAP_DEPTH_CLIP_DISABLE, and zink reports that only when the device lists VK_EXT_depth_clip_enable. The Mali driver does not list the extension, but it has depthClamp.

zink also recognizes only the name VK_EXT_rasterization_order_attachment_access, which it needs for coherent framebuffer fetch. Mali-G68 r38p1 and Mali-G710 r36p0 list only VK_ARM_rasterization_order_attachment_access; Mali-G615 r44p1 and G715 r48 list both.

Change

Depth clip enable

Without the extension, the driver clips against the depth planes exactly when depthClampEnable is false. So a driver with depthClamp can express what a VkPipelineRasterizationDepthClipStateCreateInfoEXT asks for.

The wrapper now does this when the base driver lacks the extension, has depthClamp, and the client is not DXVK or vkd3d:

  • It lists VK_EXT_depth_clip_enable and reports depthClipEnable. It reports extendedDynamicState3DepthClipEnable as unsupported, because the dynamic state is not emulated.
  • At device creation the extension is not passed to the driver. Its feature struct is unlinked from the chain before the feature masking runs, so the caller's own depthClipEnable stays set.
  • At pipeline creation, for every pipeline or library that owns pre-rasterization state, the depth clip struct is removed from a copy of the rasterization state, and depthClampEnable is set to !depthClipEnable. Clamping is only used when the device enabled depthClamp. The caller's structs are not modified.

D3D clients, drivers that have the extension, and drivers without depthClamp behave as before. WRAPPER_EMULATE_DEPTH_CLIP_ENABLE=0 turns the emulation off.

Clip off with clamp off becomes clamp on. That is the closest the driver can do, and it is what DXVK does without the extension.

Rasterization order attachment access

The EXT extension promoted the ARM one unchanged: in vk.xml the feature struct, its sType, the color blend and depth stencil pipeline create flags and the subpass description flags are all aliases with the same values.

When the driver lists the ARM name but not the EXT name, the wrapper now also lists VK_EXT_rasterization_order_attachment_access:

  • The three rasterizationOrder*AttachmentAccess feature bits are the driver's own values. The wrapper's feature query always chains the struct, and the driver fills it through the ARM extension because the sType is the same.
  • At device creation an enabled EXT name is passed to the driver as the ARM name. The feature struct stays in the chain. Pipeline and subpass flags need no translation.

Drivers that list the EXT name, or neither name, behave as before. This applies to every client, like the existing vertex_attribute_divisor alias: DXVK and vkd3d-proton do not use the extension, and it reports only what the driver supports.

Testing

Run on BrowserStack devices with the wrapper from #66 (wrapper-gamenative-20261120.tzst, sha256 4443e109...43ff) and the guest libGL from #67 (extra_libs-20261120.tzst, sha256 6f4914c0...44bc, reports git-9b8c6bf6f8), X11, xlib zink, no version or extension overrides. A WGL test program requests each context version, then draws and reads pixels back: depth clamp on and off (19 cases), all eight packed 10/10/10/2 vertex formats with plain, instanced and interleaved layouts (59 cases), and dual-source blending with every src1 factor and equation, constant color, color masks, sRGB, RGBA16F, RGB565, the default framebuffer, overlapping primitives in one draw, 4x MSAA and alpha-to-coverage (63 cases). The testbed's GL texture suite runs as a second step.

Device Driver GL with shipped parts GL with both changes Packed formats Dual-source blending Depth clamp GL texture suite
Vivo T4x 5G Mali-G615 r44p1, Vulkan 1.3 3.1 4.0 59/59 63/63 19/19 12/12
Galaxy A35 Mali-G68 r38p1, Vulkan 1.3 not run 4.0 59/59 63/63 19/19 12/12
Pixel 7 Mali-G710 r36p0, Vulkan 1.1 3.1 4.0 59/59 63/63 19/19 12/12
Pixel 9 Mali-G715 r48p0 3.2 4.0 59/59 63/63 (native) 19/19 12/12
Pixel 10 PowerVR DXT-48-1536 4.6 (earlier run) 4.6 59/59 (native) 63/63 (native) 19/19 12/12
Galaxy S24 Xclipse 940 4.6 (earlier run) 4.6 55/59 (native, see below) 63/63 (native) 19/19 12/12
Galaxy M32 Mali-G57 r26p0, Vulkan 1.1 3.1 3.2 59/59 (through the extension) not offered see below 12/12
  • "Shipped parts" is wrapper-gamenative-20261027 with extra_libs-20261104.
  • Galaxy M32 stays at 3.2: the driver has no dualSrcBlend, no rasterization order attachment access and no queue timestamps (GL_ARB_timer_query).
  • After 4.0 the Mali phones stop at 4.1 (GL_ARB_viewport_array, maxViewports is 1).

Found during these runs and not caused by these changes (both reproduce with the shipped parts):

  • Pixel 7 and Galaxy M32: after glReadPixels(GL_DEPTH_COMPONENT, GL_FLOAT) on a 24-bit depth renderbuffer, later draws to that framebuffer no longer show in readbacks. Integer reads, other depth formats and a new framebuffer work.
  • Pixel 9: after a draw with src1 blend factors and a shader that writes only one color (undefined in GL), every later readback is zero.
  • Galaxy S24: the four packed-format failures are one layout. The last four bytes of a vertex buffer that ends exactly at the last attribute read as zero, whichever attribute is stored there; four bytes of padding avoid it. The shipped parts give the same 55/59.

D3D regression

The testbed's D3D acceptance suite (D3D11 through DXVK, D3D12 through vkd3d-proton, five configurations) ran with the same two archives. Values are pass/fail/skip.

Device DXVK async DXVK 2.7.1 vkd3d 2.14 vkd3d 3.0b BCn on CPU
Galaxy A35 93/0/4 69/0/28 89/0/8 89/0/8 69/0/28
Pixel 7 73/0/24 69/0/28 88/1/8 88/1/8 69/0/28
Vivo T4x 5G 93/0/4 69/0/28 89/0/8 89/0/8 69/0/28
Pixel 10 91/0/6 69/0/28 89/0/8 89/0/8 69/0/28
  • No new failure against the results recorded for wrapper-gamenative-20261027. The one failure is the recorded Pixel 7 case (d3d12 rgba8_heap_top).
  • Four cells differ from the recorded counts by one or two cases. Each is the load_bc*_2048_final case, which skips when its background stage does not finish in 10 s.
  • No device lost and no wrapper error lines.
  • The suite's GL cases run in the same process as the D3D cases, so the wrapper log lines for the depth clip emulation and for the enabled rasterization order extension cannot be assigned to one client from these logs. That DXVK and vkd3d-proton do not take either new path is from the code, not measured separately.

Not covered: no game was run on these devices, only the test programs. On Adreno only the libGL change was run (results in #67); the wrapper change was not. The GL 4.0 features that are now reachable on Mali (tessellation, doubles) were not drawn.

Utkarsh Dalal added 2 commits November 20, 2026 10:23
…ers with depthClamp

zink exposes GL_ARB_depth_clamp only with VK_EXT_depth_clip_enable, and that extension is the last missing GL 3.2 requirement on Mali-G615 r44p1: zink gives OpenGL 3.1 there and 3.2 core and compatibility context requests fail. The driver does not list the extension but has depthClamp.

Without the extension the driver clips against the depth planes exactly when depthClampEnable is false. When the base driver lacks the extension, has depthClamp and the client is not DXVK or vkd3d, the wrapper now lists VK_EXT_depth_clip_enable with depthClipEnable and reports extendedDynamicState3DepthClipEnable as unsupported. At device creation the extension is not passed to the driver and its feature struct is unlinked from the chain before the feature masking, so the caller's depthClipEnable stays set. At pipeline creation a VkPipelineRasterizationDepthClipStateCreateInfoEXT in a pipeline that owns pre-rasterization state is removed from a copy of the rasterization state, and depthClampEnable becomes !depthClipEnable (clamping only when the device enabled depthClamp). D3D clients, drivers with the extension and drivers without depthClamp are unchanged. WRAPPER_EMULATE_DEPTH_CLIP_ENABLE=0 turns it off.
…rs with only the ARM name

zink only recognizes VK_EXT_rasterization_order_attachment_access, which it needs for coherent framebuffer fetch. Mali-G68 r38p1 and Mali-G710 r36p0 list only VK_ARM_rasterization_order_attachment_access. The EXT extension promoted the ARM one unchanged: the feature struct, its sType, the pipeline color blend and depth stencil create flags and the subpass description flags are aliases with the same values.

When the driver lists the ARM name but not the EXT name, the wrapper now also lists the EXT name. The feature bits are the driver's own: the wrapper's feature query always chains the struct, whose sType the driver knows through the ARM extension. At device creation an enabled EXT name is passed to the driver as the ARM name and the feature struct stays in the chain. Drivers that list the EXT name or neither are unchanged. It applies to every client, like the vertex_attribute_divisor alias: DXVK and vkd3d-proton do not use the extension, and it reports only what the driver supports.
@utkarshdalal utkarshdalal changed the title wrapper: emulate VK_EXT_depth_clip_enable for non-D3D clients on drivers with depthClamp wrapper: emulate VK_EXT_depth_clip_enable and expose the EXT name of rasterization order attachment access for GL Nov 20, 2026
@utkarshdalal
utkarshdalal marked this pull request as ready for review November 20, 2026 11:45
@utkarshdalal
utkarshdalal merged commit 9f7cb62 into wrapper-25 Nov 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant