zink: add driver workaround for broken EXT_depth_clip_control

for #6186

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15513>
This commit is contained in:
Mike Blumenkrantz 2022-03-22 18:05:35 -04:00 committed by Marge Bot
parent fe7c3eba33
commit 206d2f3127
5 changed files with 9 additions and 3 deletions

View file

@ -1269,7 +1269,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad
if (zs->sinfo.have_xfb)
sinfo->last_vertex = true;
if (!zink_vs_key_base(key)->clip_halfz && !screen->info.have_EXT_depth_clip_control) {
if (!zink_vs_key_base(key)->clip_halfz && screen->driver_workarounds.depth_clip_control_missing) {
NIR_PASS_V(nir, nir_lower_clip_halfz);
}
if (zink_vs_key_base(key)->push_drawid) {

View file

@ -155,7 +155,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
viewport_state.pViewports = NULL;
viewport_state.scissorCount = screen->info.have_EXT_extended_dynamic_state ? 0 : state->dyn_state1.num_viewports;
viewport_state.pScissors = NULL;
if (screen->info.have_EXT_depth_clip_control && !hw_rast_state->clip_halfz)
if (!screen->driver_workarounds.depth_clip_control_missing && !hw_rast_state->clip_halfz)
viewport_state.pNext = &clip;
VkPipelineRasterizationStateCreateInfo rast_state = {0};

View file

@ -2084,6 +2084,11 @@ static void
init_driver_workarounds(struct zink_screen *screen)
{
screen->driver_workarounds.color_write_missing = !screen->info.have_EXT_color_write_enable;
screen->driver_workarounds.depth_clip_control_missing = !screen->info.have_EXT_depth_clip_control;
if (screen->info.driver_props.driverID == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA) {
/* #6186 */
screen->driver_workarounds.depth_clip_control_missing = true;
}
/* #6185 */
if (screen->info.driver_props.driverID == VK_DRIVER_ID_MESA_RADV)
screen->driver_workarounds.color_write_missing = true;

View file

@ -180,6 +180,7 @@ struct zink_screen {
struct {
bool color_write_missing;
bool depth_clip_control_missing;
} driver_workarounds;
};

View file

@ -698,7 +698,7 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
ctx->rast_state_changed = true;
if (clip_halfz != ctx->rast_state->base.clip_halfz) {
if (screen->info.have_EXT_depth_clip_control)
if (!screen->driver_workarounds.depth_clip_control_missing)
ctx->gfx_pipeline_state.dirty = true;
else
zink_set_last_vertex_key(ctx)->clip_halfz = ctx->rast_state->base.clip_halfz;