zink: remove some ctx references from shader/pipeline compile

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12842>
This commit is contained in:
Mike Blumenkrantz 2021-09-01 13:58:05 -04:00
parent c587152eba
commit 7438d670dd
2 changed files with 26 additions and 22 deletions

View File

@ -94,32 +94,36 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
VkPipelineColorBlendAttachmentState blend_att[PIPE_MAX_COLOR_BUFS];
VkPipelineColorBlendStateCreateInfo blend_state = {0};
blend_state.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
unsigned num_attachments = state->render_pass->state.num_rts;
if (state->render_pass->state.have_zsbuf)
num_attachments--;
if (state->void_alpha_attachments) {
for (unsigned i = 0; i < num_attachments; i++) {
blend_att[i] = state->blend_state->attachments[i];
if (state->void_alpha_attachments & BITFIELD_BIT(i)) {
blend_att[i].dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
blend_att[i].srcColorBlendFactor = clamp_void_blend_factor(blend_att[i].srcColorBlendFactor);
blend_att[i].dstColorBlendFactor = clamp_void_blend_factor(blend_att[i].dstColorBlendFactor);
if (state->blend_state) {
unsigned num_attachments = state->render_pass->state.num_rts;
if (state->render_pass->state.have_zsbuf)
num_attachments--;
if (state->void_alpha_attachments) {
for (unsigned i = 0; i < num_attachments; i++) {
blend_att[i] = state->blend_state->attachments[i];
if (state->void_alpha_attachments & BITFIELD_BIT(i)) {
blend_att[i].dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
blend_att[i].srcColorBlendFactor = clamp_void_blend_factor(blend_att[i].srcColorBlendFactor);
blend_att[i].dstColorBlendFactor = clamp_void_blend_factor(blend_att[i].dstColorBlendFactor);
}
}
}
blend_state.pAttachments = blend_att;
} else
blend_state.pAttachments = state->blend_state->attachments;
blend_state.attachmentCount = num_attachments;
blend_state.logicOpEnable = state->blend_state->logicop_enable;
blend_state.logicOp = state->blend_state->logicop_func;
blend_state.pAttachments = blend_att;
} else
blend_state.pAttachments = state->blend_state->attachments;
blend_state.attachmentCount = num_attachments;
blend_state.logicOpEnable = state->blend_state->logicop_enable;
blend_state.logicOp = state->blend_state->logicop_func;
}
VkPipelineMultisampleStateCreateInfo ms_state = {0};
ms_state.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
ms_state.rasterizationSamples = state->rast_samples + 1;
ms_state.alphaToCoverageEnable = state->blend_state->alpha_to_coverage;
if (state->blend_state->alpha_to_one && !screen->info.feats.features.alphaToOne)
warn_missing_feature("alphaToOne");
ms_state.alphaToOneEnable = state->blend_state->alpha_to_one;
if (state->blend_state) {
ms_state.alphaToCoverageEnable = state->blend_state->alpha_to_coverage;
if (state->blend_state->alpha_to_one && !screen->info.feats.features.alphaToOne)
warn_missing_feature("alphaToOne");
ms_state.alphaToOneEnable = state->blend_state->alpha_to_one;
}
ms_state.pSampleMask = state->sample_mask ? &state->sample_mask : NULL;
if (hw_rast_state->force_persample_interp) {
ms_state.sampleShadingEnable = VK_TRUE;

View File

@ -235,7 +235,7 @@ get_shader_module_for_stage(struct zink_context *ctx, struct zink_screen *screen
} else
key.is_default_variant = true;
if (zs->nir->info.num_inlinable_uniforms &&
if (ctx && zs->nir->info.num_inlinable_uniforms &&
ctx->inlinable_uniforms_valid_mask & BITFIELD64_BIT(pstage)) {
key.inline_uniforms = true;
memcpy(key.base.inlined_uniform_values,