From 363d0bcf01b1e7b77c5a8d317bb0c6df8697a836 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 11 May 2005 15:17:31 +0000 Subject: Test for texcoord[3] == zero before dividing. Not so sure about this test - if texcoord[3] is zero, we'd probably be fine except for an ASSERT in IROUND_POS() which gets triggered by the inf values created. --- src/mesa/swrast/s_nvfragprog.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/mesa/swrast/s_nvfragprog.c') diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c index 1cd1bdaf49..bb9c986afc 100644 --- a/src/mesa/swrast/s_nvfragprog.c +++ b/src/mesa/swrast/s_nvfragprog.c @@ -1218,9 +1218,15 @@ execute_program( GLcontext *ctx, { GLfloat texcoord[4], color[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); - texcoord[0] /= texcoord[3]; - texcoord[1] /= texcoord[3]; - texcoord[2] /= texcoord[3]; + /* Not so sure about this test - if texcoord[3] is + * 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]; + } /* Note: LOD=0 */ fetch_texel( ctx, texcoord, 0.0F, inst->TexSrcUnit, color ); store_vector4( inst, machine, color ); @@ -1231,7 +1237,8 @@ execute_program( GLcontext *ctx, { GLfloat texcoord[4], color[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); - if (inst->TexSrcIdx != TEXTURE_CUBE_INDEX) { + if (inst->TexSrcIdx != TEXTURE_CUBE_INDEX && + texcoord[3] != 0.0) { texcoord[0] /= texcoord[3]; texcoord[1] /= texcoord[3]; texcoord[2] /= texcoord[3]; @@ -1417,6 +1424,10 @@ _swrast_exec_fragment_program( GLcontext *ctx, struct sw_span *span ) ctx->_CurrentProgram = GL_FRAGMENT_PROGRAM_ARB; /* or NV, doesn't matter */ + if (program->Parameters) { + _mesa_load_state_parameters(ctx, program->Parameters); + } + for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { init_machine(ctx, &ctx->FragmentProgram.Machine, -- cgit v1.2.3