nv50,nvc0: implement half_pixel_center
authorTiziano Bacocco <tizbac2@gmail.com>
Tue, 30 Dec 2014 20:33:48 +0000 (21:33 +0100)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 31 Dec 2014 01:11:55 +0000 (20:11 -0500)
LAST_LINE_PIXEL has actually been renamed to PIXEL_CENTER_INTEGER in
rnndb; use that method to implement the rasterizer setting, used for
st/nine.

Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/nv50/nv50_3d.xml.h
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nv50/nv50_state.c
src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_state.c
src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h

index a2c22c5eaa5089a96982584978558b318cd11144..711445f35c78e4cc80a49559a955388a117920ff 100644 (file)
@@ -1708,7 +1708,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NV50_3D_CULL_FACE_BACK                                 0x00000405
 #define NV50_3D_CULL_FACE_FRONT_AND_BACK                       0x00000408
 
-#define NV50_3D_LINE_LAST_PIXEL                                        0x00001924
+#define NV50_3D_PIXEL_CENTER_INTEGER                                   0x00001924
 
 #define NVA3_3D_FP_MULTISAMPLE                                 0x00001928
 #define NVA3_3D_FP_MULTISAMPLE_EXPORT_SAMPLE_MASK              0x00000001
index 5c1a21d2731c82f207c1d1a763871678fa0e8be2..ff087341de1ca5a021368622386eb1d09b3423b4 100644 (file)
@@ -462,8 +462,6 @@ nv50_screen_init_hwctx(struct nv50_screen *screen)
    PUSH_DATA (push, 0);
    BEGIN_NV04(push, NV50_3D(PRIM_RESTART_WITH_DRAW_ARRAYS), 1);
    PUSH_DATA (push, 1);
-   BEGIN_NV04(push, NV50_3D(LINE_LAST_PIXEL), 1);
-   PUSH_DATA (push, 0);
    BEGIN_NV04(push, NV50_3D(BLEND_SEPARATE_ALPHA), 1);
    PUSH_DATA (push, 1);
 
index 155cdddf8450ceec3645449be1b81077ed8f294a..f233efedb1c70be3460eade043220cabf4348065 100644 (file)
  *  ! pipe_rasterizer_state.flatshade_first also applies to QUADS
  *    (There's a GL query for that, forcing an exception is just ridiculous.)
  *
- *  ! pipe_rasterizer_state.half_pixel_center is ignored - pixel centers
- *     are always at half integer coordinates and the top-left rule applies
- *    (There does not seem to be a hardware switch for this.)
- *
  *  ! pipe_rasterizer_state.sprite_coord_enable is masked with 0xff on NVC0
  *    (The hardware only has 8 slots meant for TexCoord and we have to assign
  *     in advance to maintain elegant separate shader objects.)
@@ -221,7 +217,7 @@ nv50_blend_state_delete(struct pipe_context *pipe, void *hwcso)
    FREE(hwcso);
 }
 
-/* NOTE: ignoring line_last_pixel, using FALSE (set on screen init) */
+/* NOTE: ignoring line_last_pixel */
 static void *
 nv50_rasterizer_state_create(struct pipe_context *pipe,
                              const struct pipe_rasterizer_state *cso)
@@ -336,6 +332,9 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
    SB_BEGIN_3D(so, DEPTH_CLIP_NEGATIVE_Z, 1);
    SB_DATA    (so, cso->clip_halfz);
 
+   SB_BEGIN_3D(so, PIXEL_CENTER_INTEGER, 1);
+   SB_DATA    (so, !cso->half_pixel_center);
+
    assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
    return (void *)so;
 }
index 238951733cfbb75847483155c1d9684c15d064ff..eea5327b6cb884b1c3a4a0f5a1347d28c285250f 100644 (file)
@@ -25,7 +25,7 @@ struct nv50_blend_stateobj {
 struct nv50_rasterizer_stateobj {
    struct pipe_rasterizer_state pipe;
    int size;
-   uint32_t state[48];
+   uint32_t state[49];
 };
 
 struct nv50_zsa_stateobj {
index 5bd5e95370fc5b3977f0565a32d0a81c649f41b6..57407c5fa1b6cbb36f1d6c87b7637fc63884e1ed 100644 (file)
@@ -1041,7 +1041,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NVC0_3D_CULL_FACE_BACK                                 0x00000405
 #define NVC0_3D_CULL_FACE_FRONT_AND_BACK                       0x00000408
 
-#define NVC0_3D_LINE_LAST_PIXEL                                        0x00001924
+#define NVC0_3D_PIXEL_CENTER_INTEGER                                   0x00001924
 
 #define NVC0_3D_VIEWPORT_TRANSFORM_EN                          0x0000192c
 
index 7f68236ad1468a5288dad25ccbfa39aac737dd73..5032c7f807090e308c6e99aca09705e0b955a9ec 100644 (file)
@@ -787,8 +787,6 @@ nvc0_screen_create(struct nouveau_device *dev)
    PUSH_DATA (push, 0);
    BEGIN_NVC0(push, NVC0_3D(LINE_WIDTH_SEPARATE), 1);
    PUSH_DATA (push, 1);
-   BEGIN_NVC0(push, NVC0_3D(LINE_LAST_PIXEL), 1);
-   PUSH_DATA (push, 0);
    BEGIN_NVC0(push, NVC0_3D(PRIM_RESTART_WITH_DRAW_ARRAYS), 1);
    PUSH_DATA (push, 1);
    BEGIN_NVC0(push, NVC0_3D(BLEND_SEPARATE_ALPHA), 1);
index 54deb20cb0ccc0bfdb2ff81859ae6ed7aacf96cb..728618fdec3942aae990f92f0bee277cbdceca84 100644 (file)
@@ -204,7 +204,7 @@ nvc0_blend_state_delete(struct pipe_context *pipe, void *hwcso)
     FREE(hwcso);
 }
 
-/* NOTE: ignoring line_last_pixel, using FALSE (set on screen init) */
+/* NOTE: ignoring line_last_pixel */
 static void *
 nvc0_rasterizer_state_create(struct pipe_context *pipe,
                              const struct pipe_rasterizer_state *cso)
@@ -315,6 +315,8 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe,
 
     SB_IMMED_3D(so, DEPTH_CLIP_NEGATIVE_Z, cso->clip_halfz);
 
+    SB_IMMED_3D(so, PIXEL_CENTER_INTEGER, !cso->half_pixel_center);
+
     assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
     return (void *)so;
 }
index 80c3342403297ec9fa93b721e8f7f9559350d063..1d70b7c7b23e166694e7f3a3dc53bda89b1b30ef 100644 (file)
@@ -23,7 +23,7 @@ struct nvc0_blend_stateobj {
 struct nvc0_rasterizer_stateobj {
    struct pipe_rasterizer_state pipe;
    int size;
-   uint32_t state[43];
+   uint32_t state[44];
 };
 
 struct nvc0_zsa_stateobj {