summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-11-05 17:10:45 +0000
committerBrian Paul <[email protected]>2005-11-05 17:10:45 +0000
commit7e807510d8c3e88ee7ae6c697393201cf08f992f (patch)
treee9b016baa0c63f333efd586619568731dc3db747 /src/mesa/swrast
parent73347516be1a515380af1a71cbeaec51001a46dc (diff)
Unify vertex/fragment program instuctions.
Based on patch by Ian (#4967) but also unify instruction opcodes.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_fragprog_to_c.c163
-rw-r--r--src/mesa/swrast/s_nvfragprog.c134
-rw-r--r--src/mesa/swrast/s_tcc.c2
3 files changed, 150 insertions, 149 deletions
diff --git a/src/mesa/swrast/s_fragprog_to_c.c b/src/mesa/swrast/s_fragprog_to_c.c
index e94c4c78a6a..dfd02dcd541 100644
--- a/src/mesa/swrast/s_fragprog_to_c.c
+++ b/src/mesa/swrast/s_fragprog_to_c.c
@@ -30,7 +30,7 @@
#include "glheader.h"
#include "colormac.h"
#include "context.h"
-#include "nvfragprog.h"
+#include "program_instruction.h"
#include "macros.h"
#include "program.h"
@@ -179,7 +179,7 @@ static INLINE void emit_char( struct fragment_program *p, char c )
* Retrieve a ureg for the given source register. Will emit
* constants, apply swizzling and negation as needed.
*/
-static GLuint src_vector( const struct fp_src_register *source )
+static GLuint src_vector( const struct prog_src_register *source )
{
GLuint src;
@@ -262,7 +262,7 @@ static void print_footer( struct fragment_program *p )
}
static void print_dest_reg( struct fragment_program *p,
- const struct fp_instruction *inst )
+ const struct prog_instruction *inst )
{
switch (inst->DstReg.File) {
case PROGRAM_OUTPUT:
@@ -277,7 +277,7 @@ static void print_dest_reg( struct fragment_program *p,
}
static void print_dest( struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
GLuint idx )
{
print_dest_reg(p, inst);
@@ -369,7 +369,7 @@ static void print_expression( struct fragment_program *p,
}
static void do_tex_kill( struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
GLuint arg )
{
GLuint i;
@@ -389,7 +389,7 @@ static void do_tex_kill( struct fragment_program *p,
}
static void do_tex_simple( struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
const char *fn, GLuint texunit, GLuint arg )
{
emit(p, " %s( ctx, ", fn);
@@ -401,7 +401,7 @@ static void do_tex_simple( struct fragment_program *p,
static void do_tex( struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
const char *fn, GLuint texunit, GLuint arg )
{
GLuint i;
@@ -444,7 +444,7 @@ static void do_tex( struct fragment_program *p,
static void saturate( struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
GLuint i )
{
emit(p, " ");
@@ -456,7 +456,7 @@ static void saturate( struct fragment_program *p,
static void assign_single( GLuint i,
struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
const char *fmt,
... )
{
@@ -476,7 +476,7 @@ static void assign_single( GLuint i,
}
static void assign4( struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
const char *fmt,
... )
{
@@ -498,7 +498,7 @@ static void assign4( struct fragment_program *p,
}
static void assign4_replicate( struct fragment_program *p,
- const struct fp_instruction *inst,
+ const struct prog_instruction *inst,
const char *fmt,
... )
{
@@ -537,44 +537,45 @@ static void assign4_replicate( struct fragment_program *p,
}
-
-
+/**
+ * XXX This should go away.
+ */
static GLuint nr_args( GLuint opcode )
{
switch (opcode) {
- case FP_OPCODE_ABS: return 1;
- case FP_OPCODE_ADD: return 2;
- case FP_OPCODE_CMP: return 3;
- case FP_OPCODE_COS: return 1;
- case FP_OPCODE_DP3: return 2;
- case FP_OPCODE_DP4: return 2;
- case FP_OPCODE_DPH: return 2;
- case FP_OPCODE_DST: return 2;
- case FP_OPCODE_EX2: return 1;
- case FP_OPCODE_FLR: return 1;
- case FP_OPCODE_FRC: return 1;
- case FP_OPCODE_KIL: return 1;
- case FP_OPCODE_LG2: return 1;
- case FP_OPCODE_LIT: return 1;
- case FP_OPCODE_LRP: return 3;
- case FP_OPCODE_MAD: return 3;
- case FP_OPCODE_MAX: return 2;
- case FP_OPCODE_MIN: return 2;
- case FP_OPCODE_MOV: return 1;
- case FP_OPCODE_MUL: return 2;
- case FP_OPCODE_POW: return 2;
- case FP_OPCODE_RCP: return 1;
- case FP_OPCODE_RSQ: return 1;
- case FP_OPCODE_SCS: return 1;
- case FP_OPCODE_SGE: return 2;
- case FP_OPCODE_SIN: return 1;
- case FP_OPCODE_SLT: return 2;
- case FP_OPCODE_SUB: return 2;
- case FP_OPCODE_SWZ: return 1;
- case FP_OPCODE_TEX: return 1;
- case FP_OPCODE_TXB: return 1;
- case FP_OPCODE_TXP: return 1;
- case FP_OPCODE_XPD: return 2;
+ case OPCODE_ABS: return 1;
+ case OPCODE_ADD: return 2;
+ case OPCODE_CMP: return 3;
+ case OPCODE_COS: return 1;
+ case OPCODE_DP3: return 2;
+ case OPCODE_DP4: return 2;
+ case OPCODE_DPH: return 2;
+ case OPCODE_DST: return 2;
+ case OPCODE_EX2: return 1;
+ case OPCODE_FLR: return 1;
+ case OPCODE_FRC: return 1;
+ case OPCODE_KIL: return 1;
+ case OPCODE_LG2: return 1;
+ case OPCODE_LIT: return 1;
+ case OPCODE_LRP: return 3;
+ case OPCODE_MAD: return 3;
+ case OPCODE_MAX: return 2;
+ case OPCODE_MIN: return 2;
+ case OPCODE_MOV: return 1;
+ case OPCODE_MUL: return 2;
+ case OPCODE_POW: return 2;
+ case OPCODE_RCP: return 1;
+ case OPCODE_RSQ: return 1;
+ case OPCODE_SCS: return 1;
+ case OPCODE_SGE: return 2;
+ case OPCODE_SIN: return 1;
+ case OPCODE_SLT: return 2;
+ case OPCODE_SUB: return 2;
+ case OPCODE_SWZ: return 1;
+ case OPCODE_TEX: return 1;
+ case OPCODE_TXB: return 1;
+ case OPCODE_TXP: return 1;
+ case OPCODE_XPD: return 2;
default: return 0;
}
}
@@ -583,9 +584,9 @@ static GLuint nr_args( GLuint opcode )
static void translate_program( struct fragment_program *p )
{
- const struct fp_instruction *inst = p->Instructions;
+ const struct prog_instruction *inst = p->Instructions;
- for (; inst->Opcode != FP_OPCODE_END; inst++) {
+ for (; inst->Opcode != OPCODE_END; inst++) {
GLuint src[3], i;
GLuint nr = nr_args( inst->Opcode );
@@ -606,23 +607,23 @@ static void translate_program( struct fragment_program *p )
}
switch (inst->Opcode) {
- case FP_OPCODE_ABS:
+ case OPCODE_ABS:
assign4(p, inst, "fabsf(%s)", src[0]);
break;
- case FP_OPCODE_ADD:
+ case OPCODE_ADD:
assign4(p, inst, "%s + %s", src[0], src[1]);
break;
- case FP_OPCODE_CMP:
+ case OPCODE_CMP:
assign4(p, inst, "%s < 0.0F ? %s : %s", src[0], src[1], src[2]);
break;
- case FP_OPCODE_COS:
+ case OPCODE_COS:
assign4_replicate(p, inst, "COS(%s)", src[0]);
break;
- case FP_OPCODE_DP3:
+ case OPCODE_DP3:
assign4_replicate(p, inst,
"%s*%s + %s*%s + %s*%s",
deref(src[0],_X),
@@ -633,7 +634,7 @@ static void translate_program( struct fragment_program *p )
deref(src[1],_Z));
break;
- case FP_OPCODE_DP4:
+ case OPCODE_DP4:
assign4_replicate(p, inst,
"%s*%s + %s*%s + %s*%s + %s*%s",
deref(src[0],_X),
@@ -644,7 +645,7 @@ static void translate_program( struct fragment_program *p )
deref(src[1],_Z));
break;
- case FP_OPCODE_DPH:
+ case OPCODE_DPH:
assign4_replicate(p, inst,
"%s*%s + %s*%s + %s*%s + %s",
deref(src[0],_X),
@@ -654,7 +655,7 @@ static void translate_program( struct fragment_program *p )
deref(src[1],_Z));
break;
- case FP_OPCODE_DST:
+ case OPCODE_DST:
/* result[0] = 1 * 1;
* result[1] = a[1] * b[1];
* result[2] = a[2] * 1;
@@ -669,27 +670,27 @@ static void translate_program( struct fragment_program *p )
assign_single(3, p, inst, "%s", deref(src[1], _W));
break;
- case FP_OPCODE_EX2:
+ case OPCODE_EX2:
assign4_replicate(p, inst, "powf(2.0, %s)", src[0]);
break;
- case FP_OPCODE_FLR:
+ case OPCODE_FLR:
assign4_replicate(p, inst, "floorf(%s)", src[0]);
break;
- case FP_OPCODE_FRC:
+ case OPCODE_FRC:
assign4_replicate(p, inst, "%s - floorf(%s)", src[0], src[0]);
break;
- case FP_OPCODE_KIL:
+ case OPCODE_KIL:
do_tex_kill(p, inst, src[0]);
break;
- case FP_OPCODE_LG2:
+ case OPCODE_LG2:
assign4_replicate(p, inst, "LOG2(%s)", src[0]);
break;
- case FP_OPCODE_LIT:
+ case OPCODE_LIT:
assign_single(0, p, inst, "1.0");
assign_single(1, p, inst, "MIN2(%s, 0)", deref(src[0], _X));
assign_single(2, p, inst, "(%s > 0.0) ? expf(%s * MIN2(%s, 0)) : 0.0",
@@ -699,45 +700,45 @@ static void translate_program( struct fragment_program *p )
assign_single(3, p, inst, "1.0");
break;
- case FP_OPCODE_LRP:
+ case OPCODE_LRP:
assign4(p, inst,
"%s * %s + (1.0 - %s) * %s",
src[0], src[1], src[0], src[2]);
break;
- case FP_OPCODE_MAD:
+ case OPCODE_MAD:
assign4(p, inst, "%s * %s + %s", src[0], src[1], src[2]);
break;
- case FP_OPCODE_MAX:
+ case OPCODE_MAX:
assign4(p, inst, "MAX2(%s, %s)", src[0], src[1]);
break;
- case FP_OPCODE_MIN:
+ case OPCODE_MIN:
assign4(p, inst, "MIN2(%s, %s)", src[0], src[1]);
break;
- case FP_OPCODE_MOV:
+ case OPCODE_MOV:
assign4(p, inst, "%s", src[0]);
break;
- case FP_OPCODE_MUL:
+ case OPCODE_MUL:
assign4(p, inst, "%s * %s", src[0], src[1]);
break;
- case FP_OPCODE_POW:
+ case OPCODE_POW:
assign4_replicate(p, inst, "powf(%s, %s)", src[0], src[1]);
break;
- case FP_OPCODE_RCP:
+ case OPCODE_RCP:
assign4_replicate(p, inst, "1.0/%s", src[0]);
break;
- case FP_OPCODE_RSQ:
+ case OPCODE_RSQ:
assign4_replicate(p, inst, "_mesa_inv_sqrtf(%s)", src[0]);
break;
- case FP_OPCODE_SCS:
+ case OPCODE_SCS:
if (inst->DstReg.WriteMask[0]) {
assign_single(0, p, inst, "cosf(%s)", deref(src[0], _X));
}
@@ -747,39 +748,39 @@ static void translate_program( struct fragment_program *p )
}
break;
- case FP_OPCODE_SGE:
+ case OPCODE_SGE:
assign4(p, inst, "%s >= %s ? 1.0 : 0.0", src[0], src[1]);
break;
- case FP_OPCODE_SIN:
+ case OPCODE_SIN:
assign4_replicate(p, inst, "sinf(%s)", src[0]);
break;
- case FP_OPCODE_SLT:
+ case OPCODE_SLT:
assign4(p, inst, "%s < %s ? 1.0 : 0.0", src[0], src[1]);
break;
- case FP_OPCODE_SUB:
+ case OPCODE_SUB:
assign4(p, inst, "%s - %s", src[0], src[1]);
break;
- case FP_OPCODE_SWZ: /* same implementation as MOV: */
+ case OPCODE_SWZ: /* same implementation as MOV: */
assign4(p, inst, "%s", src[0]);
break;
- case FP_OPCODE_TEX:
+ case OPCODE_TEX:
do_tex(p, inst, "TEX", inst->TexSrcUnit, src[0]);
break;
- case FP_OPCODE_TXB:
+ case OPCODE_TXB:
do_tex(p, inst, "TXB", inst->TexSrcUnit, src[0]);
break;
- case FP_OPCODE_TXP:
+ case OPCODE_TXP:
do_tex(p, inst, "TXP", inst->TexSrcUnit, src[0]);
break;
- case FP_OPCODE_XPD:
+ case OPCODE_XPD:
/* Cross product:
* result.x = src[0].y * src[1].z - src[0].z * src[1].y;
* result.y = src[0].z * src[1].x - src[0].x * src[1].z;
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index cae0e49cc35..94224bc1d34 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -34,7 +34,7 @@
#include "glheader.h"
#include "colormac.h"
#include "context.h"
-#include "nvfragprog.h"
+#include "program_instruction.h"
#include "program.h"
#include "s_nvfragprog.h"
@@ -104,7 +104,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
*/
static INLINE const GLfloat *
get_register_pointer( GLcontext *ctx,
- const struct fp_src_register *source,
+ const struct prog_src_register *source,
const struct fp_machine *machine,
const struct fragment_program *program )
{
@@ -151,7 +151,7 @@ get_register_pointer( GLcontext *ctx,
*/
static void
fetch_vector4( GLcontext *ctx,
- const struct fp_src_register *source,
+ const struct prog_src_register *source,
const struct fp_machine *machine,
const struct fragment_program *program,
GLfloat result[4] )
@@ -192,7 +192,7 @@ fetch_vector4( GLcontext *ctx,
*/
static GLboolean
fetch_vector4_deriv( GLcontext *ctx,
- const struct fp_src_register *source,
+ const struct prog_src_register *source,
const struct sw_span *span,
char xOrY, GLint column, GLfloat result[4] )
{
@@ -321,7 +321,7 @@ fetch_vector4_deriv( GLcontext *ctx,
*/
static void
fetch_vector1( GLcontext *ctx,
- const struct fp_src_register *source,
+ const struct prog_src_register *source,
const struct fp_machine *machine,
const struct fragment_program *program,
GLfloat result[4] )
@@ -385,13 +385,13 @@ test_cc(GLuint condCode, GLuint ccMaskRule)
* set-condition-code flags.
*/
static void
-store_vector4( const struct fp_instruction *inst,
+store_vector4( const struct prog_instruction *inst,
struct fp_machine *machine,
const GLfloat value[4] )
{
- const struct fp_dst_register *dest = &(inst->DstReg);
+ const struct prog_dst_register *dest = &(inst->DstReg);
const GLboolean clamp = inst->Saturate;
- const GLboolean updateCC = inst->UpdateCondRegister;
+ const GLboolean updateCC = inst->CondUpdate;
GLfloat *dstReg;
GLfloat dummyReg[4];
GLfloat clampedValue[4];
@@ -599,7 +599,7 @@ execute_program( GLcontext *ctx,
#endif
for (pc = 0; pc < maxInst; pc++) {
- const struct fp_instruction *inst = program->Instructions + pc;
+ const struct prog_instruction *inst = program->Instructions + pc;
if (ctx->FragmentProgram.CallbackEnabled &&
ctx->FragmentProgram.Callback) {
@@ -609,7 +609,7 @@ execute_program( GLcontext *ctx,
}
switch (inst->Opcode) {
- case FP_OPCODE_ABS:
+ case OPCODE_ABS:
{
GLfloat a[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -620,7 +620,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_ADD:
+ case OPCODE_ADD:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -632,7 +632,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_CMP:
+ case OPCODE_CMP:
{
GLfloat a[4], b[4], c[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -645,7 +645,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_COS:
+ case OPCODE_COS:
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -653,7 +653,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_DDX: /* Partial derivative with respect to X */
+ case OPCODE_DDX: /* Partial derivative with respect to X */
{
GLfloat a[4], aNext[4], result[4];
struct fp_machine dMachine;
@@ -679,7 +679,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_DDY: /* Partial derivative with respect to Y */
+ case OPCODE_DDY: /* Partial derivative with respect to Y */
{
GLfloat a[4], aNext[4], result[4];
struct fp_machine dMachine;
@@ -698,7 +698,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_DP3:
+ case OPCODE_DP3:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -712,7 +712,7 @@ execute_program( GLcontext *ctx,
#endif
}
break;
- case FP_OPCODE_DP4:
+ case OPCODE_DP4:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -726,7 +726,7 @@ execute_program( GLcontext *ctx,
#endif
}
break;
- case FP_OPCODE_DPH:
+ case OPCODE_DPH:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -736,7 +736,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_DST: /* Distance vector */
+ case OPCODE_DST: /* Distance vector */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -748,7 +748,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_EX2: /* Exponential base 2 */
+ case OPCODE_EX2: /* Exponential base 2 */
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -757,7 +757,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_FLR:
+ case OPCODE_FLR:
{
GLfloat a[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -768,7 +768,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_FRC:
+ case OPCODE_FRC:
{
GLfloat a[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -779,7 +779,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_KIL_NV: /* NV_f_p only */
+ case OPCODE_KIL_NV: /* NV_f_p only */
{
const GLuint swizzle = inst->DstReg.CondSwizzle;
const GLuint condMask = inst->DstReg.CondMask;
@@ -791,7 +791,7 @@ execute_program( GLcontext *ctx,
}
}
break;
- case FP_OPCODE_KIL: /* ARB_f_p only */
+ case OPCODE_KIL: /* ARB_f_p only */
{
GLfloat a[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -800,7 +800,7 @@ execute_program( GLcontext *ctx,
}
}
break;
- case FP_OPCODE_LG2: /* log base 2 */
+ case OPCODE_LG2: /* log base 2 */
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -809,7 +809,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_LIT:
+ case OPCODE_LIT:
{
const GLfloat epsilon = 1.0F / 256.0F; /* from NV VP spec */
GLfloat a[4], result[4];
@@ -834,7 +834,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_LRP:
+ case OPCODE_LRP:
{
GLfloat a[4], b[4], c[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -847,7 +847,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_MAD:
+ case OPCODE_MAD:
{
GLfloat a[4], b[4], c[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -860,7 +860,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_MAX:
+ case OPCODE_MAX:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -878,7 +878,7 @@ execute_program( GLcontext *ctx,
#endif
}
break;
- case FP_OPCODE_MIN:
+ case OPCODE_MIN:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -890,7 +890,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_MOV:
+ case OPCODE_MOV:
{
GLfloat result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, result );
@@ -901,7 +901,7 @@ execute_program( GLcontext *ctx,
#endif
}
break;
- case FP_OPCODE_MUL:
+ case OPCODE_MUL:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -919,7 +919,7 @@ execute_program( GLcontext *ctx,
#endif
}
break;
- case FP_OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */
+ case OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */
{
GLfloat a[4], result[4];
GLhalfNV hx, hy;
@@ -934,7 +934,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_PK2US: /* pack two GLushorts into one 32-bit float */
+ case OPCODE_PK2US: /* pack two GLushorts into one 32-bit float */
{
GLfloat a[4], result[4];
GLuint usx, usy, *rawResult = (GLuint *) result;
@@ -948,7 +948,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_PK4B: /* pack four GLbytes into one 32-bit float */
+ case OPCODE_PK4B: /* pack four GLbytes into one 32-bit float */
{
GLfloat a[4], result[4];
GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result;
@@ -966,7 +966,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_PK4UB: /* pack four GLubytes into one 32-bit float */
+ case OPCODE_PK4UB: /* pack four GLubytes into one 32-bit float */
{
GLfloat a[4], result[4];
GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result;
@@ -984,7 +984,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_POW:
+ case OPCODE_POW:
{
GLfloat a[4], b[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -994,7 +994,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_RCP:
+ case OPCODE_RCP:
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1009,7 +1009,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_RFL:
+ case OPCODE_RFL:
{
GLfloat axis[4], dir[4], result[4], tmp[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, axis );
@@ -1027,7 +1027,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_RSQ: /* 1 / sqrt() */
+ case OPCODE_RSQ: /* 1 / sqrt() */
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1039,7 +1039,7 @@ execute_program( GLcontext *ctx,
#endif
}
break;
- case FP_OPCODE_SCS: /* sine and cos */
+ case OPCODE_SCS: /* sine and cos */
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1050,7 +1050,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SEQ: /* set on equal */
+ case OPCODE_SEQ: /* set on equal */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1062,13 +1062,13 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SFL: /* set false, operands ignored */
+ case OPCODE_SFL: /* set false, operands ignored */
{
static const GLfloat result[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SGE: /* set on greater or equal */
+ case OPCODE_SGE: /* set on greater or equal */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1080,7 +1080,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SGT: /* set on greater */
+ case OPCODE_SGT: /* set on greater */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1092,7 +1092,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SIN:
+ case OPCODE_SIN:
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1101,7 +1101,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SLE: /* set on less or equal */
+ case OPCODE_SLE: /* set on less or equal */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1113,7 +1113,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SLT: /* set on less */
+ case OPCODE_SLT: /* set on less */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1125,7 +1125,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SNE: /* set on not equal */
+ case OPCODE_SNE: /* set on not equal */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1137,13 +1137,13 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_STR: /* set true, operands ignored */
+ case OPCODE_STR: /* set true, operands ignored */
{
static const GLfloat result[4] = { 1.0F, 1.0F, 1.0F, 1.0F };
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SUB:
+ case OPCODE_SUB:
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1155,9 +1155,9 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_SWZ:
+ case OPCODE_SWZ:
{
- const struct fp_src_register *source = &inst->SrcReg[0];
+ const struct prog_src_register *source = &inst->SrcReg[0];
const GLfloat *src = get_register_pointer(ctx, source,
machine, program);
GLfloat result[4];
@@ -1178,7 +1178,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_TEX: /* Both ARB and NV frag prog */
+ case OPCODE_TEX: /* Both ARB and NV frag prog */
/* Texel lookup */
{
GLfloat texcoord[4], color[4];
@@ -1206,7 +1206,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, color );
}
break;
- case FP_OPCODE_TXB: /* GL_ARB_fragment_program only */
+ case OPCODE_TXB: /* GL_ARB_fragment_program only */
/* Texel lookup with LOD bias */
{
GLfloat texcoord[4], color[4], bias, lambda;
@@ -1222,7 +1222,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, color );
}
break;
- case FP_OPCODE_TXD: /* GL_NV_fragment_program only */
+ case OPCODE_TXD: /* GL_NV_fragment_program only */
/* Texture lookup w/ partial derivatives for LOD */
{
GLfloat texcoord[4], dtdx[4], dtdy[4], color[4];
@@ -1234,7 +1234,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, color );
}
break;
- case FP_OPCODE_TXP: /* GL_ARB_fragment_program only */
+ case OPCODE_TXP: /* GL_ARB_fragment_program only */
/* Texture lookup w/ projective divide */
{
GLfloat texcoord[4], color[4];
@@ -1262,12 +1262,12 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, color );
}
break;
- case FP_OPCODE_TXP_NV: /* GL_NV_fragment_program only */
+ case OPCODE_TXP_NV: /* GL_NV_fragment_program only */
/* Texture lookup w/ projective divide */
{
GLfloat texcoord[4], color[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord );
- if (inst->TexSrcIdx != TEXTURE_CUBE_INDEX &&
+ if (inst->TexSrcTarget != TEXTURE_CUBE_INDEX &&
texcoord[3] != 0.0) {
texcoord[0] /= texcoord[3];
texcoord[1] /= texcoord[3];
@@ -1279,7 +1279,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, color );
}
break;
- case FP_OPCODE_UP2H: /* unpack two 16-bit floats */
+ case OPCODE_UP2H: /* unpack two 16-bit floats */
{
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
@@ -1292,7 +1292,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_UP2US: /* unpack two GLushorts */
+ case OPCODE_UP2US: /* unpack two GLushorts */
{
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
@@ -1305,7 +1305,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_UP4B: /* unpack four GLbytes */
+ case OPCODE_UP4B: /* unpack four GLbytes */
{
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
@@ -1317,7 +1317,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_UP4UB: /* unpack four GLubytes */
+ case OPCODE_UP4UB: /* unpack four GLubytes */
{
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
@@ -1329,7 +1329,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_XPD: /* cross product */
+ case OPCODE_XPD: /* cross product */
{
GLfloat a[4], b[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1341,7 +1341,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_X2D: /* 2-D matrix transform */
+ case OPCODE_X2D: /* 2-D matrix transform */
{
GLfloat a[4], b[4], c[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
@@ -1354,7 +1354,7 @@ execute_program( GLcontext *ctx,
store_vector4( inst, machine, result );
}
break;
- case FP_OPCODE_PRINT:
+ case OPCODE_PRINT:
{
if (inst->SrcReg[0].File != -1) {
GLfloat a[4];
@@ -1367,7 +1367,7 @@ execute_program( GLcontext *ctx,
}
}
break;
- case FP_OPCODE_END:
+ case OPCODE_END:
return GL_TRUE;
default:
_mesa_problem(ctx, "Bad opcode %d in _mesa_exec_fragment_program",
diff --git a/src/mesa/swrast/s_tcc.c b/src/mesa/swrast/s_tcc.c
index e896d1fef54..9e6f4f26b7d 100644
--- a/src/mesa/swrast/s_tcc.c
+++ b/src/mesa/swrast/s_tcc.c
@@ -33,7 +33,7 @@
#include "imports.h"
#include "colormac.h"
#include "context.h"
-#include "nvfragprog.h"
+#include "program_instruction.h"
#include "macros.h"
#include "program.h"