From 4f3de8b956b6e29ec84530365ea8bdf200c66375 Mon Sep 17 00:00:00 2001 From: Aleksi Sapon Date: Tue, 21 Oct 2025 13:42:32 -0400 Subject: [PATCH] llvmpipe: doc fixes Reviewed-by: Jose Fonseca Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 15 ++++++++------- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 15 ++++----------- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 4 ++-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 7127f697abe..c267ae2a0da 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1132,8 +1132,9 @@ lp_build_div(struct lp_build_context *bld, /** * Linear interpolation helper. * - * @param normalized whether we are interpolating normalized values, - * encoded in normalized integers, twice as wide. + * @param flags + * LP_BLD_LERP_WIDE_NORMALIZED: whether we are interpolating normalized + * values, encoded in normalized integers, twice as wide. * * @sa http://www.stereopsis.com/doubleblend.html */ @@ -1191,9 +1192,9 @@ lp_build_lerp_simple(struct lp_build_context *bld, } } else { /* - * The rescaling trick above doesn't work for signed numbers, so - * use the 2**n - 1 divison approximation in lp_build_mul_norm - * instead. + * Scale x from [0, 2**n - 1] to [0, 2**n] by adding the + * most-significant-bit to the lowest-significant-bit, so that + * later we can just divide by 2**n instead of 2**n - 1. */ assert(!(flags & LP_BLD_LERP_PRESCALED_WEIGHTS)); res = lp_build_mul_norm(bld->gallivm, bld->type, x, delta); @@ -1228,8 +1229,8 @@ lp_build_lerp_simple(struct lp_build_context *bld, /* * We need to mask out the high order bits when lerping 8bit * normalized colors stored on 16bits - */ - /* XXX: This step is necessary for lerping 8bit colors stored on + * + * XXX: This step is necessary for lerping 8bit colors stored on * 16bits, but it will be wrong for true fixed point use cases. * Basically we need a more powerful lp_type, capable of further * distinguishing the values interpretation from the value storage. diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index a71d407d1df..7e932c8ee51 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -546,7 +546,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, /** * Fetch texels for image with linear sampling. - * Return filtered color as two vectors of 16-bit fixed point values. + * Return filtered color as one vectors of 8-bit unorm values. */ static void lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld, @@ -581,7 +581,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld, * * where each value is between 0 and 0xff, * - * into one 16 x i20 + * into one 16 x i8 * * s_fpart = {s0, s0, s0, s0, s1, s1, s1, s1, s2, s2, s2, s2, s3, s3, s3, s3} * @@ -628,13 +628,6 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld, * bit cast them into 16 x u8 * * r0 g0 b0 a0 r1 g1 b1 a1 r2 g2 b2 a2 r3 g3 b3 a3 - * - * unpack them into two 8 x i16: - * - * r0 g0 b0 a0 r1 g1 b1 a1 - * r2 g2 b2 a2 r3 g3 b3 a3 - * - * The higher 8 bits of the resulting elements will be zero. */ numj = 1 + (dims >= 2); numk = 1 + (dims >= 3); @@ -677,7 +670,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld, } /* - * Linear interpolation with 8.8 fixed point. + * Linear interpolation with 8-bit unorm. */ /* general 1/2/3-D lerping */ @@ -726,7 +719,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld, /** * Sample a single texture image with (bi-)(tri-)linear sampling. - * Return filtered color as two vectors of 16-bit fixed point values. + * Return filtered color as a vector of 8-bit unorm values. */ static void lp_build_sample_image_linear(struct lp_build_sample_context *bld, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 7c928cb9a64..30a201f613f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -3641,7 +3641,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm, (bld.num_lods == 1 || derived_sampler_state.min_img_filter == derived_sampler_state.mag_img_filter))) { if (use_aos) { - /* do sampling/filtering with fixed pt arithmetic */ + /* do sampling/filtering with 8-bit unorm arithmetic */ lp_build_sample_aos(&bld, newcoords[0], newcoords[1], newcoords[2], @@ -3792,7 +3792,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm, } if (use_aos) { - /* do sampling/filtering with fixed pt arithmetic */ + /* do sampling/filtering with 8-bit arithmetic */ lp_build_sample_aos(&bld4, s4, t4, r4, offsets4, lod_positive4, lod_fpart4,