gallivm/sample: always square rho before fast log2

The fast log2 works better if rho is squared, i.e.

fast_log2(sqrt(2)) == 0.4
0.5 * fast_log2(2) == 0.5

so just square rho, and always divide by 2 afterwards.

Fixes:
GTF-GL45.gtf30.GL3Tests.sgis_texture_lod.sgis_texture_lod_basic_lod_selection

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5820>
This commit is contained in:
Dave Airlie
2020-04-14 15:28:05 +10:00
parent a9c9486106
commit 75e01d01a5
3 changed files with 7 additions and 9 deletions

View File

@@ -28,9 +28,6 @@ dEQP-GLES2.functional.rasterization.interpolation.basic.lines_wide
dEQP-GLES2.functional.rasterization.interpolation.projected.line_loop_wide
dEQP-GLES2.functional.rasterization.interpolation.projected.line_strip_wide
dEQP-GLES2.functional.rasterization.interpolation.projected.lines_wide
dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2d_bias
dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2dproj_vec3_bias
dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2dproj_vec4_bias
dEQP-GLES2.functional.texture.filtering.2d.linear_mipmap_linear_linear_clamp_rgba8888
dEQP-GLES2.functional.texture.filtering.2d.linear_mipmap_linear_linear_mirror_etc1
dEQP-GLES2.functional.texture.filtering.2d.linear_mipmap_linear_linear_mirror_rgba8888

View File

@@ -39,7 +39,6 @@ dEQP-GLES3.functional.clipping.triangle_vertex.clip_two.clip_neg_y_neg_z_and_neg
dEQP-GLES3.functional.clipping.triangle_vertex.clip_two.clip_pos_y_pos_z_and_neg_x_neg_y_neg_z
dEQP-GLES3.functional.draw.random.105
dEQP-GLES3.functional.draw.random.114
dEQP-GLES3.functional.draw.random.124
dEQP-GLES3.functional.draw.random.135
dEQP-GLES3.functional.draw.random.144
dEQP-GLES3.functional.draw.random.155

View File

@@ -848,13 +848,15 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
lod = lp_build_log2(lodf_bld, rho);
}
else {
/* get more accurate results if we just sqaure rho always */
if (!rho_squared)
rho = lp_build_mul(lodf_bld, rho, rho);
lod = lp_build_fast_log2(lodf_bld, rho);
}
if (rho_squared) {
/* log2(x^2) == 0.5*log2(x) */
lod = lp_build_mul(lodf_bld, lod,
lp_build_const_vec(bld->gallivm, lodf_bld->type, 0.5F));
}
/* log2(x^2) == 0.5*log2(x) */
lod = lp_build_mul(lodf_bld, lod,
lp_build_const_vec(bld->gallivm, lodf_bld->type, 0.5F));
/* add shader lod bias */
if (lod_bias) {