aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2014-08-30 01:32:59 +0200
committerRoland Scheidegger <[email protected]>2014-08-30 01:33:02 +0200
commit9da75f96bce738d5b2c58e6fe0ce8ad436667c58 (patch)
tree1bda657b5bf9b36349c5110250e19b25a3618f07 /src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
parent26a5156de7e11f21a8690cf159b643e45b4f90a8 (diff)
gallivm: handle cube map arrays for texture sampling
Pretty easy, just make sure that all paths testing for PIPE_TEXTURE_CUBE also recognize PIPE_TEXTURE_CUBE_ARRAY, and add the layer * 6 calculation to the calculated face. Also handle it for texture size query, looks like OpenGL wants the number of cubes, not layers (so need division by 6). No piglit regressions. v2: fix up adding cube layer to face for seamless filtering (needs to happen after calculating per-sample face). Undetected by piglit unfortunately. Reviewed-by: Jose Fonseca <[email protected]> (v1)
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
index 2f026065766..394521d382a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
@@ -704,9 +704,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
offset = lp_build_add(&bld->int_coord_bld, offset, z_offset);
}
}
- if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
- bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
- bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
+ if (has_layer_coord(bld->static_texture_state->target)) {
LLVMValueRef z_offset;
/* The r coord is the cube face in [0,5] or array layer */
z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
@@ -781,9 +779,7 @@ lp_build_sample_image_nearest_afloat(struct lp_build_sample_context *bld,
&z_icoord);
}
}
- if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
- bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
- bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
+ if (has_layer_coord(bld->static_texture_state->target)) {
z_icoord = r;
}
@@ -1130,9 +1126,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
&x_subcoord[0], &x_subcoord[1]);
/* add potential cube/array/mip offsets now as they are constant per pixel */
- if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
- bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
- bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
+ if (has_layer_coord(bld->static_texture_state->target)) {
LLVMValueRef z_offset;
z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
/* The r coord is the cube face in [0,5] or array layer */
@@ -1301,9 +1295,7 @@ lp_build_sample_image_linear_afloat(struct lp_build_sample_context *bld,
&x_offset1, &x_subcoord[1]);
/* add potential cube/array/mip offsets now as they are constant per pixel */
- if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
- bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
- bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
+ if (has_layer_coord(bld->static_texture_state->target)) {
LLVMValueRef z_offset;
z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
/* The r coord is the cube face in [0,5] or array layer */