zink: steal a bit from rast_samples in pipeline state

zink only handles values up to 64, so this still has an extra bit

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
This commit is contained in:
Mike Blumenkrantz 2021-07-15 09:20:27 -04:00 committed by Marge Bot
parent 9260b86905
commit c73adf8c90
3 changed files with 7 additions and 7 deletions

View File

@ -1599,7 +1599,7 @@ setup_framebuffer(struct zink_context *ctx)
struct zink_render_pass *rp = ctx->gfx_pipeline_state.render_pass;
if (ctx->gfx_pipeline_state.sample_locations_enabled && ctx->sample_locations_changed) {
unsigned samples = ctx->gfx_pipeline_state.rast_samples;
unsigned samples = ctx->gfx_pipeline_state.rast_samples + 1;
unsigned idx = util_logbase2_ceil(MAX2(samples, 1));
VkExtent2D grid_size = screen->maxSampleLocationGridSize[idx];
@ -1718,11 +1718,11 @@ void
zink_init_vk_sample_locations(struct zink_context *ctx, VkSampleLocationsInfoEXT *loc)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
unsigned idx = util_logbase2_ceil(MAX2(ctx->gfx_pipeline_state.rast_samples, 1));
unsigned idx = util_logbase2_ceil(MAX2(ctx->gfx_pipeline_state.rast_samples + 1, 1));
loc->sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT;
loc->pNext = NULL;
loc->sampleLocationsPerPixel = 1 << idx;
loc->sampleLocationsCount = ctx->gfx_pipeline_state.rast_samples;
loc->sampleLocationsCount = ctx->gfx_pipeline_state.rast_samples + 1;
loc->sampleLocationGridSize = screen->maxSampleLocationGridSize[idx];
loc->pSampleLocations = ctx->vk_sample_locations;
}
@ -2018,9 +2018,9 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
ctx->fb_changed |= ctx->framebuffer != fb;
ctx->framebuffer = fb;
uint8_t rast_samples = util_framebuffer_get_num_samples(state);
uint8_t rast_samples = util_framebuffer_get_num_samples(state) - 1;
/* in vulkan, gl_SampleMask needs to be explicitly ignored for sampleCount == 1 */
if ((ctx->gfx_pipeline_state.rast_samples > 1) != (rast_samples > 1))
if ((ctx->gfx_pipeline_state.rast_samples > 0) != (rast_samples > 0))
ctx->dirty_shader_stages |= 1 << PIPE_SHADER_FRAGMENT;
if (ctx->gfx_pipeline_state.rast_samples != rast_samples) {
ctx->sample_locations_changed |= ctx->gfx_pipeline_state.sample_locations_enabled;

View File

@ -114,7 +114,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
VkPipelineMultisampleStateCreateInfo ms_state = {0};
ms_state.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
ms_state.rasterizationSamples = state->rast_samples;
ms_state.rasterizationSamples = state->rast_samples + 1;
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;

View File

@ -46,7 +46,7 @@ struct zink_gfx_pipeline_state {
struct zink_rasterizer_hw_state *rast_state;
VkSampleMask sample_mask;
uint8_t rast_samples;
uint8_t rast_samples:7;
uint8_t vertices_per_patch;
/* Pre-hashed value for table lookup, invalid when zero.