gallium: add a cap for VIEWPORT_SUBPIXEL_BITS (v2)
authorJózef Kucia <joseph.kucia@gmail.com>
Tue, 19 Jul 2016 11:07:24 +0000 (13:07 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 20 Jul 2016 10:45:31 +0000 (12:45 +0200)
This allows Gallium drivers to advertise the subpixel precision
for floating point viewports bounds.

v2:
  - Set ViewportSubpixelBits in st_init_limits.

Signed-off-by: Józef Kucia <joseph.kucia@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
18 files changed:
src/gallium/docs/source/screen.rst
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nouveau/nv30/nv30_screen.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/drivers/swr/swr_screen.cpp
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_extensions.c

index 141b45aa8058b5cfe947ec061d9704406a3e0109..34f2e721a8a783bdc8ea938d9551d017bd5de3c4 100644 (file)
@@ -345,6 +345,8 @@ The integer capabilities:
   supported in ``set_window_rectangles``.
 * ``PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED``: If true, the driver implements support
   for ``pipe_rasterizer_state::offset_units_unscaled``.
+* ``PIPE_CAP_VIEWPORT_SUBPIXEL_BITS``: Number of bits of subpixel precision for
+  floating point viewport bounds.
 
 
 .. _pipe_capf:
index 5255c10411d4284f1b877aebe5b135a76b2de296..81fb2adae424ea9fe208c1929018eb962c52a409 100644 (file)
@@ -267,6 +267,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_TGSI_VOTE:
        case PIPE_CAP_MAX_WINDOW_RECTANGLES:
        case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+       case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
                return 0;
 
        case PIPE_CAP_MAX_VIEWPORTS:
index 3f0ab98a3c556cb15201d36fbf5ff5b34b30811c..6b5218bc4673fb6e1b52ca9dc2b32ff418109430 100644 (file)
@@ -290,6 +290,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
    case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
    case PIPE_CAP_SAMPLER_VIEW_TARGET:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
 
    case PIPE_CAP_MAX_VIEWPORTS:
index 2024688ecdb9fd5d844f68c31a1bef06bd30beb6..448f512d7d15554e9aa15e4e201fc81ab45b2b7d 100644 (file)
@@ -505,6 +505,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 684c7a539efbd327979a382462053e287f096ff4..61c3fb7a41030eed91035a077bb610bbe80f033c 100644 (file)
@@ -328,6 +328,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
    }
    /* should only get here on unhandled cases */
index 68d8317bd6005db8588af69fb6996fa4f9960816..3d75021fa49690405d0f90c1c11f67f60c5b34d4 100644 (file)
@@ -199,6 +199,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 303ecf121ae1c16a8b1c37eec329d8ffe490e0f2..d18a768113299445ac420fa6dc2005bd1d25ac9a 100644 (file)
@@ -253,6 +253,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index a3cd0467b2d7ee9ff48e35660f4ca57de3fb26ee..6d924c3544ce0f41974b17b6f99f3b874aa05602 100644 (file)
@@ -272,6 +272,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_PCI_BUS:
    case PIPE_CAP_PCI_DEVICE:
    case PIPE_CAP_PCI_FUNCTION:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index d47b70d65b317d850d142cc96d416b34798ba4db..7d2ea4a476734ea53d1a43553cc573ff69618e5b 100644 (file)
@@ -221,6 +221,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_TGSI_VOTE:
         case PIPE_CAP_MAX_WINDOW_RECTANGLES:
         case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+        case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
             return 0;
 
         /* SWTCL-only features. */
index f23daf95109f244bf952b494ae5626b95c59f623..6bd027b8a6f2243e4c59629b76349d32eefa2ec5 100644 (file)
@@ -371,6 +371,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
        case PIPE_CAP_TGSI_VOTE:
        case PIPE_CAP_MAX_WINDOW_RECTANGLES:
+       case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
                return 0;
 
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
index ee97bcfaea5cc0c22fb29eb4232d648e0c42c4cf..768dc8cd6801d1eb630c2ac9f30a52c9d750a60d 100644 (file)
@@ -444,6 +444,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
        case PIPE_CAP_TGSI_VOTE:
        case PIPE_CAP_MAX_WINDOW_RECTANGLES:
+       case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
                return 0;
 
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
index 93022db8055d1462f3dad2577056fac80b376466..e80c1aa38a8a5e97a9e4aee01c6bf0ededbd8e50 100644 (file)
@@ -278,6 +278,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
    case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
       return 4;
index 5b4ac745453bfd9f9be571cb53ef52acfddf902e..13253aca43f2fcf5780b786ba64771193a505f69 100644 (file)
@@ -412,6 +412,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
    }
 
index d47840575120ebf7304b81c6cbdd73f5e3cee85c..e0e59fa674c14fc6eb25e51929b1ef0ec56fcbe3 100644 (file)
@@ -364,6 +364,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
    }
 
index 29c0f94bf906587e5cb095a12ad61974cfe2ae27..5c17c55c9381b43e95a6ef050ca2240902154af4 100644 (file)
@@ -217,6 +217,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_TGSI_VOTE:
         case PIPE_CAP_MAX_WINDOW_RECTANGLES:
         case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+        case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
                 return 0;
 
                 /* Stream output. */
index 82e7f1303e49fe9e27097762f498acbfdc89f643..fd3d35dc745814a4df0392d84f600f78205cd7ae 100644 (file)
@@ -246,6 +246,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VOTE:
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
+   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
       return 0;
    case PIPE_CAP_VENDOR_ID:
       return 0x1af4;
index 62fa67374f2c2f29b2d10e294153578c9c8ac997..3ab6c2f62b0f6fe0e48f62f1ad5f48facff59168 100644 (file)
@@ -732,6 +732,7 @@ enum pipe_cap
    PIPE_CAP_TGSI_VOTE,
    PIPE_CAP_MAX_WINDOW_RECTANGLES,
    PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED,
+   PIPE_CAP_VIEWPORT_SUBPIXEL_BITS,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
index d2ecc7fa59304870456331e8c770e7fabcbf9671..d0e7d3840f59aedbbfdc000b8ab301ce19f288da 100644 (file)
@@ -105,6 +105,9 @@ void st_init_limits(struct pipe_screen *screen,
    c->MaxViewportHeight =
    c->MaxRenderbufferSize = c->MaxTextureRectSize;
 
+   c->ViewportSubpixelBits =
+      screen->get_param(screen, PIPE_CAP_VIEWPORT_SUBPIXEL_BITS);
+
    c->MaxDrawBuffers = c->MaxColorAttachments =
       _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
              1, MAX_DRAW_BUFFERS);