From d31dc00f82d2121dc0378db77264d9263540a192 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 25 Jan 2020 11:19:23 -0800 Subject: Reworked main headers to be compatible with c --- .../include/FramebufferCache.h | 2 +- .../include/PipelineStateVkImpl.h | 16 ++++++------- .../GraphicsEngineVulkan/include/RenderPassCache.h | 2 +- .../include/VulkanTypeConversions.h | 8 +++---- .../src/DeviceContextVkImpl.cpp | 14 +++++------ .../GraphicsEngineVulkan/src/FramebufferCache.cpp | 2 +- .../src/PipelineStateVkImpl.cpp | 28 +++++++++++----------- .../src/RenderDeviceVkImpl.cpp | 2 +- .../GraphicsEngineVulkan/src/RenderPassCache.cpp | 4 ++-- .../src/ShaderResourceLayoutVk.cpp | 6 ++--- .../src/VulkanTypeConversions.cpp | 18 +++++++------- .../src/VulkanUtilities/VulkanDebug.cpp | 12 +++++----- 12 files changed, 57 insertions(+), 57 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/FramebufferCache.h b/Graphics/GraphicsEngineVulkan/include/FramebufferCache.h index cc5f4b20..f2efe0f7 100644 --- a/Graphics/GraphicsEngineVulkan/include/FramebufferCache.h +++ b/Graphics/GraphicsEngineVulkan/include/FramebufferCache.h @@ -61,7 +61,7 @@ public: VkRenderPass Pass; Uint32 NumRenderTargets; VkImageView DSV; - VkImageView RTVs[MaxRenderTargets]; + VkImageView RTVs[MAX_RENDER_TARGETS]; Uint64 CommandQueueMask; bool operator==(const FramebufferCacheKey& rhs) const; diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h index 51434bf7..5e5af2cb 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h @@ -113,13 +113,13 @@ public: return m_SRBMemAllocator; } - static VkRenderPassCreateInfo GetRenderPassCreateInfo(Uint32 NumRenderTargets, - const TEXTURE_FORMAT RTVFormats[], - TEXTURE_FORMAT DSVFormat, - Uint32 SampleCount, - std::array& Attachments, - std::array& AttachmentReferences, - VkSubpassDescription& SubpassDesc); + static VkRenderPassCreateInfo GetRenderPassCreateInfo(Uint32 NumRenderTargets, + const TEXTURE_FORMAT RTVFormats[], + TEXTURE_FORMAT DSVFormat, + Uint32 SampleCount, + std::array& Attachments, + std::array& AttachmentReferences, + VkSubpassDescription& SubpassDesc); void InitializeStaticSRBResources(ShaderResourceCacheVk& ResourceCache) const; @@ -150,7 +150,7 @@ private: // SRB memory allocator must be declared before m_pDefaultShaderResBinding SRBMemoryAllocator m_SRBMemAllocator; - std::array m_ShaderModules; + std::array m_ShaderModules; VkRenderPass m_RenderPass = VK_NULL_HANDLE; // Render passes are managed by the render device VulkanUtilities::PipelineWrapper m_Pipeline; diff --git a/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h b/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h index 16fca03a..2cc0ba95 100644 --- a/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h +++ b/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h @@ -87,7 +87,7 @@ public: Uint8 NumRenderTargets; Uint8 SampleCount; TEXTURE_FORMAT DSVFormat; - TEXTURE_FORMAT RTVFormats[MaxRenderTargets]; + TEXTURE_FORMAT RTVFormats[MAX_RENDER_TARGETS]; bool operator==(const RenderPassCacheKey& rhs) const { diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.h b/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.h index 939d3815..1f752700 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.h @@ -48,10 +48,10 @@ void BlendStateDesc_To_VkBlendStateCI(const BlendStateDesc& VkPipelineColorBlendStateCreateInfo& ColorBlendStateCI, std::vector& ColorBlendAttachments); -void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& LayoutDesc, - VkPipelineVertexInputStateCreateInfo& VertexInputStateCI, - std::array& BindingDescriptions, - std::array& AttributeDescription); +void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& LayoutDesc, + VkPipelineVertexInputStateCreateInfo& VertexInputStateCI, + std::array& BindingDescriptions, + std::array& AttributeDescription); void PrimitiveTopology_To_VkPrimitiveTopologyAndPatchCPCount(PRIMITIVE_TOPOLOGY PrimTopology, VkPrimitiveTopology& VkPrimTopology, diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 40828c06..d3a83e38 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -332,9 +332,9 @@ void DeviceContextVkImpl::CommitVkVertexBuffers() LOG_ERROR("Currently bound pipeline state '", m_pPipelineState->GetDesc().Name, "' expects ", m_pPipelineState->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound"); #endif // Do not initialize array with zeros for performance reasons - VkBuffer vkVertexBuffers[MaxBufferSlots]; // = {} - VkDeviceSize Offsets[MaxBufferSlots]; - VERIFY(m_NumVertexStreams <= MaxBufferSlots, "Too many buffers are being set"); + VkBuffer vkVertexBuffers[MAX_BUFFER_SLOTS]; // = {} + VkDeviceSize Offsets[MAX_BUFFER_SLOTS]; + VERIFY(m_NumVertexStreams <= MAX_BUFFER_SLOTS, "Too many buffers are being set"); bool DynamicBufferPresent = false; for (Uint32 slot = 0; slot < m_NumVertexStreams; ++slot) { @@ -986,7 +986,7 @@ void DeviceContextVkImpl::CommitViewports() if (m_NumViewports == 0) return; - VkViewport VkViewports[MaxViewports]; // Do not waste time initializing array to zero + VkViewport VkViewports[MAX_VIEWPORTS]; // Do not waste time initializing array to zero for (Uint32 vp = 0; vp < m_NumViewports; ++vp) { VkViewports[vp].x = m_Viewports[vp].TopLeftX; @@ -1043,7 +1043,7 @@ void DeviceContextVkImpl::CommitScissorRects() if (m_NumScissorRects == 0) return; // Scissors have not been set in the context yet - VkRect2D VkScissorRects[MaxViewports]; // Do not waste time initializing array with zeroes + VkRect2D VkScissorRects[MAX_VIEWPORTS]; // Do not waste time initializing array with zeroes for (Uint32 sr = 0; sr < m_NumScissorRects; ++sr) { const auto& SrcRect = m_ScissorRects[sr]; @@ -2346,9 +2346,9 @@ void DeviceContextVkImpl::TransitionResourceStates(Uint32 BarrierCount, StateTra VkImageSubresourceRange SubResRange; SubResRange.aspectMask = 0; SubResRange.baseMipLevel = Barrier.FirstMipLevel; - SubResRange.levelCount = (Barrier.MipLevelsCount == StateTransitionDesc::RemainingMipLevels) ? VK_REMAINING_MIP_LEVELS : Barrier.MipLevelsCount; + SubResRange.levelCount = (Barrier.MipLevelsCount == REMAINING_MIP_LEVELS) ? VK_REMAINING_MIP_LEVELS : Barrier.MipLevelsCount; SubResRange.baseArrayLayer = Barrier.FirstArraySlice; - SubResRange.layerCount = (Barrier.ArraySliceCount == StateTransitionDesc::RemainingArraySlices) ? VK_REMAINING_ARRAY_LAYERS : Barrier.ArraySliceCount; + SubResRange.layerCount = (Barrier.ArraySliceCount == REMAINING_ARRAY_SLICES) ? VK_REMAINING_ARRAY_LAYERS : Barrier.ArraySliceCount; TransitionTextureState(*pTextureVkImpl, Barrier.OldState, Barrier.NewState, Barrier.UpdateResourceState, &SubResRange); } else diff --git a/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp b/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp index 86d87d17..d6c84d02 100644 --- a/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp +++ b/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp @@ -82,7 +82,7 @@ VkFramebuffer FramebufferCache::GetFramebuffer(const FramebufferCacheKey& Key, u FramebufferCI.flags = 0; // reserved for future use FramebufferCI.renderPass = Key.Pass; FramebufferCI.attachmentCount = (Key.DSV != VK_NULL_HANDLE ? 1 : 0) + Key.NumRenderTargets; - VkImageView Attachments[1 + MaxRenderTargets]; + VkImageView Attachments[1 + MAX_RENDER_TARGETS]; uint32_t attachment = 0; if (Key.DSV != VK_NULL_HANDLE) Attachments[attachment++] = Key.DSV; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index cef3ec6b..d507bdc1 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -41,15 +41,15 @@ namespace Diligent { VkRenderPassCreateInfo PipelineStateVkImpl::GetRenderPassCreateInfo( - Uint32 NumRenderTargets, - const TEXTURE_FORMAT RTVFormats[], - TEXTURE_FORMAT DSVFormat, - Uint32 SampleCount, - std::array& Attachments, - std::array& AttachmentReferences, - VkSubpassDescription& SubpassDesc) + Uint32 NumRenderTargets, + const TEXTURE_FORMAT RTVFormats[], + TEXTURE_FORMAT DSVFormat, + Uint32 SampleCount, + std::array& Attachments, + std::array& AttachmentReferences, + VkSubpassDescription& SubpassDesc) { - VERIFY_EXPR(NumRenderTargets <= MaxRenderTargets); + VERIFY_EXPR(NumRenderTargets <= MAX_RENDER_TARGETS); // Prepare render pass create info (7.1) VkRenderPassCreateInfo RenderPassCI = {}; @@ -160,8 +160,8 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters, // Initialize shader resource layouts auto& ShaderResLayoutAllocator = GetRawAllocator(); - std::array, MaxShadersInPipeline> ShaderResources; - std::array, MaxShadersInPipeline> ShaderSPIRVs; + std::array, MAX_SHADERS_IN_PIPELINE> ShaderResources; + std::array, MAX_SHADERS_IN_PIPELINE> ShaderSPIRVs; m_ShaderResourceLayouts = ALLOCATE(ShaderResLayoutAllocator, "Raw memory for ShaderResourceLayoutVk", ShaderResourceLayoutVk, m_NumShaders * 2); m_StaticResCaches = ALLOCATE(GetRawAllocator(), "Raw memory for ShaderResourceCacheVk", ShaderResourceCacheVk, m_NumShaders); @@ -189,7 +189,7 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters, if (PipelineDesc.SRBAllocationGranularity > 1) { - std::array ShaderVariableDataSizes = {}; + std::array ShaderVariableDataSizes = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) { const SHADER_RESOURCE_VARIABLE_TYPE AllowedVarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE, SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC}; @@ -206,7 +206,7 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters, } // Create shader modules and initialize shader stages - std::array ShaderStages = {}; + std::array ShaderStages = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) { auto* pShaderVk = GetShader(s); @@ -309,8 +309,8 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters, VkPipelineVertexInputStateCreateInfo VertexInputStateCI = {}; - std::array BindingDescriptions; - std::array AttributeDescription; + std::array BindingDescriptions; + std::array AttributeDescription; InputLayoutDesc_To_VkVertexInputStateCI(GraphicsPipeline.InputLayout, VertexInputStateCI, BindingDescriptions, AttributeDescription); PipelineCI.pVertexInputState = &VertexInputStateCI; diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 58941eca..64853356 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -147,7 +147,7 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters* } // clang-format on { - m_DeviceCaps.DevType = DeviceType::Vulkan; + m_DeviceCaps.DevType = RENDER_DEVICE_TYPE_VULKAN; m_DeviceCaps.MajorVersion = 1; m_DeviceCaps.MinorVersion = 0; m_DeviceCaps.AdaterType = ADAPTER_TYPE_HARDWARE; diff --git a/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp b/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp index 55791502..c3e61cac 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp @@ -50,8 +50,8 @@ VkRenderPass RenderPassCache::GetRenderPass(const RenderPassCacheKey& Key) if (it == m_Cache.end()) { // Do not zero-intitialize arrays - std::array Attachments; - std::array AttachmentReferences; + std::array Attachments; + std::array AttachmentReferences; VkSubpassDescription Subpass; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index 9cc56ab8..325deb5b 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -358,9 +358,9 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice* Layouts[s].AllocateMemory(std::move(pShaderResources[s]), LayoutDataAllocator, ResourceLayoutDesc, AllowedVarTypes, NumAllowedTypes, AllocateImmutableSamplers); } - VERIFY_EXPR(NumShaders <= MaxShadersInPipeline); - std::array, MaxShadersInPipeline> CurrResInd = {}; - std::array CurrImmutableSamplerInd = {}; + VERIFY_EXPR(NumShaders <= MAX_SHADERS_IN_PIPELINE); + std::array, MAX_SHADERS_IN_PIPELINE> CurrResInd = {}; + std::array CurrImmutableSamplerInd = {}; #ifdef _DEBUG std::unordered_map> dbgBindings_CacheOffsets; #endif diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp index a2f416e6..5bf3ada9 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp @@ -929,16 +929,16 @@ void BlendStateDesc_To_VkBlendStateCI(const BlendStateDesc& } } -VkVertexInputRate LayoutElemFrequencyToVkInputRate(LayoutElement::FREQUENCY frequency) +VkVertexInputRate LayoutElemFrequencyToVkInputRate(INPUT_ELEMENT_FREQUENCY frequency) { switch (frequency) { - case LayoutElement::FREQUENCY_UNDEFINED: + case INPUT_ELEMENT_FREQUENCY_UNDEFINED: UNEXPECTED("Undefined layout element frequency"); return VK_VERTEX_INPUT_RATE_VERTEX; - case LayoutElement::FREQUENCY_PER_VERTEX: return VK_VERTEX_INPUT_RATE_VERTEX; - case LayoutElement::FREQUENCY_PER_INSTANCE: return VK_VERTEX_INPUT_RATE_INSTANCE; + case INPUT_ELEMENT_FREQUENCY_PER_VERTEX: return VK_VERTEX_INPUT_RATE_VERTEX; + case INPUT_ELEMENT_FREQUENCY_PER_INSTANCE: return VK_VERTEX_INPUT_RATE_INSTANCE; default: UNEXPECTED("Unknown layout element frequency"); @@ -946,10 +946,10 @@ VkVertexInputRate LayoutElemFrequencyToVkInputRate(LayoutElement::FREQUENCY freq } } -void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& LayoutDesc, - VkPipelineVertexInputStateCreateInfo& VertexInputStateCI, - std::array& BindingDescriptions, - std::array& AttributeDescription) +void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& LayoutDesc, + VkPipelineVertexInputStateCreateInfo& VertexInputStateCI, + std::array& BindingDescriptions, + std::array& AttributeDescription) { // Vertex input description (20.2) VertexInputStateCI.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; @@ -959,7 +959,7 @@ void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& VertexInputStateCI.pVertexBindingDescriptions = BindingDescriptions.data(); VertexInputStateCI.vertexAttributeDescriptionCount = LayoutDesc.NumElements; VertexInputStateCI.pVertexAttributeDescriptions = AttributeDescription.data(); - std::array BufferSlot2BindingDescInd; + std::array BufferSlot2BindingDescInd; BufferSlot2BindingDescInd.fill(-1); for (Uint32 elem = 0; elem < LayoutDesc.NumElements; ++elem) { diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp index 90202b89..428f8ead 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp @@ -52,26 +52,26 @@ VKAPI_ATTR VkBool32 VKAPI_CALL DebugMessengerCallback(VkDebugUtilsMessageSeverit } } - Diligent::DebugMessageSeverity MsgSeverity = Diligent::DebugMessageSeverity::Info; + Diligent::DEBUG_MESSAGE_SEVERITY MsgSeverity = Diligent::DEBUG_MESSAGE_SEVERITY_INFO; if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT) { - MsgSeverity = Diligent::DebugMessageSeverity::Info; + MsgSeverity = Diligent::DEBUG_MESSAGE_SEVERITY_INFO; } else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT) { - MsgSeverity = Diligent::DebugMessageSeverity::Info; + MsgSeverity = Diligent::DEBUG_MESSAGE_SEVERITY_INFO; } else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) { - MsgSeverity = Diligent::DebugMessageSeverity::Warning; + MsgSeverity = Diligent::DEBUG_MESSAGE_SEVERITY_WARNING; } else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { - MsgSeverity = Diligent::DebugMessageSeverity::Error; + MsgSeverity = Diligent::DEBUG_MESSAGE_SEVERITY_ERROR; } else { - MsgSeverity = Diligent::DebugMessageSeverity::Info; + MsgSeverity = Diligent::DEBUG_MESSAGE_SEVERITY_INFO; } debugMessage << "Vulkan debug message ("; -- cgit v1.2.3