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;
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:
if (cso->offset_point || cso->offset_line || cso->offset_tri) {
SB_BEGIN_3D(so, POLYGON_OFFSET_FACTOR, 1);
SB_DATA (so, fui(cso->offset_scale));
- SB_BEGIN_3D(so, POLYGON_OFFSET_UNITS, 1);
- SB_DATA (so, fui(cso->offset_units * 2.0f));
+ if (!cso->offset_units_unscaled) {
+ SB_BEGIN_3D(so, POLYGON_OFFSET_UNITS, 1);
+ SB_DATA (so, fui(cso->offset_units * 2.0f));
+ }
SB_BEGIN_3D(so, POLYGON_OFFSET_CLAMP, 1);
SB_DATA (so, fui(cso->offset_clamp));
}
PUSH_DATA (push, ms);
}
+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)
{
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 |