Mesa (main): gallium/mesa: enhance PIPE_CAP_CLIP_PLANES to support override number

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 30 07:05:01 UTC 2021


Module: Mesa
Branch: main
Commit: af3cbc53794710bdd417057bf49334d9056a77fc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=af3cbc53794710bdd417057bf49334d9056a77fc

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Dec 30 11:09:07 2021 +1000

gallium/mesa: enhance PIPE_CAP_CLIP_PLANES to support override number

There exists hardware intel gen4 specifically that has only 6 clip planes
but supports GLSL 1.30. This enhances the CAP so that the current values
of 0,1 remain the same, but giving it a larger number will override the
max.

This allows the gen4 intel to set this to 6 and leave everyone else alone.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14344>

---

 docs/gallium/screen.rst                | 2 +-
 src/mesa/state_tracker/st_extensions.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst
index 3c99e93c2d3..b51fe497851 100644
--- a/docs/gallium/screen.rst
+++ b/docs/gallium/screen.rst
@@ -602,7 +602,7 @@ The integer capabilities:
     that backfacing primitives should use the back-side color as the FS input
     color.  If unset, mesa/st will lower it to gl_FrontFacing reads in the
     fragment shader.
-* ``PIPE_CAP_CLIP_PLANES``: Driver supports user-defined clip-planes.
+* ``PIPE_CAP_CLIP_PLANES``: Driver supports user-defined clip-planes. 0 denotes none, 1 denotes MAX_CLIP_PLANES. > 1 overrides MAX.
 * ``PIPE_CAP_MAX_VERTEX_BUFFERS``: Number of supported vertex buffers.
 * ``PIPE_CAP_OPENCL_INTEGER_FUNCTIONS``: Driver supports extended OpenCL-style integer functions.  This includes averge, saturating additiong, saturating subtraction, absolute difference, count leading zeros, and count trailing zeros.
 * ``PIPE_CAP_INTEGER_MULTIPLY_32X16``: Driver supports integer multiplication between a 32-bit integer and a 16-bit integer.  If the second operand is 32-bits, the upper 16-bits are ignored, and the low 16-bits are possibly sign extended as necessary.
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index adf24b93fca..0c56b609568 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -1195,6 +1195,11 @@ void st_init_extensions(struct pipe_screen *screen,
       consts->NativeIntegers = GL_TRUE;
       consts->MaxClipPlanes = 8;
 
+      uint32_t drv_clip_planes = screen->get_param(screen, PIPE_CAP_CLIP_PLANES);
+      /* only override for > 1 - 0 if none, 1 is MAX, >2 overrides MAX */
+      if (drv_clip_planes > 1)
+         consts->MaxClipPlanes = drv_clip_planes;
+
       if (screen->get_param(screen, PIPE_CAP_VERTEXID_NOBASE)) {
          consts->VertexID_is_zero_based = GL_TRUE;
       }



More information about the mesa-commit mailing list