summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvfx/nvfx_vbo.c
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-09-05 05:42:59 +0200
committerLuca Barbieri <luca@luca-barbieri.com>2010-09-05 17:52:25 +0200
commit8e2badfc269082f4b52a82ac1c5b4350bef0d01b (patch)
tree29483004c748edea67ba8fd9041251c780eb882b /src/gallium/drivers/nvfx/nvfx_vbo.c
parent43cfc1ed8ef489b1d6077fcabbce1b91830b5e55 (diff)
nvfx: add rewritten swtnl support
The old swtnl code was broken by the new shader linkage support for GLSL. This is a rewrite of swtnl support, which should instead work properly, be faster and more closer to the much more tested hardware pipeline.
Diffstat (limited to 'src/gallium/drivers/nvfx/nvfx_vbo.c')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_vbo.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c
index 611de808af..c35e926a7a 100644
--- a/src/gallium/drivers/nvfx/nvfx_vbo.c
+++ b/src/gallium/drivers/nvfx/nvfx_vbo.c
@@ -339,6 +339,44 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
}
void
+nvfx_vbo_swtnl_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ unsigned num_outputs = nvfx->vertprog->draw_elements;
+ int elements = MAX2(num_outputs, nvfx->hw_vtxelt_nr);
+
+ if (!elements)
+ return;
+
+ WAIT_RING(chan, (1 + 6 + 1 + 2) + elements * 2);
+
+ OUT_RING(chan, RING_3D(NV34TCL_VTXFMT(0), elements));
+ for(unsigned i = 0; i < num_outputs; ++i)
+ OUT_RING(chan, (4 << NV34TCL_VTXFMT_SIZE_SHIFT) | NV34TCL_VTXFMT_TYPE_32_FLOAT);
+ for(unsigned i = num_outputs; i < elements; ++i)
+ OUT_RING(chan, NV34TCL_VTXFMT_TYPE_32_FLOAT);
+
+ if(nvfx->is_nv4x) {
+ unsigned i;
+ /* seems to be some kind of cache flushing */
+ for(i = 0; i < 3; ++i) {
+ OUT_RING(chan, RING_3D(0x1718, 1));
+ OUT_RING(chan, 0);
+ }
+ }
+
+ OUT_RING(chan, RING_3D(NV34TCL_VTXBUF_ADDRESS(0), elements));
+ for (unsigned i = 0; i < elements; i++)
+ OUT_RING(chan, 0);
+
+ OUT_RING(chan, RING_3D(0x1710, 1));
+ OUT_RING(chan, 0);
+
+ nvfx->hw_vtxelt_nr = num_outputs;
+ nvfx->relocs_needed &=~ NVFX_RELOCATE_VTXBUF;
+}
+
+void
nvfx_vbo_relocate(struct nvfx_context *nvfx)
{
struct nouveau_channel* chan;