gallium: add viewport swizzling state and cap
authorIlia Mirkin <imirkin@alum.mit.edu>
Mon, 6 Apr 2020 03:43:08 +0000 (23:43 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 12 Apr 2020 16:01:46 +0000 (12:01 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4519>

src/gallium/auxiliary/util/u_screen.c
src/gallium/docs/source/screen.rst
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_state.h

index d770a84c21a91b5e8d416f37c1c1832aa529816a..c6795ac260e4aba99c9dc35ac398f65ab0d5e38e 100644 (file)
@@ -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:
index 4743f0ffdffe5e536fdcbae1ee9128daa73e934c..520563a6a33d32e9a2199193e22a6071d037659a 100644 (file)
@@ -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:
 
index 04388d317a34b5197748231da64aed4d279ff1fd..5fb6fcf3ebd444e26c0090c38f537e264b9b2f8b 100644 (file)
@@ -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,
 };
 
 /**
index b0d8eaed2fa90714c380835cf382ae23ab0f2fee..736649acd2f474b694b25d6c99e71acda5a79006 100644 (file)
@@ -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;
 };