From b12b48fea3ea7919b7146ed0105a627f79c72497 Mon Sep 17 00:00:00 2001 From: Mark Nefedov Date: Fri, 8 May 2020 18:19:11 +0300 Subject: The 'BackBufferDesc.Format' variable is assigned values twice successively. Perhaps this is a mistake. --- Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index 732c47e5..a72f34ca 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -513,7 +513,6 @@ void SwapChainVkImpl::InitBuffersAndViews() for (uint32_t i = 0; i < swapchainImageCount; i++) { TextureDesc BackBufferDesc; - BackBufferDesc.Format = m_SwapChainDesc.ColorBufferFormat; std::stringstream name_ss; name_ss << "Main back buffer " << i; auto name = name_ss.str(); -- cgit v1.2.3 From 7f159819485ec1b4e27923b4438bf7ac77d6bb24 Mon Sep 17 00:00:00 2001 From: Mark Nefedov Date: Fri, 8 May 2020 18:28:48 +0300 Subject: A part of conditional expression is always true: DebugName != nullptr, because of ```cpp if (DebugName == nullptr) DebugName = ""; ``` --- .../src/VulkanUtilities/VulkanLogicalDevice.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp index 4f69421d..fbe6439a 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp @@ -97,7 +97,7 @@ VulkanObjectWrapper VulkanLogicalDevice::CreateVulkanObj auto err = VkCreateObject(m_VkDevice, &CreateInfo, m_VkAllocator, &VkObject); CHECK_VK_ERROR_AND_THROW(err, "Failed to create Vulkan ", ObjectType, " '", DebugName, '\''); - if (DebugName != nullptr && *DebugName != 0) + if (*DebugName != 0) SetVulkanObjectName(m_VkDevice, VkObject, DebugName); return VulkanObjectWrapper{GetSharedPtr(), std::move(VkObject)}; @@ -169,7 +169,7 @@ DeviceMemoryWrapper VulkanLogicalDevice::AllocateDeviceMemory(const VkMemoryAllo auto err = vkAllocateMemory(m_VkDevice, &AllocInfo, m_VkAllocator, &vkDeviceMem); CHECK_VK_ERROR_AND_THROW(err, "Failed to allocate device memory '", DebugName, '\''); - if (DebugName != nullptr && *DebugName != 0) + if (*DebugName != 0) SetDeviceMemoryName(m_VkDevice, vkDeviceMem, DebugName); return DeviceMemoryWrapper{GetSharedPtr(), std::move(vkDeviceMem)}; @@ -189,7 +189,7 @@ PipelineWrapper VulkanLogicalDevice::CreateComputePipeline(const VkComputePipeli auto err = vkCreateComputePipelines(m_VkDevice, cache, 1, &PipelineCI, m_VkAllocator, &vkPipeline); CHECK_VK_ERROR_AND_THROW(err, "Failed to create compute pipeline '", DebugName, '\''); - if (DebugName != nullptr && *DebugName != 0) + if (*DebugName != 0) SetPipelineName(m_VkDevice, vkPipeline, DebugName); return PipelineWrapper{GetSharedPtr(), std::move(vkPipeline)}; @@ -209,7 +209,7 @@ PipelineWrapper VulkanLogicalDevice::CreateGraphicsPipeline(const VkGraphicsPipe auto err = vkCreateGraphicsPipelines(m_VkDevice, cache, 1, &PipelineCI, m_VkAllocator, &vkPipeline); CHECK_VK_ERROR_AND_THROW(err, "Failed to create graphics pipeline '", DebugName, '\''); - if (DebugName != nullptr && *DebugName != 0) + if (*DebugName != 0) SetPipelineName(m_VkDevice, vkPipeline, DebugName); return PipelineWrapper{GetSharedPtr(), std::move(vkPipeline)}; @@ -270,7 +270,7 @@ VkCommandBuffer VulkanLogicalDevice::AllocateVkCommandBuffer(const VkCommandBuff DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to allocate command buffer '", DebugName, '\''); (void)err; - if (DebugName != nullptr && *DebugName != 0) + if (*DebugName != 0) SetCommandBufferName(m_VkDevice, CmdBuff, DebugName); return CmdBuff; @@ -290,7 +290,7 @@ VkDescriptorSet VulkanLogicalDevice::AllocateVkDescriptorSet(const VkDescriptorS if (err != VK_SUCCESS) return VK_NULL_HANDLE; - if (DebugName != nullptr && *DebugName != 0) + if (*DebugName != 0) SetDescriptorSetName(m_VkDevice, DescrSet, DebugName); return DescrSet; -- cgit v1.2.3 From 9c52a33d4391d7fdbf1c029c249b8df40d437557 Mon Sep 17 00:00:00 2001 From: Mark Nefedov Date: Fri, 8 May 2020 21:46:19 +0300 Subject: Clang-format --- Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index a72f34ca..1789596f 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -512,7 +512,7 @@ void SwapChainVkImpl::InitBuffersAndViews() for (uint32_t i = 0; i < swapchainImageCount; i++) { - TextureDesc BackBufferDesc; + TextureDesc BackBufferDesc; std::stringstream name_ss; name_ss << "Main back buffer " << i; auto name = name_ss.str(); -- cgit v1.2.3 From a73660e60194f32db33eef0112bc3da133da183c Mon Sep 17 00:00:00 2001 From: Mark Nefedov Date: Fri, 8 May 2020 22:18:13 +0300 Subject: Checks can be simplified "(A && B) || (!A && !B) same A == B", fiters => filters typo. --- Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp index 22135811..38943da6 100644 --- a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp @@ -60,20 +60,18 @@ SamplerVkImpl::SamplerVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImp SamplerCI.mipLodBias = m_Desc.MipLODBias; SamplerCI.anisotropyEnable = IsAnisotropicFilter(m_Desc.MinFilter); #ifdef DILIGENT_DEVELOPMENT - if (!((SamplerCI.anisotropyEnable && IsAnisotropicFilter(m_Desc.MagFilter)) || - (!SamplerCI.anisotropyEnable && !IsAnisotropicFilter(m_Desc.MagFilter)))) + if (SamplerCI.anisotropyEnable != IsAnisotropicFilter(m_Desc.MagFilter)) { - LOG_ERROR("Min and mag fiters must both be either anisotropic filters or non-anisotropic ones"); + LOG_ERROR("Min and mag filters must both be either anisotropic filters or non-anisotropic ones"); } #endif SamplerCI.maxAnisotropy = static_cast(m_Desc.MaxAnisotropy); SamplerCI.compareEnable = IsComparisonFilter(m_Desc.MinFilter); #ifdef DILIGENT_DEVELOPMENT - if (!((SamplerCI.compareEnable && IsComparisonFilter(m_Desc.MagFilter)) || - (!SamplerCI.compareEnable && !IsComparisonFilter(m_Desc.MagFilter)))) + if (SamplerCI.compareEnable != IsComparisonFilter(m_Desc.MagFilter)) { - LOG_ERROR("Min and mag fiters must both be either comparison filters or non-comparison ones"); + LOG_ERROR("Min and mag filters must both be either comparison filters or non-comparison ones"); } #endif -- cgit v1.2.3