diff --git a/.pick_status.json b/.pick_status.json index a3d203a2870..cdd9f1377b2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -481,7 +481,7 @@ "description": "zink: handle !half_pixel_center", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index 69fae28485d..9ff8182a6ed 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -588,6 +588,15 @@ zink_draw(struct pipe_context *pctx, CLAMP(ctx->vp_state.viewport_states[i].translate[2] + ctx->vp_state.viewport_states[i].scale[2], 0, 1) }; + if (!ctx->rast_state->base.half_pixel_center) { + /* magic constant value from dxvk */ + float cf = 0.5f - (1.0f / 128.0f); + viewport.x += cf; + if (viewport.height < 0) + viewport.y += cf; + else + viewport.y -= cf; + } viewports[i] = viewport; } if (DYNAMIC_STATE != ZINK_NO_DYNAMIC_STATE) diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c index 6a8d80a9d28..287655459c4 100644 --- a/src/gallium/drivers/zink/zink_state.c +++ b/src/gallium/drivers/zink/zink_state.c @@ -635,6 +635,7 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso) bool force_persample_interp = ctx->rast_state ? ctx->rast_state->hw_state.force_persample_interp : false; bool clip_halfz = ctx->rast_state ? ctx->rast_state->hw_state.clip_halfz : false; bool rasterizer_discard = ctx->rast_state ? ctx->rast_state->base.rasterizer_discard : false; + bool half_pixel_center = ctx->rast_state ? ctx->rast_state->base.half_pixel_center : true; ctx->rast_state = cso; if (ctx->rast_state) { @@ -678,6 +679,9 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso) if (ctx->rast_state->base.force_persample_interp != force_persample_interp) zink_set_fs_key(ctx)->force_persample_interp = ctx->rast_state->base.force_persample_interp; + + if (ctx->rast_state->base.half_pixel_center != half_pixel_center) + ctx->vp_state_changed = true; } }