summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-02-28 15:56:53 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-02-28 15:56:53 +0000
commita11b4c46b33a49501b81ce638474abd36b89582b (patch)
treee67111e272edc8aa63b8f0af538452909dba1ec9 /Graphics/GraphicsEngineVulkan
parentImproved shader resource binding error reporting in ShaderResourceLayoutVk (diff)
downloadDiligentCore-a11b4c46b33a49501b81ce638474abd36b89582b.tar.gz
DiligentCore-a11b4c46b33a49501b81ce638474abd36b89582b.zip
Renamed PipelineLayoutDesc to PipelineResourceLayoutDesc
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h6
-rw-r--r--Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp10
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp4
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp48
4 files changed, 34 insertions, 34 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h
index c3dd9146..5fd6f520 100644
--- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h
+++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h
@@ -128,7 +128,7 @@ public:
// shader resource layout and the cache
void InitializeStaticResourceLayout(std::shared_ptr<const SPIRVShaderResources> pSrcResources,
IMemoryAllocator& LayoutDataAllocator,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
ShaderResourceCacheVk& StaticResourceCache);
// This method is called by PipelineStateVkImpl class instance to initialize resource
@@ -138,7 +138,7 @@ public:
ShaderResourceLayoutVk Layouts[],
std::shared_ptr<const SPIRVShaderResources> pShaderResources[],
IMemoryAllocator& LayoutDataAllocator,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
std::vector<uint32_t> SPIRVs[],
class PipelineLayout& PipelineLayout);
@@ -319,7 +319,7 @@ private:
void AllocateMemory(std::shared_ptr<const SPIRVShaderResources> pSrcResources,
IMemoryAllocator& Allocator,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes,
Uint32 NumAllowedTypes);
diff --git a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp
index d177ca46..305f04ef 100644
--- a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp
@@ -147,14 +147,14 @@ namespace Diligent
PSODesc.Name = name.c_str();
PSODesc.ComputePipeline.pCS = pCS;
- PSODesc.Layout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC;
+ PSODesc.ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC;
ShaderResourceVariableDesc VarDesc{SHADER_TYPE_COMPUTE, "CB", SHADER_RESOURCE_VARIABLE_TYPE_STATIC};
- PSODesc.Layout.Variables = &VarDesc;
- PSODesc.Layout.NumVariables = 1;
+ PSODesc.ResourceLayout.Variables = &VarDesc;
+ PSODesc.ResourceLayout.NumVariables = 1;
const StaticSamplerDesc StaticSampler(SHADER_TYPE_COMPUTE, "SrcMip", Sam_LinearClamp);
- PSODesc.Layout.StaticSamplers = &StaticSampler;
- PSODesc.Layout.NumStaticSamplers = 1;
+ PSODesc.ResourceLayout.StaticSamplers = &StaticSampler;
+ PSODesc.ResourceLayout.NumStaticSamplers = 1;
m_DeviceVkImpl.CreatePipelineState(PSODesc, &PSOs[NonPowOfTwo]);
PSOs[NonPowOfTwo]->GetStaticShaderVariable(SHADER_TYPE_COMPUTE, "CB")->Set(m_ConstantsCB);
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index ec5ff6b3..548441a7 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -174,13 +174,13 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters
auto* pStaticResLayout = new (m_ShaderResourceLayouts + m_NumShaders + s) ShaderResourceLayoutVk(LogicalDevice);
auto* pStaticResCache = new (m_StaticResCaches + s) ShaderResourceCacheVk(ShaderResourceCacheVk::DbgCacheContentType::StaticShaderResources);
- pStaticResLayout->InitializeStaticResourceLayout(ShaderResources[s], ShaderResLayoutAllocator, PipelineDesc.Layout, m_StaticResCaches[s]);
+ pStaticResLayout->InitializeStaticResourceLayout(ShaderResources[s], ShaderResLayoutAllocator, PipelineDesc.ResourceLayout, m_StaticResCaches[s]);
auto* pStaticVarMgr = new (m_StaticVarsMgrs + s) ShaderVariableManagerVk(*this);
pStaticVarMgr->Initialize(*pStaticResLayout, GetRawAllocator(), nullptr, 0, *pStaticResCache);
}
ShaderResourceLayoutVk::Initialize(pDeviceVk, m_NumShaders, m_ShaderResourceLayouts, ShaderResources.data(), GetRawAllocator(),
- PipelineDesc.Layout, ShaderSPIRVs.data(), m_PipelineLayout);
+ PipelineDesc.ResourceLayout, ShaderSPIRVs.data(), m_PipelineLayout);
m_PipelineLayout.Finalize(LogicalDevice);
if (PipelineDesc.SRBAllocationGranularity > 1)
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp
index 7f1eb1bb..abd606b4 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp
@@ -40,7 +40,7 @@ namespace Diligent
{
static Int32 FindImmutableSampler(SHADER_TYPE ShaderType,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
const SPIRVShaderResourceAttribs& Attribs,
const char* SamplerSuffix)
{
@@ -58,9 +58,9 @@ static Int32 FindImmutableSampler(SHADER_TYPE ShaderType,
return -1;
}
- for (Uint32 s=0; s < LayoutDesc.NumStaticSamplers; ++s)
+ for (Uint32 s=0; s < ResourceLayoutDesc.NumStaticSamplers; ++s)
{
- const auto& StSam = LayoutDesc.StaticSamplers[s];
+ const auto& StSam = ResourceLayoutDesc.StaticSamplers[s];
if ( ((StSam.ShaderStages & ShaderType) != 0) && StreqSuff(Attribs.Name, StSam.SamplerOrTextureName, SamplerSuffix) )
return s;
}
@@ -70,14 +70,14 @@ static Int32 FindImmutableSampler(SHADER_TYPE ShaderType,
static SHADER_RESOURCE_VARIABLE_TYPE GetShaderVariableType(SHADER_TYPE ShaderType,
const SPIRVShaderResourceAttribs& Attribs,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
const char* CombinedSamplerSuffix)
{
if (Attribs.Type == SPIRVShaderResourceAttribs::ResourceType::SeparateSampler)
{
// Use texture or sampler name to derive separate sampler type
// When HLSL-style combined image samplers are not used, CombinedSamplerSuffix is null
- return GetShaderVariableType(ShaderType, LayoutDesc.DefaultVariableType, LayoutDesc.Variables, LayoutDesc.NumVariables,
+ return GetShaderVariableType(ShaderType, ResourceLayoutDesc.DefaultVariableType, ResourceLayoutDesc.Variables, ResourceLayoutDesc.NumVariables,
[&](const char* VarName)
{
return StreqSuff(Attribs.Name, VarName, CombinedSamplerSuffix);
@@ -85,7 +85,7 @@ static SHADER_RESOURCE_VARIABLE_TYPE GetShaderVariableType(SHADER_TYPE
}
else
{
- return GetShaderVariableType(ShaderType, Attribs.Name, LayoutDesc);
+ return GetShaderVariableType(ShaderType, Attribs.Name, ResourceLayoutDesc);
}
}
@@ -102,7 +102,7 @@ ShaderResourceLayoutVk::~ShaderResourceLayoutVk()
void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptr<const SPIRVShaderResources> pSrcResources,
IMemoryAllocator& Allocator,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes,
Uint32 NumAllowedTypes)
{
@@ -119,7 +119,7 @@ void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptr<const SPIRVShaderRes
m_pResources->ProcessResources(
[&](const SPIRVShaderResourceAttribs& ResAttribs, Uint32)
{
- auto VarType = GetShaderVariableType(ShaderType, ResAttribs, LayoutDesc, CombinedSamplerSuffix);
+ auto VarType = GetShaderVariableType(ShaderType, ResAttribs, ResourceLayoutDesc, CombinedSamplerSuffix);
if (IsAllowedType(VarType, AllowedTypeBits))
{
VERIFY( Uint32{m_NumResources[VarType]} + 1 <= Uint32{std::numeric_limits<Uint16>::max()}, "Number of resources exceeds max representable value");
@@ -137,9 +137,9 @@ void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptr<const SPIRVShaderRes
m_NumResources[SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES] = static_cast<Uint16>(TotalResources);
m_NumImmutableSamplers = 0;
- for(Uint32 s=0; s < LayoutDesc.NumStaticSamplers; ++s)
+ for(Uint32 s=0; s < ResourceLayoutDesc.NumStaticSamplers; ++s)
{
- const auto& StSamDesc = LayoutDesc.StaticSamplers[s];
+ const auto& StSamDesc = ResourceLayoutDesc.StaticSamplers[s];
if ((StSamDesc.ShaderStages & ShaderType) != 0)
++m_NumImmutableSamplers;
}
@@ -162,11 +162,11 @@ void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptr<const SPIRVShaderRes
void ShaderResourceLayoutVk::InitializeStaticResourceLayout(std::shared_ptr<const SPIRVShaderResources> pSrcResources,
IMemoryAllocator& LayoutDataAllocator,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
ShaderResourceCacheVk& StaticResourceCache)
{
auto AllowedVarType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC;
- AllocateMemory(std::move(pSrcResources), LayoutDataAllocator, LayoutDesc, &AllowedVarType, 1);
+ AllocateMemory(std::move(pSrcResources), LayoutDataAllocator, ResourceLayoutDesc, &AllowedVarType, 1);
std::array<Uint32, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES> CurrResInd = {};
Uint32 StaticResCacheSize = 0;
@@ -178,7 +178,7 @@ void ShaderResourceLayoutVk::InitializeStaticResourceLayout(std::shared_ptr<cons
m_pResources->ProcessResources(
[&](const SPIRVShaderResourceAttribs& Attribs, Uint32)
{
- auto VarType = GetShaderVariableType(ShaderType, Attribs, LayoutDesc, CombinedSamplerSuffix);
+ auto VarType = GetShaderVariableType(ShaderType, Attribs, ResourceLayoutDesc, CombinedSamplerSuffix);
if (!IsAllowedType(VarType, AllowedTypeBits))
return;
@@ -216,15 +216,15 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice*
ShaderResourceLayoutVk Layouts[],
std::shared_ptr<const SPIRVShaderResources> pShaderResources[],
IMemoryAllocator& LayoutDataAllocator,
- const PipelineLayoutDesc& LayoutDesc,
+ const PipelineResourceLayoutDesc& ResourceLayoutDesc,
std::vector<uint32_t> SPIRVs[],
class PipelineLayout& PipelineLayout)
{
#ifdef DEVELOPMENT
- for (Uint32 v = 0; v < LayoutDesc.NumVariables; ++v)
+ for (Uint32 v = 0; v < ResourceLayoutDesc.NumVariables; ++v)
{
bool VariableFound = false;
- const auto& VarDesc = LayoutDesc.Variables[v];
+ const auto& VarDesc = ResourceLayoutDesc.Variables[v];
if (VarDesc.ShaderStages == SHADER_TYPE_UNKNOWN)
{
LOG_WARNING_MESSAGE("No allowed shader stages specified for variable '", VarDesc.Name, "' labeled as ", GetShaderVariableTypeLiteralName(VarDesc.Type), ".");
@@ -248,9 +248,9 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice*
}
}
- for (Uint32 sam = 0; sam < LayoutDesc.NumStaticSamplers; ++sam)
+ for (Uint32 sam = 0; sam < ResourceLayoutDesc.NumStaticSamplers; ++sam)
{
- const auto& StSamDesc = LayoutDesc.StaticSamplers[sam];
+ const auto& StSamDesc = ResourceLayoutDesc.StaticSamplers[sam];
if (StSamDesc.ShaderStages == SHADER_TYPE_UNKNOWN)
{
LOG_WARNING_MESSAGE("No allowed shader stages specified for static sampler '", StSamDesc.SamplerOrTextureName, ".");
@@ -301,7 +301,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice*
for (Uint32 s=0; s < NumShaders; ++s)
{
- Layouts[s].AllocateMemory(std::move(pShaderResources[s]), LayoutDataAllocator, LayoutDesc, AllowedVarTypes, NumAllowedTypes);
+ Layouts[s].AllocateMemory(std::move(pShaderResources[s]), LayoutDataAllocator, ResourceLayoutDesc, AllowedVarTypes, NumAllowedTypes);
}
VERIFY_EXPR(NumShaders <= MaxShadersInPipeline);
@@ -320,7 +320,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice*
Uint32 DescriptorSet = 0;
Uint32 CacheOffset = 0;
const auto ShaderType = Resources.GetShaderType();
- const SHADER_RESOURCE_VARIABLE_TYPE VarType = GetShaderVariableType(ShaderType, Attribs, LayoutDesc, Resources.GetCombinedSamplerSuffix());
+ const SHADER_RESOURCE_VARIABLE_TYPE VarType = GetShaderVariableType(ShaderType, Attribs, ResourceLayoutDesc, Resources.GetCombinedSamplerSuffix());
if (!IsAllowedType(VarType, AllowedTypeBits))
return;
@@ -333,13 +333,13 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice*
SamplerInd = ResLayout.FindAssignedSampler(Attribs, CurrResInd[ShaderInd][VarType], VarType);
}
- Int32 SrcImmutableSamplerInd = FindImmutableSampler(ShaderType, LayoutDesc, Attribs, Resources.GetCombinedSamplerSuffix());
+ Int32 SrcImmutableSamplerInd = FindImmutableSampler(ShaderType, ResourceLayoutDesc, Attribs, Resources.GetCombinedSamplerSuffix());
VkSampler vkImmutableSampler = VK_NULL_HANDLE;
if (SrcImmutableSamplerInd >= 0)
{
auto& ImmutableSampler = ResLayout.GetImmutableSampler(CurrImmutableSamplerInd[ShaderInd]++);
VERIFY(!ImmutableSampler, "Immutable sampler has already been initialized!");
- const auto& ImmutableSamplerDesc = LayoutDesc.StaticSamplers[SrcImmutableSamplerInd].Desc;
+ const auto& ImmutableSamplerDesc = ResourceLayoutDesc.StaticSamplers[SrcImmutableSamplerInd].Desc;
pRenderDevice->CreateSampler(ImmutableSamplerDesc, &ImmutableSampler);
vkImmutableSampler = ImmutableSampler.RawPtr<SamplerVkImpl>()->GetVkSampler();
}
@@ -372,7 +372,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice*
for (Uint32 n = 0; n < Resources.GetNumUBs(); ++n)
{
const auto& UB = Resources.GetUB(n);
- auto VarType = GetShaderVariableType(Resources.GetShaderType(), UB.Name, LayoutDesc);
+ auto VarType = GetShaderVariableType(Resources.GetShaderType(), UB.Name, ResourceLayoutDesc);
if (IsAllowedType(VarType, AllowedTypeBits))
{
AddResource(s, Layout, Resources, UB);
@@ -388,7 +388,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice*
for (Uint32 n = 0; n < Resources.GetNumSBs(); ++n)
{
const auto& SB = Resources.GetSB(n);
- auto VarType = GetShaderVariableType(Resources.GetShaderType(), SB.Name, LayoutDesc);
+ auto VarType = GetShaderVariableType(Resources.GetShaderType(), SB.Name, ResourceLayoutDesc);
if (IsAllowedType(VarType, AllowedTypeBits))
{
AddResource(s, Layout, Resources, SB);