* VC5_PACKET_DEPTH_OFFSET
*/
uint16_t offset_units;
+ /**
+ * The HW treats polygon offset units based on a Z24 buffer, so we
+ * need to scale up offset_units if we're only Z16.
+ */
+ uint16_t z16_offset_units;
/**
* Half-float (1/8/7 bits) value of polygon offset scale for
* VC5_PACKET_DEPTH_OFFSET
cl_emit(&job->bcl, DEPTH_OFFSET, depth) {
depth.depth_offset_factor =
v3d->rasterizer->offset_factor;
- depth.depth_offset_units =
- v3d->rasterizer->offset_units;
+ if (job->zsbuf &&
+ job->zsbuf->format == PIPE_FORMAT_Z16_UNORM) {
+ depth.depth_offset_units =
+ v3d->rasterizer->z16_offset_units;
+ } else {
+ depth.depth_offset_units =
+ v3d->rasterizer->offset_units;
+ }
}
}