summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_state.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-09-24 13:59:53 -0700
committerEric Anholt <[email protected]>2014-09-24 15:56:39 -0700
commit7fa399f93af288bc0b9764819d4e5b6184e75d78 (patch)
tree98394c211268435336e2204a91e1610e11eaea99 /src/gallium/drivers/vc4/vc4_state.c
parent6abbdfe3dbe7d4372b30461e97b4ad557ff4e5d2 (diff)
vc4: Actually add support for polygon offset.
Setting the bit without setting the offset values is kind of useless. Fixes piglit polygon-offset (but not polygon-mode-offset).
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_state.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_state.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c
index 2e14573deb0..81dac21f548 100644
--- a/src/gallium/drivers/vc4/vc4_state.c
+++ b/src/gallium/drivers/vc4/vc4_state.c
@@ -79,6 +79,12 @@ vc4_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask)
vc4->dirty |= VC4_DIRTY_SAMPLE_MASK;
}
+static uint16_t
+float_to_187_half(float f)
+{
+ return fui(f) >> 16;
+}
+
static void *
vc4_create_rasterizer_state(struct pipe_context *pctx,
const struct pipe_rasterizer_state *cso)
@@ -102,9 +108,13 @@ vc4_create_rasterizer_state(struct pipe_context *pctx,
if (cso->front_ccw)
so->config_bits[0] |= VC4_CONFIG_BITS_CW_PRIMITIVES;
- if (cso->offset_tri)
+ if (cso->offset_tri) {
so->config_bits[0] |= VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET;
+ so->offset_units = float_to_187_half(cso->offset_units);
+ so->offset_factor = float_to_187_half(cso->offset_scale);
+ }
+
return so;
}