From 42cedb77f0b32719d1a2528c0953ee4dbb3110d8 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 17 Apr 2020 20:25:01 -0400 Subject: [PATCH] Update glslang; fix BOO_HAS_GL on Windows --- CMakeLists.txt | 4 ++++ glslang | 2 +- lib/win/ApplicationWin32.cpp | 4 ++++ lib/win/Win32Common.hpp | 3 ++- lib/win/WindowWin32.cpp | 9 +++++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8127b9e..861ed69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -408,6 +408,10 @@ if(NOT NX) function(glslang_set_link_args TARGET) endfunction(glslang_set_link_args) + # Disable PCH for now + function(glslang_pch SRCS PCHCPP) + endfunction(glslang_pch) + set(ENABLE_SPVREMAPPER On) add_definitions("-DENABLE_OPT=0") add_subdirectory(glslang/glslang) diff --git a/glslang b/glslang index c374030..9f46e3d 160000 --- a/glslang +++ b/glslang @@ -1 +1 @@ -Subproject commit c374030e80604ab5c2a516b3f9dd1e85b05898e4 +Subproject commit 9f46e3dd5e11febbfbed971e74e10ed638e6578d diff --git a/lib/win/ApplicationWin32.cpp b/lib/win/ApplicationWin32.cpp index 400269f..a025a12 100644 --- a/lib/win/ApplicationWin32.cpp +++ b/lib/win/ApplicationWin32.cpp @@ -102,9 +102,11 @@ public: m_3dCtx.m_ctx11.m_sampleCount = samples; m_3dCtx.m_ctx11.m_anisotropy = anisotropy; m_3dCtx.m_ctx11.m_fbFormat = deepColor ? DXGI_FORMAT_R16G16B16A16_FLOAT : DXGI_FORMAT_R8G8B8A8_UNORM; +#if BOO_HAS_GL m_3dCtx.m_ctxOgl.m_glCtx.m_sampleCount = samples; m_3dCtx.m_ctxOgl.m_glCtx.m_anisotropy = anisotropy; m_3dCtx.m_ctxOgl.m_glCtx.m_deepColor = deepColor; +#endif #if BOO_HAS_VULKAN g_VulkanContext.m_sampleCountColor = samples; g_VulkanContext.m_sampleCountDepth = samples; @@ -264,6 +266,7 @@ public: } #endif +#if BOO_HAS_GL /* Finally try OpenGL */ { /* Obtain DXGI Factory */ @@ -274,6 +277,7 @@ public: Log.report(logvisor::Info, FMT_STRING("initialized OpenGL renderer")); return; } +#endif Log.report(logvisor::Fatal, FMT_STRING("system doesn't support Vulkan, D3D11, or OpenGL")); } diff --git a/lib/win/Win32Common.hpp b/lib/win/Win32Common.hpp index c77916a..9ceaa7c 100644 --- a/lib/win/Win32Common.hpp +++ b/lib/win/Win32Common.hpp @@ -45,8 +45,9 @@ struct OGLContext { int m_fsCountDown = 0; }; std::unordered_map m_windows; - +#if BOO_HAS_GL boo::GLContext m_glCtx; +#endif }; #if !WINDOWS_STORE diff --git a/lib/win/WindowWin32.cpp b/lib/win/WindowWin32.cpp index 3d46da7..6317585 100644 --- a/lib/win/WindowWin32.cpp +++ b/lib/win/WindowWin32.cpp @@ -7,8 +7,11 @@ #include "boo/IWindow.hpp" #include "boo/audiodev/IAudioVoiceEngine.hpp" +#include "boo/graphicsdev/IGraphicsCommandQueue.hpp" #include "boo/graphicsdev/D3D.hpp" +#if BOO_HAS_GL #include "boo/graphicsdev/GL.hpp" +#endif #include "boo/graphicsdev/glew.h" #include "boo/graphicsdev/wglew.h" @@ -34,8 +37,10 @@ static logvisor::Module Log("boo::WindowWin32"); std::unique_ptr _NewD3D11CommandQueue(D3D11Context* ctx, D3D11Context::Window* windowCtx, IGraphicsContext* parent); std::unique_ptr _NewD3D11DataFactory(D3D11Context* ctx, IGraphicsContext* parent); +#if BOO_HAS_GL std::unique_ptr _NewGLCommandQueue(IGraphicsContext* parent, GLContext* glCtx); std::unique_ptr _NewGLDataFactory(IGraphicsContext* parent, GLContext* glCtx); +#endif #if BOO_HAS_VULKAN std::unique_ptr _NewVulkanCommandQueue(VulkanContext* ctx, VulkanContext::Window* windowCtx, IGraphicsContext* parent); @@ -122,6 +127,7 @@ public: IGraphicsDataFactory* getLoadContextDataFactory() override { return m_dataFactory.get(); } }; +#if BOO_HAS_GL struct GraphicsContextWin32GL : GraphicsContextWin32 { std::unique_ptr m_dataFactory; std::unique_ptr m_commandQueue; @@ -333,6 +339,7 @@ public: return m_dataFactory.get(); } }; +#endif #if BOO_HAS_VULKAN struct GraphicsContextWin32Vulkan : GraphicsContextWin32 { @@ -871,11 +878,13 @@ public: #endif IGraphicsContext::EGraphicsAPI api = IGraphicsContext::EGraphicsAPI::D3D11; +#if BOO_HAS_GL if (b3dCtx.m_ctxOgl.m_dxFactory) { m_gfxCtx.reset(new GraphicsContextWin32GL(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, m_hwnd, b3dCtx)); m_openGL = true; return; } +#endif m_gfxCtx.reset(new GraphicsContextWin32D3D(api, this, m_hwnd, b3dCtx)); }