aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-09-14 15:36:24 -0700
committerJason Ekstrand <[email protected]>2015-09-15 11:09:48 -0700
commit0c6df7a1cb593666636aed660e90be0c6aca4591 (patch)
tree17e3c6bfbce0cd3db07df63cf7452770dd129ca1 /src/mesa/drivers/dri/i965
parent51824000541d8df9f870cbe0823a3835c9403bff (diff)
i965/fs_surface_builder: Only apply predicate to components that exist
In certain conditions, we have to do bounds-checking in the shader for image_load_store. The way this works for image loads is that we do a predicated load and then emit a series of selects, one per component, that gives us 0 or the loaded value depending on whether or not you're in bounds. However, we were hard-coding 4 components which may not be correct. Instead, we should be using size which is the number of components read. Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
index 727e8d1b82a..88f22fa9c7f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
@@ -905,7 +905,7 @@ namespace brw {
tmp = emit_untyped_read(bld, image, laddr, 1, size, pred);
/* An out of bounds surface access should give zero as result. */
- for (unsigned c = 0; c < 4; ++c)
+ for (unsigned c = 0; c < size; ++c)
set_predicate(pred, bld.SEL(offset(tmp, bld, c),
offset(tmp, bld, c), fs_reg(0)));
}