Commit ce579e29 authored by Bill Kristiansen's avatar Bill Kristiansen

d3d12: state transitions for multi-planar resources

parent f896a5f3
Pipeline #156903 waiting for manual action with stages
......@@ -1140,6 +1140,7 @@ d3d12_transition_subresources_state(struct d3d12_context *ctx,
struct d3d12_resource *res,
uint32_t start_level, uint32_t num_levels,
uint32_t start_layer, uint32_t num_layers,
uint32_t start_plane, uint32_t num_planes,
D3D12_RESOURCE_STATES state,
SubresourceTransitionFlags flags)
{
......@@ -1149,8 +1150,11 @@ d3d12_transition_subresources_state(struct d3d12_context *ctx,
const uint32_t level = start_level + l;
for (uint32_t a = 0; a < num_layers; a++) {
const uint32_t layer = start_layer + a;
uint32_t subres_id = level + (layer * res->mip_levels);
ctx->resource_state_manager->TransitionSubresource(xres, subres_id, state, flags);
for( uint32_t p = 0; p < num_planes; p++) {
const uint32_t plane = start_plane + p;
uint32_t subres_id = level + (layer * res->mip_levels) + plane * (res->mip_levels * res->base.array_size);
ctx->resource_state_manager->TransitionSubresource(xres, subres_id, state, flags);
}
}
}
}
......
......@@ -265,6 +265,7 @@ d3d12_transition_subresources_state(struct d3d12_context *ctx,
struct d3d12_resource *res,
uint32_t start_level, uint32_t num_levels,
uint32_t start_layer, uint32_t num_layers,
uint32_t start_plane, uint32_t num_planes,
D3D12_RESOURCE_STATES state,
SubresourceTransitionFlags flags);
......
......@@ -108,6 +108,7 @@ fill_srv_descriptors(struct d3d12_context *ctx,
d3d12_transition_subresources_state(ctx, d3d12_resource(view->base.texture),
view->base.u.tex.first_level, view->mip_levels,
view->base.u.tex.first_layer, view->array_size,
0, 1,
state, SubresourceTransitionFlags_TransitionPreDraw);
}
} else {
......@@ -468,15 +469,18 @@ d3d12_draw_vbo(struct pipe_context *pctx,
d3d12_transition_subresources_state(ctx, d3d12_resource(psurf->texture),
psurf->u.tex.level, 1,
psurf->u.tex.first_layer, num_layers,
0, 1,
D3D12_RESOURCE_STATE_RENDER_TARGET,
SubresourceTransitionFlags_TransitionPreDraw);
}
if (ctx->fb.zsbuf) {
struct pipe_surface *psurf = ctx->fb.zsbuf;
const uint32_t num_layers = psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1;
bool num_planes = util_format_description(psurf->format);
  • I thing what you really want here is:

          auto descr = util_format_description(psurf->format);
          auto num_planes = (util_format_has_depth(descr) ? 1 : 0) +
                            (util_format_has_stencil(descr) ? 1 : 0);

    and with that the warning vanishes.

    Edited by Gert Wollny
Please register or sign in to reply
d3d12_transition_subresources_state(ctx, d3d12_resource(psurf->texture),
psurf->u.tex.level, 1,
psurf->u.tex.first_layer, num_layers,
0, num_planes,
D3D12_RESOURCE_STATE_DEPTH_WRITE,
SubresourceTransitionFlags_TransitionPreDraw);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment