summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-01-09 04:19:13 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-01-09 04:19:13 +0000
commit66cda8480b2ac9956e8a3f55bcdeb29438a11760 (patch)
tree83ffe64ba82db7fed9629bcf06f6765b7b02032b /Graphics/GraphicsEngineVulkan
parentMinor fix (diff)
downloadDiligentCore-66cda8480b2ac9956e8a3f55bcdeb29438a11760.tar.gz
DiligentCore-66cda8480b2ac9956e8a3f55bcdeb29438a11760.zip
Added option to not build glslang
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/CMakeLists.txt11
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp7
-rw-r--r--Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp9
3 files changed, 22 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
index 8189865c..e4be34e3 100644
--- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt
+++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt
@@ -190,9 +190,7 @@ set(PUBLIC_DEPENDENCIES
)
target_link_libraries(GraphicsEngineVk-static PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES})
-
target_link_libraries(GraphicsEngineVk-shared PUBLIC GraphicsEngineVk-static)
-target_compile_definitions(GraphicsEngineVk-shared PUBLIC ENGINE_DLL=1)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -218,8 +216,13 @@ elseif(PLATFORM_IOS)
else()
message(FATAL_ERROR "Unknown platform")
endif()
-target_compile_definitions(GraphicsEngineVk-shared PRIVATE ${PRIVATE_COMPILE_DEFINITIONS})
-target_compile_definitions(GraphicsEngineVk-static PRIVATE ${PRIVATE_COMPILE_DEFINITIONS})
+
+if (${NO_GLSLANG})
+ message("GLSLang is not being built. Vulkan backend will only be able to consume SPIRV byte code.")
+endif()
+
+target_compile_definitions(GraphicsEngineVk-shared PRIVATE ${PRIVATE_COMPILE_DEFINITIONS} ENGINE_DLL=1)
+target_compile_definitions(GraphicsEngineVk-static PRIVATE ${PRIVATE_COMPILE_DEFINITIONS} NO_GLSLANG=$<BOOL:${NO_GLSLANG}>)
if(PLATFORM_WIN32)
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
index 00629544..b0058a8f 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp
@@ -29,7 +29,10 @@
#include "RenderDeviceVkImpl.h"
#include "DataBlobImpl.h"
#include "GLSLSourceBuilder.h"
+
+#if !NO_GLSLANG
#include "SPIRVUtils.h"
+#endif
namespace Diligent
{
@@ -42,6 +45,9 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl*
{
if (CreationAttribs.Source != nullptr || CreationAttribs.FilePath != nullptr)
{
+#if NO_GLSLANG
+ LOG_ERROR_AND_THROW("Diligent engine was not linked with glslang and can only consume compiled SPIRV bytecode.");
+#else
DEV_CHECK_ERR(CreationAttribs.ByteCode == nullptr, "'ByteCode' must be null when shader is created from source code or a file");
DEV_CHECK_ERR(CreationAttribs.ByteCodeSize == 0, "'ByteCodeSize' must be 0 when shader is created from source code or a file");
@@ -59,6 +65,7 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl*
{
LOG_ERROR_AND_THROW("Failed to compile shader");
}
+#endif
}
else if (CreationAttribs.ByteCode != nullptr)
{
diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp
index 4aa776aa..9c884c17 100644
--- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp
@@ -26,7 +26,11 @@
#include "VulkanErrors.h"
#include "VulkanUtilities/VulkanInstance.h"
#include "VulkanUtilities/VulkanDebug.h"
+
+#if !NO_GLSLANG
#include "SPIRVUtils.h"
+#endif
+
#include "PlatformDefinitions.h"
namespace VulkanUtilities
@@ -193,8 +197,9 @@ namespace VulkanUtilities
CHECK_VK_ERROR(err, "Failed to enumerate physical devices");
VERIFY_EXPR(m_PhysicalDevices.size() == PhysicalDeviceCount);
}
-
+#if !NO_GLSLANG
Diligent::InitializeGlslang();
+#endif
}
VulkanInstance::~VulkanInstance()
@@ -205,7 +210,9 @@ namespace VulkanUtilities
}
vkDestroyInstance(m_VkInstance, m_pVkAllocator);
+#if !NO_GLSLANG
Diligent::FinalizeGlslang();
+#endif
}
VkPhysicalDevice VulkanInstance::SelectPhysicalDevice()const