summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_cs.h
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-01-21 02:21:09 -0800
committerCorbin Simpson <[email protected]>2009-02-01 23:30:25 -0800
commit22877265f4fdf66c75df391d6de95bd5c1584ea3 (patch)
treefb2366ce6deb4a562a1187c318c5aa9090a11280 /src/gallium/drivers/r300/r300_cs.h
parent6885560de54db26683eb813756e09fa3822c3492 (diff)
[BROKEN] r300: Add initial clear/fill code.
Copied from mesa and still broken. Gimme a few to clean it up.
Diffstat (limited to 'src/gallium/drivers/r300/r300_cs.h')
-rw-r--r--src/gallium/drivers/r300/r300_cs.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index 3dacf253808..59ca985f40c 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -26,6 +26,18 @@
#include "r300_reg.h"
#include "r300_winsys.h"
+/* Pack a 32-bit float into a dword. */
+static uint32_t pack_float_32(float f)
+{
+ union {
+ float f;
+ uint32_t u;
+ } u;
+
+ u.f = f;
+ return u.u;
+}
+
/* Yes, I know macros are ugly. However, they are much prettier than the code
* that they neatly hide away, and don't have the cost of function setup,so
* we're going to use them. */
@@ -47,7 +59,6 @@
struct r300_winsys* cs_winsys = context->winsys; \
struct radeon_cs* cs = cs_winsys->cs
-
#define CHECK_CS(size) \
cs_winsys->check_cs(cs, (size))
@@ -59,10 +70,19 @@
#define OUT_CS(value) \
cs_winsys->write_cs_dword(cs, value)
+#define OUT_CS_32F(value) \
+ cs_winsys->write_cs_dword(cs, pack_float_32(value))
+
#define OUT_CS_REG(register, value) do { \
OUT_CS(CP_PACKET0(register, 0)); \
OUT_CS(value); } while (0)
+/* Note: This expects count to be the number of registers,
+ * not the actual packet0 count! */
+#define OUT_CS_REG_SEQ(register, count) do { \
+ OUT_CS(CP_PACKET0(register, ((count) - 1))); \
+} while (0)
+
#define OUT_CS_RELOC(bo, offset, rd, wd, flags) do { \
OUT_CS(offset); \
cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
@@ -74,4 +94,4 @@
#define FLUSH_CS \
cs_winsys->flush_cs(cs)
-#endif /* R300_CS_H */ \ No newline at end of file
+#endif /* R300_CS_H */