summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-07-29 19:18:48 +0100
committerJosé Fonseca <[email protected]>2010-07-29 19:19:05 +0100
commit5f90e76c54bbf4456c977b3cbca450d7a570179e (patch)
treea21471cbcaa498fe25af841d6e6c9f6f725a6154 /src/gallium/auxiliary
parenta258701cd949d45041ed571ca08fedc40de2cf69 (diff)
gallivm: fix lp_build_sample_offset() crash when indexing a 1-D texture
If y==NULL and y_stride==NULL it means the texture is 1D. Return zero for out_i and the offset instead of garbage.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 0fd014ab9b3..655c4fb901a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -179,6 +179,9 @@ lp_build_sample_offset(struct lp_build_context *bld,
LLVMValueRef y_offset = lp_build_mul(bld, y, y_stride);
offset = lp_build_add(bld, offset, y_offset);
}
+ else {
+ *out_j = bld->zero;
+ }
if (z && z_stride) {
LLVMValueRef z_offset = lp_build_mul(bld, z, z_stride);