const unsigned stride = sizeof ctx->vertices[0] / sizeof ctx->vertices[0][0][0];
util_map_texcoords2d_onto_cubemap(src_face,
&ctx->vertices[0][1][0], stride,
- &ctx->vertices[0][1][0], stride);
+ &ctx->vertices[0][1][0], stride,
+ TRUE);
}
offset = get_next_slot( ctx );
util_map_texcoords2d_onto_cubemap(layer % 6,
/* pointer, stride in floats */
&face_coord[0][0], 2,
- &ctx->vertices[0][1][0], 8);
+ &ctx->vertices[0][1][0], 8,
+ TRUE);
} else {
set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8);
}
};
util_map_texcoords2d_onto_cubemap(layer, &st[0][0], 2,
- &ctx->vertices[0][1][0], 8);
+ &ctx->vertices[0][1][0], 8,
+ FALSE);
}
else if (tex_target == PIPE_TEXTURE_1D_ARRAY) {
/* 1D texture array */
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;
/* 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;
#ifndef U_TEXTURE_H
#define U_TEXTURE_H
+#include "pipe/p_compiler.h"
+
#ifdef __cplusplus
extern "C" {
#endif
*/
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);
#ifdef __cplusplus