(t_src_class(a.File) == PVS_SRC_REG_INPUT && \
t_src_class(b.File) == PVS_SRC_REG_INPUT)))) \
-#define ZERO_SRC_0 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), \
- SWIZZLE_ZERO, SWIZZLE_ZERO, \
- SWIZZLE_ZERO, SWIZZLE_ZERO, \
- t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4))
-
-#define ZERO_SRC_1 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), \
- SWIZZLE_ZERO, SWIZZLE_ZERO, \
- SWIZZLE_ZERO, SWIZZLE_ZERO, \
- t_src_class(src[1].File), VSF_FLAG_NONE) | (src[1].RelAddr << 4))
-
-#define ZERO_SRC_2 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), \
- SWIZZLE_ZERO, SWIZZLE_ZERO, \
- SWIZZLE_ZERO, SWIZZLE_ZERO, \
- t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4))
-
-#define ONE_SRC_0 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[0]), \
- SWIZZLE_ONE, SWIZZLE_ONE, \
- SWIZZLE_ONE, SWIZZLE_ONE, \
- t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4))
-
-#define ONE_SRC_1 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]), \
- SWIZZLE_ONE, SWIZZLE_ONE, \
- SWIZZLE_ONE, SWIZZLE_ONE, \
- t_src_class(src[1].File), VSF_FLAG_NONE) | (src[1].RelAddr << 4))
-
-#define ONE_SRC_2 (PVS_SOURCE_OPCODE(t_src_index(vp, &src[2]), \
- SWIZZLE_ONE, SWIZZLE_ONE, \
- SWIZZLE_ONE, SWIZZLE_ONE, \
- t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4))
+/*
+ * Take an already-setup and valid source then swizzle it appropriately to
+ * obtain a constant ZERO or ONE source.
+ */
+#define PVS_SOURCE_CONSTANT(x, y) \
+ (PVS_SOURCE_OPCODE(t_src_index(vp, &src[x]), \
+ t_swizzle(y), \
+ t_swizzle(y), \
+ t_swizzle(y), \
+ t_swizzle(y), \
+ t_src_class(src[x].File), \
+ VSF_FLAG_NONE) | (src[x].RelAddr << 4))
#define FREE_TEMPS() \
do { \
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
SWIZZLE_ZERO,
t_src_class(src[1].File),
src[1].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[1].RelAddr << 4);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_src_class(src[0].File),
src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src_scalar(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src_scalar(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
PVS_DST_REG_TEMPORARY);
inst[1] = t_src(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
inst += 4;
inst[0] = PVS_OPCODE(VE_ADD,
(!src[0].
NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE
/*VSF_FLAG_ALL */ );
- inst[3] = ZERO_SRC_0;
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
(*u_temp_i)--;
return inst;
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_src_class(src[0].File),
src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src_scalar(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src_scalar(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
inst[3] = t_src_scalar(vp, &src[1]);
return inst;
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src_scalar(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src_scalar(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
inst[2] = t_src(vp, &src[1]);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
return inst;
}
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
- inst[2] = ONE_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ONE);
inst[3] = PVS_SOURCE_OPCODE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
inst[1] = t_src(vp, &src[0]);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
return inst;
}
t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W
t_src_class(src[1].File),
src[1].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4);
- inst[3] = ZERO_SRC_1;
+ inst[3] = PVS_SOURCE_CONSTANT(1, SWIZZLE_ZERO);
inst += 4;
inst[0] = PVS_OPCODE(VE_MULTIPLY_ADD,
SWIZZLE_W,
t_src_class(src[2].File),
VSF_FLAG_NONE) | (src[2].RelAddr << 4);
- inst[2] = ZERO_SRC_2;
- inst[3] = ZERO_SRC_2;
+ inst[2] = PVS_SOURCE_CONSTANT(2, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(2, SWIZZLE_ZERO);
inst += 4;
src[2].File = PROGRAM_TEMPORARY;
SWIZZLE_W,
t_src_class(src[0].File),
VSF_FLAG_NONE) | (src[0].RelAddr << 4);
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
inst += 4;
src[0].File = PROGRAM_TEMPORARY;
GL_FALSE,
vp->outputs[i],
VSF_FLAG_ALL, PVS_DST_REG_OUT);
- inst[1] = ZERO_SRC_0;
- inst[2] = ZERO_SRC_0;
- inst[3] = ZERO_SRC_0;
+ inst[1] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[2] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
+ inst[3] = PVS_SOURCE_CONSTANT(0, SWIZZLE_ZERO);
inst += 4;
}
}