aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-02-23 15:52:24 +0100
committerLuca Barbieri <[email protected]>2010-04-12 12:13:23 +0200
commit5eb6b1a981f87a39323604f5496aafdb38b126a9 (patch)
tree038b1206979b16fa0f565fad3c39fe846439d89a /src/gallium/drivers
parentf768528af53f3f7d7a1a90b3eef1b02bd821e28a (diff)
nvfx: so->RING_3D: vertprog
We could use an sb here instead, but there is no obvious performance advantage, and perhaps there could be a disadvantage.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.h1
-rw-r--r--src/gallium/drivers/nvfx/nvfx_vertprog.c45
2 files changed, 19 insertions, 27 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h
index f1f9fb775b8..555513a6428 100644
--- a/src/gallium/drivers/nvfx/nvfx_state.h
+++ b/src/gallium/drivers/nvfx/nvfx_state.h
@@ -39,7 +39,6 @@ struct nvfx_vertex_program {
uint32_t ir;
uint32_t or;
uint32_t clip_ctrl;
- struct nouveau_stateobj *so;
};
struct nvfx_fragment_program_data {
diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c
index 78ba10c31c5..3d25ab761a3 100644
--- a/src/gallium/drivers/nvfx/nvfx_vertprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c
@@ -847,6 +847,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
vp = nvfx->vertprog;
constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX];
+ // TODO: ouch! can't we just use constant slots for these?!
if ((nvfx->dirty & NVFX_NEW_UCP) ||
memcmp(&nvfx->clip, &vp->ucp, sizeof(vp->ucp))) {
nvfx_vertprog_destroy(nvfx, vp);
@@ -858,21 +859,19 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
}
/* Translate TGSI shader into hw bytecode */
- if (vp->translated)
- goto check_gpu_resources;
-
- nvfx->fallback_swtnl &= ~NVFX_NEW_VERTPROG;
+ if (!vp->translated)
+ {
+ nvfx->fallback_swtnl &= ~NVFX_NEW_VERTPROG;
nvfx_vertprog_translate(nvfx, vp);
- if (!vp->translated) {
- nvfx->fallback_swtnl |= NVFX_NEW_VERTPROG;
+ if (!vp->translated) {
+ nvfx->fallback_swtnl |= NVFX_NEW_VERTPROG;
return FALSE;
+ }
}
-check_gpu_resources:
/* Allocate hw vtxprog exec slots */
if (!vp->exec) {
struct nouveau_resource *heap = nvfx->screen->vp_exec_heap;
- struct nouveau_stateobj *so;
uint vplen = vp->nr_insns;
if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) {
@@ -887,19 +886,6 @@ check_gpu_resources:
assert(0);
}
- so = so_new(3, 4, 0);
- so_method(so, eng3d, NV34TCL_VP_START_FROM_ID, 1);
- so_data (so, vp->exec->start);
- if(nvfx->is_nv4x) {
- so_method(so, eng3d, NV40TCL_VP_ATTRIB_EN, 2);
- so_data (so, vp->ir);
- so_data (so, vp->or);
- }
- so_method(so, eng3d, NV34TCL_VP_CLIP_PLANES_ENABLE, 1);
- so_data (so, vp->clip_ctrl);
- so_ref(so, &vp->so);
- so_ref(NULL, &so);
-
upload_code = TRUE;
}
@@ -1007,9 +993,18 @@ check_gpu_resources:
}
}
- if (vp->so != nvfx->state.hw[NVFX_STATE_VERTPROG]) {
- so_ref(vp->so, &nvfx->state.hw[NVFX_STATE_VERTPROG]);
- return TRUE;
+ if(nvfx->dirty & (NVFX_NEW_VERTPROG | NVFX_NEW_UCP))
+ {
+ WAIT_RING(chan, 7);
+ OUT_RING(chan, RING_3D(NV34TCL_VP_START_FROM_ID, 1));
+ OUT_RING(chan, vp->exec->start);
+ if(nvfx->is_nv4x) {
+ OUT_RING(chan, RING_3D(NV40TCL_VP_ATTRIB_EN, 2));
+ OUT_RING(chan, vp->ir);
+ OUT_RING(chan, vp->or);
+ }
+ OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANES_ENABLE, 1));
+ OUT_RING(chan, vp->clip_ctrl);
}
return FALSE;
@@ -1039,13 +1034,11 @@ nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp)
vp->data_start_min = 0;
vp->ir = vp->or = vp->clip_ctrl = 0;
- so_ref(NULL, &vp->so);
}
struct nvfx_state_entry nvfx_state_vertprog = {
.validate = nvfx_vertprog_validate,
.dirty = {
.pipe = NVFX_NEW_VERTPROG | NVFX_NEW_UCP,
- .hw = NVFX_STATE_VERTPROG,
}
};