summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2012-11-22 22:13:46 +1300
committerEric Anholt <[email protected]>2012-12-14 15:26:39 -0800
commitd2dbba87554d9490b49884185a29ca2b46e4a616 (patch)
treef587efb5ad509e857c6113ae4b95a3314cc2c9d6 /src/mesa/drivers/dri/i965
parent6e34723ac9fa2d5c34cb2a38118ecf5b856c4992 (diff)
i965: fs: Add fixup for textureSize on Gen6/7
V2: Moved up into emit(ir_texture *) to avoid duplication and fix ordering for Gen7; Gen6 math quirks moved into previous patches. Tested on Gen6 only; passes all the cube_map_array piglits. V3: Fixed weird whitespace V4: Use sampler->type; otherwise broken on arrays of samplers. v5: Minor style fixes (by anholt) Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 6a39f98509e..708677f3847 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1371,6 +1371,17 @@ fs_visitor::visit(ir_texture *ir)
if (ir->shadow_comparitor)
inst->shadow_compare = true;
+ /* fixup #layers for cube map arrays */
+ if (ir->op == ir_txs) {
+ glsl_type const *type = ir->sampler->type;
+ if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE &&
+ type->sampler_array) {
+ fs_reg depth = dst;
+ depth.reg_offset = 2;
+ emit_math(SHADER_OPCODE_INT_QUOTIENT, depth, depth, fs_reg(6));
+ }
+ }
+
swizzle_result(ir, dst, sampler);
}