X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fv3d%2Fv3dx_state.c;h=6ee4a2a835f53a19c6cb0d7b7314c53270336962;hb=e146e3a795ecd070679b8dfd1ad7f370e9ec5665;hp=34b845730f6132bbc2bda089e8a7b55965c261db;hpb=9039cf70fa0b785f390c649486e12d6c10e9142b;p=mesa.git diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index 34b845730f6..6ee4a2a835f 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -104,10 +104,23 @@ v3d_create_rasterizer_state(struct pipe_context *pctx, */ so->point_size = MAX2(cso->point_size, .125f); - if (cso->offset_tri) { - so->offset_units = float_to_187_half(cso->offset_units); - so->z16_offset_units = float_to_187_half(cso->offset_units * 256.0); - so->offset_factor = float_to_187_half(cso->offset_scale); + STATIC_ASSERT(sizeof(so->depth_offset) >= + cl_packet_length(DEPTH_OFFSET)); + v3dx_pack(&so->depth_offset, DEPTH_OFFSET, depth) { + depth.depth_offset_factor = + float_to_187_half(cso->offset_scale); + depth.depth_offset_units = + float_to_187_half(cso->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. + */ + v3dx_pack(&so->depth_offset_z16, DEPTH_OFFSET, depth) { + depth.depth_offset_factor = + float_to_187_half(cso->offset_scale); + depth.depth_offset_units = + float_to_187_half(cso->offset_units * 256.0); } return so;