Mesa (main): llvmpipe: do not always use pixel-rounded coordinates for points
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 11 08:13:09 UTC 2021
Module: Mesa
Branch: main
Commit: f530e72ea05f7fadf139df558f10d7ad9d38cc46
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f530e72ea05f7fadf139df558f10d7ad9d38cc46
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Mon Jun 7 16:06:15 2021 +0200
llvmpipe: do not always use pixel-rounded coordinates for points
LLVMpipe always used the bounding-box to rasterize-points, rather than
the actual rasterization-planes. This happened because the primitive was
expanded by one unit outside the bounding box. While this kinda work for
non-multisampled cases, it's not really quite *correct*.
Rasterization of non-legacy points in OpenGL is defined as the
intersection of a the pixel centers with a rectangle of size width and
height, centered around the point in viewport coordinates. This applies
both to multi-sampled and non-multisampled cases.
So let's fix the rasterizer to use the correct definition in both cases.
We leave the legacy case as-is, and just do the inverse adjustment
there so the end result should be the same.
This fixes the following dEQP test-cases:
- dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_4.primitives.points
- dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.points
...as well as this one for Lavapipe:
- dEQP-VK.rasterization.primitives_multisample_4_bit.no_stipple.points
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11183>
---
.../drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt | 2 --
src/gallium/drivers/llvmpipe/lp_setup_point.c | 37 ++++++++++++++++------
.../drivers/virgl/ci/deqp-virgl-gl-fails.txt | 2 --
.../drivers/virgl/ci/deqp-virgl-gles-fails.txt | 2 --
.../frontends/lavapipe/ci/deqp-lvp-fails.txt | 1 -
5 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt b/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt
index 525d25f2aeb..952e45dbd21 100644
--- a/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt
+++ b/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt
@@ -47,8 +47,6 @@ dEQP-GLES3.functional.polygon_offset.fixed16_render_with_units,Fail
dEQP-GLES3.functional.polygon_offset.fixed24_displacement_with_units,Fail
dEQP-GLES3.functional.polygon_offset.fixed24_render_with_units,Fail
dEQP-GLES3.functional.polygon_offset.float32_displacement_with_units,Fail
-dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_4.primitives.points,Fail
-dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.points,Fail
dEQP-GLES3.functional.rasterization.fbo.rbo_singlesample.interpolation.lines_wide,Fail
dEQP-GLES3.functional.rasterization.fbo.texture_2d.interpolation.lines_wide,Fail
dEQP-GLES3.functional.rasterization.interpolation.basic.line_loop_wide,Fail
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index 66e1416abeb..bca2d47d135 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -355,6 +355,7 @@ try_setup_point( struct lp_setup_context *setup,
struct lp_rast_triangle *point;
unsigned bytes;
struct u_rect bbox;
+ int x[2], y[2];
unsigned nr_planes = 4;
struct point_info info;
unsigned viewport_index = 0;
@@ -374,7 +375,7 @@ try_setup_point( struct lp_setup_context *setup,
print_point(setup, v0, size);
/* Bounding rectangle (in pixels) */
- if (!setup->legacy_points) {
+ if (!setup->legacy_points || setup->multisample) {
/*
* Rasterize points as quads.
*/
@@ -387,10 +388,14 @@ try_setup_point( struct lp_setup_context *setup,
x0 = subpixel_snap(v0[0][0] - pixel_offset) - fixed_width/2;
y0 = subpixel_snap(v0[0][1] - pixel_offset) - fixed_width/2;
- bbox.x0 = (x0 + (FIXED_ONE-1)) >> FIXED_ORDER;
- bbox.x1 = (x0 + fixed_width + (FIXED_ONE-1)) >> FIXED_ORDER;
- bbox.y0 = (y0 + (FIXED_ONE-1) + adj) >> FIXED_ORDER;
- bbox.y1 = (y0 + fixed_width + (FIXED_ONE-1) + adj) >> FIXED_ORDER;
+ x[0] = x0;
+ x[1] = x0 + fixed_width;
+ y[0] = y0;
+ y[1] = y0 + fixed_width;
+ bbox.x0 = x[0] >> FIXED_ORDER;
+ bbox.x1 = (x[1] + (FIXED_ONE-1)) >> FIXED_ORDER;
+ bbox.y0 = (y[0] + adj) >> FIXED_ORDER;
+ bbox.y1 = (y[1] + (FIXED_ONE-1) + adj) >> FIXED_ORDER;
/* Inclusive coordinates:
*/
@@ -438,6 +443,11 @@ try_setup_point( struct lp_setup_context *setup,
bbox.x1 = bbox.x0 + int_width - 1;
bbox.y1 = bbox.y0 + int_width - 1;
}
+
+ x[0] = (bbox.x0 - 1) << 8;
+ x[1] = (bbox.x1 + 1) << 8;
+ y[0] = (bbox.y0 - 1) << 8;
+ y[1] = (bbox.y1 + 1) << 8;
}
if (0) {
@@ -504,23 +514,32 @@ try_setup_point( struct lp_setup_context *setup,
plane[0].dcdx = ~0U << 8;
plane[0].dcdy = 0;
- plane[0].c = (1-bbox.x0) << 8;
+ plane[0].c = -x[0];
plane[0].eo = 1 << 8;
plane[1].dcdx = 1 << 8;
plane[1].dcdy = 0;
- plane[1].c = (bbox.x1+1) << 8;
+ plane[1].c = x[1];
plane[1].eo = 0;
plane[2].dcdx = 0;
plane[2].dcdy = 1 << 8;
- plane[2].c = (1-bbox.y0) << 8;
+ plane[2].c = -y[0];
plane[2].eo = 1 << 8;
plane[3].dcdx = 0;
plane[3].dcdy = ~0U << 8;
- plane[3].c = (bbox.y1+1) << 8;
+ plane[3].c = y[1];
plane[3].eo = 0;
+
+ if (!setup->legacy_points || setup->multisample) {
+ /* adjust for fill-rule*/
+ plane[0].c++; /* left */
+ if (setup->bottom_edge_rule == 0)
+ plane[2].c++; /* top-left */
+ else
+ plane[3].c++; /* bottom-left */
+ }
}
return lp_setup_bin_triangle(setup, point, &bbox, &bbox, nr_planes, viewport_index);
diff --git a/src/gallium/drivers/virgl/ci/deqp-virgl-gl-fails.txt b/src/gallium/drivers/virgl/ci/deqp-virgl-gl-fails.txt
index b4de9d91f01..38f1a950f98 100644
--- a/src/gallium/drivers/virgl/ci/deqp-virgl-gl-fails.txt
+++ b/src/gallium/drivers/virgl/ci/deqp-virgl-gl-fails.txt
@@ -38,8 +38,6 @@ dEQP-GLES3.functional.polygon_offset.fixed16_render_with_units,Fail
dEQP-GLES3.functional.polygon_offset.fixed24_displacement_with_units,Fail
dEQP-GLES3.functional.polygon_offset.fixed24_render_with_units,Fail
dEQP-GLES3.functional.polygon_offset.float32_displacement_with_units,Fail
-dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_4.primitives.points,Fail
-dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.points,Fail
dEQP-GLES3.functional.rasterization.fbo.rbo_singlesample.interpolation.lines_wide,Fail
dEQP-GLES3.functional.rasterization.fbo.texture_2d.interpolation.lines_wide,Fail
dEQP-GLES3.functional.rasterization.interpolation.basic.line_loop_wide,Fail
diff --git a/src/gallium/drivers/virgl/ci/deqp-virgl-gles-fails.txt b/src/gallium/drivers/virgl/ci/deqp-virgl-gles-fails.txt
index 5b7bafcda0a..63014852eac 100644
--- a/src/gallium/drivers/virgl/ci/deqp-virgl-gles-fails.txt
+++ b/src/gallium/drivers/virgl/ci/deqp-virgl-gles-fails.txt
@@ -37,8 +37,6 @@ dEQP-GLES3.functional.polygon_offset.fixed16_render_with_units,Fail
dEQP-GLES3.functional.polygon_offset.fixed24_displacement_with_units,Fail
dEQP-GLES3.functional.polygon_offset.fixed24_render_with_units,Fail
dEQP-GLES3.functional.polygon_offset.float32_displacement_with_units,Fail
-dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_4.primitives.points,Fail
-dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.points,Fail
dEQP-GLES3.functional.rasterization.fbo.rbo_singlesample.interpolation.lines_wide,Fail
dEQP-GLES3.functional.rasterization.fbo.texture_2d.interpolation.lines_wide,Fail
dEQP-GLES3.functional.rasterization.interpolation.basic.line_loop_wide,Fail
diff --git a/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt b/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt
index a0e6c548572..ccb249844b8 100644
--- a/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt
+++ b/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt
@@ -33,7 +33,6 @@ dEQP-VK.image.mismatched_formats.image_write.a8b8g8r8_srgb_pack32_with_rgb10a2,C
dEQP-VK.image.mismatched_formats.image_write.b8g8r8a8_srgb_with_rgba8,Crash
dEQP-VK.image.mismatched_formats.image_write.r8g8b8a8_srgb_with_rgb10a2,Crash
dEQP-VK.rasterization.interpolation.projected.non_strict_lines,Fail
-dEQP-VK.rasterization.primitives_multisample_4_bit.no_stipple.points,Fail
dEQP-VK.texture.filtering.2d.combinations.linear_mipmap_linear.linear.clamp_to_edge.repeat,Fail
dEQP-VK.texture.filtering.2d.combinations.linear_mipmap_linear.linear.mirror_clamp_to_edge.repeat,Fail
dEQP-VK.texture.filtering.2d.combinations.linear_mipmap_linear.linear.mirrored_repeat.mirror_clamp_to_edge,Fail
More information about the mesa-commit
mailing list