diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-12-24 01:43:25 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-12-24 01:43:25 +0000 |
| commit | dcd30d944d000fbadc28540d3cef1fbe4224dec3 (patch) | |
| tree | 7d96a0d6b1d72b066ff77fd341b16550838e3544 /Graphics/GraphicsEngineVulkan | |
| parent | Fixed TOC in readme (diff) | |
| download | DiligentCore-dcd30d944d000fbadc28540d3cef1fbe4224dec3.tar.gz DiligentCore-dcd30d944d000fbadc28540d3cef1fbe4224dec3.zip | |
A bunch of minor changes to fix clang warnings and errors
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
19 files changed, 76 insertions, 49 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h index ca57e3e8..bc16ff0b 100644 --- a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h @@ -52,7 +52,7 @@ public: bool bIsDefaultView); ~BufferViewVkImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface ); + virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface )override final; virtual VkBufferView GetVkBufferView()const override final{return m_BuffView;} @@ -60,7 +60,7 @@ public: BufferVkImpl* GetBufferVk(); protected: - + VulkanUtilities::BufferViewWrapper m_BuffView; }; diff --git a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h index ca07d3ef..c46e996b 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h @@ -73,11 +73,8 @@ public: void SetFence(RefCntAutoPtr<FenceVkImpl> pFence){m_pFence = std::move(pFence);} private: - // A value that will be signaled by the command queue next - Atomics::AtomicInt64 m_NextFenceValue; - std::shared_ptr<VulkanUtilities::VulkanLogicalDevice> m_LogicalDevice; - + const VkQueue m_VkQueue; const uint32_t m_QueueFamilyIndex; // Fence is signaled right after a command buffer has been @@ -86,6 +83,9 @@ private: // are guaranteed to be finished by the GPU RefCntAutoPtr<FenceVkImpl> m_pFence; + // A value that will be signaled by the command queue next + Atomics::AtomicInt64 m_NextFenceValue; + std::mutex m_QueueMutex; }; diff --git a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h index 16717d27..a819ab8d 100644 --- a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h +++ b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h @@ -60,13 +60,13 @@ public: DescriptorSetAllocation(DescriptorSetAllocation&& rhs)noexcept : Set (rhs.Set), - CmdQueueMask (rhs.CmdQueueMask), Pool (rhs.Pool), + CmdQueueMask (rhs.CmdQueueMask), DescrSetAllocator(rhs.DescrSetAllocator) { rhs.Reset(); } - + DescriptorSetAllocation& operator = (DescriptorSetAllocation&& rhs)noexcept { Release(); @@ -100,7 +100,7 @@ public: { Release(); } - + VkDescriptorSet GetVkDescriptorSet()const {return Set;} private: diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h index 8f1d5453..1bbb8555 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h @@ -54,7 +54,7 @@ public: PipelineStateVkImpl( IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pDeviceVk, const PipelineStateDesc &PipelineDesc ); ~PipelineStateVkImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface ); + virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface )override final; virtual void CreateShaderResourceBinding( IShaderResourceBinding **ppShaderResourceBinding, bool InitStaticResources )override final; diff --git a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h index 6028d785..5db3ad8f 100644 --- a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h @@ -49,7 +49,7 @@ public: void* pNativeWndHandle); ~SwapChainVkImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ); + virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface )override final; virtual void Present(Uint32 SyncInterval)override final; virtual void Resize( Uint32 NewWidth, Uint32 NewHeight )override final; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h b/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h index 7414edee..d02ab104 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h @@ -62,10 +62,10 @@ struct VulkanUploadAllocation VkDeviceSize _Size, VkDeviceSize _AlignedOffset, VkBuffer _vkBuffer) noexcept : + vkBuffer (_vkBuffer), CPUAddress (_CPUAddress), Size (_Size), - AlignedOffset(_AlignedOffset), - vkBuffer (_vkBuffer) + AlignedOffset(_AlignedOffset) {} VulkanUploadAllocation (const VulkanUploadAllocation&) = delete; VulkanUploadAllocation& operator = (const VulkanUploadAllocation&) = delete; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h index bb0f4f59..f3277ef0 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h @@ -47,7 +47,7 @@ struct VulkanMemoryAllocation VulkanMemoryAllocation (const VulkanMemoryAllocation&) = delete; VulkanMemoryAllocation& operator= (const VulkanMemoryAllocation&) = delete; - VulkanMemoryAllocation(VulkanMemoryPage* _Page, size_t _UnalignedOffset, size_t _Size)noexcept : + VulkanMemoryAllocation(VulkanMemoryPage* _Page, VkDeviceSize _UnalignedOffset, VkDeviceSize _Size)noexcept : Page (_Page), UnalignedOffset(_UnalignedOffset), Size (_Size) @@ -81,8 +81,8 @@ struct VulkanMemoryAllocation ~VulkanMemoryAllocation(); VulkanMemoryPage* Page = nullptr; // Memory page that contains this allocation - size_t UnalignedOffset = 0; // Unaligned offset from the start of the memory - size_t Size = 0; // Reserved size of this allocation + VkDeviceSize UnalignedOffset = 0; // Unaligned offset from the start of the memory + VkDeviceSize Size = 0; // Reserved size of this allocation }; class VulkanMemoryPage diff --git a/Graphics/GraphicsEngineVulkan/include/pch.h b/Graphics/GraphicsEngineVulkan/include/pch.h index 7c623f11..d79f4ab3 100644 --- a/Graphics/GraphicsEngineVulkan/include/pch.h +++ b/Graphics/GraphicsEngineVulkan/include/pch.h @@ -44,6 +44,26 @@ #include "vulkan.h" +#include "GraphicsTypes.h" + +namespace std +{ + template<>struct hash<Diligent::TEXTURE_FORMAT> + { + size_t operator()( const Diligent::TEXTURE_FORMAT &fmt ) const + { + return hash<size_t>()(size_t{fmt}); + } + }; + template<>struct hash<VkFormat> + { + size_t operator()( const VkFormat &fmt ) const + { + return hash<int>()(int{fmt}); + } + }; +} + #include "PlatformDefinitions.h" #include "Errors.h" #include "RefCntAutoPtr.h" diff --git a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp index 84869918..bf07f046 100644 --- a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp @@ -179,7 +179,7 @@ BufferVkImpl :: BufferVkImpl(IReferenceCounters* pRefCounters, VERIFY( IsPowerOfTwo(MemReqs.alignment), "Alignment is not power of 2!"); m_MemoryAllocation = pRenderDeviceVk->AllocateMemory(MemReqs, BufferMemoryFlags); - auto AlignedOffset = Align(m_MemoryAllocation.UnalignedOffset, MemReqs.alignment); + auto AlignedOffset = Align(VkDeviceSize{m_MemoryAllocation.UnalignedOffset}, MemReqs.alignment); VERIFY(m_MemoryAllocation.Size >= MemReqs.size + (AlignedOffset - m_MemoryAllocation.UnalignedOffset), "Size of memory allocation is too small"); auto Memory = m_MemoryAllocation.Page->GetVkMemory(); auto err = LogicalDevice.BindBufferMemory(m_VulkanBuffer, Memory, AlignedOffset); @@ -205,14 +205,14 @@ BufferVkImpl :: BufferVkImpl(IReferenceCounters* pRefCounters, // to the host (10.2) auto StagingMemoryAllocation = pRenderDeviceVk->AllocateMemory(StagingBufferMemReqs, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); auto StagingBufferMemory = StagingMemoryAllocation.Page->GetVkMemory(); - auto AlignedStagingMemOffset = Align(StagingMemoryAllocation.UnalignedOffset, StagingBufferMemReqs.alignment); + auto AlignedStagingMemOffset = Align(VkDeviceSize{StagingMemoryAllocation.UnalignedOffset}, StagingBufferMemReqs.alignment); VERIFY_EXPR(StagingMemoryAllocation.Size >= StagingBufferMemReqs.size + (AlignedStagingMemOffset - StagingMemoryAllocation.UnalignedOffset)); auto* StagingData = reinterpret_cast<uint8_t*>(StagingMemoryAllocation.Page->GetCPUMemory()); if (StagingData == nullptr) LOG_BUFFER_ERROR_AND_THROW("Failed to allocate staging data"); memcpy(StagingData + AlignedStagingMemOffset, BuffData.pData, BuffData.DataSize); - + err = LogicalDevice.BindBufferMemory(StagingBuffer, StagingBufferMemory, AlignedStagingMemOffset); CHECK_VK_ERROR_AND_THROW(err, "Failed to bind staging bufer memory"); diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index b34daae6..67fa2840 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -760,9 +760,19 @@ namespace Diligent if(GetNumCommandsInCtx() != 0) { - LOG_ERROR_MESSAGE(m_bIsDeferred ? - "There are outstanding commands in deferred device context #", m_ContextId, " when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame" : - "There are outstanding commands in the immediate device context when finishing the frame. This is an error and may cause unpredicted behaviour. Call Flush() to submit all commands for execution before finishing the frame"); + if (m_bIsDeferred) + { + LOG_ERROR_MESSAGE("There are outstanding commands in deferred device context #", m_ContextId, + " when finishing the frame. This is an error and may cause unpredicted behaviour." + " Close all deferred contexts and execute them before finishing the frame."); + + } + else + { + LOG_ERROR_MESSAGE("There are outstanding commands in the immediate device context when finishing the frame." + " This is an error and may cause unpredicted behaviour. Call Flush() to submit all commands" + " for execution before finishing the frame."); + } } if (!m_MappedTextures.empty()) diff --git a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp index 4e575fa6..6412123e 100644 --- a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp +++ b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp @@ -289,8 +289,7 @@ namespace Diligent static_cast<Int32>(NumMips), static_cast<Int32>(ViewDesc.FirstArraySlice), 0, - 1.0f / static_cast<float>(DstWidth), - 1.0f / static_cast<float>(DstHeight) + {1.0f / static_cast<float>(DstWidth), 1.0f / static_cast<float>(DstHeight)} }; } diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp index 5c18e2eb..8b973f7c 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp @@ -218,8 +218,8 @@ bool PipelineLayout::DescriptorSetLayoutManager::DescriptorSetLayout::operator = B0.stageFlags != B1.stageFlags) return false; - if ( B0.pImmutableSamplers != nullptr && B1.pImmutableSamplers == nullptr || - B0.pImmutableSamplers == nullptr && B1.pImmutableSamplers != nullptr) + if ( (B0.pImmutableSamplers != nullptr && B1.pImmutableSamplers == nullptr) || + (B0.pImmutableSamplers == nullptr && B1.pImmutableSamplers != nullptr) ) return false; // Static samplers themselves should not affect compatibility } diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 1b21d91e..d15bb584 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -172,7 +172,7 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters std::array<size_t, MaxShadersInPipeline> ShaderVariableDataSizes = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) { - std::array<SHADER_VARIABLE_TYPE, 2> AllowedVarTypes = { SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC }; + std::array<SHADER_VARIABLE_TYPE, 2> AllowedVarTypes = { {SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC} }; Uint32 UnusedNumVars = 0; ShaderVariableDataSizes[s] = ShaderVariableManagerVk::GetRequiredMemorySize(m_ShaderResourceLayouts[s], AllowedVarTypes.data(), static_cast<Uint32>(AllowedVarTypes.size()), UnusedNumVars); } @@ -350,8 +350,8 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters MSStateCI.pSampleMask = SampleMask; // an array of static coverage information that is ANDed with // the coverage information generated during rasterization (25.3) MSStateCI.alphaToCoverageEnable = VK_FALSE; // whether a temporary coverage value is generated based on - // the alpha component of the fragment’s first color output - MSStateCI.alphaToOneEnable = VK_FALSE; // whether the alpha component of the fragment’s first color output is replaced with one + // the alpha component of the fragment�s first color output + MSStateCI.alphaToOneEnable = VK_FALSE; // whether the alpha component of the fragment�s first color output is replaced with one PipelineCI.pMultisampleState = &MSStateCI; VkPipelineDepthStencilStateCreateInfo DepthStencilStateCI = diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp index 12d46cef..8f32e0c5 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp @@ -185,7 +185,7 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk( const EngineVkAttribs& Crea auto &RawMemAllocator = GetRawAllocator(); pCmdQueueVk = NEW_RC_OBJ(RawMemAllocator, "CommandQueueVk instance", CommandQueueVkImpl)(LogicalDevice, QueueInfo.queueFamilyIndex); - std::array<ICommandQueueVk*, 1> CommandQueues = {pCmdQueueVk}; + std::array<ICommandQueueVk*, 1> CommandQueues = {{pCmdQueueVk}}; AttachToVulkanDevice(Instance, std::move(PhysicalDevice), LogicalDevice, CommandQueues.size(), CommandQueues.data(), CreationAttribs, ppDevice, ppContexts, NumDeferredContexts); FenceDesc Desc; diff --git a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp index 292c4fea..3da951ab 100644 --- a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp @@ -47,8 +47,8 @@ SamplerVkImpl::SamplerVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImp SamplerCI.mipLodBias = m_Desc.MipLODBias; SamplerCI.anisotropyEnable = IsAnisotropicFilter(m_Desc.MinFilter); #ifdef DEVELOPMENT - if( !( SamplerCI.anisotropyEnable && IsAnisotropicFilter(m_Desc.MagFilter) || - !SamplerCI.anisotropyEnable && !IsAnisotropicFilter(m_Desc.MagFilter)) ) + if( !( (SamplerCI.anisotropyEnable && IsAnisotropicFilter(m_Desc.MagFilter)) || + (!SamplerCI.anisotropyEnable && !IsAnisotropicFilter(m_Desc.MagFilter)) ) ) { LOG_ERROR("Min and mag fiters must both be either anisotropic filters or non-anisotropic ones"); } @@ -57,8 +57,8 @@ SamplerVkImpl::SamplerVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImp SamplerCI.maxAnisotropy = static_cast<float>(m_Desc.MaxAnisotropy); SamplerCI.compareEnable = IsComparisonFilter(m_Desc.MinFilter); #ifdef DEVELOPMENT - if( !( SamplerCI.compareEnable && IsComparisonFilter(m_Desc.MagFilter) || - !SamplerCI.compareEnable && !IsComparisonFilter(m_Desc.MagFilter)) ) + if( !( (SamplerCI.compareEnable && IsComparisonFilter(m_Desc.MagFilter)) || + (!SamplerCI.compareEnable && !IsComparisonFilter(m_Desc.MagFilter)) ) ) { LOG_ERROR("Min and mag fiters must both be either comparison filters or non-comparison ones"); } diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp index 9676ee4f..add3373d 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp @@ -64,7 +64,7 @@ ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl( IReferenceCounters* pR // Initialize vars manager to reference mutable and dynamic variables // Note that the cache has space for all variable types - std::array<SHADER_VARIABLE_TYPE, 2> VarTypes = {SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC}; + std::array<SHADER_VARIABLE_TYPE, 2> VarTypes = {{SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC}}; m_pShaderVarMgrs[s].Initialize(SrcLayout, VarDataAllocator, VarTypes.data(), static_cast<Uint32>(VarTypes.size()), m_ShaderResourceCache); m_ResourceLayoutIndex[ShaderInd] = static_cast<Int8>(s); diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index e8fa7094..89b05416 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -57,16 +57,12 @@ SwapChainVkImpl::SwapChainVkImpl(IReferenceCounters* pRefCounters, #elif defined(VK_USE_PLATFORM_IOS_MVK) VkIOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; - surfaceCreateInfo.pNext = NULL; - surfaceCreateInfo.flags = 0; - surfaceCreateInfo.pView = view; + surfaceCreateInfo.pView = nullptr; auto err = vkCreateIOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); #elif defined(VK_USE_PLATFORM_MACOS_MVK) VkMacOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; - surfaceCreateInfo.pNext = NULL; - surfaceCreateInfo.flags = 0; - surfaceCreateInfo.pView = view; + surfaceCreateInfo.pView = nullptr; auto err = vkCreateMacOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, NULL, &m_VkSurface); #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) VkWaylandSurfaceCreateInfoKHR surfaceCreateInfo = {}; diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp index 6cf4cd5a..a0553d18 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp @@ -656,7 +656,7 @@ VkPipelineRasterizationStateCreateInfo RasterizerStateDesc_To_VkRasterizationSta RSStateCI.pNext = nullptr; RSStateCI.flags = 0; // Reserved for future use. - // If depth clamping is enabled, before the incoming fragment’s zf is compared to za, zf is clamped to + // If depth clamping is enabled, before the incoming fragment�s zf is compared to za, zf is clamped to // [min(n,f), max(n,f)], where n and f are the minDepth and maxDepth depth range values of the viewport // used by this fragment, respectively (25.10) // This value is the opposite of clip enable @@ -673,7 +673,7 @@ VkPipelineRasterizationStateCreateInfo RasterizerStateDesc_To_VkRasterizationSta // that relates to the usable resolution of the depth buffer RSStateCI.depthBiasClamp = RasterizerDesc.DepthBiasClamp; // maximum (or minimum) depth bias of a fragment. RSStateCI.depthBiasSlopeFactor = - RasterizerDesc.SlopeScaledDepthBias; // a scalar factor applied to a fragment’s slope in depth bias calculations. + RasterizerDesc.SlopeScaledDepthBias; // a scalar factor applied to a fragment�s slope in depth bias calculations. RSStateCI.lineWidth = 1.f; // If the wide lines feature is not enabled, and no element of the pDynamicStates member of // pDynamicState is VK_DYNAMIC_STATE_LINE_WIDTH, the lineWidth member of // pRasterizationState must be 1.0 (9.2) @@ -983,7 +983,7 @@ void PrimitiveTopology_To_VkPrimitiveTopologyAndPatchCPCount(PRIMITIVE_TOPOLOGY case PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: VkPrimTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; return; - + case PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: VkPrimTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; return; @@ -995,11 +995,13 @@ void PrimitiveTopology_To_VkPrimitiveTopologyAndPatchCPCount(PRIMITIVE_TOPOLOGY case PRIMITIVE_TOPOLOGY_LINE_LIST: VkPrimTopology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST; return; - } - VERIFY_EXPR(PrimTopology >= PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST && PrimTopology < PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES); - VkPrimTopology = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; - PatchControlPoints = static_cast<uint32_t>(PrimTopology) - static_cast<uint32_t>(PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST) + 1; + default: + VERIFY_EXPR(PrimTopology >= PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST && PrimTopology < PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES); + VkPrimTopology = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; + PatchControlPoints = static_cast<uint32_t>(PrimTopology) - static_cast<uint32_t>(PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST) + 1; + return; + } } VkFilter FilterTypeToVkFilter(FILTER_TYPE FilterType) diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp index 54249e59..38adc3b0 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp @@ -82,7 +82,7 @@ VulkanMemoryAllocation VulkanMemoryPage::Allocate(VkDeviceSize size, VkDeviceSiz { // Offset may not necessarily be aligned, but the allocation is guaranteed to be large enough // to accomodate requested alignment - VERIFY_EXPR( Diligent::Align(Allocation.UnalignedOffset, alignment) - Allocation.UnalignedOffset + size <= Allocation.Size ); + VERIFY_EXPR( Diligent::Align(VkDeviceSize{Allocation.UnalignedOffset}, alignment) - Allocation.UnalignedOffset + size <= Allocation.Size ); return VulkanMemoryAllocation{this, Allocation.UnalignedOffset, Allocation.Size}; } else |
