summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_texture.c')
-rw-r--r--src/gallium/auxiliary/util/u_texture.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_texture.c b/src/gallium/auxiliary/util/u_texture.c
index d97e57a7903..e865f8e73d0 100644
--- a/src/gallium/auxiliary/util/u_texture.c
+++ b/src/gallium/auxiliary/util/u_texture.c
@@ -42,7 +42,8 @@
void util_map_texcoords2d_onto_cubemap(unsigned face,
const float *in_st, unsigned in_stride,
- float *out_str, unsigned out_stride)
+ float *out_str, unsigned out_stride,
+ boolean allow_scale)
{
int i;
float rx, ry, rz;
@@ -52,8 +53,14 @@ void util_map_texcoords2d_onto_cubemap(unsigned face,
/* Compute sc = +/-scale and tc = +/-scale.
* Not +/-1 to avoid cube face selection ambiguity near the edges,
* though that can still sometimes happen with this scale factor...
+ *
+ * XXX: Yep, there is no safe scale factor that will prevent sampling
+ * the neighbouring face when stretching out. A more reliable solution
+ * would be to clamp (sc, tc) against +/- 1.0-1.0/mipsize, in the shader.
+ *
+ * Also, this is not necessary when minifying, or 1:1 blits.
*/
- const float scale = 0.9999f;
+ const float scale = allow_scale ? 0.9999f : 1.0f;
const float sc = (2 * in_st[0] - 1) * scale;
const float tc = (2 * in_st[1] - 1) * scale;