d3d12: Don't unnecessarily recompute manual_depth_range

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21909>
This commit is contained in:
Giancarlo Devich 2023-03-14 11:28:24 -07:00 committed by Marge Bot
parent 8a3ac98524
commit 7854f9283c
4 changed files with 9 additions and 3 deletions

View file

@ -318,7 +318,7 @@ frag_result_color_lowering(struct d3d12_context *ctx)
return 0;
}
static bool
bool
manual_depth_range(struct d3d12_context *ctx)
{
if (!d3d12_need_zero_one_depth_range(ctx))
@ -1620,7 +1620,7 @@ d3d12_select_shader_variants(struct d3d12_context *ctx, const struct pipe_draw_i
sel_ctx.needs_vertex_reordering = needs_vertex_reordering(&sel_ctx, dinfo);
sel_ctx.missing_dual_src_outputs = ctx->missing_dual_src_outputs;
sel_ctx.frag_result_color_lowering = frag_result_color_lowering(ctx);
sel_ctx.manual_depth_range = manual_depth_range(ctx);
sel_ctx.manual_depth_range = ctx->manual_depth_range;
validate_geometry_shader_variant(&sel_ctx);
validate_tess_ctrl_shader_variant(&sel_ctx);

View file

@ -320,6 +320,9 @@ has_flat_varyings(struct d3d12_context* ctx);
bool
d3d12_compare_varying_info(const struct d3d12_varying_info *expect, const struct d3d12_varying_info *have);
bool
manual_depth_range(struct d3d12_context* ctx);
#ifdef __cplusplus
}
#endif

View file

@ -1134,6 +1134,7 @@ d3d12_bind_fs_state(struct pipe_context *pctx,
(struct d3d12_shader_selector *) fss);
ctx->has_flat_varyings = has_flat_varyings(ctx);
ctx->missing_dual_src_outputs = missing_dual_src_outputs(ctx);
ctx->manual_depth_range = manual_depth_range(ctx);
}
static void
@ -2515,6 +2516,7 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->has_flat_varyings = false;
ctx->missing_dual_src_outputs = false;
ctx->manual_depth_range = false;
d3d12_context_surface_init(&ctx->base);
d3d12_context_resource_init(&ctx->base);
@ -2657,5 +2659,5 @@ d3d12_need_zero_one_depth_range(struct d3d12_context *ctx)
* end up generating needless code, but the result will be correct.
*/
return fs->initial->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH);
return fs && fs->initial->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH);
}

View file

@ -241,6 +241,7 @@ struct d3d12_context {
bool has_flat_varyings;
bool missing_dual_src_outputs;
bool manual_depth_range;
struct d3d12_gfx_pipeline_state gfx_pipeline_state;
struct d3d12_compute_pipeline_state compute_pipeline_state;