From 0ab81efefc02b69f51d6c7e05c20cfd1aec42029 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 23 Feb 2024 09:47:28 +0100 Subject: [PATCH] gallium: remove always-false parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Mike Blumenkrantz Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/util/u_blitter.c | 3 +-- src/gallium/auxiliary/util/u_texture.c | 18 +++--------------- src/gallium/auxiliary/util/u_texture.h | 3 +-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index fdcbe21f29e..210248fc180 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -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; diff --git a/src/gallium/auxiliary/util/u_texture.c b/src/gallium/auxiliary/util/u_texture.c index df3f43e85df..7132937ee76 100644 --- a/src/gallium/auxiliary/util/u_texture.c +++ b/src/gallium/auxiliary/util/u_texture.c @@ -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: diff --git a/src/gallium/auxiliary/util/u_texture.h b/src/gallium/auxiliary/util/u_texture.h index 98a0890e2c6..a882cea6eaf 100644 --- a/src/gallium/auxiliary/util/u_texture.h +++ b/src/gallium/auxiliary/util/u_texture.h @@ -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