diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-25 19:19:23 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-25 19:19:23 +0000 |
| commit | d31dc00f82d2121dc0378db77264d9263540a192 (patch) | |
| tree | d384eb65560a6bef42e339d4393e03b6c9baaa16 /Graphics/GraphicsEngineVulkan | |
| parent | Updated handling of fatal errors (diff) | |
| download | DiligentCore-d31dc00f82d2121dc0378db77264d9263540a192.tar.gz DiligentCore-d31dc00f82d2121dc0378db77264d9263540a192.zip | |
Reworked main headers to be compatible with c
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
12 files changed, 57 insertions, 57 deletions
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<VkAttachmentDescription, MaxRenderTargets + 1>& Attachments, - std::array<VkAttachmentReference, MaxRenderTargets + 1>& AttachmentReferences, - VkSubpassDescription& SubpassDesc); + static VkRenderPassCreateInfo GetRenderPassCreateInfo(Uint32 NumRenderTargets, + const TEXTURE_FORMAT RTVFormats[], + TEXTURE_FORMAT DSVFormat, + Uint32 SampleCount, + std::array<VkAttachmentDescription, MAX_RENDER_TARGETS + 1>& Attachments, + std::array<VkAttachmentReference, MAX_RENDER_TARGETS + 1>& 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<VulkanUtilities::ShaderModuleWrapper, MaxShadersInPipeline> m_ShaderModules; + std::array<VulkanUtilities::ShaderModuleWrapper, MAX_SHADERS_IN_PIPELINE> 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<VkPipelineColorBlendAttachmentState>& ColorBlendAttachments); -void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& LayoutDesc, - VkPipelineVertexInputStateCreateInfo& VertexInputStateCI, - std::array<VkVertexInputBindingDescription, iMaxLayoutElements>& BindingDescriptions, - std::array<VkVertexInputAttributeDescription, iMaxLayoutElements>& AttributeDescription); +void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& LayoutDesc, + VkPipelineVertexInputStateCreateInfo& VertexInputStateCI, + std::array<VkVertexInputBindingDescription, MAX_LAYOUT_ELEMENTS>& BindingDescriptions, + std::array<VkVertexInputAttributeDescription, MAX_LAYOUT_ELEMENTS>& 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<VkAttachmentDescription, MaxRenderTargets + 1>& Attachments, - std::array<VkAttachmentReference, MaxRenderTargets + 1>& AttachmentReferences, - VkSubpassDescription& SubpassDesc) + Uint32 NumRenderTargets, + const TEXTURE_FORMAT RTVFormats[], + TEXTURE_FORMAT DSVFormat, + Uint32 SampleCount, + std::array<VkAttachmentDescription, MAX_RENDER_TARGETS + 1>& Attachments, + std::array<VkAttachmentReference, MAX_RENDER_TARGETS + 1>& 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<std::shared_ptr<const SPIRVShaderResources>, MaxShadersInPipeline> ShaderResources; - std::array<std::vector<uint32_t>, MaxShadersInPipeline> ShaderSPIRVs; + std::array<std::shared_ptr<const SPIRVShaderResources>, MAX_SHADERS_IN_PIPELINE> ShaderResources; + std::array<std::vector<uint32_t>, 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<size_t, MaxShadersInPipeline> ShaderVariableDataSizes = {}; + std::array<size_t, MAX_SHADERS_IN_PIPELINE> 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<VkPipelineShaderStageCreateInfo, MaxShadersInPipeline> ShaderStages = {}; + std::array<VkPipelineShaderStageCreateInfo, MAX_SHADERS_IN_PIPELINE> ShaderStages = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) { auto* pShaderVk = GetShader<const ShaderVkImpl>(s); @@ -309,8 +309,8 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters, VkPipelineVertexInputStateCreateInfo VertexInputStateCI = {}; - std::array<VkVertexInputBindingDescription, iMaxLayoutElements> BindingDescriptions; - std::array<VkVertexInputAttributeDescription, iMaxLayoutElements> AttributeDescription; + std::array<VkVertexInputBindingDescription, MAX_LAYOUT_ELEMENTS> BindingDescriptions; + std::array<VkVertexInputAttributeDescription, MAX_LAYOUT_ELEMENTS> 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<VkAttachmentDescription, MaxRenderTargets + 1> Attachments; - std::array<VkAttachmentReference, MaxRenderTargets + 1> AttachmentReferences; + std::array<VkAttachmentDescription, MAX_RENDER_TARGETS + 1> Attachments; + std::array<VkAttachmentReference, MAX_RENDER_TARGETS + 1> 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<std::array<Uint32, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES>, MaxShadersInPipeline> CurrResInd = {}; - std::array<Uint32, MaxShadersInPipeline> CurrImmutableSamplerInd = {}; + VERIFY_EXPR(NumShaders <= MAX_SHADERS_IN_PIPELINE); + std::array<std::array<Uint32, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES>, MAX_SHADERS_IN_PIPELINE> CurrResInd = {}; + std::array<Uint32, MAX_SHADERS_IN_PIPELINE> CurrImmutableSamplerInd = {}; #ifdef _DEBUG std::unordered_map<Uint32, std::pair<Uint32, Uint32>> 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<VkVertexInputBindingDescription, iMaxLayoutElements>& BindingDescriptions, - std::array<VkVertexInputAttributeDescription, iMaxLayoutElements>& AttributeDescription) +void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc& LayoutDesc, + VkPipelineVertexInputStateCreateInfo& VertexInputStateCI, + std::array<VkVertexInputBindingDescription, MAX_LAYOUT_ELEMENTS>& BindingDescriptions, + std::array<VkVertexInputAttributeDescription, MAX_LAYOUT_ELEMENTS>& 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<Int32, iMaxLayoutElements> BufferSlot2BindingDescInd; + std::array<Int32, MAX_LAYOUT_ELEMENTS> 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 ("; |
