From 83d636fc74d44024e8ba4af44521242f56497f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Fri, 2 Jan 2026 16:44:52 +0100 Subject: [PATCH] r300: Z16 polygon offset fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The way I understand the HW docs is that the polygon offset is applied always in 24bit depth domain (there are no polygon offset depth format control registers like r600 has), so we need to manually rescale for 16bit buffers. Signed-off-by: Pavel Ondračka Part-of: --- src/gallium/drivers/r300/ci/r300-rs740-fails.txt | 2 -- src/gallium/drivers/r300/ci/r300-rv380-fails.txt | 2 -- src/gallium/drivers/r300/ci/r300-rv410-fails.txt | 2 -- src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt | 2 -- src/gallium/drivers/r300/r300_state.c | 5 +++-- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/r300/ci/r300-rs740-fails.txt b/src/gallium/drivers/r300/ci/r300-rs740-fails.txt index f7b0849796f..cddbf823285 100644 --- a/src/gallium/drivers/r300/ci/r300-rs740-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rs740-fails.txt @@ -41,7 +41,6 @@ dEQP-GLES2.functional.fragment_ops.random.63,Fail dEQP-GLES2.functional.fragment_ops.random.66,Fail dEQP-GLES2.functional.fragment_ops.random.81,Fail -dEQP-GLES2.functional.polygon_offset.fixed16_displacement_with_units,Fail dEQP-GLES2.functional.rasterization.primitives.line_loop_wide,Fail dEQP-GLES2.functional.rasterization.primitives.line_strip_wide,Fail dEQP-GLES2.functional.rasterization.primitives.points,Fail @@ -485,7 +484,6 @@ KHR-GLES2.texture_3d.filtering.sizes.63x63x63_nearest_mipmap_linear,Fail KHR-GLES2.texture_3d.filtering.sizes.63x63x63_nearest_mipmap_nearest,Fail # New failures with ES CTS 3.2.12.0 -dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units,Fail dEQP-GLES2.functional.uniform_api.info_query.nested_structs_arrays.mat4_mat2_both,Fail dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.nested_structs_arrays.mat4_mat2_both,Fail dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.render.nested_structs_arrays.mat4_mat2_both,Fail diff --git a/src/gallium/drivers/r300/ci/r300-rv380-fails.txt b/src/gallium/drivers/r300/ci/r300-rv380-fails.txt index cccedc24e96..1aafe59cc56 100644 --- a/src/gallium/drivers/r300/ci/r300-rv380-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv380-fails.txt @@ -1,7 +1,5 @@ dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb_half_float_oes,Fail -dEQP-GLES2.functional.polygon_offset.fixed16_displacement_with_units,Fail -dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units,Fail dEQP-GLES2.functional.shaders.builtin_variable.frontfacing,Fail dEQP-GLES2.functional.shaders.conversions.vector_combine.vec2_bool_to_ivec3_fragment,Fail dEQP-GLES2.functional.shaders.conversions.vector_combine.vec2_bvec2_to_ivec4_fragment,Fail diff --git a/src/gallium/drivers/r300/ci/r300-rv410-fails.txt b/src/gallium/drivers/r300/ci/r300-rv410-fails.txt index 29c23d95c44..6c42cb3c186 100644 --- a/src/gallium/drivers/r300/ci/r300-rv410-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv410-fails.txt @@ -29,7 +29,6 @@ dEQP-GLES2.functional.fragment_ops.random.66,Fail dEQP-GLES2.functional.fragment_ops.random.81,Fail dEQP-GLES2.functional.fragment_ops.random.77,Fail -dEQP-GLES2.functional.polygon_offset.fixed16_displacement_with_units,Fail dEQP-GLES2.functional.rasterization.primitives.line_loop_wide,Fail dEQP-GLES2.functional.rasterization.primitives.line_strip_wide,Fail dEQP-GLES2.functional.shaders.builtin_variable.frontfacing,Fail @@ -474,7 +473,6 @@ KHR-GLES2.texture_3d.filtering.sizes.63x63x63_nearest_mipmap_linear,Fail KHR-GLES2.texture_3d.filtering.sizes.63x63x63_nearest_mipmap_nearest,Fail # New failures with ES CTS 3.2.12.0 -dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units,Fail dEQP-GLES2.functional.uniform_api.info_query.nested_structs_arrays.mat4_mat2_both,Fail dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.nested_structs_arrays.mat4_mat2_both,Fail dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.render.nested_structs_arrays.mat4_mat2_both,Fail diff --git a/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt b/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt index 163ba4573d9..8c288032c3b 100644 --- a/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt @@ -2,8 +2,6 @@ dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb_half_float_oes,Fail dEQP-GLES2.functional.polygon_offset.default_factor_1_slope,Fail -dEQP-GLES2.functional.polygon_offset.fixed16_displacement_with_units,Fail -dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units,Fail dEQP-GLES2.functional.polygon_offset.fixed16_factor_1_slope,Fail dEQP-GLES2.functional.shaders.loops.do_while_dynamic_iterations.mixed_break_continue_fragment,Fail diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 901b88b66a9..e9f7868c68a 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1503,8 +1503,8 @@ static void* r300_create_rs_state(struct pipe_context* pipe, /* Build the two command buffers for polygon offset setup. */ if (polygon_offset_enable) { - float scale = state->offset_scale * 12; - float offset = state->offset_units * 4; + float scale = state->offset_scale * 256 * 12; + float offset = state->offset_units * 256 * 2; BEGIN_CB(rs->cb_poly_offset_zb16, 5); OUT_CB_REG_SEQ(R300_SU_POLY_OFFSET_FRONT_SCALE, 4); @@ -1515,6 +1515,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe, END_CB; offset = state->offset_units * 2; + scale = state->offset_scale * 12; BEGIN_CB(rs->cb_poly_offset_zb24, 5); OUT_CB_REG_SEQ(R300_SU_POLY_OFFSET_FRONT_SCALE, 4);