X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fprogram%2Fprog_execute.c;h=115525eba57370e8cbd38a0a26fd3961961ccf93;hb=109c211ffd746cff3434dd9c9ea412a28ae0190a;hp=9ee2f20145b69994c9c9d5d3cd7de540c8cea0d0;hpb=b2e0293213dcff24e26a4968a19262bfe7a781b9;p=mesa.git diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index 9ee2f20145b..115525eba57 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.3 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -17,9 +16,10 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /** @@ -65,9 +65,6 @@ fi.i = 0xFF800000; \ x = fi.f; \ } while (0) -#elif defined(VMS) -#define SET_POS_INFINITY(x) x = __MAXFLOAT -#define SET_NEG_INFINITY(x) x = -__MAXFLOAT #else #define SET_POS_INFINITY(x) x = (GLfloat) HUGE_VAL #define SET_NEG_INFINITY(x) x = (GLfloat) -HUGE_VAL @@ -111,7 +108,7 @@ get_src_register_pointer(const struct prog_src_register *source, return machine->VertAttribs[reg]; } else { - if (reg >= FRAG_ATTRIB_MAX) + if (reg >= VARYING_SLOT_MAX) return ZeroVec; return machine->Attribs[reg][machine->CurElement]; } @@ -121,16 +118,6 @@ get_src_register_pointer(const struct prog_src_register *source, return ZeroVec; return machine->Outputs[reg]; - case PROGRAM_LOCAL_PARAM: - if (reg >= MAX_PROGRAM_LOCAL_PARAMS) - return ZeroVec; - return machine->CurProgram->LocalParams[reg]; - - case PROGRAM_ENV_PARAM: - if (reg >= MAX_PROGRAM_ENV_PARAMS) - return ZeroVec; - return machine->EnvParams[reg]; - case PROGRAM_STATE_VAR: /* Fallthrough */ case PROGRAM_CONSTANT: @@ -148,7 +135,7 @@ get_src_register_pointer(const struct prog_src_register *source, _mesa_problem(NULL, "Invalid src register file %d in get_src_register_pointer()", source->File); - return NULL; + return ZeroVec; } } @@ -187,7 +174,7 @@ get_dst_register_pointer(const struct prog_dst_register *dest, _mesa_problem(NULL, "Invalid dest register file %d in get_dst_register_pointer()", dest->File); - return NULL; + return dummyReg; } } @@ -202,7 +189,6 @@ fetch_vector4(const struct prog_src_register *source, const struct gl_program_machine *machine, GLfloat result[4]) { const GLfloat *src = get_src_register_pointer(source, machine); - ASSERT(src); if (source->Swizzle == SWIZZLE_NOOP) { /* no swizzling */ @@ -242,37 +228,6 @@ fetch_vector4(const struct prog_src_register *source, } -/** - * Fetch a 4-element uint vector from the given source register. - * Apply swizzling but not negation/abs. - */ -static void -fetch_vector4ui(const struct prog_src_register *source, - const struct gl_program_machine *machine, GLuint result[4]) -{ - const GLuint *src = (GLuint *) get_src_register_pointer(source, machine); - ASSERT(src); - - if (source->Swizzle == SWIZZLE_NOOP) { - /* no swizzling */ - COPY_4V(result, src); - } - else { - ASSERT(GET_SWZ(source->Swizzle, 0) <= 3); - ASSERT(GET_SWZ(source->Swizzle, 1) <= 3); - ASSERT(GET_SWZ(source->Swizzle, 2) <= 3); - ASSERT(GET_SWZ(source->Swizzle, 3) <= 3); - result[0] = src[GET_SWZ(source->Swizzle, 0)]; - result[1] = src[GET_SWZ(source->Swizzle, 1)]; - result[2] = src[GET_SWZ(source->Swizzle, 2)]; - result[3] = src[GET_SWZ(source->Swizzle, 3)]; - } - - /* Note: no Negate or Abs here */ -} - - - /** * Fetch the derivative with respect to X or Y for the given register. * XXX this currently only works for fragment program input attribs. @@ -286,7 +241,7 @@ fetch_vector4_deriv(struct gl_context * ctx, if (source->File == PROGRAM_INPUT && source->Index < (GLint) machine->NumDeriv) { const GLint col = machine->CurElement; - const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3]; + const GLfloat w = machine->Attribs[VARYING_SLOT_POS][col][3]; const GLfloat invQ = 1.0f / w; GLfloat deriv[4]; @@ -336,7 +291,6 @@ fetch_vector1(const struct prog_src_register *source, const struct gl_program_machine *machine, GLfloat result[4]) { const GLfloat *src = get_src_register_pointer(source, machine); - ASSERT(src); result[0] = src[GET_SWZ(source->Swizzle, 0)]; @@ -374,7 +328,7 @@ fetch_texel(struct gl_context *ctx, */ if (machine->NumDeriv > 0 && inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) { + inst->SrcReg[0].Index == VARYING_SLOT_TEX0 + inst->TexSrcUnit) { /* simple texture fetch for which we should have derivatives */ GLuint attr = inst->SrcReg[0].Index; machine->FetchTexelDeriv(ctx, texcoord, @@ -669,18 +623,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_AND: /* bitwise AND */ - { - GLuint a[4], b[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - fetch_vector4ui(&inst->SrcReg[1], machine, b); - result[0] = a[0] & b[0]; - result[1] = a[1] & b[1]; - result[2] = a[2] & b[2]; - result[3] = a[3] & b[3]; - store_vector4ui(inst, machine, result); - } - break; case OPCODE_ARL: { GLfloat t[4]; @@ -793,20 +735,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_DP2A: - { - GLfloat a[4], b[4], c, result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - fetch_vector1(&inst->SrcReg[1], machine, &c); - result[0] = result[1] = result[2] = result[3] = DOT2(a, b) + c; - store_vector4(inst, machine, result); - if (DEBUG_PROG) { - printf("DP2A %g = (%g %g) . (%g %g) + %g\n", - result[0], a[0], a[1], b[0], b[1], c); - } - } - break; case OPCODE_DP3: { GLfloat a[4], b[4], result[4]; @@ -1027,15 +955,7 @@ _mesa_execute_program(struct gl_context * ctx, fetch_vector1(&inst->SrcReg[0], machine, t); abs_t0 = FABSF(t[0]); if (abs_t0 != 0.0F) { - /* Since we really can't handle infinite values on VMS - * like other OSes we'll use __MAXFLOAT to represent - * infinity. This may need some tweaking. - */ -#ifdef VMS - if (abs_t0 == __MAXFLOAT) -#else if (IS_INF_OR_NAN(abs_t0)) -#endif { SET_POS_INFINITY(q[0]); q[1] = 1.0F; @@ -1204,59 +1124,6 @@ _mesa_execute_program(struct gl_context * ctx, break; case OPCODE_NOP: break; - case OPCODE_NOT: /* bitwise NOT */ - { - GLuint a[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - result[0] = ~a[0]; - result[1] = ~a[1]; - result[2] = ~a[2]; - result[3] = ~a[3]; - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_NRM3: /* 3-component normalization */ - { - GLfloat a[4], result[4]; - GLfloat tmp; - fetch_vector4(&inst->SrcReg[0], machine, a); - tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2]; - if (tmp != 0.0F) - tmp = INV_SQRTF(tmp); - result[0] = tmp * a[0]; - result[1] = tmp * a[1]; - result[2] = tmp * a[2]; - result[3] = 0.0; /* undefined, but prevent valgrind warnings */ - store_vector4(inst, machine, result); - } - break; - case OPCODE_NRM4: /* 4-component normalization */ - { - GLfloat a[4], result[4]; - GLfloat tmp; - fetch_vector4(&inst->SrcReg[0], machine, a); - tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]; - if (tmp != 0.0F) - tmp = INV_SQRTF(tmp); - result[0] = tmp * a[0]; - result[1] = tmp * a[1]; - result[2] = tmp * a[2]; - result[3] = tmp * a[3]; - store_vector4(inst, machine, result); - } - break; - case OPCODE_OR: /* bitwise OR */ - { - GLuint a[4], b[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - fetch_vector4ui(&inst->SrcReg[1], machine, b); - result[0] = a[0] | b[0]; - result[1] = a[1] | b[1]; - result[2] = a[2] | b[2]; - result[3] = a[3] | b[3]; - store_vector4ui(inst, machine, result); - } - break; case OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */ { GLfloat a[4]; @@ -1758,18 +1625,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_XOR: /* bitwise XOR */ - { - GLuint a[4], b[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - fetch_vector4ui(&inst->SrcReg[1], machine, b); - result[0] = a[0] ^ b[0]; - result[1] = a[1] ^ b[1]; - result[2] = a[2] ^ b[2]; - result[3] = a[3] ^ b[3]; - store_vector4ui(inst, machine, result); - } - break; case OPCODE_XPD: /* cross product */ { GLfloat a[4], b[4], result[4]; @@ -1800,19 +1655,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_PRINT: - { - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - GLfloat a[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - printf("%s%g, %g, %g, %g\n", (const char *) inst->Data, - a[0], a[1], a[2], a[3]); - } - else { - printf("%s\n", (const char *) inst->Data); - } - } - break; case OPCODE_END: return GL_TRUE; default: