diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.h b/src/gallium/drivers/nouveau/nv50/nv50_context.h index ee6eb0ef715..7bf4ce3008e 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_context.h +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.h @@ -70,7 +70,17 @@ #define NV50_CB_PVP 124 #define NV50_CB_PGP 126 #define NV50_CB_PFP 125 +/* constant buffer permanently mapped in as c15[] */ #define NV50_CB_AUX 127 +/* size of the buffer: 64k. not all taken up, can be reduced if needed. */ +#define NV50_CB_AUX_SIZE (1 << 16) +/* 8 user clip planes, at 4 32-bit floats each */ +#define NV50_CB_AUX_UCP_OFFSET 0x0 +/* 256 textures, each with 2 16-bit integers specifying the x/y MS shift */ +#define NV50_CB_AUX_MS_OFFSET 0x80 +/* 4 32-bit floats for the vertex runout, put at the end */ +#define NV50_CB_AUX_RUNOUT_OFFSET (NV50_CB_AUX_SIZE - 0x10) + struct nv50_blitctx; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 2e7b84d5911..436226b9e6b 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -471,7 +471,7 @@ nv50_screen_init_hwctx(struct nv50_screen *screen) BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3); PUSH_DATAh(push, screen->uniforms->offset + (3 << 16)); PUSH_DATA (push, screen->uniforms->offset + (3 << 16)); - PUSH_DATA (push, (NV50_CB_AUX << 16) | 0x0200); + PUSH_DATA (push, (NV50_CB_AUX << 16) | (NV50_CB_AUX_SIZE & 0xffff)); BEGIN_NI04(push, NV50_3D(SET_PROGRAM_CB), 3); PUSH_DATA (push, (NV50_CB_AUX << 12) | 0xf01); @@ -480,15 +480,15 @@ nv50_screen_init_hwctx(struct nv50_screen *screen) /* return { 0.0, 0.0, 0.0, 0.0 } on out-of-bounds vtxbuf access */ BEGIN_NV04(push, NV50_3D(CB_ADDR), 1); - PUSH_DATA (push, ((1 << 9) << 6) | NV50_CB_AUX); + PUSH_DATA (push, (NV50_CB_AUX_RUNOUT_OFFSET << 6) | NV50_CB_AUX); BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 4); PUSH_DATAf(push, 0.0f); PUSH_DATAf(push, 0.0f); PUSH_DATAf(push, 0.0f); PUSH_DATAf(push, 0.0f); BEGIN_NV04(push, NV50_3D(VERTEX_RUNOUT_ADDRESS_HIGH), 2); - PUSH_DATAh(push, screen->uniforms->offset + (3 << 16) + (1 << 9)); - PUSH_DATA (push, screen->uniforms->offset + (3 << 16) + (1 << 9)); + PUSH_DATAh(push, screen->uniforms->offset + (3 << 16) + NV50_CB_AUX_RUNOUT_OFFSET); + PUSH_DATA (push, screen->uniforms->offset + (3 << 16) + NV50_CB_AUX_RUNOUT_OFFSET); /* max TIC (bits 4:8) & TSC bindings, per program type */ for (i = 0; i < 3; ++i) { diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c index bb05f033b81..95592533bb3 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c @@ -260,7 +260,7 @@ nv50_validate_clip(struct nv50_context *nv50) if (nv50->dirty & NV50_NEW_CLIP) { BEGIN_NV04(push, NV50_3D(CB_ADDR), 1); - PUSH_DATA (push, (0 << 8) | NV50_CB_AUX); + PUSH_DATA (push, (NV50_CB_AUX_UCP_OFFSET << 8) | NV50_CB_AUX); BEGIN_NI04(push, NV50_3D(CB_DATA(0)), PIPE_MAX_CLIP_PLANES * 4); PUSH_DATAp(push, &nv50->clip.ucp[0][0], PIPE_MAX_CLIP_PLANES * 4); }