gallium: remove always-false parameter

We always pass false to util_map_texcoords2d_onto_cubemap function, which
allows us to avoid the dodgy case of using a close-to-one scaling factor
in an attempt to avoid sampling on the edges.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27759>
This commit is contained in:
Erik Faye-Lund
2024-02-23 09:47:28 +01:00
committed by Marge Bot
parent 9ea8249e55
commit 0ab81efefc
3 changed files with 5 additions and 19 deletions
+1 -2
View File
@@ -1831,8 +1831,7 @@ blitter_draw_tex(struct blitter_context_priv *ctx,
util_map_texcoords2d_onto_cubemap((unsigned)layer % 6,
/* pointer, stride in floats */
&face_coord[0][0], 2,
&ctx->vertices[0][1][0], 8,
false);
&ctx->vertices[0][1][0], 8);
for (unsigned i = 0; i < 4; i++)
ctx->vertices[i][1][3] = coord.texcoord.w;
+3 -15
View File
@@ -42,27 +42,15 @@
void util_map_texcoords2d_onto_cubemap(unsigned face,
const float *in_st, unsigned in_stride,
float *out_str, unsigned out_stride,
bool allow_scale)
float *out_str, unsigned out_stride)
{
int i;
float rx, ry, rz;
/* loop over quad verts */
for (i = 0; i < 4; i++) {
/* 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 = allow_scale ? 0.9999f : 1.0f;
const float sc = (2 * in_st[0] - 1) * scale;
const float tc = (2 * in_st[1] - 1) * scale;
const float sc = 2 * in_st[0] - 1;
const float tc = 2 * in_st[1] - 1;
switch (face) {
case PIPE_TEX_FACE_POS_X:
+1 -2
View File
@@ -46,8 +46,7 @@ extern "C" {
*/
void util_map_texcoords2d_onto_cubemap(unsigned face,
const float *in_st, unsigned in_stride,
float *out_str, unsigned out_stride,
bool allow_scale);
float *out_str, unsigned out_stride);
#ifdef __cplusplus