tgsi: add caps for fragment coord conventions (v3)
authorLuca Barbieri <luca@luca-barbieri.com>
Thu, 21 Jan 2010 04:36:14 +0000 (05:36 +0100)
committerLuca Barbieri <luca@luca-barbieri.com>
Fri, 29 Jan 2010 13:13:14 +0000 (14:13 +0100)
Changes in v3:
- Renumber caps to accomodate caps to add to master in the meantime
- Document caps
- Add unsupported caps to *_screen.c too

Changes in v2:
- Split for properties patch
- Use positive caps instead of negative caps

This adds 4 caps to indicate support of each of the fragment coord
conventions.

All drivers are also modifed to add the appropriate caps.

Some drivers were incorrectly using non-Gallium-default conventions,
and caps for them have them set so that they will behave correctly
after the later state tracker patches.

This drivers are softpipe/llvmpipe (uses integer rather than half
integer) and pre-nv50 Nouveau (uses lower left rather than upper left).

Other drivers might be broken. With this patchset, fixing them is
only a matter of exposing the appropriate caps that match the behavior
of the existing code.

Drivers are encouraged to support all conventions themselves for better
performance, and this feature is added to softpipe in a later patch.

15 files changed:
src/gallium/docs/source/screen.rst
src/gallium/drivers/cell/ppu/cell_screen.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/i965/brw_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nv04/nv04_screen.c
src/gallium/drivers/nv10/nv10_screen.c
src/gallium/drivers/nv20/nv20_screen.c
src/gallium/drivers/nv30/nv30_screen.c
src/gallium/drivers/nv40/nv40_screen.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_defines.h

index f2421c74ae45b6fdc0bbe3bee43cb2293ee7698c..0507b81627b07bb1a9c5a114f3adc396f3d159d4 100644 (file)
@@ -57,6 +57,14 @@ The integer capabilities:
   only permit binding one constant buffer per shader, and the shaders will
   not permit two-dimensional access to constants.
 * ``MAX_CONST_BUFFER_SIZE``: Maximum byte size of a single constant buffer.
+* ``PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT``: Whether the TGSI property
+  FS_COORD_ORIGIN with value UPPER_LEFT is supported
+* ``PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT``: Whether the TGSI property
+  FS_COORD_ORIGIN with value LOWER_LEFT is supported
+* ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER``: Whether the TGSI
+  property FS_COORD_PIXEL_CENTER with value HALF_INTEGER is supported
+* ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER``: Whether the TGSI
+  property FS_COORD_PIXEL_CENTER with value INTEGER is supported
 
 The floating-point capabilities:
 
index d185c6b8497548781a0c845d31335422a853975b..37b04396b3ea343d55456d57c33a3b7fb7125caf 100644 (file)
@@ -86,6 +86,12 @@ cell_get_param(struct pipe_screen *screen, int param)
       return 0; /* XXX to do */
    case PIPE_CAP_TGSI_CONT_SUPPORTED:
       return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+      return 0;
    default:
       return 0;
    }
index d4ee8f5339bd8d1d1d274dfcdfbc3035066be871..7b8d66b8aa1530633ae6144950b3dfe38519f038 100644 (file)
@@ -117,6 +117,12 @@ i915_get_param(struct pipe_screen *screen, int param)
       return 8;  /* max 128x128x128 */
    case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
       return 11; /* max 1024x1024 */
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+      return 0;
    default:
       return 0;
    }
index a3728fb16e0a2c289d10517f000a4340d86a4685..a8f9892d71dac6eec14b290fc77163b232ab626a 100644 (file)
@@ -175,6 +175,12 @@ brw_get_param(struct pipe_screen *screen, int param)
       return 8;  /* max 128x128x128 */
    case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
       return 11; /* max 1024x1024 */
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+      return 0;
    default:
       return 0;
    }
index f04c0320ba06a80a76984d099801347490921e52..902009d90b566d984787aa4b44a15b52f65ff36c 100644 (file)
@@ -114,6 +114,12 @@ llvmpipe_get_param(struct pipe_screen *screen, int param)
       return 0;
    case PIPE_CAP_INDEP_BLEND_FUNC:
       return 0;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+      return 0;
    default:
       return 0;
    }
