summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver McFadden <[email protected]>2007-07-16 06:38:12 +0000
committerOliver McFadden <[email protected]>2007-07-16 06:38:12 +0000
commit87855fb32cf7df0162720fc71976d3d23c0dbba6 (patch)
treee2d57b20a501a1333b02a9c31102cbfbcd2a7a49 /src
parentddb74cb443913a159ec800891710f18d4700d398 (diff)
r300: Added a function for vertex program default opcode translation.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c109
1 files changed, 52 insertions, 57 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 1fea88a8539..d960419240f 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -862,6 +862,55 @@ static void t_opcode_rcc(struct r300_vertex_program *vp,
_mesa_exit(-1);
}
+static void t_opcode_default(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi,
+ struct r300_vertprog_instruction *o_inst,
+ struct prog_src_register src[3],
+ int num_operands, int are_srcs_scalar)
+{
+ o_inst->opcode =
+ MAKE_VSF_OP(t_opcode(vpi->Opcode),
+ t_dst_index(vp, &vpi->DstReg),
+ t_dst_mask(vpi->DstReg.WriteMask),
+ t_dst_class(vpi->DstReg.File));
+
+ switch (num_operands) {
+ case 1:
+ if (are_srcs_scalar) {
+ o_inst->src[0] = t_src_scalar(vp, &src[0]);
+ } else {
+ o_inst->src[0] = t_src(vp, &src[0]);
+ }
+ o_inst->src[1] = ZERO_SRC_0;
+ o_inst->src[2] = ZERO_SRC_0;
+ break;
+ case 2:
+ if (are_srcs_scalar) {
+ o_inst->src[0] = t_src_scalar(vp, &src[0]);
+ o_inst->src[1] = t_src_scalar(vp, &src[1]);
+ } else {
+ o_inst->src[0] = t_src(vp, &src[0]);
+ o_inst->src[1] = t_src(vp, &src[1]);
+ }
+ o_inst->src[2] = ZERO_SRC_1;
+ break;
+ case 3:
+ if (are_srcs_scalar) {
+ o_inst->src[0] = t_src_scalar(vp, &src[0]);
+ o_inst->src[1] = t_src_scalar(vp, &src[1]);
+ o_inst->src[2] = t_src_scalar(vp, &src[2]);
+ } else {
+ o_inst->src[0] = t_src(vp, &src[0]);
+ o_inst->src[1] = t_src(vp, &src[1]);
+ o_inst->src[2] = t_src(vp, &src[2]);
+ }
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
static void t_inputs_outputs(struct r300_vertex_program *vp)
{
int i;
@@ -1064,64 +1113,11 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
t_opcode_rcc(vp, vpi, o_inst, src);
break;
case OPCODE_END:
+ /* empty */
break;
-
- /* all other opcodes */
default:
- o_inst->opcode =
- MAKE_VSF_OP(t_opcode(vpi->Opcode),
- t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask),
- t_dst_class(vpi->DstReg.File));
-
- switch (num_operands) {
- case 1:
- if (are_srcs_scalar) {
- o_inst->src[0] =
- t_src_scalar(vp, &src[0]);
- } else {
- o_inst->src[0] =
- t_src(vp, &src[0]);
- }
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
- break;
- case 2:
- if (are_srcs_scalar) {
- o_inst->src[0] =
- t_src_scalar(vp, &src[0]);
- o_inst->src[1] =
- t_src_scalar(vp, &src[1]);
- } else {
- o_inst->src[0] =
- t_src(vp, &src[0]);
- o_inst->src[1] =
- t_src(vp, &src[1]);
- }
- o_inst->src[2] = ZERO_SRC_1;
- break;
- case 3:
- if (are_srcs_scalar) {
- o_inst->src[0] =
- t_src_scalar(vp, &src[0]);
- o_inst->src[1] =
- t_src_scalar(vp, &src[1]);
- o_inst->src[2] =
- t_src_scalar(vp, &src[2]);
- } else {
- o_inst->src[0] =
- t_src(vp, &src[0]);
- o_inst->src[1] =
- t_src(vp, &src[1]);
- o_inst->src[2] =
- t_src(vp, &src[2]);
- }
- break;
- default:
- assert(0);
- break;
- }
-
+ t_opcode_default(vp, vpi, o_inst, src,
+ num_operands, are_srcs_scalar);
break;
}
}
@@ -1131,7 +1127,6 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
vp->program.length = 0;
vp->native = GL_FALSE;
}
-
#if 0
fprintf(stderr, "hw program:\n");
for (i = 0; i < vp->program.length; i++)