From d1e4b86b9e272e3d32f21bb6a7e0fb2830cadfb7 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 20 Apr 2019 12:20:32 +0300 Subject: [PATCH 1/4] - fixed compilation with GCC and Clang src/rendering/hwrenderer/scene/hw_walls.cpp:176:44: error: conditional expression is ambiguous; 'PalEntry' can be converted to 'int' and vice versa --- src/rendering/hwrenderer/scene/hw_walls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rendering/hwrenderer/scene/hw_walls.cpp b/src/rendering/hwrenderer/scene/hw_walls.cpp index 4f8ee4d15..9f1b4aab0 100644 --- a/src/rendering/hwrenderer/scene/hw_walls.cpp +++ b/src/rendering/hwrenderer/scene/hw_walls.cpp @@ -173,7 +173,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) PalEntry color1 = side->GetSpecialColor(tierndx, side_t::walltop, frontsector); PalEntry color2 = side->GetSpecialColor(tierndx, side_t::wallbottom, frontsector); state.SetObjectColor(color1); - state.SetObjectColor2((color1 != color2) ? color2 : 0); + state.SetObjectColor2((color1 != color2) ? color2 : PalEntry(0)); state.SetAddColor(side->GetAdditiveColor(tierndx, frontsector)); if (color1 != color2) { From 401a4944b4e2fb6926c6d7f543c8e0de11adf2e6 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 20 Apr 2019 16:35:26 +0200 Subject: [PATCH 2/4] - fix Queue is signaling semaphore that has not been waited on by any queue --- src/rendering/vulkan/system/vk_framebuffer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index cff8a446a..54789bbdb 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -217,7 +217,9 @@ void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t cou submit.addSignal(mRenderFinishedSemaphore.get()); } - submit.addSignal(mSubmitSemaphore[currentIndex].get()); + if (!finish) + submit.addSignal(mSubmitSemaphore[currentIndex].get()); + submit.execute(device, device->graphicsQueue, mSubmitFence[currentIndex].get()); mNextSubmit++; } From a3587009e76f838b36710a449644a3303a527468 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 20 Apr 2019 16:42:52 +0200 Subject: [PATCH 3/4] - the semaphore should never be added when its the last submit before waiting --- src/rendering/vulkan/system/vk_framebuffer.cpp | 10 +++++----- src/rendering/vulkan/system/vk_framebuffer.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index 54789bbdb..da43430ab 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -193,7 +193,7 @@ void VulkanFrameBuffer::DeleteFrameObjects() FrameDeleteList.CommandBuffers.clear(); } -void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish) +void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish, bool lastsubmit) { int currentIndex = mNextSubmit % maxConcurrentSubmitCount; @@ -217,14 +217,14 @@ void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t cou submit.addSignal(mRenderFinishedSemaphore.get()); } - if (!finish) + if (!lastsubmit) submit.addSignal(mSubmitSemaphore[currentIndex].get()); submit.execute(device, device->graphicsQueue, mSubmitFence[currentIndex].get()); mNextSubmit++; } -void VulkanFrameBuffer::FlushCommands(bool finish) +void VulkanFrameBuffer::FlushCommands(bool finish, bool lastsubmit) { if (mDrawCommands || mTransferCommands) { @@ -245,7 +245,7 @@ void VulkanFrameBuffer::FlushCommands(bool finish) FrameDeleteList.CommandBuffers.push_back(std::move(mDrawCommands)); } - FlushCommands(commands, count, finish); + FlushCommands(commands, count, finish, lastsubmit); current_rendered_commandbuffers += (int)count; } @@ -263,7 +263,7 @@ void VulkanFrameBuffer::WaitForCommands(bool finish) mPostprocess->DrawPresentTexture(mOutputLetterbox, true, true); } - FlushCommands(finish); + FlushCommands(finish, true); if (finish) { diff --git a/src/rendering/vulkan/system/vk_framebuffer.h b/src/rendering/vulkan/system/vk_framebuffer.h index 5bdbc820d..0051abbaa 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.h +++ b/src/rendering/vulkan/system/vk_framebuffer.h @@ -34,7 +34,7 @@ public: VkPostprocess *GetPostprocess() { return mPostprocess.get(); } VkRenderBuffers *GetBuffers() { return mActiveRenderBuffers; } - void FlushCommands(bool finish); + void FlushCommands(bool finish, bool lastsubmit = false); unsigned int GetLightBufferBlockSize() const; @@ -111,7 +111,7 @@ private: void CopyScreenToBuffer(int w, int h, void *data); void UpdateShadowMap(); void DeleteFrameObjects(); - void FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish); + void FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish, bool lastsubmit); std::unique_ptr mShaderManager; std::unique_ptr mSamplerManager; From 09883431bfd4c811dc8ba120bc0f1676cf4fe070 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 20 Apr 2019 19:19:34 +0200 Subject: [PATCH 4/4] - fix wrong clamp mode used in OpenGL - fix sampler array size on Vulkan --- src/rendering/gl/renderer/gl_renderbuffers.cpp | 2 +- src/rendering/vulkan/renderer/vk_postprocess.cpp | 2 +- src/rendering/vulkan/renderer/vk_postprocess.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rendering/gl/renderer/gl_renderbuffers.cpp b/src/rendering/gl/renderer/gl_renderbuffers.cpp index a54df1279..2ab12e44a 100644 --- a/src/rendering/gl/renderer/gl_renderbuffers.cpp +++ b/src/rendering/gl/renderer/gl_renderbuffers.cpp @@ -868,7 +868,7 @@ void GLPPRenderState::Draw() const PPTextureInput &input = Textures[index]; int filter = (input.Filter == PPFilterMode::Nearest) ? GL_NEAREST : GL_LINEAR; - int wrap = (input.Wrap == PPWrapMode::Clamp) ? GL_CLAMP : GL_REPEAT; + int wrap = (input.Wrap == PPWrapMode::Clamp) ? GL_CLAMP_TO_EDGE : GL_REPEAT; switch (input.Type) { diff --git a/src/rendering/vulkan/renderer/vk_postprocess.cpp b/src/rendering/vulkan/renderer/vk_postprocess.cpp index e0f489144..8716b8d38 100644 --- a/src/rendering/vulkan/renderer/vk_postprocess.cpp +++ b/src/rendering/vulkan/renderer/vk_postprocess.cpp @@ -287,7 +287,7 @@ void VkPostprocess::RenderBuffersReset() VulkanSampler *VkPostprocess::GetSampler(PPFilterMode filter, PPWrapMode wrap) { - int index = (((int)filter) << 2) | (int)wrap; + int index = (((int)filter) << 1) | (int)wrap; auto &sampler = mSamplers[index]; if (sampler) return sampler.get(); diff --git a/src/rendering/vulkan/renderer/vk_postprocess.h b/src/rendering/vulkan/renderer/vk_postprocess.h index ace4afdfe..a1b6b9e87 100644 --- a/src/rendering/vulkan/renderer/vk_postprocess.h +++ b/src/rendering/vulkan/renderer/vk_postprocess.h @@ -75,7 +75,7 @@ private: VulkanSampler *GetSampler(PPFilterMode filter, PPWrapMode wrap); - std::array, 16> mSamplers; + std::array, 4> mSamplers; std::map> mRenderPassSetup; std::unique_ptr mDescriptorPool; int mCurrentPipelineImage = 0;