d3d12: Fix re-enabling predication after temporary disablement

The equal-zero vs not-equal-zero property was previously lost

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14486>
This commit is contained in:
Jesse Natalie
2022-01-10 08:56:58 -08:00
committed by Marge Bot
parent 07bf8b18b5
commit 9609387a4f
5 changed files with 21 additions and 14 deletions

View File

@@ -25,6 +25,7 @@
#include "d3d12_compiler.h"
#include "d3d12_debug.h"
#include "d3d12_format.h"
#include "d3d12_query.h"
#include "d3d12_resource.h"
#include "d3d12_screen.h"
@@ -956,8 +957,7 @@ d3d12_blit(struct pipe_context *pctx,
util_format_short_name(info->dst.resource->format));
if (!info->render_condition_enable && ctx->current_predication) {
ctx->cmdlist->SetPredication(
d3d12_resource_resource(ctx->current_predication), 0, D3D12_PREDICATION_OP_EQUAL_ZERO);
d3d12_enable_predication(ctx);
if (D3D12_DEBUG_BLIT & d3d12_debug)
debug_printf("D3D12 BLIT: Re-enable predication\n");
}

View File

@@ -1908,9 +1908,7 @@ d3d12_clear_render_target(struct pipe_context *pctx,
d3d12_batch_reference_surface_texture(d3d12_current_batch(ctx), surf);
if (!render_condition_enabled && ctx->current_predication) {
ctx->cmdlist->SetPredication(
d3d12_resource_resource(ctx->current_predication), 0,
D3D12_PREDICATION_OP_EQUAL_ZERO);
d3d12_enable_predication(ctx);
}
}
@@ -1951,9 +1949,7 @@ d3d12_clear_depth_stencil(struct pipe_context *pctx,
d3d12_batch_reference_surface_texture(d3d12_current_batch(ctx), surf);
if (!render_condition_enabled && ctx->current_predication) {
ctx->cmdlist->SetPredication(
d3d12_resource_resource(ctx->current_predication), 0,
D3D12_PREDICATION_OP_EQUAL_ZERO);
d3d12_enable_predication(ctx);
}
}

View File

@@ -246,6 +246,7 @@ struct d3d12_context {
struct d3d12_validation_tools *validation_tools;
struct d3d12_resource *current_predication;
bool predication_condition;
#ifdef __cplusplus
ResourceStateManager *resource_state_manager;

View File

@@ -503,13 +503,20 @@ d3d12_render_condition(struct pipe_context *pctx,
d3d12_apply_resource_states(ctx);
ctx->current_predication = query->predicate;
ctx->predication_condition = condition;
d3d12_enable_predication(ctx);
}
void
d3d12_enable_predication(struct d3d12_context *ctx)
{
/* documentation of ID3D12GraphicsCommandList::SetPredication method:
* "resource manipulation commands are _not_ actually performed
* if the resulting predicate data of the predicate is equal to
* the operation specified."
*/
ctx->cmdlist->SetPredication(d3d12_resource_resource(query->predicate), 0,
condition ? D3D12_PREDICATION_OP_NOT_EQUAL_ZERO :
* "resource manipulation commands are _not_ actually performed
* if the resulting predicate data of the predicate is equal to
* the operation specified."
*/
ctx->cmdlist->SetPredication(d3d12_resource_resource(ctx->current_predication), 0,
ctx->predication_condition ? D3D12_PREDICATION_OP_NOT_EQUAL_ZERO :
D3D12_PREDICATION_OP_EQUAL_ZERO);
}

View File

@@ -35,4 +35,7 @@ d3d12_resume_queries(struct d3d12_context *ctx);
void
d3d12_validate_queries(struct d3d12_context *ctx);
void
d3d12_enable_predication(struct d3d12_context *ctx);
#endif