nv50,nvc0: set vertex id base to index_bias
PATCH 1/1 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]>
--- src/gallium/drivers/nouveau/nv50/nv50_screen.c | 7 +++++++ src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 ++++++++ src/gallium/drivers/nouveau/nvc0/mme/com9097.mme | 7 ++++++- src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h | 12 ++++++++---- src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 8 ++++++-- 5 files changed, 35 insertions(+), 7 deletions(-)
src/gallium/drivers/nouveau/nv50/nv50_screen.c +7 -0
@@ -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); }
src/gallium/drivers/nouveau/nv50/nv50_vbo.c +8 -0
@@ -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; }
src/gallium/drivers/nouveau/nvc0/mme/com9097.mme +6 -1
@@ -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
src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h +8 -4
@@ -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, };
src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c +6 -2
@@ -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 ;
Signature · 6 lines
2.0.5 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau