Vulkan: Pick shaders after calling ConvertStateToVulkanKey because it may end up disabling shader blending

(due to too many copies, see DrawEngineCommon::ApplyShaderBlending).

(So much state leaking all over the place ... I want to redesign the
whole thing).

Typo fix in comment
This commit is contained in:
Henrik Rydgård committed 2020-03-29 15:02:40 +02:00
1 parent 620aa50cf1
commit 21eaef04fc
2 files changed
+7 -3

No files matched your search

+5 -3
View File
@@ -259,6 +259,7 @@ void DrawEngineVulkan::DeviceRestore(VulkanContext *vulkan, Draw::DrawContext *d
}
void DrawEngineVulkan::BeginFrame() {
// Too many issues right now to allow reuse.
lastPipeline_ = nullptr;
int curFrame = vulkan_->GetCurFrame();
@@ -808,12 +809,13 @@ void DrawEngineVulkan::DoFlush() {
}
if (!lastPipeline_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE) || prim != lastPrim_) {
shaderManager_->GetShaders(prim, lastVType_, &vshader, &fshader, true); // usehwtransform
_dbg_assert_msg_(G3D, vshader->UseHWTransform(), "Bad vshader");
if (prim != lastPrim_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE)) {
ConvertStateToVulkanKey(*framebufferManager_, shaderManager_, prim, pipelineKey_, dynState_);
}
shaderManager_->GetShaders(prim, lastVType_, &vshader, &fshader, true); // usehwtransform
_dbg_assert_msg_(G3D, vshader->UseHWTransform(), "Bad vshader");
Draw::NativeObject object = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE ? Draw::NativeObject::FRAMEBUFFER_RENDERPASS : Draw::NativeObject::BACKBUFFER_RENDERPASS;
VkRenderPass renderPass = (VkRenderPass)draw_->GetNativeObject(object);
VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(pipelineLayout_, renderPass, pipelineKey_, &dec_->decFmt, vshader, fshader, true);
+2
View File
@@ -172,6 +172,8 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
// Until next time, force it off.
ResetShaderBlending();
gstate_c.SetAllowShaderBlend(false);
// Make sure we recompute the fragment shader ID to one that doesn't try to use shader blending.
gstate_c.Dirty(DIRTY_FRAGMENTSHADER_STATE);
}
} else if (blendState.resetShaderBlending) {
ResetShaderBlending();