summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-03-29 01:22:47 +0200
committerSamuel Pitoiset <[email protected]>2017-06-14 10:04:36 +0200
commit77cbded9957836d573664a5c2b1d26cbf04988ad (patch)
tree38c660dab631ea15e24fcee7da29ed5e51e2d77c
parent5d59226a7fd6d96501d573e23f10eca7d83a68e8 (diff)
st/glsl_to_tgsi: teach the DCE pass about bindless samplers/images
When a texture (or an image) instruction uses a bindless sampler (respectively a bindless image), make sure the DCE pass won't remove code when the resource is a temporary variable. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e2505a709ae..834b6c6dec4 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5290,6 +5290,21 @@ glsl_to_tgsi_visitor::eliminate_dead_code(void)
}
}
}
+
+ if (inst->resource.file == PROGRAM_TEMPORARY) {
+ int src_chans;
+
+ src_chans = 1 << GET_SWZ(inst->resource.swizzle, 0);
+ src_chans |= 1 << GET_SWZ(inst->resource.swizzle, 1);
+ src_chans |= 1 << GET_SWZ(inst->resource.swizzle, 2);
+ src_chans |= 1 << GET_SWZ(inst->resource.swizzle, 3);
+
+ for (int c = 0; c < 4; c++) {
+ if (src_chans & (1 << c))
+ writes[4 * inst->resource.index + c] = NULL;
+ }
+ }
+
break;
}