summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-02-23 11:11:52 +0100
committerLuca Barbieri <[email protected]>2010-04-12 12:13:16 +0200
commit188b579e30cb7f8d7eef5cc9eb5913d9d43a3038 (patch)
tree9896cc8a127da99fd289c81d246395d78c8f203b /src/gallium/drivers
parentd75f99ab0c98b36028d7e80b8cf6906b672e571f (diff)
nouveau: add state buffers, lightweight replacement for state objects
Just a dumb buffer, allowed by the RING_3D/fixed subchannel binding and no support for relocations. This is *much* faster than state objects.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_statebuf.h27
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_statebuf.h b/src/gallium/drivers/nouveau/nouveau_statebuf.h
new file mode 100644
index 00000000000..dcffdd91154
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nouveau_statebuf.h
@@ -0,0 +1,27 @@
+#ifndef __NOUVEAU_STATEBUF_H__
+#define __NOUVEAU_STATEBUF_H__
+
+/* state buffers: lightweight state objects interface */
+/* relocations are not supported, but Gallium CSOs don't require them */
+
+struct nouveau_statebuf_builder
+{
+ uint32_t* p;
+#ifdef DEBUG
+ uint32_t* pend;
+#endif
+};
+
+#ifdef DEBUG
+#define sb_init(var) {var, var + sizeof(var) / sizeof((var)[0])}
+#define sb_data(sb, v) do {assert((sb).p != (sb).pend); *(sb).p++ = (v);} while(0)
+#else
+#define sb_init(var) {var}
+#define sb_data(sb, v) *(sb).p++ = (v)
+#endif
+
+#define sb_method(sb, v, n) sb_data(sb, RING_3D(v, n));
+
+#define sb_len(sb, var) ((sb).p - (var))
+#define sb_emit(chan, sb_buf, sb_len) do {WAIT_RING((chan), (sb_len)); OUT_RINGp((chan), (sb_buf), (sb_len)); } while(0)
+#endif
diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h
index 1f612ea95f5..8f5b33fcffb 100644
--- a/src/gallium/drivers/nvfx/nvfx_state.h
+++ b/src/gallium/drivers/nvfx/nvfx_state.h
@@ -3,6 +3,7 @@
#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h"
+#include "nouveau/nouveau_statebuf.h"
struct nvfx_vertex_program_exec {
uint32_t data[4];