summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-05-20 21:52:23 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-05-20 21:52:23 +0000
commit2b737638bee41bba51b02cbe052734ce1fb45a9e (patch)
tree6168e272d8b276b31d72a7b117b371de75e15bc8 /Graphics/GraphicsEngineVulkan
parentCouple minor updates (diff)
downloadDiligentCore-2b737638bee41bba51b02cbe052734ce1fb45a9e.tar.gz
DiligentCore-2b737638bee41bba51b02cbe052734ce1fb45a9e.zip
Imlemented pipeline compatibility test in Vulkan
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h9
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp16
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp30
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp1
4 files changed, 26 insertions, 30 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h
index 9377ef39..865a3540 100644
--- a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h
@@ -35,6 +35,7 @@
#include "ShaderResourceLayoutVk.h"
#include "AdaptiveFixedBlockAllocator.h"
#include "VulkanUtilities/VulkanObjectWrappers.h"
+#include "VulkanUtilities/VulkanCommandBuffer.h"
#include "PipelineLayout.h"
/// Namespace for the Direct3D11 implementation of the graphics engine
@@ -63,10 +64,10 @@ public:
virtual VkPipeline GetVkPipeline()const override final { return m_Pipeline; }
- //ShaderResourceCacheVk* CommitAndTransitionShaderResources(IShaderResourceBinding *pShaderResourceBinding,
- // class CommandContext &Ctx,
- // bool CommitResources,
- // bool TransitionResources)const;
+ ShaderResourceCacheVk* CommitAndTransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding,
+ VulkanUtilities::VulkanCommandBuffer& CmdBuff,
+ bool CommitResources,
+ bool TransitionResources)const;
const PipelineLayout& GetPipelineLayout()const{return m_PipelineLayout;}
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
index d21bb0aa..a9ac994f 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
@@ -196,8 +196,9 @@ PipelineLayout::DescriptorSetLayoutManager::DescriptorSetLayout::~DescriptorSetL
bool PipelineLayout::DescriptorSetLayoutManager::DescriptorSetLayout::operator == (const DescriptorSetLayout& rhs)const
{
- if(NumLayoutBindings != rhs.NumLayoutBindings ||
- TotalDescriptors != rhs.TotalDescriptors)
+ if(TotalDescriptors != rhs.TotalDescriptors ||
+ SetIndex != rhs.SetIndex ||
+ NumLayoutBindings != rhs.NumLayoutBindings)
return false;
for(uint32_t b=0; b < NumLayoutBindings; ++b)
@@ -213,14 +214,7 @@ bool PipelineLayout::DescriptorSetLayoutManager::DescriptorSetLayout::operator =
if( B0.pImmutableSamplers != nullptr && B1.pImmutableSamplers == nullptr ||
B0.pImmutableSamplers == nullptr && B1.pImmutableSamplers != nullptr)
return false;
- if(B0.pImmutableSamplers != nullptr && B1.pImmutableSamplers != nullptr)
- {
- // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
- // and descriptorCount is not 0 and pImmutableSamplers is not NULL, pImmutableSamplers must be a
- // valid pointer to an array of descriptorCount valid VkSampler handles (13.2.1)
- if(memcmp(B0.pImmutableSamplers, B1.pImmutableSamplers, sizeof(VkSampler) * B0.descriptorCount) != 0)
- return false;
- }
+ // Static samplers themselves should not affect compatibility
}
return true;
}
@@ -290,7 +284,7 @@ PipelineLayout::DescriptorSetLayoutManager::~DescriptorSetLayoutManager()
bool PipelineLayout::DescriptorSetLayoutManager::operator == (const DescriptorSetLayoutManager& rhs)const
{
- if(m_DescriptorSetLayouts.size() != rhs.m_DescriptorSetLayouts.size())
+ if(m_ActiveSets != rhs.m_ActiveSets)
return false;
for(size_t i=0; i < m_DescriptorSetLayouts.size(); ++i)
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index 8e3a5219..8bb7afa4 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -456,12 +456,12 @@ bool PipelineStateVkImpl::IsCompatibleWith(const IPipelineState *pPSO)const
if (pPSO == this)
return true;
-#if 0
+
const PipelineStateVkImpl *pPSOVk = ValidatedCast<const PipelineStateVkImpl>(pPSO);
if (m_ShaderResourceLayoutHash != pPSOVk->m_ShaderResourceLayoutHash)
return false;
- auto IsSameRootSignature = m_RootSig.IsSameAs(pPSOVk->m_RootSig);
+ auto IsSamePipelineLayout = m_PipelineLayout.IsSameAs(pPSOVk->m_PipelineLayout);
#ifdef _DEBUG
{
@@ -480,8 +480,8 @@ bool PipelineStateVkImpl::IsCompatibleWith(const IPipelineState *pPSO)const
IsCompatibleShaders = false;
break;
}
- const ShaderResourcesVk *pRes0 = pShader0->GetShaderResources().get();
- const ShaderResourcesVk *pRes1 = pShader1->GetShaderResources().get();
+ const auto *pRes0 = pShader0->GetShaderResources().get();
+ const auto *pRes1 = pShader1->GetShaderResources().get();
if (!pRes0->IsCompatibleWith(*pRes1))
{
IsCompatibleShaders = false;
@@ -491,22 +491,20 @@ bool PipelineStateVkImpl::IsCompatibleWith(const IPipelineState *pPSO)const
}
if(IsCompatibleShaders)
- VERIFY(IsSameRootSignature, "Compatible shaders must have same root signatures");
+ VERIFY(IsSamePipelineLayout, "Compatible shaders must have same pipeline layouts");
}
#endif
-
- return IsSameRootSignature;
-#endif
- return true;
+
+ return IsSamePipelineLayout;
}
-#if 0
-ShaderResourceCacheVk* PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBinding *pShaderResourceBinding,
- CommandContext &Ctx,
- bool CommitResources,
- bool TransitionResources)const
+ShaderResourceCacheVk* PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding,
+ VulkanUtilities::VulkanCommandBuffer& CmdBuff,
+ bool CommitResources,
+ bool TransitionResources)const
{
+#if 0
#ifdef VERIFY_SHADER_BINDINGS
if (pShaderResourceBinding == nullptr &&
(m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_MUTABLE) != 0 ||
@@ -559,9 +557,11 @@ ShaderResourceCacheVk* PipelineStateVkImpl::CommitAndTransitionShaderResources(I
m_RootSig.TransitionResources(ResourceCache, Ctx);
}
return &ResourceCache;
+#endif
+ return nullptr;
}
-
+#if 0
bool PipelineStateVkImpl::dbgContainsShaderResources()const
{
return m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_STATIC) != 0 ||
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp
index 2cfab085..08d56395 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp
@@ -157,6 +157,7 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk( const EngineVkAttribs& Crea
DeviceFeatures.samplerAnisotropy = VK_TRUE;
DeviceFeatures.geometryShader = VK_TRUE;
DeviceFeatures.tessellationShader= VK_TRUE;
+ DeviceFeatures.dualSrcBlend = VK_TRUE;
DeviceCreateInfo.pEnabledFeatures = &DeviceFeatures; // NULL or a pointer to a VkPhysicalDeviceFeatures structure that contains
// boolean indicators of all the features to be enabled.