[Mesa-dev] [PATCH] nvc0: provide support for unscaled poly offset units
Ilia Mirkin
imirkin at alum.mit.edu
Sat Jun 25 19:22:18 UTC 2016
On at least Kepler hardware, the units differ based on RT format. Emit a
properly scaled value for Z16 depth buffers vs other formats, to help
out st/nine.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 2 +-
.../drivers/nouveau/nvc0/nvc0_state_validate.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 8c46b2a..ce6bd8b 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -234,6 +234,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
case PIPE_CAP_COMPUTE:
case PIPE_CAP_TGSI_VOTE:
+ case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
return 1;
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
@@ -263,7 +264,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_PCI_BUS:
case PIPE_CAP_PCI_DEVICE:
case PIPE_CAP_PCI_FUNCTION:
- case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
return 0;
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 05c15ce..ea0bd23 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -672,6 +672,26 @@ nvc0_validate_derived_3(struct nvc0_context *nvc0)
}
static void
+nvc0_validate_derived_4(struct nvc0_context *nvc0)
+{
+ struct nouveau_pushbuf *push = nvc0->base.pushbuf;
+ struct pipe_framebuffer_state *fb = &nvc0->framebuffer;
+ struct pipe_rasterizer_state *rast = &nvc0->rast->pipe;
+
+ if (!rast)
+ return;
+
+ if (rast->offset_units_unscaled) {
+ BEGIN_NVC0(push, NVC0_3D(POLYGON_OFFSET_UNITS), 1);
+ if (fb->zsbuf && fb->zsbuf->format == PIPE_FORMAT_Z16_UNORM)
+ PUSH_DATAf(push, rast->offset_units * (1 << 16));
+ else
+ PUSH_DATAf(push, rast->offset_units * (1 << 24));
+ }
+}
+
+
+static void
nvc0_validate_tess_state(struct nvc0_context *nvc0)
{
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
@@ -754,6 +774,7 @@ validate_list_3d[] = {
NVC0_NEW_3D_RASTERIZER },
{ nvc0_validate_derived_2, NVC0_NEW_3D_ZSA | NVC0_NEW_3D_FRAMEBUFFER },
{ nvc0_validate_derived_3, NVC0_NEW_3D_BLEND | NVC0_NEW_3D_FRAMEBUFFER },
+ { nvc0_validate_derived_4, NVC0_NEW_3D_RASTERIZER | NVC0_NEW_3D_FRAMEBUFFER },
{ nvc0_validate_clip, NVC0_NEW_3D_CLIP | NVC0_NEW_3D_RASTERIZER |
NVC0_NEW_3D_VERTPROG |
NVC0_NEW_3D_TEVLPROG |
--
2.7.3
More information about the mesa-dev
mailing list