VulkanDevice: Fix multi-texture+UBO push descriptors

This commit is contained in:
Stenzek 2023-08-30 02:03:22 +10:00
parent 9e7d48cf85
commit 22eecc2b0a
2 changed files with 8 additions and 6 deletions

View file

@ -2096,8 +2096,8 @@ void VulkanDevice::EndPresent()
EndRenderPass(); EndRenderPass();
VkCommandBuffer cmdbuf = GetCurrentCommandBuffer(); VkCommandBuffer cmdbuf = GetCurrentCommandBuffer();
VulkanTexture::TransitionSubresourcesToLayout(cmdbuf, m_swap_chain->GetCurrentImage(), GPUTexture::Type::RenderTarget, 0, 1, VulkanTexture::TransitionSubresourcesToLayout(cmdbuf, m_swap_chain->GetCurrentImage(), GPUTexture::Type::RenderTarget,
0, 1, VulkanTexture::Layout::ColorAttachment, 0, 1, 0, 1, VulkanTexture::Layout::ColorAttachment,
VulkanTexture::Layout::PresentSrc); VulkanTexture::Layout::PresentSrc);
SubmitCommandBuffer(m_swap_chain.get(), !m_swap_chain->IsPresentModeSynchronizing()); SubmitCommandBuffer(m_swap_chain.get(), !m_swap_chain->IsPresentModeSynchronizing());
MoveToNextCommandBuffer(); MoveToNextCommandBuffer();
@ -2960,8 +2960,8 @@ void VulkanDevice::SetInitialPipelineState()
void VulkanDevice::SetTextureSampler(u32 slot, GPUTexture* texture, GPUSampler* sampler) void VulkanDevice::SetTextureSampler(u32 slot, GPUTexture* texture, GPUSampler* sampler)
{ {
VulkanTexture* T = static_cast<VulkanTexture*>(texture); VulkanTexture* T = texture ? static_cast<VulkanTexture*>(texture) : m_null_texture.get();
const VkSampler vsampler = sampler ? static_cast<VulkanSampler*>(sampler)->GetSampler() : VK_NULL_HANDLE; const VkSampler vsampler = static_cast<VulkanSampler*>(sampler ? sampler : m_nearest_sampler.get())->GetSampler();
if (m_current_textures[slot] != texture || m_current_samplers[slot] != vsampler) if (m_current_textures[slot] != texture || m_current_samplers[slot] != vsampler)
{ {
m_current_textures[slot] = T; m_current_textures[slot] = T;
@ -3108,8 +3108,9 @@ bool VulkanDevice::UpdateDescriptorSetsForLayout(bool new_layout, bool new_dynam
m_current_samplers[i], VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); m_current_samplers[i], VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
} }
const u32 set = (layout == GPUPipeline::Layout::MultiTextureAndUBO) ? 1 : 0;
dsub.PushUpdate(GetCurrentCommandBuffer(), VK_PIPELINE_BIND_POINT_GRAPHICS, dsub.PushUpdate(GetCurrentCommandBuffer(), VK_PIPELINE_BIND_POINT_GRAPHICS,
m_pipeline_layouts[static_cast<u8>(m_current_pipeline_layout)], false); m_pipeline_layouts[static_cast<u8>(m_current_pipeline_layout)], set);
if (num_ds == 0) if (num_ds == 0)
return true; return true;
} }

View file

@ -167,9 +167,10 @@ std::unique_ptr<GPUPipeline> VulkanDevice::CreatePipeline(const GPUPipeline::Gra
i, 0, format_mapping[static_cast<u8>(va.type.GetValue())][static_cast<u8>(va.components.GetValue() - 1)], i, 0, format_mapping[static_cast<u8>(va.type.GetValue())][static_cast<u8>(va.components.GetValue() - 1)],
va.offset); va.offset);
} }
gpb.SetPrimitiveTopology(primitives[static_cast<u8>(config.primitive)]);
} }
gpb.SetPrimitiveTopology(primitives[static_cast<u8>(config.primitive)]);
// Line width? // Line width?
gpb.SetRasterizationState(VK_POLYGON_MODE_FILL, gpb.SetRasterizationState(VK_POLYGON_MODE_FILL,