summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2013-10-05 23:10:04 +1300
committerChris Forbes <[email protected]>2013-10-06 11:25:11 +1300
commite8ec2e03442cc21e84ff3a1ed7610e6b6d4468e5 (patch)
treeaed5f616ee6f11a09579c91767a4a39ceaea2f1c /src/mesa
parent09c6fd450dcd70016823f861e72be64fdd122802 (diff)
i965/vs: Add support for textureGather(.., comp)
- For HSW: Select the channel based on the component selected (swizzle is done in HW) - For IVB: Select the channel based on the swizzle state for the component selected. Only apply the RG32F w/a if we actually want green -- we're about to flag it regardless of swizzle state. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 224524e9499..09f0236c682 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2150,7 +2150,8 @@ vec4_visitor::visit(ir_texture *ir)
* emitting anything other than setting up the constant result.
*/
if (ir->op == ir_tg4) {
- int swiz = GET_SWZ(key->tex.swizzles[sampler], 0);
+ ir_constant *chan = ir->lod_info.component->as_constant();
+ int swiz = GET_SWZ(key->tex.swizzles[sampler], chan->value.i[0]);
if (swiz == SWIZZLE_ZERO || swiz == SWIZZLE_ONE) {
dst_reg result(this, ir->type);
this->result = src_reg(result);
@@ -2398,14 +2399,17 @@ vec4_visitor::visit(ir_texture *ir)
uint32_t
vec4_visitor::gather_channel(ir_texture *ir, int sampler)
{
- int swiz = GET_SWZ(key->tex.swizzles[sampler], 0 /* red */);
- if (key->tex.gather_channel_quirk_mask & (1<<sampler))
- return 2; /* gather4 sampler is broken for green channel on RG32F --
- * we must ask for blue instead.
- */
+ ir_constant *chan = ir->lod_info.component->as_constant();
+ int swiz = GET_SWZ(key->tex.swizzles[sampler], chan->value.i[0]);
switch (swiz) {
case SWIZZLE_X: return 0;
- case SWIZZLE_Y: return 1;
+ case SWIZZLE_Y:
+ /* gather4 sampler is broken for green channel on RG32F --
+ * we must ask for blue instead.
+ */
+ if (key->tex.gather_channel_quirk_mask & (1<<sampler))
+ return 2;
+ return 1;
case SWIZZLE_Z: return 2;
case SWIZZLE_W: return 3;
default: