aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2005-05-11 15:17:31 +0000
committerKeith Whitwell <[email protected]>2005-05-11 15:17:31 +0000
commit363d0bcf01b1e7b77c5a8d317bb0c6df8697a836 (patch)
treec4de2ee3f9a8a0b4f89b7015937e1470bb156bbf /src/mesa/swrast
parente490242b9aeb50bd96fed7a9afbf529295a8ac0e (diff)
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.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_nvfragprog.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index 1cd1bdaf493..bb9c986afc2 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,