summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-09-17 20:28:10 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-09-17 20:28:10 +0000
commit6bccf55c08b641ee2b0ae0df1e5908e28e52e612 (patch)
tree7237eed479980235e6987e6868eacb88f9ae96b8 /Graphics/GraphicsEngineD3D11
parentAdded UnifiedMemoryCPUAccess member to GraphicsAdapterInfo struct (API Versio... (diff)
parentdon't link with vulkan if used volk, added shader name to log message (diff)
downloadDiligentCore-6bccf55c08b641ee2b0ae0df1e5908e28e52e612.tar.gz
DiligentCore-6bccf55c08b641ee2b0ae0df1e5908e28e52e612.zip
Merge branch 'mesh_shader_fix' of https://github.com/azhirnov/DiligentCore into azhirnov-mesh_shader_fix
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp4
-rw-r--r--Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp7
-rw-r--r--Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp7
4 files changed, 12 insertions, 8 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp
index 515f6640..10921348 100644
--- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp
+++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp
@@ -142,9 +142,9 @@ private:
// SRB memory allocator must be defined before the default shader res binding
SRBMemoryAllocator m_SRBMemAllocator;
- Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1};
+ std::array<Int8, NUM_SHADER_TYPES> m_ResourceLayoutIndex;
- Uint16 m_StaticSamplerOffsets[MAX_SHADERS_IN_PIPELINE + 1] = {};
+ std::array<Uint16, MAX_SHADERS_IN_PIPELINE + 1> m_StaticSamplerOffsets = {};
struct StaticSamplerInfo
{
const D3DShaderResourceAttribs& Attribs;
diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp
index b5704f96..86daad77 100644
--- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp
+++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp
@@ -36,6 +36,7 @@
#include "ShaderResourceCacheD3D11.hpp"
#include "ShaderResourceLayoutD3D11.hpp"
#include "STDAllocator.hpp"
+#include <array>
namespace Diligent
{
@@ -98,11 +99,11 @@ private:
ShaderResourceCacheD3D11* m_pBoundResourceCaches = nullptr;
ShaderResourceLayoutD3D11* m_pResourceLayouts = nullptr;
- Int8 m_ShaderTypeIndex[6] = {};
+ std::array<Int8, NUM_SHADER_TYPES> m_ShaderTypeIndex = {};
// Resource layout index in m_ResourceLayouts[] array for every shader stage
- Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1};
- Uint8 m_NumActiveShaders = 0;
+ std::array<Int8, NUM_SHADER_TYPES> m_ResourceLayoutIndex;
+ Uint8 m_NumActiveShaders = 0;
bool m_bIsStaticResourcesBound = false;
};
diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
index f0625c7b..87294ce1 100644
--- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
@@ -50,6 +50,8 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pR
m_StaticSamplers (STD_ALLOCATOR_RAW_MEM(StaticSamplerInfo, GetRawAllocator(), "Allocator for vector<StaticSamplerInfo>"))
// clang-format on
{
+ m_ResourceLayoutIndex.fill(-1);
+
if (m_Desc.IsComputePipeline())
{
auto* pCS = ValidatedCast<ShaderD3D11Impl>(m_Desc.ComputePipeline.pCS);
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
index ae51f277..5769d949 100644
--- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
@@ -49,6 +49,7 @@ ShaderResourceBindingD3D11Impl::ShaderResourceBindingD3D11Impl(IReferenceCounter
m_bIsStaticResourcesBound{false}
// clang-format on
{
+ m_ResourceLayoutIndex.fill(-1);
m_NumActiveShaders = static_cast<Uint8>(pPSO->GetNumShaders());
// clang-format off
@@ -183,7 +184,7 @@ void ShaderResourceBindingD3D11Impl::InitializeStaticResources(const IPipelineSt
IShaderResourceVariable* ShaderResourceBindingD3D11Impl::GetVariableByName(SHADER_TYPE ShaderType, const char* Name)
{
auto Ind = GetShaderTypeIndex(ShaderType);
- VERIFY_EXPR(Ind >= 0 && Ind < _countof(m_ResourceLayoutIndex));
+ VERIFY_EXPR(Ind >= 0 && Ind < m_ResourceLayoutIndex.size());
auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
if (ResLayoutIndex < 0)
{
@@ -199,7 +200,7 @@ IShaderResourceVariable* ShaderResourceBindingD3D11Impl::GetVariableByName(SHADE
Uint32 ShaderResourceBindingD3D11Impl::GetVariableCount(SHADER_TYPE ShaderType) const
{
auto Ind = GetShaderTypeIndex(ShaderType);
- VERIFY_EXPR(Ind >= 0 && Ind < _countof(m_ResourceLayoutIndex));
+ VERIFY_EXPR(Ind >= 0 && Ind < m_ResourceLayoutIndex.size());
auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
if (ResLayoutIndex < 0)
{
@@ -215,7 +216,7 @@ Uint32 ShaderResourceBindingD3D11Impl::GetVariableCount(SHADER_TYPE ShaderType)
IShaderResourceVariable* ShaderResourceBindingD3D11Impl::GetVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index)
{
auto Ind = GetShaderTypeIndex(ShaderType);
- VERIFY_EXPR(Ind >= 0 && Ind < _countof(m_ResourceLayoutIndex));
+ VERIFY_EXPR(Ind >= 0 && Ind < m_ResourceLayoutIndex.size());
auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
if (ResLayoutIndex < 0)
{