X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fprogram%2Fprog_execute.c;h=956b84a20d6496c7c9ebe61f592ff27c0b0fc9c6;hb=ed3f1e04c7d2b5c17885919db5fde310d4bdf822;hp=8ae015f4bf2b0a66e183de6e537d8399f88e666e;hpb=46ce78d4c659fcf9fb2b088424d4d16d13ab5d75;p=mesa.git diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index 8ae015f4bf2..956b84a20d6 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -36,9 +36,10 @@ #include "c99_math.h" +#include "main/errors.h" #include "main/glheader.h" -#include "main/colormac.h" #include "main/macros.h" +#include "main/mtypes.h" #include "prog_execute.h" #include "prog_instruction.h" #include "prog_parameter.h" @@ -118,13 +119,15 @@ get_src_register_pointer(const struct prog_src_register *source, /* Fallthrough */ case PROGRAM_CONSTANT: /* Fallthrough */ - case PROGRAM_UNIFORM: + case PROGRAM_UNIFORM: { if (reg >= (GLint) prog->Parameters->NumParameters) return ZeroVec; - return (GLfloat *) prog->Parameters->ParameterValues[reg]; + unsigned pvo = prog->Parameters->ParameterValueOffset[reg]; + return (GLfloat *) prog->Parameters->ParameterValues + pvo; + } case PROGRAM_SYSTEM_VALUE: - assert(reg < (GLint) Elements(machine->SystemValues)); + assert(reg < (GLint) ARRAY_SIZE(machine->SystemValues)); return machine->SystemValues[reg]; default: @@ -201,12 +204,6 @@ fetch_vector4(const struct prog_src_register *source, result[3] = src[GET_SWZ(source->Swizzle, 3)]; } - if (source->Abs) { - result[0] = FABSF(result[0]); - result[1] = FABSF(result[1]); - result[2] = FABSF(result[2]); - result[3] = FABSF(result[3]); - } if (source->Negate) { assert(source->Negate == NEGATE_XYZW); result[0] = -result[0]; @@ -216,10 +213,10 @@ fetch_vector4(const struct prog_src_register *source, } #ifdef NAN_CHECK - assert(!IS_INF_OR_NAN(result[0])); - assert(!IS_INF_OR_NAN(result[0])); - assert(!IS_INF_OR_NAN(result[0])); - assert(!IS_INF_OR_NAN(result[0])); + assert(!util_is_inf_or_nan(result[0])); + assert(!util_is_inf_or_nan(result[0])); + assert(!util_is_inf_or_nan(result[0])); + assert(!util_is_inf_or_nan(result[0])); #endif } @@ -229,8 +226,7 @@ fetch_vector4(const struct prog_src_register *source, * XXX this currently only works for fragment program input attribs. */ static void -fetch_vector4_deriv(struct gl_context * ctx, - const struct prog_src_register *source, +fetch_vector4_deriv(const struct prog_src_register *source, const struct gl_program_machine *machine, char xOrY, GLfloat result[4]) { @@ -259,12 +255,6 @@ fetch_vector4_deriv(struct gl_context * ctx, result[2] = deriv[GET_SWZ(source->Swizzle, 2)]; result[3] = deriv[GET_SWZ(source->Swizzle, 3)]; - if (source->Abs) { - result[0] = FABSF(result[0]); - result[1] = FABSF(result[1]); - result[2] = FABSF(result[2]); - result[3] = FABSF(result[3]); - } if (source->Negate) { assert(source->Negate == NEGATE_XYZW); result[0] = -result[0]; @@ -290,9 +280,6 @@ fetch_vector1(const struct prog_src_register *source, result[0] = src[GET_SWZ(source->Swizzle, 0)]; - if (source->Abs) { - result[0] = FABSF(result[0]); - } if (source->Negate) { result[0] = -result[0]; } @@ -329,66 +316,6 @@ fetch_texel(struct gl_context *ctx, } -/** - * Test value against zero and return GT, LT, EQ or UN if NaN. - */ -static inline GLuint -generate_cc(float value) -{ - if (value != value) - return COND_UN; /* NaN */ - if (value > 0.0F) - return COND_GT; - if (value < 0.0F) - return COND_LT; - return COND_EQ; -} - - -/** - * Test if the ccMaskRule is satisfied by the given condition code. - * Used to mask destination writes according to the current condition code. - */ -static inline GLboolean -test_cc(GLuint condCode, GLuint ccMaskRule) -{ - switch (ccMaskRule) { - case COND_EQ: return (condCode == COND_EQ); - case COND_NE: return (condCode != COND_EQ); - case COND_LT: return (condCode == COND_LT); - case COND_GE: return (condCode == COND_GT || condCode == COND_EQ); - case COND_LE: return (condCode == COND_LT || condCode == COND_EQ); - case COND_GT: return (condCode == COND_GT); - case COND_TR: return GL_TRUE; - case COND_FL: return GL_FALSE; - default: return GL_TRUE; - } -} - - -/** - * Evaluate the 4 condition codes against a predicate and return GL_TRUE - * or GL_FALSE to indicate result. - */ -static inline GLboolean -eval_condition(const struct gl_program_machine *machine, - const struct prog_instruction *inst) -{ - const GLuint swizzle = inst->DstReg.CondSwizzle; - const GLuint condMask = inst->DstReg.CondMask; - if (test_cc(machine->CondCodes[GET_SWZ(swizzle, 0)], condMask) || - test_cc(machine->CondCodes[GET_SWZ(swizzle, 1)], condMask) || - test_cc(machine->CondCodes[GET_SWZ(swizzle, 2)], condMask) || - test_cc(machine->CondCodes[GET_SWZ(swizzle, 3)], condMask)) { - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - - - /** * Store 4 floats into a register. Observe the instructions saturate and * set-condition-code flags. @@ -398,16 +325,16 @@ store_vector4(const struct prog_instruction *inst, struct gl_program_machine *machine, const GLfloat value[4]) { const struct prog_dst_register *dstReg = &(inst->DstReg); - const GLboolean clamp = inst->SaturateMode == SATURATE_ZERO_ONE; + const GLboolean clamp = inst->Saturate; GLuint writeMask = dstReg->WriteMask; GLfloat clampedValue[4]; GLfloat *dst = get_dst_register_pointer(dstReg, machine); #if 0 if (value[0] > 1.0e10 || - IS_INF_OR_NAN(value[0]) || - IS_INF_OR_NAN(value[1]) || - IS_INF_OR_NAN(value[2]) || IS_INF_OR_NAN(value[3])) + util_is_inf_or_nan(value[0]) || + util_is_inf_or_nan(value[1]) || + util_is_inf_or_nan(value[2]) || util_is_inf_or_nan(value[3])) printf("store %g %g %g %g\n", value[0], value[1], value[2], value[3]); #endif @@ -419,35 +346,11 @@ store_vector4(const struct prog_instruction *inst, value = clampedValue; } - if (dstReg->CondMask != COND_TR) { - /* condition codes may turn off some writes */ - if (writeMask & WRITEMASK_X) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_X; - } - if (writeMask & WRITEMASK_Y) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_Y; - } - if (writeMask & WRITEMASK_Z) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_Z; - } - if (writeMask & WRITEMASK_W) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_W; - } - } - #ifdef NAN_CHECK - assert(!IS_INF_OR_NAN(value[0])); - assert(!IS_INF_OR_NAN(value[0])); - assert(!IS_INF_OR_NAN(value[0])); - assert(!IS_INF_OR_NAN(value[0])); + assert(!util_is_inf_or_nan(value[0])); + assert(!util_is_inf_or_nan(value[0])); + assert(!util_is_inf_or_nan(value[0])); + assert(!util_is_inf_or_nan(value[0])); #endif if (writeMask & WRITEMASK_X) @@ -458,24 +361,6 @@ store_vector4(const struct prog_instruction *inst, dst[2] = value[2]; if (writeMask & WRITEMASK_W) dst[3] = value[3]; - - if (inst->CondUpdate) { - if (writeMask & WRITEMASK_X) - machine->CondCodes[0] = generate_cc(value[0]); - if (writeMask & WRITEMASK_Y) - machine->CondCodes[1] = generate_cc(value[1]); - if (writeMask & WRITEMASK_Z) - machine->CondCodes[2] = generate_cc(value[2]); - if (writeMask & WRITEMASK_W) - machine->CondCodes[3] = generate_cc(value[3]); -#if DEBUG_PROG - printf("CondCodes=(%s,%s,%s,%s) for:\n", - _mesa_condcode_string(machine->CondCodes[0]), - _mesa_condcode_string(machine->CondCodes[1]), - _mesa_condcode_string(machine->CondCodes[2]), - _mesa_condcode_string(machine->CondCodes[3])); -#endif - } } @@ -492,7 +377,7 @@ _mesa_execute_program(struct gl_context * ctx, const struct gl_program *program, struct gl_program_machine *machine) { - const GLuint numInst = program->NumInstructions; + const GLuint numInst = program->arb.NumInstructions; const GLuint maxExec = 65536; GLuint pc, numExec = 0; @@ -510,7 +395,7 @@ _mesa_execute_program(struct gl_context * ctx, } for (pc = 0; pc < numInst; pc++) { - const struct prog_instruction *inst = program->Instructions + pc; + const struct prog_instruction *inst = program->arb.Instructions + pc; if (DEBUG_PROG) { _mesa_print_instruction(inst); @@ -521,10 +406,10 @@ _mesa_execute_program(struct gl_context * ctx, { GLfloat a[4], result[4]; fetch_vector4(&inst->SrcReg[0], machine, a); - result[0] = FABSF(a[0]); - result[1] = FABSF(a[1]); - result[2] = FABSF(a[2]); - result[3] = FABSF(a[3]); + result[0] = fabsf(a[0]); + result[1] = fabsf(a[1]); + result[2] = fabsf(a[2]); + result[3] = fabsf(a[3]); store_vector4(inst, machine, result); } break; @@ -549,7 +434,7 @@ _mesa_execute_program(struct gl_context * ctx, { GLfloat t[4]; fetch_vector4(&inst->SrcReg[0], machine, t); - machine->AddressReg[0][0] = IFLOOR(t[0]); + machine->AddressReg[0][0] = util_ifloor(t[0]); if (DEBUG_PROG) { printf("ARL %d\n", machine->AddressReg[0][0]); } @@ -557,12 +442,12 @@ _mesa_execute_program(struct gl_context * ctx, break; case OPCODE_BGNLOOP: /* no-op */ - assert(program->Instructions[inst->BranchTarget].Opcode + assert(program->arb.Instructions[inst->BranchTarget].Opcode == OPCODE_ENDLOOP); break; case OPCODE_ENDLOOP: /* subtract 1 here since pc is incremented by for(pc) loop */ - assert(program->Instructions[inst->BranchTarget].Opcode + assert(program->arb.Instructions[inst->BranchTarget].Opcode == OPCODE_BGNLOOP); pc = inst->BranchTarget - 1; /* go to matching BNGLOOP */ break; @@ -571,33 +456,27 @@ _mesa_execute_program(struct gl_context * ctx, case OPCODE_ENDSUB: /* end subroutine */ break; case OPCODE_BRK: /* break out of loop (conditional) */ - assert(program->Instructions[inst->BranchTarget].Opcode + assert(program->arb.Instructions[inst->BranchTarget].Opcode == OPCODE_ENDLOOP); - if (eval_condition(machine, inst)) { - /* break out of loop */ - /* pc++ at end of for-loop will put us after the ENDLOOP inst */ - pc = inst->BranchTarget; - } + /* break out of loop */ + /* pc++ at end of for-loop will put us after the ENDLOOP inst */ + pc = inst->BranchTarget; break; case OPCODE_CONT: /* continue loop (conditional) */ - assert(program->Instructions[inst->BranchTarget].Opcode + assert(program->arb.Instructions[inst->BranchTarget].Opcode == OPCODE_ENDLOOP); - if (eval_condition(machine, inst)) { - /* continue at ENDLOOP */ - /* Subtract 1 here since we'll do pc++ at end of for-loop */ - pc = inst->BranchTarget - 1; - } + /* continue at ENDLOOP */ + /* Subtract 1 here since we'll do pc++ at end of for-loop */ + pc = inst->BranchTarget - 1; break; case OPCODE_CAL: /* Call subroutine (conditional) */ - if (eval_condition(machine, inst)) { - /* call the subroutine */ - if (machine->StackDepth >= MAX_PROGRAM_CALL_DEPTH) { - return GL_TRUE; /* Per GL_NV_vertex_program2 spec */ - } - machine->CallStack[machine->StackDepth++] = pc + 1; /* next inst */ - /* Subtract 1 here since we'll do pc++ at end of for-loop */ - pc = inst->BranchTarget - 1; + /* call the subroutine */ + if (machine->StackDepth >= MAX_PROGRAM_CALL_DEPTH) { + return GL_TRUE; /* Per GL_NV_vertex_program2 spec */ } + machine->CallStack[machine->StackDepth++] = pc + 1; /* next inst */ + /* Subtract 1 here since we'll do pc++ at end of for-loop */ + pc = inst->BranchTarget - 1; break; case OPCODE_CMP: { @@ -624,23 +503,21 @@ _mesa_execute_program(struct gl_context * ctx, GLfloat a[4], result[4]; fetch_vector1(&inst->SrcReg[0], machine, a); result[0] = result[1] = result[2] = result[3] - = (GLfloat) cos(a[0]); + = cosf(a[0]); store_vector4(inst, machine, result); } break; case OPCODE_DDX: /* Partial derivative with respect to X */ { GLfloat result[4]; - fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine, - 'X', result); + fetch_vector4_deriv(&inst->SrcReg[0], machine, 'X', result); store_vector4(inst, machine, result); } break; case OPCODE_DDY: /* Partial derivative with respect to Y */ { GLfloat result[4]; - fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine, - 'Y', result); + fetch_vector4_deriv(&inst->SrcReg[0], machine, 'Y', result); store_vector4(inst, machine, result); } break; @@ -724,7 +601,7 @@ _mesa_execute_program(struct gl_context * ctx, * result.z = result.x * APPX(result.y) * We do what the ARB extension says. */ - q[2] = (GLfloat) pow(2.0, t[0]); + q[2] = exp2f(t[0]); } q[1] = t[0] - floor_t0; q[3] = 1.0F; @@ -735,9 +612,9 @@ _mesa_execute_program(struct gl_context * ctx, { GLfloat a[4], result[4], val; fetch_vector1(&inst->SrcReg[0], machine, a); - val = (GLfloat) pow(2.0, a[0]); + val = exp2f(a[0]); /* - if (IS_INF_OR_NAN(val)) + if (util_is_inf_or_nan(val)) val = 1.0e10; */ result[0] = result[1] = result[2] = result[3] = val; @@ -769,19 +646,14 @@ _mesa_execute_program(struct gl_context * ctx, case OPCODE_IF: { GLboolean cond; - assert(program->Instructions[inst->BranchTarget].Opcode + assert(program->arb.Instructions[inst->BranchTarget].Opcode == OPCODE_ELSE || - program->Instructions[inst->BranchTarget].Opcode + program->arb.Instructions[inst->BranchTarget].Opcode == OPCODE_ENDIF); /* eval condition */ - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - GLfloat a[4]; - fetch_vector1(&inst->SrcReg[0], machine, a); - cond = (a[0] != 0.0); - } - else { - cond = eval_condition(machine, inst); - } + GLfloat a[4]; + fetch_vector1(&inst->SrcReg[0], machine, a); + cond = (a[0] != 0.0F); if (DEBUG_PROG) { printf("IF: %d\n", cond); } @@ -798,7 +670,7 @@ _mesa_execute_program(struct gl_context * ctx, break; case OPCODE_ELSE: /* goto ENDIF */ - assert(program->Instructions[inst->BranchTarget].Opcode + assert(program->arb.Instructions[inst->BranchTarget].Opcode == OPCODE_ENDIF); assert(inst->BranchTarget >= 0); pc = inst->BranchTarget; @@ -806,11 +678,6 @@ _mesa_execute_program(struct gl_context * ctx, case OPCODE_ENDIF: /* nothing */ break; - case OPCODE_KIL_NV: /* NV_f_p only (conditional) */ - if (eval_condition(machine, inst)) { - return GL_FALSE; - } - break; case OPCODE_KIL: /* ARB_f_p only */ { GLfloat a[4]; @@ -835,7 +702,7 @@ _mesa_execute_program(struct gl_context * ctx, val = -FLT_MAX; } else { - val = (float)(log(a[0]) * 1.442695F); + val = logf(a[0]) * 1.442695F; } result[0] = result[1] = result[2] = result[3] = val; store_vector4(inst, machine, result); @@ -854,10 +721,10 @@ _mesa_execute_program(struct gl_context * ctx, result[1] = a[0]; /* XXX we could probably just use pow() here */ if (a[0] > 0.0F) { - if (a[1] == 0.0 && a[3] == 0.0) + if (a[1] == 0.0F && a[3] == 0.0F) result[2] = 1.0F; else - result[2] = (GLfloat) pow(a[1], a[3]); + result[2] = powf(a[1], a[3]); } else { result[2] = 0.0F; @@ -875,9 +742,9 @@ _mesa_execute_program(struct gl_context * ctx, { GLfloat t[4], q[4], abs_t0; fetch_vector1(&inst->SrcReg[0], machine, t); - abs_t0 = FABSF(t[0]); + abs_t0 = fabsf(t[0]); if (abs_t0 != 0.0F) { - if (IS_INF_OR_NAN(abs_t0)) + if (util_is_inf_or_nan(abs_t0)) { SET_POS_INFINITY(q[0]); q[1] = 1.0F; @@ -887,12 +754,12 @@ _mesa_execute_program(struct gl_context * ctx, int exponent; GLfloat mantissa = frexpf(t[0], &exponent); q[0] = (GLfloat) (exponent - 1); - q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */ + q[1] = 2.0F * mantissa; /* map [.5, 1) -> [1, 2) */ /* The fast LOG2 macro doesn't meet the precision * requirements. */ - q[2] = (float)(log(t[0]) * 1.442695F); + q[2] = logf(t[0]) * 1.442695F; } } else { @@ -1052,7 +919,7 @@ _mesa_execute_program(struct gl_context * ctx, fetch_vector1(&inst->SrcReg[0], machine, a); fetch_vector1(&inst->SrcReg[1], machine, b); result[0] = result[1] = result[2] = result[3] - = (GLfloat) pow(a[0], b[0]); + = powf(a[0], b[0]); store_vector4(inst, machine, result); } break; @@ -1064,7 +931,7 @@ _mesa_execute_program(struct gl_context * ctx, if (DEBUG_PROG) { if (a[0] == 0) printf("RCP(0)\n"); - else if (IS_INF_OR_NAN(a[0])) + else if (util_is_inf_or_nan(a[0])) printf("RCP(inf)\n"); } result[0] = result[1] = result[2] = result[3] = 1.0F / a[0]; @@ -1072,20 +939,18 @@ _mesa_execute_program(struct gl_context * ctx, } break; case OPCODE_RET: /* return from subroutine (conditional) */ - if (eval_condition(machine, inst)) { - if (machine->StackDepth == 0) { - return GL_TRUE; /* Per GL_NV_vertex_program2 spec */ - } - /* subtract one because of pc++ in the for loop */ - pc = machine->CallStack[--machine->StackDepth] - 1; + if (machine->StackDepth == 0) { + return GL_TRUE; /* Per GL_NV_vertex_program2 spec */ } + /* subtract one because of pc++ in the for loop */ + pc = machine->CallStack[--machine->StackDepth] - 1; break; case OPCODE_RSQ: /* 1 / sqrt() */ { GLfloat a[4], result[4]; fetch_vector1(&inst->SrcReg[0], machine, a); - a[0] = FABSF(a[0]); - result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]); + a[0] = fabsf(a[0]); + result[0] = result[1] = result[2] = result[3] = 1.0f / sqrtf(a[0]); store_vector4(inst, machine, result); if (DEBUG_PROG) { printf("RSQ %g = 1/sqrt(|%g|)\n", result[0], a[0]); @@ -1096,29 +961,11 @@ _mesa_execute_program(struct gl_context * ctx, { GLfloat a[4], result[4]; fetch_vector1(&inst->SrcReg[0], machine, a); - result[0] = (GLfloat) cos(a[0]); - result[1] = (GLfloat) sin(a[0]); - result[2] = 0.0; /* undefined! */ - result[3] = 0.0; /* undefined! */ - store_vector4(inst, machine, result); - } - break; - case OPCODE_SEQ: /* set on equal */ - { - GLfloat a[4], b[4], result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - result[0] = (a[0] == b[0]) ? 1.0F : 0.0F; - result[1] = (a[1] == b[1]) ? 1.0F : 0.0F; - result[2] = (a[2] == b[2]) ? 1.0F : 0.0F; - result[3] = (a[3] == b[3]) ? 1.0F : 0.0F; + result[0] = cosf(a[0]); + result[1] = sinf(a[0]); + result[2] = 0.0F; /* undefined! */ + result[3] = 0.0F; /* undefined! */ store_vector4(inst, machine, result); - if (DEBUG_PROG) { - printf("SEQ (%g %g %g %g) = (%g %g %g %g) == (%g %g %g %g)\n", - result[0], result[1], result[2], result[3], - a[0], a[1], a[2], a[3], - b[0], b[1], b[2], b[3]); - } } break; case OPCODE_SGE: /* set on greater or equal */ @@ -1139,51 +986,15 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_SGT: /* set on greater */ - { - GLfloat a[4], b[4], result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - result[0] = (a[0] > b[0]) ? 1.0F : 0.0F; - result[1] = (a[1] > b[1]) ? 1.0F : 0.0F; - result[2] = (a[2] > b[2]) ? 1.0F : 0.0F; - result[3] = (a[3] > b[3]) ? 1.0F : 0.0F; - store_vector4(inst, machine, result); - if (DEBUG_PROG) { - printf("SGT (%g %g %g %g) = (%g %g %g %g) > (%g %g %g %g)\n", - result[0], result[1], result[2], result[3], - a[0], a[1], a[2], a[3], - b[0], b[1], b[2], b[3]); - } - } - break; case OPCODE_SIN: { GLfloat a[4], result[4]; fetch_vector1(&inst->SrcReg[0], machine, a); result[0] = result[1] = result[2] = result[3] - = (GLfloat) sin(a[0]); + = sinf(a[0]); store_vector4(inst, machine, result); } break; - case OPCODE_SLE: /* set on less or equal */ - { - GLfloat a[4], b[4], result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - result[0] = (a[0] <= b[0]) ? 1.0F : 0.0F; - result[1] = (a[1] <= b[1]) ? 1.0F : 0.0F; - result[2] = (a[2] <= b[2]) ? 1.0F : 0.0F; - result[3] = (a[3] <= b[3]) ? 1.0F : 0.0F; - store_vector4(inst, machine, result); - if (DEBUG_PROG) { - printf("SLE (%g %g %g %g) = (%g %g %g %g) <= (%g %g %g %g)\n", - result[0], result[1], result[2], result[3], - a[0], a[1], a[2], a[3], - b[0], b[1], b[2], b[3]); - } - } - break; case OPCODE_SLT: /* set on less */ { GLfloat a[4], b[4], result[4]; @@ -1202,24 +1013,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_SNE: /* set on not equal */ - { - GLfloat a[4], b[4], result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - result[0] = (a[0] != b[0]) ? 1.0F : 0.0F; - result[1] = (a[1] != b[1]) ? 1.0F : 0.0F; - result[2] = (a[2] != b[2]) ? 1.0F : 0.0F; - result[3] = (a[3] != b[3]) ? 1.0F : 0.0F; - store_vector4(inst, machine, result); - if (DEBUG_PROG) { - printf("SNE (%g %g %g %g) = (%g %g %g %g) != (%g %g %g %g)\n", - result[0], result[1], result[2], result[3], - a[0], a[1], a[2], a[3], - b[0], b[1], b[2], b[3]); - } - } - break; case OPCODE_SSG: /* set sign (-1, 0 or +1) */ { GLfloat a[4], result[4]; @@ -1322,7 +1115,7 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, color); } break; - case OPCODE_TXD: /* GL_NV_fragment_program only */ + case OPCODE_TXD: /* Texture lookup w/ partial derivatives for LOD */ { GLfloat texcoord[4], dtdx[4], dtdy[4], color[4]; @@ -1361,27 +1154,7 @@ _mesa_execute_program(struct gl_context * ctx, * zero, we'd probably be fine except for an assert in * IROUND_POS() which gets triggered by the inf values created. */ - if (texcoord[3] != 0.0) { - texcoord[0] /= texcoord[3]; - texcoord[1] /= texcoord[3]; - texcoord[2] /= texcoord[3]; - } - - fetch_texel(ctx, machine, inst, texcoord, 0.0, color); - - store_vector4(inst, machine, color); - } - break; - case OPCODE_TXP_NV: /* GL_NV_fragment_program only */ - /* Texture lookup w/ projective divide, as above, but do not - * do the divide by w if sampling from a cube map. - */ - { - GLfloat texcoord[4], color[4]; - - fetch_vector4(&inst->SrcReg[0], machine, texcoord); - if (inst->TexSrcTarget != TEXTURE_CUBE_INDEX && - texcoord[3] != 0.0) { + if (texcoord[3] != 0.0F) { texcoord[0] /= texcoord[3]; texcoord[1] /= texcoord[3]; texcoord[2] /= texcoord[3];