Mesa (master): gallium: add viewport swizzling state and cap

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Apr 12 16:26:41 UTC 2020


Module: Mesa
Branch: master
Commit: 4137a79c2a7edb5f0caf0964ab748da7c279b61c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4137a79c2a7edb5f0caf0964ab748da7c279b61c

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sun Apr  5 23:43:08 2020 -0400

gallium: add viewport swizzling state and cap

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4519>

---

 src/gallium/auxiliary/util/u_screen.c |  1 +
 src/gallium/docs/source/screen.rst    |  1 +
 src/gallium/include/pipe/p_defines.h  | 15 +++++++++++++++
 src/gallium/include/pipe/p_state.h    |  4 ++++
 4 files changed, 21 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index d770a84c21a..c6795ac260e 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -258,6 +258,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
    case PIPE_CAP_MAX_WINDOW_RECTANGLES: /* Enables EXT_window_rectangles */
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
+   case PIPE_CAP_VIEWPORT_SWIZZLE:
    case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
    case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
    case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 4743f0ffdff..520563a6a33 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -573,6 +573,7 @@ The integer capabilities:
 * ``PIPE_CAP_PSIZ_CLAMPED``: Driver needs for the point size to be clamped. Additionally, the gl_PointSize has been modified and its value should be lowered for transform feedback, if needed. Defaults to false.
 * ``PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES``: pipe_draw_info::start can be non-zero with user indices.
 * ``PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE``: Buffer size used to upload vertices for glBegin/glEnd.
+* ``PIPE_CAP_VIEWPORT_SWIZZLE``: Whether pipe_viewport_state::swizzle can be used to specify pre-clipping swizzling of coordinates (see GL_NV_viewport_swizzle).
 
 .. _pipe_capf:
 
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 04388d317a3..5fb6fcf3ebd 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -626,6 +626,20 @@ enum pipe_swizzle {
    PIPE_SWIZZLE_MAX, /**< Number of enums counter (must be last) */
 };
 
+/**
+ * Viewport swizzles
+ */
+enum pipe_viewport_swizzle {
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_X,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_X,
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_Y,
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_Z,
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_W,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_W,
+};
+
 #define PIPE_TIMEOUT_INFINITE 0xffffffffffffffffull
 
 
@@ -920,6 +934,7 @@ enum pipe_cap
    PIPE_CAP_PSIZ_CLAMPED,
    PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES,
    PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE,
+   PIPE_CAP_VIEWPORT_SWIZZLE,
 };
 
 /**
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index b0d8eaed2fa..736649acd2f 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -213,6 +213,10 @@ struct pipe_viewport_state
 {
    float scale[3];
    float translate[3];
+   enum pipe_viewport_swizzle swizzle_x:3;
+   enum pipe_viewport_swizzle swizzle_y:3;
+   enum pipe_viewport_swizzle swizzle_z:3;
+   enum pipe_viewport_swizzle swizzle_w:3;
 };
 
 



More information about the mesa-commit mailing list