summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2007-03-19 00:08:45 +1100
committerBen Skeggs <[email protected]>2007-03-19 00:13:41 +1100
commitbcf4f4de76197dbb88b884ce55b5e457ff2f79b0 (patch)
treefaa11b63b11d9024b0fc50b0a30a5308ed48a181 /src
parentbb02092d749ff9d58a13fd99f66154504b4f3dd1 (diff)
nouveau: avoid using uninitialised TexSrcUnit.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_shader_0.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c b/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c
index 73c1f7c2a53..211483dc027 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c
@@ -263,6 +263,23 @@ pass0_make_mask(GLuint mesa_mask)
return mask;
}
+static GLboolean
+pass0_opcode_is_tex(enum prog_opcode op)
+{
+ switch (op) {
+ case OPCODE_TEX:
+ case OPCODE_TXB:
+ case OPCODE_TXD:
+ case OPCODE_TXL:
+ case OPCODE_TXP:
+ return GL_TRUE;
+ default:
+ break;
+ }
+
+ return GL_FALSE;
+}
+
static nvsTexTarget
pass0_make_tex_target(GLuint mesa)
{
@@ -721,7 +738,11 @@ pass0_translate_arith(nouveauShader *nvs, struct gl_program *prog,
(inst->SaturateMode != SATURATE_OFF),
src[0], src[1], src[2]);
nvsinst->tex_unit = inst->TexSrcUnit;
- nvsinst->tex_target = pass0_make_tex_target(inst->TexSrcTarget);
+ if (pass0_opcode_is_tex(inst->Opcode))
+ nvsinst->tex_target =
+ pass0_make_tex_target(inst->TexSrcTarget);
+ else
+ nvsinst->tex_target = NVS_TEX_TARGET_UNKNOWN;
ret = GL_TRUE;
} else