for (int i = 0; i < fb->nr_cbufs; i++) {
struct zink_resource *cbuf = zink_resource(fb->cbufs[i]->texture);
state.rts[i].format = cbuf->format;
+ state.rts[i].samples = cbuf->base.nr_samples > 0 ? cbuf->base.nr_samples : VK_SAMPLE_COUNT_1_BIT;
}
state.num_cbufs = fb->nr_cbufs;
if (fb->zsbuf) {
struct zink_resource *zsbuf = zink_resource(fb->zsbuf->texture);
state.rts[fb->nr_cbufs].format = zsbuf->format;
+ state.rts[fb->nr_cbufs].samples = zsbuf->base.nr_samples > 0 ? zsbuf->base.nr_samples : VK_SAMPLE_COUNT_1_BIT;
}
state.have_zsbuf = fb->zsbuf != NULL;
struct zink_context *ctx = zink_context(pctx);
struct zink_screen *screen = zink_screen(pctx->screen);
+ VkSampleCountFlagBits rast_samples = VK_SAMPLE_COUNT_1_BIT;
+ for (int i = 0; i < state->nr_cbufs; i++)
+ rast_samples = MAX2(rast_samples, state->cbufs[i]->texture->nr_samples);
+ if (state->zsbuf && state->zsbuf->texture->nr_samples)
+ rast_samples = MAX2(rast_samples, state->zsbuf->texture->nr_samples);
+
util_copy_framebuffer_state(&ctx->fb_state, state);
struct zink_framebuffer *fb = get_framebuffer(ctx);
zink_framebuffer_reference(screen, &ctx->framebuffer, fb);
zink_render_pass_reference(screen, &ctx->gfx_pipeline_state.render_pass, fb->rp);
+ ctx->gfx_pipeline_state.rast_samples = rast_samples;
ctx->gfx_pipeline_state.num_attachments = state->nr_cbufs;
struct zink_batch *batch = zink_batch_no_rp(ctx);
VkPipelineMultisampleStateCreateInfo ms_state = {};
ms_state.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
- ms_state.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
+ ms_state.rasterizationSamples = state->rast_samples;
ms_state.alphaToCoverageEnable = state->blend_state->alpha_to_coverage;
ms_state.alphaToOneEnable = state->blend_state->alpha_to_one;
ms_state.pSampleMask = state->sample_mask ? &state->sample_mask : NULL;
struct zink_rt_attrib *rt = state->rts + i;
attachments[i].flags = 0;
attachments[i].format = rt->format;
- attachments[i].samples = VK_SAMPLE_COUNT_1_BIT;
+ attachments[i].samples = rt->samples;
attachments[i].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
attachments[i].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
attachments[i].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
struct zink_rt_attrib *rt = state->rts + state->num_cbufs;
attachments[num_attachments].flags = 0;
attachments[num_attachments].format = rt->format;
- attachments[num_attachments].samples = VK_SAMPLE_COUNT_1_BIT;
+ attachments[num_attachments].samples = rt->samples;
attachments[num_attachments].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
attachments[num_attachments].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
attachments[num_attachments].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;