Commit b8ed9fdd authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Swizzle macro

parent 2e08e55b
......@@ -215,3 +215,11 @@ __attribute__((__packed__))
#define REGISTER_TEXTURE_1 28
#define REGISTER_TEXTURE_2 29
#define REGISTER_SELECT 31
/* Swizzle support */
#define SWIZZLE(A, B, C, D) ((D << 6) | (C << 4) | (B << 2) | (A << 0))
#define COMPONENT_X 0x0
#define COMPONENT_Y 0x1
#define COMPONENT_Z 0x2
#define COMPONENT_W 0x3
......@@ -65,7 +65,7 @@ typedef struct midgard_instruction {
.load_store = { \
.op = midgard_op_##name, \
.mask = 0xF, \
.swizzle = 0xFF, \
.swizzle = SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_Z, COMPONENT_W), \
.reg = reg, \
.address = address \
} \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment