Mesa (master): a4xx: add polygon offset clamp, fix units
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 6 18:21:26 UTC 2020
Module: Mesa
Branch: master
Commit: 42c814158b5f66dddb69c35e1b3a8f28db6c8923
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=42c814158b5f66dddb69c35e1b3a8f28db6c8923
Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date: Sun Jul 5 22:06:48 2020 -0400
a4xx: add polygon offset clamp, fix units
For some reason, in order to get all tests to pass, pretty much all
hardware (across vendors) has to program in offset_units * 2. This fixes
dEQP-GLES3.functional.polygon_offset.float32_displacement_with_units.
While we're at it, add polygon offset clamp support.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5763>
---
src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 3 ++-
src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c | 4 +++-
src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.h | 1 +
src/gallium/drivers/freedreno/freedreno_screen.c | 2 +-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
index e6848a1aecc..256167298e6 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
@@ -613,9 +613,10 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
OUT_RING(ring, rasterizer->gras_su_point_minmax);
OUT_RING(ring, rasterizer->gras_su_point_size);
- OUT_PKT0(ring, REG_A4XX_GRAS_SU_POLY_OFFSET_SCALE, 2);
+ OUT_PKT0(ring, REG_A4XX_GRAS_SU_POLY_OFFSET_SCALE, 3);
OUT_RING(ring, rasterizer->gras_su_poly_offset_scale);
OUT_RING(ring, rasterizer->gras_su_poly_offset_offset);
+ OUT_RING(ring, rasterizer->gras_su_poly_offset_clamp);
OUT_PKT0(ring, REG_A4XX_GRAS_CL_CLIP_CNTL, 1);
OUT_RING(ring, rasterizer->gras_cl_clip_cntl);
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c b/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c
index 3477a43653a..8d674debe9a 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c
@@ -71,7 +71,9 @@ fd4_rasterizer_state_create(struct pipe_context *pctx,
so->gras_su_poly_offset_scale =
A4XX_GRAS_SU_POLY_OFFSET_SCALE(cso->offset_scale);
so->gras_su_poly_offset_offset =
- A4XX_GRAS_SU_POLY_OFFSET_OFFSET(cso->offset_units);
+ A4XX_GRAS_SU_POLY_OFFSET_OFFSET(cso->offset_units * 2.0f);
+ so->gras_su_poly_offset_clamp =
+ A4XX_GRAS_SU_POLY_OFFSET_CLAMP(cso->offset_clamp);
so->gras_su_mode_control =
A4XX_GRAS_SU_MODE_CONTROL_LINEHALFWIDTH(cso->line_width/2.0);
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.h b/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.h
index 40bd2f6824d..b9019c3e667 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.h
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.h
@@ -36,6 +36,7 @@ struct fd4_rasterizer_stateobj {
uint32_t gras_su_point_size;
uint32_t gras_su_poly_offset_scale;
uint32_t gras_su_poly_offset_offset;
+ uint32_t gras_su_poly_offset_clamp;
uint32_t gras_su_mode_control;
uint32_t gras_cl_clip_cntl;
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 0ab93801ba8..bda4dcf788c 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -263,7 +263,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return is_a3xx(screen) || is_a4xx(screen);
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
- return is_a5xx(screen) || is_a6xx(screen);
+ return is_a4xx(screen) || is_a5xx(screen) || is_a6xx(screen);
case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
if (is_a3xx(screen)) return 16;
More information about the mesa-commit
mailing list