Setting the bit without setting the offset values is kind of useless.
Fixes piglit polygon-offset (but not polygon-mode-offset).
uint8_t config_bits[3];
float point_size;
+
+ /**
+ * Half-float (1/8/7 bits) value of polygon offset units for
+ * VC4_PACKET_DEPTH_OFFSET
+ */
+ uint16_t offset_units;
+ /**
+ * Half-float (1/8/7 bits) value of polygon offset scale for
+ * VC4_PACKET_DEPTH_OFFSET
+ */
+ uint16_t offset_factor;
};
struct vc4_depth_stencil_alpha_state {
vc4->zsa->config_bits[2]);
}
+ if (vc4->dirty & VC4_DIRTY_RASTERIZER) {
+ cl_u8(&vc4->bcl, VC4_PACKET_DEPTH_OFFSET);
+ cl_u16(&vc4->bcl, vc4->rasterizer->offset_factor);
+ cl_u16(&vc4->bcl, vc4->rasterizer->offset_units);
+ }
+
if (vc4->dirty & VC4_DIRTY_VIEWPORT) {
cl_u8(&vc4->bcl, VC4_PACKET_CLIPPER_XY_SCALING);
cl_f(&vc4->bcl, vc4->viewport.scale[0] * 16.0f);
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)
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;
}