index 4eba7725753626eb0a7fffe3d8683fb7d41cd575..97538964af85a07c428f1d828c9905d33bd07cca 100644 (file)
@@ -49,6 +49,12 @@ nv04_screen_get_param(struct pipe_screen *screen, int param)
                return 0;
        case PIPE_CAP_INDEP_BLEND_FUNC:
                return 0;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+               return 1;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+               return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
                return 0;
index 2dabc4509fb4011debb5b56b68c3b93b9b6bdb8b..4e6bc12994397034eeb2756340b9fecf03f46e3c 100644 (file)
@@ -44,6 +44,12 @@ nv10_screen_get_param(struct pipe_screen *screen, int param)
                return 0;
        case PIPE_CAP_INDEP_BLEND_FUNC:
                return 0;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+               return 1;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+               return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
                return 0;
index 7782cbe3a8ecb9d2a05b7dc420a55b4d01a170fe..df9401bcce0ebb2f38ea3376395b08fb58fe352d 100644 (file)
@@ -44,6 +44,12 @@ nv20_screen_get_param(struct pipe_screen *screen, int param)
                return 0;
        case PIPE_CAP_INDEP_BLEND_FUNC:
                return 0;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+               return 1;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+               return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
                return 0;
index 8f8f3ea1a9f8403abac3b7b128914f6ca0c20aed..ee83ec56760114031890beaf84867791fdaeeac2 100644 (file)
@@ -71,6 +71,12 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param)
                return 0;
        case PIPE_CAP_INDEP_BLEND_FUNC:
                return 0;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+               return 1;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+               return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
                return 0;
index 4eab5daa80c68143d0aeeeedeb30e2cc6f7ba70b..b1a7343b409e908ec7a249330706b1f2912fec88 100644 (file)
@@ -56,6 +56,12 @@ nv40_screen_get_param(struct pipe_screen *pscreen, int param)
                return 0;
        case PIPE_CAP_INDEP_BLEND_FUNC:
                return 0;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+               return 1;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+               return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
                return 0;
index 6af9700c1afded245135c9b6929514a5f1541fbb..c4465a228ca95a95d725fe9805a917ccb0313e51 100644 (file)
@@ -139,6 +139,12 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
                return 1;
        case PIPE_CAP_INDEP_BLEND_FUNC:
                return 0;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+               return 1;
+       case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+               return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
                return 0;
index 679a5644afdf1322f70a3d6efeaeb68d73923416..f311284d15df2e412d79f8b861527d53b54b1ebc 100644 (file)
@@ -156,6 +156,12 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
             return 1;
         case PIPE_CAP_INDEP_BLEND_FUNC:
             return 0;
+        case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+        case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+           return 1;
+        case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+        case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+            return 0;
         default:
             debug_printf("r300: Implementation error: Bad param %d\n",
                 param);
index b2841f410314c9685d852c48a658bb0b05d1aa33..410fabf49097c828755113e6384b2c2e774a0ae7 100644 (file)
@@ -99,6 +99,12 @@ softpipe_get_param(struct pipe_screen *screen, int param)
       return 1;
    case PIPE_CAP_INDEP_BLEND_FUNC:
       return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+      return 0;
    default:
       return 0;
    }
index cd1ed7bac8b352c2bd27d72f8a4ea6b0bde2166e..c9db9ac874748efd7b3291d5cdedd93232c31394 100644 (file)
@@ -144,6 +144,13 @@ svga_get_paramf(struct pipe_screen *screen, int param)
    case PIPE_CAP_BLEND_EQUATION_SEPARATE: /* req. for GL 1.5 */
       return 1;
 
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+      return 0;
+
    default:
       return 0;
    }
index b28441dca9c24f05e5a64e02123370ad83d68248..63ba3119b81e42356b905895d282ce2d9f83d49b 100644 (file)
@@ -409,6 +409,10 @@ enum pipe_transfer_usage {
 #define PIPE_CAP_MAX_CONST_BUFFER_SIZE   33  /*< In bytes */
 #define PIPE_CAP_INDEP_BLEND_ENABLE      34  /*< blend enables and write masks per rendertarget */
 #define PIPE_CAP_INDEP_BLEND_FUNC        35  /*< different blend funcs per rendertarget */
+#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT 36
+#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT 37
+#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 38
+#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER 39
 
 
 /**