This was supposed to go to mesa3d.<br><br><div class="gmail_quote">On Thu, Dec 31, 2009 at 6:24 PM, Luca Barbieri <span dir="ltr"><<a href="mailto:luca@luca-barbieri.com">luca@luca-barbieri.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Also some missing _src()s and cosmetic changes.<br>
---<br>
src/gallium/programs/galliumut/Makefile | 5 +<br>
.../programs/galliumut/gen_uureg_opcodes.sh | 29 +++<br>
src/gallium/programs/galliumut/uureg.h | 196 ++++----------------<br>
3 files changed, 71 insertions(+), 159 deletions(-)<br>
create mode 100644 src/gallium/programs/galliumut/gen_uureg_opcodes.sh<br>
<br>
diff --git a/src/gallium/programs/galliumut/Makefile b/src/gallium/programs/galliumut/Makefile<br>
index ab0d684..4cb9d7c 100644<br>
--- a/src/gallium/programs/galliumut/Makefile<br>
+++ b/src/gallium/programs/galliumut/Makefile<br>
@@ -9,3 +9,8 @@ LIBRARY_DEFINES = --std=gnu99<br>
C_SOURCES = egl_gallium.c image.c normal_gen.c<br>
<br>
include ../../Makefile.template<br>
+<br>
+default: uureg_opcodes.h<br>
+<br>
+uureg_opcodes.h: gen_uureg_opcodes.sh<br>
+ bash $^ > $@<br>
diff --git a/src/gallium/programs/galliumut/gen_uureg_opcodes.sh b/src/gallium/programs/galliumut/gen_uureg_opcodes.sh<br>
new file mode 100644<br>
index 0000000..3a56fcb<br>
--- /dev/null<br>
+++ b/src/gallium/programs/galliumut/gen_uureg_opcodes.sh<br>
@@ -0,0 +1,29 @@<br>
+#!/bin/bash<br>
+cat - <<EOF<br>
+#ifndef UUREG_OPCODES_H<br>
+#define UUREG_OPCODES_H<br>
+<br>
+/* Autogenerated file, do not edit manually! Use make to regenerate. */<br>
+<br>
+EOF<br>
+<br>
+cat - << EOF|cpp -P -E - -I../../auxiliary|sed -re 's/^define /#define _/; s/ CAT /##/g;'<br>
+#define OP00(op) define op() ureg_##op(ureg)<br>
+#define OP01(op) define op(src) ureg_##op(ureg, _src(src))<br>
+#define OP00_LBL(op) define op(label) ureg_##op(ureg, label)<br>
+#define OP01_LBL(op) define op(src, label) ureg_##op(ureg, _src(src), label)<br>
+#define OP10(op) define op(dst) ureg_##op(ureg, dst)<br>
+#define OP11(op) define op(dst, src) ureg_##op(ureg, dst, _src(src))<br>
+#define OP12(op) define op(dst, src0, src1) ureg_##op(ureg, dst, _src(src0), _src(src1))<br>
+#define OP12_TEX(op) define op(dst, target, src0, src1) ureg_##op(ureg, dst, TGSI_TEXTURE_ CAT target, _src(src0), _src(src1))<br>
+#define OP13(op) define op(dst, src0, src1, src2) ureg_##op(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
+#define OP14_TEX(op) define op(dst, target, src0, src1, src2, src3) ureg_##op(ureg, dst, TGSI_TEXTURE_ CAT target, _src(src0), _src(src1), _src(src2), _src(src3))<br>
+<br>
+#include <tgsi/tgsi_opcode_tmp.h><br>
+EOF<br>
+<br>
+cat - <<EOF<br>
+<br>
+#endif<br>
+EOF<br>
+<br>
diff --git a/src/gallium/programs/galliumut/uureg.h b/src/gallium/programs/galliumut/uureg.h<br>
index a2d07a7..d30e188 100644<br>
--- a/src/gallium/programs/galliumut/uureg.h<br>
+++ b/src/gallium/programs/galliumut/uureg.h<br>
@@ -60,7 +60,7 @@ static inline struct ureg_src _src(const struct ureg_src& src) {return src;}<br>
#define _OUTPUT(v, n, i) struct ureg_dst v = ureg_DECL_output(ureg, TGSI_SEMANTIC_##n, i)<br>
#define _CONST_(v, i) struct ureg_src v = ureg_DECL_constant(ureg, i)<br>
#define _CONST(v, s) UREG_CONST(v, ureg, s)<br>
- #define _CONST_MAT3(v, s) UREG_CONST_MAT3(v, ureg, s)<br>
+#define _CONST_MAT3(v, s) UREG_CONST_MAT3(v, ureg, s)<br>
#define _CONST_MAT4(v, s) UREG_CONST_MAT4(v, ureg, s)<br>
#define _ADDRESS(v) struct ureg_src v = ureg_DECL_address(ureg)<br>
#define _LOOP(v) struct ureg_src v = ureg_DECL_loop(ureg)<br>
@@ -88,6 +88,41 @@ static inline struct ureg_src _src(const struct ureg_src& src) {return src;}<br>
#define _zy(v) _swz(v, Z, Y, Z, Y)<br>
#define _zw(v) _swz(v, Z, W, Z, W)<br>
<br>
+#define _ind(r, a) ureg_src_indirect(_src(r), _src(a))<br>
+#define _abs(x) ureg_abs(_src(x))<br>
+#define _neg(x) ureg_negate(_src(x))<br>
+#define _undef ureg_src_undef()<br>
+#define _is_undef(v) ureg_src_is_undef(_src(v))<br>
+<br>
+#define _X(v) ureg_writemask((v), TGSI_WRITEMASK_X)<br>
+#define _Y(v) ureg_writemask((v), TGSI_WRITEMASK_Y)<br>
+#define _Z(v) ureg_writemask((v), TGSI_WRITEMASK_Z)<br>
+#define _W(v) ureg_writemask((v), TGSI_WRITEMASK_W)<br>
+#define _XY(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y)<br>
+#define _XZ(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Z)<br>
+#define _XW(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_W)<br>
+#define _YZ(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z)<br>
+#define _YW(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_W)<br>
+#define _ZW(v) ureg_writemask((v), TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
+#define _XYZ(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z)<br>
+#define _XYW(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y | TGSI_WRITEMASK_W)<br>
+#define _XZW(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
+#define _YZW(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
+#define _XYZW(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
+<br>
+#define _SAT(v) ureg_saturate(v)<br>
+#define _PRED(v, n, x, y, z, w) ureg_predicate(v, n, x, y, z, w)<br>
+#define _IND(r, a) ureg_dst_indirect(r, _src(a))<br>
+#define _UNDEF ureg_dst_undef()<br>
+#define _IS_UNDEF(v) ureg_dst_is_undef(v)<br>
+<br>
+#define _VERT struct ureg_program* ureg = ureg_create(TGSI_PROCESSOR_VERTEX)<br>
+#define _FRAG struct ureg_program* ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT)<br>
+<br>
+#define _END_SHADER(pipe) (_END(), ureg_create_shader_and_destroy(ureg, pipe))<br>
+<br>
+#include "uureg_opcodes.h"<br>
+<br>
/* generate with<br>
#!/usr/bin/python<br>
l = ('x', 'y', 'z', 'w')<br>
@@ -354,162 +389,5 @@ for i in range(256):<br>
#define _wwwz(v) _swz(v, W, W, W, Z)<br>
#define _wwww(v) _swz(v, W, W, W, W)<br>
<br>
-#define _ind(r, a) ureg_src_indirect(_src(r), _src(a))<br>
-#define _abs(x) ureg_abs(_src(x))<br>
-#define _neg(x) ureg_negate(_src(x))<br>
-#define _undef ureg_src_undef()<br>
-#define _is_undef(v) ureg_src_is_undef(v)<br>
-<br>
-#define _X(v) ureg_writemask((v), TGSI_WRITEMASK_X)<br>
-#define _Y(v) ureg_writemask((v), TGSI_WRITEMASK_Y)<br>
-#define _Z(v) ureg_writemask((v), TGSI_WRITEMASK_Z)<br>
-#define _W(v) ureg_writemask((v), TGSI_WRITEMASK_W)<br>
-#define _XY(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y)<br>
-#define _XZ(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Z)<br>
-#define _XW(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_W)<br>
-#define _YZ(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z)<br>
-#define _YW(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_W)<br>
-#define _ZW(v) ureg_writemask((v), TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
-#define _XYZ(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z)<br>
-#define _XYW(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y | TGSI_WRITEMASK_W)<br>
-#define _XZW(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
-#define _YZW(v) ureg_writemask((v), TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
-#define _XYZW(v) ureg_writemask((v), TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y | TGSI_WRITEMASK_Z | TGSI_WRITEMASK_W)<br>
-<br>
-#define _SAT(v) ureg_saturate(v)<br>
-#define _PRED(v, n, x, y, z, w) ureg_predicate(v, n, x, y, z, w)<br>
-#define _IND(r, a) ureg_dst_indirect(r, _src(a))<br>
-#define _UNDEF ureg_dst_undef()<br>
-#define _IS_UNDEF(v) ureg_dst_is_undef(v)<br>
-<br>
-#define _VERT struct ureg_program* ureg = ureg_create(TGSI_PROCESSOR_VERTEX)<br>
-#define _FRAG struct ureg_program* ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT)<br>
-<br>
-#define _END_SHADER(pipe) (_END(), ureg_create_shader_and_destroy(ureg, pipe))<br>
-<br>
-/*<br>
-Generate with:<br>
-cat - << EOF|gcc -E - -I../../src/gallium/auxiliary|sed -re 's/^define/#define/; s/(ureg.* )(src[0-9]+)/\1_src(\2)/; s/(ureg.* )(src[0-9]+)/\1_src(\2)/; s/(ureg.* )(src[0-9]+)/\1_src(\2)/; s/(ureg.* )(src[0-9]+)/\1_src(\2)/; s/(ureg.* )(target)/\1TGSI_TEXTURE_##\2/;'<br>
-#define OP00(op) define op() ureg_##op(ureg)<br>
-#define OP01(op) define op(src) ureg_##op(ureg, src)<br>
-#define OP00_LBL(op) define op(label) ureg_##op(ureg, label)<br>
-#define OP01_LBL(op) define op(src, label) ureg_##op(ureg, src, label)<br>
-#define OP10(op) define op(dst) ureg_##op(ureg, dst)<br>
-#define OP11(op) define op(dst, src) ureg_##op(ureg, dst, src)<br>
-#define OP12(op) define op(dst, src0, src1) ureg_##op(ureg, dst, src0, src1)<br>
-#define OP12_TEX(op) define op(dst, target, src0, src1) ureg_##op(ureg, dst, target, src0, src1)<br>
-#define OP13(op) define op(dst, src0, src1, src2) ureg_##op(ureg, dst, src0, src1, src2)<br>
-#define OP14_TEX(op) define op(dst, target, src0, src1, src2, src3) ureg_##op(ureg, dst, target, src0, src1, src2, src3)<br>
-<br>
-#include <tgsi/tgsi_opcode_tmp.h><br>
-EOF<br>
-*/<br>
-<br>
-#define _ARL(dst, src) ureg_ARL(ureg, dst, _src(src))<br>
-#define _MOV(dst, src) ureg_MOV(ureg, dst, _src(src))<br>
-#define _LIT(dst, src) ureg_LIT(ureg, dst, _src(src))<br>
-#define _RCP(dst, src) ureg_RCP(ureg, dst, _src(src))<br>
-#define _RSQ(dst, src) ureg_RSQ(ureg, dst, _src(src))<br>
-#define _EXP(dst, src) ureg_EXP(ureg, dst, _src(src))<br>
-#define _LOG(dst, src) ureg_LOG(ureg, dst, _src(src))<br>
-#define _MUL(dst, src0, src1) ureg_MUL(ureg, dst, _src(src0), _src(src1))<br>
-#define _ADD(dst, src0, src1) ureg_ADD(ureg, dst, _src(src0), _src(src1))<br>
-#define _DP3(dst, src0, src1) ureg_DP3(ureg, dst, _src(src0), _src(src1))<br>
-#define _DP4(dst, src0, src1) ureg_DP4(ureg, dst, _src(src0), _src(src1))<br>
-#define _DST(dst, src0, src1) ureg_DST(ureg, dst, _src(src0), _src(src1))<br>
-#define _MIN(dst, src0, src1) ureg_MIN(ureg, dst, _src(src0), _src(src1))<br>
-#define _MAX(dst, src0, src1) ureg_MAX(ureg, dst, _src(src0), _src(src1))<br>
-#define _SLT(dst, src0, src1) ureg_SLT(ureg, dst, _src(src0), _src(src1))<br>
-#define _SGE(dst, src0, src1) ureg_SGE(ureg, dst, _src(src0), _src(src1))<br>
-#define _MAD(dst, src0, src1, src2) ureg_MAD(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _SUB(dst, src0, src1) ureg_SUB(ureg, dst, _src(src0), _src(src1))<br>
-#define _LRP(dst, src0, src1, src2) ureg_LRP(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _CND(dst, src0, src1, src2) ureg_CND(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _DP2A(dst, src0, src1, src2) ureg_DP2A(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _FRC(dst, src) ureg_FRC(ureg, dst, _src(src))<br>
-#define _CLAMP(dst, src0, src1, src2) ureg_CLAMP(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _FLR(dst, src) ureg_FLR(ureg, dst, _src(src))<br>
-#define _ROUND(dst, src) ureg_ROUND(ureg, dst, _src(src))<br>
-#define _EX2(dst, src) ureg_EX2(ureg, dst, _src(src))<br>
-#define _LG2(dst, src) ureg_LG2(ureg, dst, _src(src))<br>
-#define _POW(dst, src0, src1) ureg_POW(ureg, dst, _src(src0), _src(src1))<br>
-#define _XPD(dst, src0, src1) ureg_XPD(ureg, dst, _src(src0), _src(src1))<br>
-#define _ABS(dst, src) ureg_ABS(ureg, dst, _src(src))<br>
-#define _RCC(dst, src) ureg_RCC(ureg, dst, _src(src))<br>
-#define _DPH(dst, src0, src1) ureg_DPH(ureg, dst, _src(src0), _src(src1))<br>
-#define _COS(dst, src) ureg_COS(ureg, dst, _src(src))<br>
-#define _DDX(dst, src) ureg_DDX(ureg, dst, _src(src))<br>
-#define _DDY(dst, src) ureg_DDY(ureg, dst, _src(src))<br>
-#define _KILP() ureg_KILP(ureg)<br>
-#define _PK2H(dst, src) ureg_PK2H(ureg, dst, _src(src))<br>
-#define _PK2US(dst, src) ureg_PK2US(ureg, dst, _src(src))<br>
-#define _PK4B(dst, src) ureg_PK4B(ureg, dst, _src(src))<br>
-#define _PK4UB(dst, src) ureg_PK4UB(ureg, dst, _src(src))<br>
-#define _RFL(dst, src0, src1) ureg_RFL(ureg, dst, _src(src0), _src(src1))<br>
-#define _SEQ(dst, src0, src1) ureg_SEQ(ureg, dst, _src(src0), _src(src1))<br>
-#define _SFL(dst, src0, src1) ureg_SFL(ureg, dst, _src(src0), _src(src1))<br>
-#define _SGT(dst, src0, src1) ureg_SGT(ureg, dst, _src(src0), _src(src1))<br>
-#define _SIN(dst, src) ureg_SIN(ureg, dst, _src(src))<br>
-#define _SLE(dst, src0, src1) ureg_SLE(ureg, dst, _src(src0), _src(src1))<br>
-#define _SNE(dst, src0, src1) ureg_SNE(ureg, dst, _src(src0), _src(src1))<br>
-#define _STR(dst, src0, src1) ureg_STR(ureg, dst, _src(src0), _src(src1))<br>
-#define _TEX(dst, target, src0, src1) ureg_TEX(ureg, dst, TGSI_TEXTURE_##target, _src(src0), _src(src1))<br>
-#define _TXD(dst, target, src0, src1, src2, src3) ureg_TXD(ureg, dst, TGSI_TEXTURE_##target, src0, _src(src1), _src(src2), _src(src3))<br>
-#define _TXP(dst, target, src0, src1) ureg_TXP(ureg, dst, TGSI_TEXTURE_##target, _src(src0), _src(src1))<br>
-#define _UP2H(dst, src) ureg_UP2H(ureg, dst, _src(src))<br>
-#define _UP2US(dst, src) ureg_UP2US(ureg, dst, _src(src))<br>
-#define _UP4B(dst, src) ureg_UP4B(ureg, dst, _src(src))<br>
-#define _UP4UB(dst, src) ureg_UP4UB(ureg, dst, _src(src))<br>
-#define _X2D(dst, src0, src1, src2) ureg_X2D(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _ARA(dst, src) ureg_ARA(ureg, dst, _src(src))<br>
-#define _ARR(dst, src) ureg_ARR(ureg, dst, _src(src))<br>
-#define _BRA(src) ureg_BRA(ureg, _src(src))<br>
-#define _CAL(label) ureg_CAL(ureg, label)<br>
-#define _RET() ureg_RET(ureg)<br>
-#define _SSG(dst, src) ureg_SSG(ureg, dst, _src(src))<br>
-#define _CMP(dst, src0, src1, src2) ureg_CMP(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _SCS(dst, src) ureg_SCS(ureg, dst, _src(src))<br>
-#define _TXB(dst, target, src0, src1) ureg_TXB(ureg, dst, TGSI_TEXTURE_##target, _src(src0), _src(src1))<br>
-#define _NRM(dst, src) ureg_NRM(ureg, dst, _src(src))<br>
-#define _DIV(dst, src0, src1) ureg_DIV(ureg, dst, _src(src0), _src(src1))<br>
-#define _DP2(dst, src0, src1) ureg_DP2(ureg, dst, _src(src0), _src(src1))<br>
-#define _TXL(dst, target, src0, src1) ureg_TXL(ureg, dst, TGSI_TEXTURE_##target, _src(src0), _src(src1))<br>
-#define _BRK() ureg_BRK(ureg)<br>
-#define _IF(src, label) ureg_IF(ureg, _src(src), label)<br>
-#define _BGNFOR(dst, src) ureg_BGNFOR(ureg, dst, _src(src))<br>
-#define _REP(src) ureg_REP(ureg, _src(src))<br>
-#define _ELSE(label) ureg_ELSE(ureg, label)<br>
-#define _ENDIF() ureg_ENDIF(ureg)<br>
-#define _ENDFOR(dst) ureg_ENDFOR(ureg, dst)<br>
-#define _ENDREP() ureg_ENDREP(ureg)<br>
-#define _PUSHA(src) ureg_PUSHA(ureg, _src(src))<br>
-#define _POPA(dst) ureg_POPA(ureg, dst)<br>
-#define _CEIL(dst, src) ureg_CEIL(ureg, dst, _src(src))<br>
-#define _I2F(dst, src) ureg_I2F(ureg, dst, _src(src))<br>
-#define _NOT(dst, src) ureg_NOT(ureg, dst, _src(src))<br>
-#define _TRUNC(dst, src) ureg_TRUNC(ureg, dst, _src(src))<br>
-#define _SHL(dst, src0, src1) ureg_SHL(ureg, dst, _src(src0), _src(src1))<br>
-#define _SHR(dst, src0, src1) ureg_SHR(ureg, dst, _src(src0), _src(src1))<br>
-#define _AND(dst, src0, src1) ureg_AND(ureg, dst, _src(src0), _src(src1))<br>
-#define _OR(dst, src0, src1) ureg_OR(ureg, dst, _src(src0), _src(src1))<br>
-#define _MOD(dst, src0, src1) ureg_MOD(ureg, dst, _src(src0), _src(src1))<br>
-#define _XOR(dst, src0, src1) ureg_XOR(ureg, dst, _src(src0), _src(src1))<br>
-#define _SAD(dst, src0, src1, src2) ureg_SAD(ureg, dst, _src(src0), _src(src1), _src(src2))<br>
-#define _TXF(dst, target, src0, src1) ureg_TXF(ureg, dst, TGSI_TEXTURE_##target, _src(src0), _src(src1))<br>
-#define _TXQ(dst, target, src0, src1) ureg_TXQ(ureg, dst, TGSI_TEXTURE_##target, _src(src0), _src(src1))<br>
-#define _CONT() ureg_CONT(ureg)<br>
-#define _EMIT() ureg_EMIT(ureg)<br>
-#define _ENDPRIM() ureg_ENDPRIM(ureg)<br>
-#define _BGNLOOP(label) ureg_BGNLOOP(ureg, label)<br>
-#define _BGNSUB() ureg_BGNSUB(ureg)<br>
-#define _ENDLOOP(label) ureg_ENDLOOP(ureg, label)<br>
-#define _ENDSUB() ureg_ENDSUB(ureg)<br>
-#define _NOP() ureg_NOP(ureg)<br>
-#define _NRM4(dst, src) ureg_NRM4(ureg, dst, _src(src))<br>
-#define _CALLNZ(src) ureg_CALLNZ(ureg, _src(src))<br>
-#define _IFC(src) ureg_IFC(ureg, _src(src))<br>
-#define _BREAKC(src) ureg_BREAKC(ureg, _src(src))<br>
-#define _KIL(src) ureg_KIL(ureg, _src(src))<br>
-#define _END() ureg_END(ureg)<br>
-<br>
#endif<br>
+<br>
<font color="#888888">--<br>
1.6.3.3<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Luca Barbieri<br>