if (vkQueueWaitIdle(ctx->queue) != VK_SUCCESS)
debug_printf("vkQueueWaitIdle failed\n");
- pipe_resource_reference(&ctx->null_buffer, NULL);
+ for (unsigned i = 0; i < ARRAY_SIZE(ctx->null_buffers); i++)
+ pipe_resource_reference(&ctx->null_buffers[i], NULL);
for (int i = 0; i < ARRAY_SIZE(ctx->batches); ++i)
vkFreeCommandBuffers(screen->dev, ctx->cmdpool, 1, &ctx->batches[i].cmdbuf);
VK_SAMPLE_COUNT_1_BIT;
} else {
state.rts[i].format = VK_FORMAT_R8_UINT;
- state.rts[i].samples = VK_SAMPLE_COUNT_1_BIT;
+ state.rts[i].samples = MAX2(fb->samples, 1);
}
}
state.num_cbufs = fb->nr_cbufs;
state.width = ctx->fb_state.width;
state.height = ctx->fb_state.height;
state.layers = MAX2(ctx->fb_state.layers, 1);
+ state.samples = ctx->fb_state.samples;
return zink_create_framebuffer(ctx, screen, &state);
}
bool queries_disabled;
struct pipe_resource *dummy_buffer;
- struct pipe_resource *null_buffer; /* used to create zink_framebuffer->null_surface */
+ struct pipe_resource *null_buffers[5]; /* used to create zink_framebuffer->null_surface, one buffer per samplecount */
uint32_t num_so_targets;
struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_OUTPUTS];
framebuffer_null_surface_init(struct zink_context *ctx, struct zink_framebuffer_state *state)
{
struct pipe_surface surf_templ = {};
- if (!ctx->null_buffer) {
+ 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.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_buffer = pres;
+ ctx->null_buffers[idx] = pres;
}
surf_templ.format = PIPE_FORMAT_R8_UINT;
- surf_templ.nr_samples = 1;
- return ctx->base.create_surface(&ctx->base, ctx->null_buffer, &surf_templ);
+ surf_templ.nr_samples = state->samples;
+ return ctx->base.create_surface(&ctx->base, ctx->null_buffers[idx], &surf_templ);
}
void
struct zink_render_pass *rp;
uint32_t width;
uint16_t height, layers;
+ uint8_t samples;
uint8_t num_attachments;
struct zink_surface *attachments[PIPE_MAX_COLOR_BUFS + 1];
bool has_null_attachments;