zink: add samples to rasterizer
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:

committed by
Erik Faye-Lund

parent
0c5f3e50ae
commit
e234116a96
@@ -471,12 +471,14 @@ get_render_pass(struct zink_context *ctx)
|
||||
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;
|
||||
|
||||
@@ -602,12 +604,19 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
|
||||
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);
|
||||
|
@@ -59,7 +59,7 @@ zink_create_gfx_pipeline(VkDevice dev, struct zink_gfx_program *prog,
|
||||
|
||||
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;
|
||||
|
@@ -51,6 +51,7 @@ struct zink_gfx_pipeline_state {
|
||||
float line_width;
|
||||
|
||||
VkSampleMask sample_mask;
|
||||
uint8_t rast_samples;
|
||||
};
|
||||
|
||||
VkPipeline
|
||||
|
@@ -39,7 +39,7 @@ create_render_pass(VkDevice dev, struct zink_render_pass_state *state)
|
||||
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;
|
||||
@@ -55,7 +55,7 @@ create_render_pass(VkDevice dev, struct zink_render_pass_state *state)
|
||||
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;
|
||||
|
@@ -33,6 +33,7 @@ struct zink_screen;
|
||||
|
||||
struct zink_rt_attrib {
|
||||
VkFormat format;
|
||||
VkSampleCountFlagBits samples;
|
||||
};
|
||||
|
||||
struct zink_render_pass_state {
|
||||
|
Reference in New Issue
Block a user