if (ctx->tc)
util_queue_destroy(&ctx->batch.flush_queue);
- for (unsigned i = 0; i < ARRAY_SIZE(ctx->null_buffers); i++)
- pipe_resource_reference(&ctx->null_buffers[i], NULL);
-
simple_mtx_destroy(&ctx->batch_mtx);
zink_clear_batch_state(ctx, ctx->batch.state);
zink_batch_state_reference(screen, &ctx->batch.state, NULL);
#include "util/u_memory.h"
#include "util/u_string.h"
-static struct pipe_surface *
-framebuffer_null_surface_init(struct zink_context *ctx, struct zink_framebuffer_state *state)
-{
- struct pipe_surface surf_templ = {};
- unsigned idx = util_logbase2_ceil(MAX2(state->samples, 1));
-
- if (!ctx->null_buffers[idx]) {
- struct pipe_resource *pres;
- struct pipe_resource templ = {};
- templ.width0 = state->width;
- templ.height0 = state->height;
- templ.depth0 = 1;
- templ.format = PIPE_FORMAT_R8_UINT;
- templ.target = PIPE_TEXTURE_2D;
- templ.bind = PIPE_BIND_RENDER_TARGET;
- templ.nr_samples = state->samples;
-
- pres = ctx->base.screen->resource_create(ctx->base.screen, &templ);
- if (!pres)
- return NULL;
-
- ctx->null_buffers[idx] = pres;
- }
- surf_templ.format = PIPE_FORMAT_R8_UINT;
- surf_templ.nr_samples = state->samples;
- return ctx->base.create_surface(&ctx->base, ctx->null_buffers[idx], &surf_templ);
-}
-
void
zink_destroy_framebuffer(struct zink_screen *screen,
struct zink_framebuffer *fb)
#endif
}
+ if (fb->null_surface)
+ pipe_resource_reference(&fb->null_surface->texture, NULL);
zink_surface_reference(screen, (struct zink_surface**)&fb->null_surface, NULL);
ralloc_free(fb);
num_attachments++;
} else {
if (!fb->null_surface)
- fb->null_surface = framebuffer_null_surface_init(ctx, state);
+ fb->null_surface = zink_surface_create_null(ctx, PIPE_TEXTURE_2D, state->width, state->height, state->samples);
surf = zink_surface(fb->null_surface);
state->attachments[i] = zink_surface(fb->null_surface)->image_view;
}