summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-07-21 03:49:39 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-07-21 03:49:39 +0000
commit562e84c20aaf8277c76042a40ce9837e86c78d60 (patch)
treea734a50fe15014761a85bb78f8b3585e9dc74750 /Graphics/GraphicsEngineOpenGL
parentAdded CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS enum and IShaderSourceInputStre... (diff)
downloadDiligentCore-562e84c20aaf8277c76042a40ce9837e86c78d60.tar.gz
DiligentCore-562e84c20aaf8277c76042a40ce9837e86c78d60.zip
Added DILIGENT_NO_HLSL CMake option to disable HLSL support in Vulkan and OpenGL backends
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/CMakeLists.txt11
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp10
2 files changed, 17 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
index 2751bbd5..1072d067 100644
--- a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
+++ b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt
@@ -154,19 +154,23 @@ endif()
target_include_directories(Diligent-GraphicsEngineOpenGL-static
PRIVATE
include
- ../HLSL2GLSLConverterLib/include
)
-
set(PRIVATE_DEPENDENCIES
Diligent-BuildSettings
Diligent-Common
Diligent-TargetPlatform
Diligent-GraphicsEngine
Diligent-GLSLTools
- Diligent-HLSL2GLSLConverterLib
)
+if(${DILIGENT_NO_HLSL})
+ message("HLSL support is disabled. OpenGL backend will not be able to consume HLSL source.")
+else()
+ target_include_directories(Diligent-GraphicsEngineOpenGL-static PRIVATE ../HLSL2GLSLConverterLib/include)
+ set(PRIVATE_DEPENDENCIES ${PRIVATE_DEPENDENCIES} Diligent-HLSL2GLSLConverterLib)
+endif()
+
set(PUBLIC_DEPENDENCIES
Diligent-GraphicsEngineOpenGLInterface
)
@@ -244,6 +248,7 @@ PUBLIC
${PUBLIC_DEPENDENCIES}
)
+target_compile_definitions(Diligent-GraphicsEngineOpenGL-static PRIVATE DILIGENT_NO_HLSL=$<BOOL:${DILIGENT_NO_HLSL}>)
target_compile_definitions(Diligent-GraphicsEngineOpenGL-shared PUBLIC ENGINE_DLL=1)
if(PLATFORM_MACOS)
# Silence OpenGL deprecation warnings
diff --git a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
index 88dde5f4..dacd1fe3 100644
--- a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
@@ -33,7 +33,11 @@
#include "RenderDeviceGLImpl.hpp"
#include "DeviceContextGLImpl.hpp"
#include "EngineMemory.h"
-#include "HLSL2GLSLConverterObject.hpp"
+
+#if !DILIGENT_NO_HLSL
+# include "HLSL2GLSLConverterObject.hpp"
+#endif
+
#include "EngineFactoryBase.hpp"
#if PLATFORM_IOS
@@ -273,8 +277,12 @@ GetEngineFactoryOpenGLType LoadGraphicsEngineOpenGL()
void EngineFactoryOpenGLImpl::CreateHLSL2GLSLConverter(IHLSL2GLSLConverter** ppConverter)
{
+#if DILIGENT_NO_HLSL
+ LOG_ERROR_MESSAGE("Unable to create HLSL2GLSL converter: HLSL support is disabled.");
+#else
HLSL2GLSLConverterObject* pConverter(NEW_RC_OBJ(GetRawAllocator(), "HLSL2GLSLConverterObject instance", HLSL2GLSLConverterObject)());
pConverter->QueryInterface(IID_HLSL2GLSLConverter, reinterpret_cast<IObject**>(ppConverter));
+#endif
}
#if PLATFORM_ANDROID