summaryrefslogtreecommitdiffstats
path: root/Graphics
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
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')
-rw-r--r--Graphics/GraphicsEngine/include/PipelineStateBase.hpp6
-rw-r--r--Graphics/GraphicsEngine/include/ShaderBase.hpp3
-rw-r--r--Graphics/GraphicsEngine/interface/Constants.h4
-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
-rw-r--r--Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp3
-rw-r--r--Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/RootSignature.hpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp6
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp1
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp11
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/CMakeLists.txt5
-rw-r--r--Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp6
-rw-r--r--Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp10
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp4
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp4
-rw-r--r--Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.hpp3
25 files changed, 52 insertions, 52 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
index 02a74f85..4d2e408f 100644
--- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
+++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
@@ -406,7 +406,7 @@ public:
IShader* GetHS() { return m_pHS; }
IShader* GetCS() { return m_pCS; }
- IShader* const* GetShaders() const { return m_ppShaders; }
+ IShader* const* GetShaders() const { return m_ppShaders.data(); }
Uint32 GetNumShaders() const { return m_NumShaders; }
template <typename ShaderType>
@@ -447,8 +447,8 @@ protected:
RefCntAutoPtr<IRenderPass> m_pRenderPass; ///< Strong reference to the render pass object
- IShader* m_ppShaders[MAX_SHADERS_IN_PIPELINE] = {}; ///< Array of pointers to the shaders used by this PSO
- size_t m_ShaderResourceLayoutHash = 0; ///< Hash computed from the shader resource layout
+ std::array<IShader*, MAX_SHADERS_IN_PIPELINE> m_ppShaders = {}; ///< Array of pointers to the shaders used by this PSO
+ size_t m_ShaderResourceLayoutHash = 0; ///< Hash computed from the shader resource layout
private:
#define LOG_PSO_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Description of ", GetPipelineTypeString(this->m_Desc.PipelineType), " PSO '", this->m_Desc.Name, "' is invalid: ", ##__VA_ARGS__)
diff --git a/Graphics/GraphicsEngine/include/ShaderBase.hpp b/Graphics/GraphicsEngine/include/ShaderBase.hpp
index 5b39da79..3beaa9c8 100644
--- a/Graphics/GraphicsEngine/include/ShaderBase.hpp
+++ b/Graphics/GraphicsEngine/include/ShaderBase.hpp
@@ -38,10 +38,13 @@
#include "PlatformMisc.hpp"
#include "EngineMemory.h"
#include "Align.hpp"
+#include "Constants.h"
namespace Diligent
{
+static_assert((1u << (NUM_SHADER_TYPES - 1)) == SHADER_TYPE_LAST, "check shader type enum or shader count");
+
inline SHADER_TYPE GetShaderTypeFromIndex(Int32 Index)
{
return static_cast<SHADER_TYPE>(1 << Index);
diff --git a/Graphics/GraphicsEngine/interface/Constants.h b/Graphics/GraphicsEngine/interface/Constants.h
index dfd17c45..419d6862 100644
--- a/Graphics/GraphicsEngine/interface/Constants.h
+++ b/Graphics/GraphicsEngine/interface/Constants.h
@@ -51,8 +51,12 @@ static const Uint32 MAX_RENDER_TARGETS = DILIGENT_MAX_RENDER_TARGETS;
static const Uint32 MAX_VIEWPORTS = DILIGENT_MAX_VIEWPORTS;
/// Maximum number of shader stages in a pipeline.
+/// (Vertex, Pixel, Geometry, Domain, Hull) or (Amplification, Mesh, Pixel)
static const Uint32 MAX_SHADERS_IN_PIPELINE = 5;
+///// Number of different shader types (Vertex, Pixel, Geometry, Domain, Hull, Compute, Amplification, Mesh)
+static const Uint32 NUM_SHADER_TYPES = 8;
+
// clang-format on
DILIGENT_END_NAMESPACE // namespace Diligent
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)
{
diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp
index e14903dd..91c1610a 100644
--- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp
@@ -260,9 +260,6 @@ public:
/// Implementation of IDeviceContextD3D12::ID3D12GraphicsCommandList() in Direct3D12 backend.
virtual ID3D12GraphicsCommandList* DILIGENT_CALL_TYPE GetD3D12CommandList() override final;
- ///// Number of different shader types (Vertex, Pixel, Geometry, Domain, Hull, Compute)
- //static constexpr int NumShaderTypes = 6;
-
void UpdateBufferRegion(class BufferD3D12Impl* pBuffD3D12,
D3D12DynamicAllocation& Allocation,
Uint64 DstOffset,
diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp
index 7e5b5fdd..b4d2fce9 100644
--- a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp
@@ -129,7 +129,7 @@ private:
ShaderResourceCacheD3D12* m_pStaticResourceCaches = nullptr;
ShaderVariableManagerD3D12* m_pStaticVarManagers = nullptr;
// Resource layout index in m_ResourceLayouts[] array for every shader stage
- Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1};
+ std::array<Int8, NUM_SHADER_TYPES> m_ResourceLayoutIndex;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp
index a3bc8d11..c62c8198 100644
--- a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp
@@ -474,9 +474,9 @@ private:
// in m_RootParams (NOT the Root Index!), for every variable type
// (static, mutable, dynamic) and every shader type,
// or -1, if the table is not yet assigned to the combination
- std::array<Uint8, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES * 6> m_SrvCbvUavRootTablesMap;
+ std::array<Uint8, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES * NUM_SHADER_TYPES> m_SrvCbvUavRootTablesMap;
// This array contains the same data for Sampler root table
- std::array<Uint8, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES * 6> m_SamplerRootTablesMap;
+ std::array<Uint8, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES * NUM_SHADER_TYPES> m_SamplerRootTablesMap;
RootParamsManager m_RootParams;
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp
index 09854e17..7c83ddbf 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp
@@ -80,9 +80,9 @@ private:
ShaderResourceCacheD3D12 m_ShaderResourceCache;
ShaderVariableManagerD3D12* m_pShaderVarMgrs = nullptr;
// Resource layout index in m_ResourceLayouts[] array for every shader stage
- Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1};
- bool m_bStaticResourcesInitialized = false;
- const Uint8 m_NumShaders = 0;
+ std::array<Int8, NUM_SHADER_TYPES> m_ResourceLayoutIndex;
+ bool m_bStaticResourcesInitialized = false;
+ const Uint8 m_NumShaders = 0;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp
index 19ad36bc..94d65cda 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp
@@ -48,6 +48,7 @@ ShaderResourceBindingD3D12Impl::ShaderResourceBindingD3D12Impl(IReferenceCounter
m_NumShaders {static_cast<decltype(m_NumShaders)>(pPSO->GetNumShaders())}
// clang-format on
{
+ m_ResourceLayoutIndex.fill(-1);
auto* ppShaders = pPSO->GetShaders();
auto* pRenderDeviceD3D12Impl = ValidatedCast<RenderDeviceD3D12Impl>(pPSO->GetDevice());
diff --git a/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp b/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp
index cf6a9e86..d3b11a18 100644
--- a/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp
@@ -82,7 +82,10 @@ class GLPipelineResourceLayout
public:
GLPipelineResourceLayout(IObject& Owner) :
m_Owner(Owner)
- {}
+ {
+ m_ProgramIndex.fill(-1);
+ }
+
~GLPipelineResourceLayout();
// No copies, only moves are allowed
@@ -328,9 +331,9 @@ private:
/*34*/ OffsetType m_ImageOffset = 0;
/*36*/ OffsetType m_StorageBufferOffset = 0;
/*38*/ OffsetType m_VariableEndOffset = 0;
-/*40*/ std::array<Int8, 6> m_ProgramIndex = {{-1, -1, -1, -1, -1, -1}};
-/*46*/ Uint8 m_NumPrograms = 0;
-/*48*/
+/*40*/ std::array<Int8, NUM_SHADER_TYPES> m_ProgramIndex;
+/*48*/ Uint8 m_NumPrograms = 0;
+/*49*/
// clang-format on
template <typename ResourceType> OffsetType GetResourceOffset() const;
diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
index bb2201d1..1cc0a1ef 100644
--- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
@@ -102,7 +102,7 @@ PipelineStateGLImpl::PipelineStateGLImpl(IReferenceCounters* pRefCoun
}
else
{
- m_GLPrograms.emplace_back(ShaderGLImpl::LinkProgram(m_ppShaders, m_NumShaders, false));
+ m_GLPrograms.emplace_back(ShaderGLImpl::LinkProgram(m_ppShaders.data(), m_NumShaders, false));
m_ProgramResources.resize(1);
SHADER_TYPE ShaderStages = SHADER_TYPE_UNKNOWN;
for (Uint32 i = 0; i < m_NumShaders; ++i)
diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
index 8299915a..897894e7 100644
--- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt
+++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
@@ -233,8 +233,10 @@ if(PLATFORM_WIN32)
# Use Volk
elseif(PLATFORM_MACOS)
find_library(Vulkan_LIBRARY NAMES vulkan.1 vulkan PATHS "../../ThirdParty/vulkan/libs/macOS")
+ list(APPEND PRIVATE_DEPENDENCIES ${Vulkan_LIBRARY})
elseif(PLATFORM_IOS)
set(Vulkan_LIBRARY ${MoltenVK_LIBRARY})
+ list(APPEND PRIVATE_DEPENDENCIES ${Vulkan_LIBRARY})
find_library(CORE_GRAPHICS CoreGraphics)
find_library(METAL_LIBRARY Metal)
@@ -248,9 +250,6 @@ elseif(PLATFORM_ANDROID)
# Use Volk
else()
find_library(Vulkan_LIBRARY NAMES vulkan)
-endif()
-
-if(Vulkan_LIBRARY)
list(APPEND PRIVATE_DEPENDENCIES ${Vulkan_LIBRARY})
endif()
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp
index d3915425..d93a72ac 100644
--- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp
@@ -78,9 +78,9 @@ private:
ShaderVariableManagerVk* m_pShaderVarMgrs = nullptr;
// Shader variable manager index in m_pShaderVarMgrs[] array for every shader stage
- Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1};
- bool m_bStaticResourcesInitialized = false;
- Uint8 m_NumShaders = 0;
+ std::array<Int8, NUM_SHADER_TYPES> m_ResourceLayoutIndex;
+ bool m_bStaticResourcesInitialized = false;
+ Uint8 m_NumShaders = 0;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
index 35db310b..35202b1e 100644
--- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
@@ -231,26 +231,22 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _E
bool SupportsFeatures2 = Instance->IsExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
void** NextExt = const_cast<void**>(&DeviceCreateInfo.pNext);
- // Variables may be unused if extensions are disabled.
- (void)SupportsFeatures2;
- (void)NextExt;
-
// Enable mesh shader extension.
bool MeshShadersSupported = false;
-#ifdef VK_NV_mesh_shader
if (EngineCI.Features.MeshShaders != DEVICE_FEATURE_STATE_DISABLED)
{
VkPhysicalDeviceMeshShaderFeaturesNV MeshShaderFeats = PhysicalDevice->GetExtFeatures().MeshShader;
if (SupportsFeatures2 && PhysicalDevice->IsExtensionSupported(VK_NV_MESH_SHADER_EXTENSION_NAME))
{
- MeshShadersSupported = true;
+ MeshShadersSupported = MeshShaderFeats.taskShader != VK_FALSE && MeshShaderFeats.meshShader != VK_FALSE;
DeviceExtensions.push_back(VK_NV_MESH_SHADER_EXTENSION_NAME);
*NextExt = &MeshShaderFeats;
NextExt = &MeshShaderFeats.pNext;
}
+
+ *NextExt = nullptr;
}
-#endif
if (EngineCI.Features.MeshShaders == DEVICE_FEATURE_STATE_ENABLED && !MeshShadersSupported)
LOG_ERROR_AND_THROW("Mesh shaders are not supported by this device");
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
index 65c948a4..2fd063c9 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
@@ -53,10 +53,8 @@ static VkShaderStageFlagBits ShaderTypeToVkShaderStageFlagBit(SHADER_TYPE Shader
case SHADER_TYPE_GEOMETRY: return VK_SHADER_STAGE_GEOMETRY_BIT;
case SHADER_TYPE_PIXEL: return VK_SHADER_STAGE_FRAGMENT_BIT;
case SHADER_TYPE_COMPUTE: return VK_SHADER_STAGE_COMPUTE_BIT;
-#ifdef VK_NV_mesh_shader
case SHADER_TYPE_AMPLIFICATION: return VK_SHADER_STAGE_TASK_BIT_NV;
case SHADER_TYPE_MESH: return VK_SHADER_STAGE_MESH_BIT_NV;
-#endif
// clang-format on
default:
UNEXPECTED("Unknown shader type");
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index 949086b8..c5b70426 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -230,10 +230,8 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCoun
case SHADER_TYPE_GEOMETRY: StageCI.stage = VK_SHADER_STAGE_GEOMETRY_BIT; break;
case SHADER_TYPE_PIXEL: StageCI.stage = VK_SHADER_STAGE_FRAGMENT_BIT; break;
case SHADER_TYPE_COMPUTE: StageCI.stage = VK_SHADER_STAGE_COMPUTE_BIT; break;
-#ifdef VK_NV_mesh_shader
case SHADER_TYPE_AMPLIFICATION: StageCI.stage = VK_SHADER_STAGE_TASK_BIT_NV; break;
case SHADER_TYPE_MESH: StageCI.stage = VK_SHADER_STAGE_MESH_BIT_NV; break;
-#endif
default: UNEXPECTED("Unknown shader type");
// clang-format on
}
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
index 2c245dfa..2d679e21 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
@@ -242,12 +242,8 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters*
Features.PixelUAVWritesAndAtomics = GetFeatureState(vkEnabledFeatures.fragmentStoresAndAtomics);
Features.TextureUAVExtendedFormats = GetFeatureState(vkEnabledFeatures.shaderStorageImageExtendedFormats);
-#ifdef VK_NV_mesh_shader
// All devices that support mesh shaders also support task shaders, so it is not necessary to use two separate features.
Features.MeshShaders = GetFeatureState(EngineCI.Features.MeshShaders != DEVICE_FEATURE_STATE_DISABLED && vkExtFeatures.MeshShader.meshShader != VK_FALSE && vkExtFeatures.MeshShader.taskShader != VK_FALSE);
-#else
- Features.MeshShaders = DEVICE_FEATURE_STATE_DISABLED;
-#endif
#if defined(_MSC_VER) && defined(_WIN64)
static_assert(sizeof(DeviceFeatures) == 23, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
index ee6a3709..b978c592 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp
@@ -47,6 +47,8 @@ ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl(IReferenceCounters* pR
m_ShaderResourceCache{ShaderResourceCacheVk::DbgCacheContentType::SRBResources}
// clang-format on
{
+ m_ResourceLayoutIndex.fill(-1);
+
auto* ppShaders = pPSO->GetShaders();
m_NumShaders = static_cast<decltype(m_NumShaders)>(pPSO->GetNumShaders());
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
index a094f014..5e27beb2 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
@@ -115,7 +115,7 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters,
if (m_SPIRV.empty())
{
- LOG_ERROR_AND_THROW("Failed to compile shader");
+ LOG_ERROR_AND_THROW("Failed to compile shader \"", CreationAttribs.Desc.Name, "\"");
}
}
else if (CreationAttribs.ByteCode != nullptr)
diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp
index ead31fe5..a03102d0 100644
--- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp
@@ -148,12 +148,10 @@ VulkanInstance::VulkanInstance(bool EnableValidation,
};
// This extension added to core in 1.1, but current version is 1.0
-#ifdef VK_KHR_get_physical_device_properties2
if (IsExtensionAvailable(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))
{
GlobalExtensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
}
-#endif
if (ppGlobalExtensionNames != nullptr)
{
diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp
index 685492c9..66cf94c2 100644
--- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp
@@ -77,14 +77,14 @@ VulkanPhysicalDevice::VulkanPhysicalDevice(VkPhysicalDevice vkDevice,
(void)NextFeat;
// Enable mesh shader extension.
-# ifdef VK_NV_mesh_shader
if (IsExtensionSupported(VK_NV_MESH_SHADER_EXTENSION_NAME))
{
*NextFeat = &m_ExtFeatures.MeshShader;
NextFeat = &m_ExtFeatures.MeshShader.pNext;
m_ExtFeatures.MeshShader.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV;
}
-# endif
+
+ *NextFeat = nullptr;
// Initialize device extension features by current physical device features.
// Some flags may not be supported by hardware.
diff --git a/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.hpp b/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.hpp
index 90832c3f..7e72cd8a 100644
--- a/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.hpp
+++ b/Graphics/HLSL2GLSLConverterLib/include/HLSL2GLSLConverterImpl.hpp
@@ -38,6 +38,7 @@
#include "Shader.h"
#include "HashUtils.hpp"
#include "HLSLKeywords.h"
+#include "Constants.h"
namespace Diligent
{
@@ -540,7 +541,7 @@ private:
// [fragment, input] SV_Position -> gl_FragCoord
static constexpr int InVar = 0;
static constexpr int OutVar = 1;
- std::unordered_map<HashMapStringKey, String, HashMapStringKey::Hasher> m_HLSLSemanticToGLSLVar[6][2];
+ std::unordered_map<HashMapStringKey, String, HashMapStringKey::Hasher> m_HLSLSemanticToGLSLVar[NUM_SHADER_TYPES][2];
};
} // namespace Diligent