mesa/src/gallium/auxiliary
Christian Gmeiner 9c972a61d5 gallium: Add pipe cap for masked clears and support stencil masking
Add a new PIPE_CAP_CLEAR_MASKED capability that allows drivers to
handle buffer clears with color and stencil masks directly, instead
of falling back to drawing a quad in Mesa.

This patch introduces several changes:

1. Add the new pipe cap PIPE_CAP_CLEAR_MASKED to pipe_defines.h and
   document it in the Gallium screen documentation.

2. Add color_clear_mask and stencil_clear_mask parameters to the
   pipe_context::clear() hook:
   - color_clear_mask (uint32_t): contains 4 color mask bits per draw buffer
     (max 8 buffers = 32 bits)
   - stencil_clear_mask (uint8_t): contains the stencil write mask (8 bits)

3. Update the state tracker to use the masked clear path when the
   driver supports it:
   - Pass ctx->Color.ColorMask for color buffer clears
   - Pass ctx->Stencil.WriteMask for stencil clears
   - Allow both color and stencil clears to avoid the quad path when
     masks are present and the driver advertises support

4. Update all existing driver clear() hooks to accept the new
   color_clear_mask and stencil_clear_mask parameter.

This optimization allows drivers that can efficiently handle masked
clears in hardware to do so, improving performance for applications
that frequently clear buffers with masks enabled.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31512>
2026-01-27 00:57:26 +00:00
..
cso_cache mesa,gallium: not touch TS when internal draws 2025-10-17 03:52:19 +00:00
draw ALL: use SHA1_DIGEST_LENGTH etc. instead of hardcoding the numbers 2026-01-07 08:32:33 +00:00
driver_ddebug gallium: Add pipe cap for masked clears and support stencil masking 2026-01-27 00:57:26 +00:00
driver_noop gallium: Add pipe cap for masked clears and support stencil masking 2026-01-27 00:57:26 +00:00
driver_trace gallium: Add pipe cap for masked clears and support stencil masking 2026-01-27 00:57:26 +00:00
gallivm gallium: fix sometimes-uninitialized warning 2026-01-23 18:06:01 +00:00
hud Pass the destination buffer size minus one to strncpy 2026-01-22 15:44:09 +01:00
indices gallium: add pipe_context::resource_release to eliminate buffer refcounting 2025-09-09 20:47:38 +00:00
nir tgsi/nir: Store output variables before each TGSI_OPCODE_RET 2026-01-20 19:54:23 +00:00
pipe-loader dri,gallium: Add support for RGB[A]16_UNORM display formats. 2026-01-21 12:29:03 +00:00
pipebuffer gallium/pipebuffer: fix multithread issue on pb_slab_manager_create_buffer 2025-08-23 02:09:15 +00:00
postprocess gallium: Add pipe cap for masked clears and support stencil masking 2026-01-27 00:57:26 +00:00
renderonly treewide: Make exported DRM FDs read-write. 2025-09-27 19:46:14 +00:00
rtasm util: Remove MMX/MMXext detection code 2024-11-13 23:33:15 +00:00
target-helpers pipe-loader: Load the ethos accel driver 2025-10-15 20:10:15 +00:00
tessellator gallium/tessellator: fix -Wmissing-prototype issues 2026-01-06 15:29:15 +00:00
tgsi tgsi: Remove return type from tgsi_instruction_texture 2025-08-15 08:03:04 +00:00
translate treewide: use SWAP macro 2025-07-23 19:49:47 +00:00
util gallium: Add pipe cap for masked clears and support stencil masking 2026-01-27 00:57:26 +00:00
vl meson: add mpeg12dec as a video-codec 2026-01-20 22:42:08 +00:00
meson.build aux/trace: remove -I argument 2025-10-23 07:03:01 +00:00