diff options
author | Ilia Mirkin <[email protected]> | 2014-12-30 23:19:47 -0500 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2014-12-30 23:30:23 -0500 |
commit | be0311c9626eef841f6d245359759cf1e082aebf (patch) | |
tree | 35180d95102abd447bd5efc2264108a713745443 /src/gallium/drivers | |
parent | 609c3e51f5ca8abb15867537997369e7e8a678e3 (diff) |
nv50,nvc0: set vertex id base to index_bias
Fixes the piglits which check that gl_VertexID includes the base vertex
offset:
arb_draw_indirect-vertexid elements
gl-3.2-basevertex-vertexid
Note that this leaves out the original G80, for which this will continue
to fail. It could be fixed by passing a driver constbuf value in, but
that's beyond the scope of this change.
Signed-off-by: Ilia Mirkin <[email protected]>
Cc: "10.3 10.4" <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_screen.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/mme/com9097.mme | 7 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h | 12 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 8 |
5 files changed, 35 insertions, 7 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index ff087341de1..2d8347b0ad8 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -608,6 +608,13 @@ nv50_screen_init_hwctx(struct nv50_screen *screen) BEGIN_NV04(push, NV50_3D(EDGEFLAG), 1); PUSH_DATA (push, 1); + BEGIN_NV04(push, NV50_3D(VB_ELEMENT_BASE), 1); + PUSH_DATA (push, 0); + if (screen->base.class_3d >= NV84_3D_CLASS) { + BEGIN_NV04(push, SUBC_3D(NV84_3D_VERTEX_ID_BASE), 1); + PUSH_DATA (push, 0); + } + PUSH_KICK (push); } diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c index 5a4a4578d51..c1590eefe9f 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c @@ -472,6 +472,10 @@ nv50_draw_arrays(struct nv50_context *nv50, if (nv50->state.index_bias) { BEGIN_NV04(push, NV50_3D(VB_ELEMENT_BASE), 1); PUSH_DATA (push, 0); + if (nv50->screen->base.class_3d >= NV84_3D_CLASS) { + BEGIN_NV04(push, SUBC_3D(NV84_3D_VERTEX_ID_BASE), 1); + PUSH_DATA (push, 0); + } nv50->state.index_bias = 0; } @@ -594,6 +598,10 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten, if (index_bias != nv50->state.index_bias) { BEGIN_NV04(push, NV50_3D(VB_ELEMENT_BASE), 1); PUSH_DATA (push, index_bias); + if (nv50->screen->base.class_3d >= NV84_3D_CLASS) { + BEGIN_NV04(push, SUBC_3D(NV84_3D_VERTEX_ID_BASE), 1); + PUSH_DATA (push, index_bias); + } nv50->state.index_bias = index_bias; } diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme index 07e4519d794..b2060d1fa53 100644 --- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme +++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme @@ -227,6 +227,7 @@ locn_0f_ts: /* NVC0_3D_MACRO_DRAW_ELEMENTS_INDIRECT * * NOTE: Saves and restores VB_ELEMENT,INSTANCE_BASE. + * Forcefully sets VERTEX_ID_BASE to the value of VB_ELEMENT_BASE. * * arg = mode * parm[0] = count @@ -247,6 +248,8 @@ locn_0f_ts: maddr 0x150d /* VB_ELEMENT,INSTANCE_BASE */ send $r4 send $r5 + maddr 0x446 + send $r4 mov $r4 0x1 dei_again: maddr 0x586 /* VERTEX_BEGIN_GL */ @@ -258,8 +261,10 @@ dei_again: branz $r2 #dei_again mov $r1 (extrinsrt $r1 $r4 0 1 26) /* set INSTANCE_NEXT */ maddr 0x150d /* VB_ELEMENT,INSTANCE_BASE */ - exit send $r6 + send $r6 send $r7 + exit maddr 0x446 + send $r6 dei_end: exit nop diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h index 654bf931563..bac9042c2df 100644 --- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h +++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h @@ -128,16 +128,18 @@ uint32_t mme9097_draw_elts_indirect[] = { 0x00000301, 0x00000201, 0x017dc451, -/* 0x000c: dei_again */ +/* 0x000e: dei_again */ 0x00002431, - 0x0004d007, -/* 0x0017: dei_end */ + 0x0005d007, 0x00000501, +/* 0x001b: dei_end */ 0x01434615, 0x01438715, 0x05434021, 0x00002041, 0x00002841, + 0x01118021, + 0x00002041, 0x00004411, 0x01618021, 0x00000841, @@ -148,8 +150,10 @@ uint32_t mme9097_draw_elts_indirect[] = { 0xfffe9017, 0xd0410912, 0x05434021, - 0x000030c1, + 0x00003041, 0x00003841, + 0x011180a1, + 0x00003041, 0x00000091, 0x00000011, }; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c index f99d533af77..250d495872e 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c @@ -575,8 +575,9 @@ nvc0_draw_arrays(struct nvc0_context *nvc0, if (nvc0->state.index_bias) { /* index_bias is implied 0 if !info->indexed (really ?) */ /* TODO: can we deactivate it for the VERTEX_BUFFER_FIRST command ? */ - PUSH_SPACE(push, 1); + PUSH_SPACE(push, 2); IMMED_NVC0(push, NVC0_3D(VB_ELEMENT_BASE), 0); + IMMED_NVC0(push, NVC0_3D(VERTEX_ID), 0); nvc0->state.index_bias = 0; } @@ -705,9 +706,11 @@ nvc0_draw_elements(struct nvc0_context *nvc0, boolean shorten, prim = nvc0_prim_gl(mode); if (index_bias != nvc0->state.index_bias) { - PUSH_SPACE(push, 2); + PUSH_SPACE(push, 4); BEGIN_NVC0(push, NVC0_3D(VB_ELEMENT_BASE), 1); PUSH_DATA (push, index_bias); + BEGIN_NVC0(push, NVC0_3D(VERTEX_ID), 1); + PUSH_DATA (push, index_bias); nvc0->state.index_bias = index_bias; } @@ -818,6 +821,7 @@ nvc0_draw_indirect(struct nvc0_context *nvc0, const struct pipe_draw_info *info) if (nvc0->state.index_bias) { /* index_bias is implied 0 if !info->indexed (really ?) */ IMMED_NVC0(push, NVC0_3D(VB_ELEMENT_BASE), 0); + IMMED_NVC0(push, NVC0_3D(VERTEX_ID), 0); nvc0->state.index_bias = 0; } size = 4 * 4; |