mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 07:35:41 +00:00
GLContext: Rename to OpenGLContext
This commit is contained in:
parent
c1381cfda6
commit
ab83247de3
|
@ -1755,7 +1755,7 @@ static const char* s_log_filters[] = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_OPENGL
|
#ifdef ENABLE_OPENGL
|
||||||
"GL::Context",
|
"OpenGLContext",
|
||||||
"OpenGLDevice",
|
"OpenGLDevice",
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1778,7 +1778,6 @@ static const char* s_log_filters[] = {
|
||||||
"CocoaProgressCallback",
|
"CocoaProgressCallback",
|
||||||
"MetalDevice",
|
"MetalDevice",
|
||||||
#else
|
#else
|
||||||
"ContextEGLWayland",
|
|
||||||
"X11NoGUIPlatform",
|
"X11NoGUIPlatform",
|
||||||
"WaylandNoGUIPlatform",
|
"WaylandNoGUIPlatform",
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -95,8 +95,8 @@ endif()
|
||||||
|
|
||||||
if(ENABLE_OPENGL)
|
if(ENABLE_OPENGL)
|
||||||
target_sources(util PRIVATE
|
target_sources(util PRIVATE
|
||||||
gl/context.cpp
|
opengl_context.cpp
|
||||||
gl/context.h
|
opengl_context.h
|
||||||
opengl_device.cpp
|
opengl_device.cpp
|
||||||
opengl_device.h
|
opengl_device.h
|
||||||
opengl_loader.h
|
opengl_loader.h
|
||||||
|
@ -112,29 +112,29 @@ if(ENABLE_OPENGL)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(util PRIVATE
|
target_sources(util PRIVATE
|
||||||
gl/context_wgl.cpp
|
opengl_context_wgl.cpp
|
||||||
gl/context_wgl.h
|
opengl_context_wgl.h
|
||||||
)
|
)
|
||||||
target_link_libraries(util PRIVATE "opengl32.lib")
|
target_link_libraries(util PRIVATE "opengl32.lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LINUX OR FREEBSD OR ANDROID)
|
if(LINUX OR FREEBSD OR ANDROID)
|
||||||
target_sources(util PRIVATE
|
target_sources(util PRIVATE
|
||||||
gl/context_egl.cpp
|
opengl_context_egl.cpp
|
||||||
gl/context_egl.h
|
opengl_context_egl.h
|
||||||
)
|
)
|
||||||
target_compile_definitions(util PRIVATE "-DENABLE_EGL=1")
|
target_compile_definitions(util PRIVATE "-DENABLE_EGL=1")
|
||||||
|
|
||||||
if(ENABLE_X11)
|
if(ENABLE_X11)
|
||||||
target_sources(util PRIVATE
|
target_sources(util PRIVATE
|
||||||
gl/context_egl_x11.cpp
|
opengl_context_egl_x11.cpp
|
||||||
gl/context_egl_x11.h
|
opengl_context_egl_x11.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_WAYLAND)
|
if(ENABLE_WAYLAND)
|
||||||
target_sources(util PRIVATE
|
target_sources(util PRIVATE
|
||||||
gl/context_egl_wayland.cpp
|
opengl_context_egl_wayland.cpp
|
||||||
gl/context_egl_wayland.h
|
opengl_context_egl_wayland.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
|
@ -144,10 +144,10 @@ if(ENABLE_OPENGL)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_sources(util PRIVATE
|
target_sources(util PRIVATE
|
||||||
gl/context_agl.mm
|
opengl_context_agl.mm
|
||||||
gl/context_agl.h
|
opengl_context_agl.h
|
||||||
)
|
)
|
||||||
set_source_files_properties(gl/context_agl.mm PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
|
set_source_files_properties(opengl_context_agl.mm PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
||||||
|
|
||||||
#include "context_egl_x11.h"
|
|
||||||
|
|
||||||
#include "common/error.h"
|
|
||||||
|
|
||||||
namespace GL {
|
|
||||||
ContextEGLX11::ContextEGLX11(const WindowInfo& wi) : ContextEGL(wi)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
ContextEGLX11::~ContextEGLX11() = default;
|
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextEGLX11::Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
|
||||||
Error* error)
|
|
||||||
{
|
|
||||||
std::unique_ptr<ContextEGLX11> context = std::make_unique<ContextEGLX11>(wi);
|
|
||||||
if (!context->Initialize(versions_to_try, error))
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextEGLX11::CreateSharedContext(const WindowInfo& wi, Error* error)
|
|
||||||
{
|
|
||||||
std::unique_ptr<ContextEGLX11> context = std::make_unique<ContextEGLX11>(wi);
|
|
||||||
context->m_display = m_display;
|
|
||||||
|
|
||||||
if (!context->CreateContextAndSurface(m_version, m_context, false))
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLDisplay ContextEGLX11::GetPlatformDisplay(const EGLAttrib* attribs, Error* error)
|
|
||||||
{
|
|
||||||
EGLDisplay dpy = TryGetPlatformDisplay(EGL_PLATFORM_X11_KHR, attribs);
|
|
||||||
if (dpy == EGL_NO_DISPLAY)
|
|
||||||
dpy = GetFallbackDisplay(error);
|
|
||||||
|
|
||||||
return dpy;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace GL
|
|
|
@ -1,23 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "context_egl.h"
|
|
||||||
|
|
||||||
namespace GL {
|
|
||||||
|
|
||||||
class ContextEGLX11 final : public ContextEGL
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ContextEGLX11(const WindowInfo& wi);
|
|
||||||
~ContextEGLX11() override;
|
|
||||||
|
|
||||||
static std::unique_ptr<Context> Create(const WindowInfo& wi, std::span<const Version> versions_to_try, Error* error);
|
|
||||||
|
|
||||||
std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
EGLDisplay GetPlatformDisplay(const EGLAttrib* attribs, Error* error) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace GL
|
|
|
@ -1,8 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#include "context.h"
|
#include "opengl_context.h"
|
||||||
#include "../opengl_loader.h"
|
#include "opengl_loader.h"
|
||||||
|
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
@ -16,25 +16,23 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_M_ARM64)
|
#if defined(_WIN32) && !defined(_M_ARM64)
|
||||||
#include "context_wgl.h"
|
#include "opengl_context_wgl.h"
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include "context_agl.h"
|
#include "opengl_context_agl.h"
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
#include "context_egl_android.h"
|
#include "opengl_context_egl_android.h"
|
||||||
#else
|
#else
|
||||||
#ifdef ENABLE_EGL
|
#ifdef ENABLE_EGL
|
||||||
#ifdef ENABLE_WAYLAND
|
#ifdef ENABLE_WAYLAND
|
||||||
#include "context_egl_wayland.h"
|
#include "opengl_context_egl_wayland.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_X11
|
#ifdef ENABLE_X11
|
||||||
#include "context_egl_x11.h"
|
#include "opengl_context_egl_x11.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Log_SetChannel(GL::Context);
|
Log_SetChannel(OpenGLContext);
|
||||||
|
|
||||||
namespace GL {
|
|
||||||
|
|
||||||
static bool ShouldPreferESContext()
|
static bool ShouldPreferESContext()
|
||||||
{
|
{
|
||||||
|
@ -107,18 +105,18 @@ static void DisableBrokenExtensions(const char* gl_vendor, const char* gl_render
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::Context(const WindowInfo& wi) : m_wi(wi)
|
OpenGLContext::OpenGLContext(const WindowInfo& wi) : m_wi(wi)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::~Context() = default;
|
OpenGLContext::~OpenGLContext() = default;
|
||||||
|
|
||||||
std::vector<Context::FullscreenModeInfo> Context::EnumerateFullscreenModes()
|
std::vector<OpenGLContext::FullscreenModeInfo> OpenGLContext::EnumerateFullscreenModes()
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, Error* error)
|
std::unique_ptr<OpenGLContext> OpenGLContext::Create(const WindowInfo& wi, Error* error)
|
||||||
{
|
{
|
||||||
static constexpr std::array<Version, 14> vlist = {{{Profile::Core, 4, 6},
|
static constexpr std::array<Version, 14> vlist = {{{Profile::Core, 4, 6},
|
||||||
{Profile::Core, 4, 5},
|
{Profile::Core, 4, 5},
|
||||||
|
@ -154,37 +152,33 @@ std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, Error* error)
|
||||||
versions_to_try = std::span<const Version>(new_versions_to_try, versions_to_try.size());
|
versions_to_try = std::span<const Version>(new_versions_to_try, versions_to_try.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> context;
|
std::unique_ptr<OpenGLContext> context;
|
||||||
Error local_error;
|
|
||||||
#if defined(_WIN32) && !defined(_M_ARM64)
|
#if defined(_WIN32) && !defined(_M_ARM64)
|
||||||
context = ContextWGL::Create(wi, versions_to_try, error ? error : &local_error);
|
context = OpenGLContextWGL::Create(wi, versions_to_try, error);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
context = ContextAGL::Create(wi, versions_to_try);
|
context = OpenGLContextAGL::Create(wi, versions_to_try, error);
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
context = ContextEGLAndroid::Create(wi, versions_to_try, error ? error : &local_error);
|
context = ContextEGLAndroid::Create(wi, versions_to_try, error);
|
||||||
#else
|
#else
|
||||||
#if defined(ENABLE_X11)
|
#if defined(ENABLE_X11)
|
||||||
if (wi.type == WindowInfo::Type::X11)
|
if (wi.type == WindowInfo::Type::X11)
|
||||||
context = ContextEGLX11::Create(wi, versions_to_try, error ? error : &local_error);
|
context = OpenGLContextEGLX11::Create(wi, versions_to_try, error);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ENABLE_WAYLAND)
|
#if defined(ENABLE_WAYLAND)
|
||||||
if (wi.type == WindowInfo::Type::Wayland)
|
if (wi.type == WindowInfo::Type::Wayland)
|
||||||
context = ContextEGLWayland::Create(wi, versions_to_try, error ? error : &local_error);
|
context = OpenGLContextEGLWayland::Create(wi, versions_to_try, error);
|
||||||
#endif
|
#endif
|
||||||
if (wi.type == WindowInfo::Type::Surfaceless)
|
if (wi.type == WindowInfo::Type::Surfaceless)
|
||||||
context = ContextEGL::Create(wi, versions_to_try, error ? error : &local_error);
|
context = OpenGLContextEGL::Create(wi, versions_to_try, error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
{
|
|
||||||
Log_ErrorFmt("Failed to create GL context: {}", (error ? error : &local_error)->GetDescription());
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
Log_InfoPrint(context->IsGLES() ? "Created an OpenGL ES context" : "Created an OpenGL context");
|
Log_InfoPrint(context->IsGLES() ? "Created an OpenGL ES context" : "Created an OpenGL context");
|
||||||
|
|
||||||
// TODO: Not thread-safe.
|
// TODO: Not thread-safe.
|
||||||
static Context* context_being_created;
|
static OpenGLContext* context_being_created;
|
||||||
context_being_created = context.get();
|
context_being_created = context.get();
|
||||||
|
|
||||||
// load up glad
|
// load up glad
|
||||||
|
@ -218,5 +212,3 @@ std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, Error* error)
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GL
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../window_info.h"
|
#include "window_info.h"
|
||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
|
@ -13,12 +13,11 @@
|
||||||
|
|
||||||
class Error;
|
class Error;
|
||||||
|
|
||||||
namespace GL {
|
class OpenGLContext
|
||||||
class Context
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Context(const WindowInfo& wi);
|
OpenGLContext(const WindowInfo& wi);
|
||||||
virtual ~Context();
|
virtual ~OpenGLContext();
|
||||||
|
|
||||||
enum class Profile
|
enum class Profile
|
||||||
{
|
{
|
||||||
|
@ -55,14 +54,13 @@ public:
|
||||||
virtual bool MakeCurrent() = 0;
|
virtual bool MakeCurrent() = 0;
|
||||||
virtual bool DoneCurrent() = 0;
|
virtual bool DoneCurrent() = 0;
|
||||||
virtual bool SetSwapInterval(s32 interval) = 0;
|
virtual bool SetSwapInterval(s32 interval) = 0;
|
||||||
virtual std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi, Error* error) = 0;
|
virtual std::unique_ptr<OpenGLContext> CreateSharedContext(const WindowInfo& wi, Error* error) = 0;
|
||||||
|
|
||||||
virtual std::vector<FullscreenModeInfo> EnumerateFullscreenModes();
|
virtual std::vector<FullscreenModeInfo> EnumerateFullscreenModes();
|
||||||
|
|
||||||
static std::unique_ptr<Context> Create(const WindowInfo& wi, Error* error);
|
static std::unique_ptr<OpenGLContext> Create(const WindowInfo& wi, Error* error);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WindowInfo m_wi;
|
WindowInfo m_wi;
|
||||||
Version m_version = {};
|
Version m_version = {};
|
||||||
};
|
};
|
||||||
} // namespace GL
|
|
|
@ -1,9 +1,10 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../opengl_loader.h"
|
|
||||||
#include "context.h"
|
#include "opengl_context.h"
|
||||||
|
#include "opengl_loader.h"
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__OBJC__)
|
#if defined(__APPLE__) && defined(__OBJC__)
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
@ -14,15 +15,14 @@ struct NSView;
|
||||||
#define __bridge
|
#define __bridge
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace GL {
|
class OpenGLContextAGL final : public OpenGLContext
|
||||||
|
|
||||||
class ContextAGL final : public Context
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ContextAGL(const WindowInfo& wi);
|
OpenGLContextAGL(const WindowInfo& wi);
|
||||||
~ContextAGL() override;
|
~OpenGLContextAGL() override;
|
||||||
|
|
||||||
static std::unique_ptr<Context> Create(const WindowInfo& wi, std::span<const Version> versions_to_try);
|
static std::unique_ptr<OpenGLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
||||||
|
Error* error);
|
||||||
|
|
||||||
void* GetProcAddress(const char* name) override;
|
void* GetProcAddress(const char* name) override;
|
||||||
bool ChangeSurface(const WindowInfo& new_wi) override;
|
bool ChangeSurface(const WindowInfo& new_wi) override;
|
||||||
|
@ -32,13 +32,13 @@ public:
|
||||||
bool MakeCurrent() override;
|
bool MakeCurrent() override;
|
||||||
bool DoneCurrent() override;
|
bool DoneCurrent() override;
|
||||||
bool SetSwapInterval(s32 interval) override;
|
bool SetSwapInterval(s32 interval) override;
|
||||||
std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
std::unique_ptr<OpenGLContext> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ALWAYS_INLINE NSView* GetView() const { return static_cast<NSView*>((__bridge NSView*)m_wi.window_handle); }
|
ALWAYS_INLINE NSView* GetView() const { return static_cast<NSView*>((__bridge NSView*)m_wi.window_handle); }
|
||||||
|
|
||||||
bool Initialize(std::span<const Version> versions_to_try);
|
bool Initialize(std::span<const Version> versions_to_try, Error* error);
|
||||||
bool CreateContext(NSOpenGLContext* share_context, int profile, bool make_current);
|
bool CreateContext(NSOpenGLContext* share_context, int profile, bool make_current, Error* error);
|
||||||
void BindContextToView();
|
void BindContextToView();
|
||||||
|
|
||||||
// returns true if dimensions have changed
|
// returns true if dimensions have changed
|
||||||
|
@ -48,5 +48,3 @@ private:
|
||||||
NSOpenGLPixelFormat* m_pixel_format = nullptr;
|
NSOpenGLPixelFormat* m_pixel_format = nullptr;
|
||||||
void* m_opengl_module_handle = nullptr;
|
void* m_opengl_module_handle = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GL
|
|
|
@ -1,22 +1,24 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#include "context_agl.h"
|
#include "opengl_context_agl.h"
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include <dlfcn.h>
|
|
||||||
Log_SetChannel(GL::Context);
|
|
||||||
|
|
||||||
namespace GL {
|
#include <dlfcn.h>
|
||||||
ContextAGL::ContextAGL(const WindowInfo& wi) : Context(wi)
|
|
||||||
|
Log_SetChannel(OpenGLContext);
|
||||||
|
|
||||||
|
OpenGLContextAGL::OpenGLContextAGL(const WindowInfo& wi) : OpenGLContext(wi)
|
||||||
{
|
{
|
||||||
m_opengl_module_handle = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_NOW);
|
m_opengl_module_handle = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_NOW);
|
||||||
if (!m_opengl_module_handle)
|
if (!m_opengl_module_handle)
|
||||||
Log_ErrorPrint("Could not open OpenGL.framework, function lookups will probably fail");
|
Log_ErrorPrint("Could not open OpenGL.framework, function lookups will probably fail");
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextAGL::~ContextAGL()
|
OpenGLContextAGL::~OpenGLContextAGL()
|
||||||
{
|
{
|
||||||
if ([NSOpenGLContext currentContext] == m_context)
|
if ([NSOpenGLContext currentContext] == m_context)
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
|
@ -31,20 +33,20 @@ ContextAGL::~ContextAGL()
|
||||||
dlclose(m_opengl_module_handle);
|
dlclose(m_opengl_module_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextAGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try)
|
std::unique_ptr<OpenGLContext> OpenGLContextAGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try, Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextAGL> context = std::make_unique<ContextAGL>(wi);
|
std::unique_ptr<OpenGLContextAGL> context = std::make_unique<OpenGLContextAGL>(wi);
|
||||||
if (!context->Initialize(versions_to_try))
|
if (!context->Initialize(versions_to_try, error))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::Initialize(const std::span<const Version> versions_to_try)
|
bool OpenGLContextAGL::Initialize(const std::span<const Version> versions_to_try, Error* error)
|
||||||
{
|
{
|
||||||
for (const Version& cv : versions_to_try)
|
for (const Version& cv : versions_to_try)
|
||||||
{
|
{
|
||||||
if (cv.profile == Profile::NoProfile && CreateContext(nullptr, NSOpenGLProfileVersionLegacy, true))
|
if (cv.profile == Profile::NoProfile && CreateContext(nullptr, NSOpenGLProfileVersionLegacy, true, error))
|
||||||
{
|
{
|
||||||
// we already have the dummy context, so just use that
|
// we already have the dummy context, so just use that
|
||||||
m_version = cv;
|
m_version = cv;
|
||||||
|
@ -57,7 +59,7 @@ bool ContextAGL::Initialize(const std::span<const Version> versions_to_try)
|
||||||
|
|
||||||
const NSOpenGLPixelFormatAttribute profile =
|
const NSOpenGLPixelFormatAttribute profile =
|
||||||
(cv.major_version > 3 || cv.minor_version > 2) ? NSOpenGLProfileVersion4_1Core : NSOpenGLProfileVersion3_2Core;
|
(cv.major_version > 3 || cv.minor_version > 2) ? NSOpenGLProfileVersion4_1Core : NSOpenGLProfileVersion3_2Core;
|
||||||
if (CreateContext(nullptr, static_cast<int>(profile), true))
|
if (CreateContext(nullptr, static_cast<int>(profile), true, error))
|
||||||
{
|
{
|
||||||
m_version = cv;
|
m_version = cv;
|
||||||
return true;
|
return true;
|
||||||
|
@ -65,10 +67,11 @@ bool ContextAGL::Initialize(const std::span<const Version> versions_to_try)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Error::SetStringView(error, "Failed to create any context versions.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ContextAGL::GetProcAddress(const char* name)
|
void* OpenGLContextAGL::GetProcAddress(const char* name)
|
||||||
{
|
{
|
||||||
void* addr = m_opengl_module_handle ? dlsym(m_opengl_module_handle, name) : nullptr;
|
void* addr = m_opengl_module_handle ? dlsym(m_opengl_module_handle, name) : nullptr;
|
||||||
if (addr)
|
if (addr)
|
||||||
|
@ -77,19 +80,19 @@ void* ContextAGL::GetProcAddress(const char* name)
|
||||||
return dlsym(RTLD_NEXT, name);
|
return dlsym(RTLD_NEXT, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::ChangeSurface(const WindowInfo& new_wi)
|
bool OpenGLContextAGL::ChangeSurface(const WindowInfo& new_wi)
|
||||||
{
|
{
|
||||||
m_wi = new_wi;
|
m_wi = new_wi;
|
||||||
BindContextToView();
|
BindContextToView();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextAGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/)
|
void OpenGLContextAGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/)
|
||||||
{
|
{
|
||||||
UpdateDimensions();
|
UpdateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::UpdateDimensions()
|
bool OpenGLContextAGL::UpdateDimensions()
|
||||||
{
|
{
|
||||||
const NSSize window_size = [GetView() frame].size;
|
const NSSize window_size = [GetView() frame].size;
|
||||||
const CGFloat window_scale = [[GetView() window] backingScaleFactor];
|
const CGFloat window_scale = [[GetView() window] backingScaleFactor];
|
||||||
|
@ -114,39 +117,39 @@ bool ContextAGL::UpdateDimensions()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::SwapBuffers()
|
bool OpenGLContextAGL::SwapBuffers()
|
||||||
{
|
{
|
||||||
[m_context flushBuffer];
|
[m_context flushBuffer];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::IsCurrent()
|
bool OpenGLContextAGL::IsCurrent()
|
||||||
{
|
{
|
||||||
return (m_context != nil && [NSOpenGLContext currentContext] == m_context);
|
return (m_context != nil && [NSOpenGLContext currentContext] == m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::MakeCurrent()
|
bool OpenGLContextAGL::MakeCurrent()
|
||||||
{
|
{
|
||||||
[m_context makeCurrentContext];
|
[m_context makeCurrentContext];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::DoneCurrent()
|
bool OpenGLContextAGL::DoneCurrent()
|
||||||
{
|
{
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::SetSwapInterval(s32 interval)
|
bool OpenGLContextAGL::SetSwapInterval(s32 interval)
|
||||||
{
|
{
|
||||||
GLint gl_interval = static_cast<GLint>(interval);
|
GLint gl_interval = static_cast<GLint>(interval);
|
||||||
[m_context setValues:&gl_interval forParameter:NSOpenGLCPSwapInterval];
|
[m_context setValues:&gl_interval forParameter:NSOpenGLCPSwapInterval];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextAGL::CreateSharedContext(const WindowInfo& wi, Error* error)
|
std::unique_ptr<OpenGLContext> OpenGLContextAGL::CreateSharedContext(const WindowInfo& wi, Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextAGL> context = std::make_unique<ContextAGL>(wi);
|
std::unique_ptr<OpenGLContextAGL> context = std::make_unique<OpenGLContextAGL>(wi);
|
||||||
|
|
||||||
context->m_context = [[NSOpenGLContext alloc] initWithFormat:m_pixel_format shareContext:m_context];
|
context->m_context = [[NSOpenGLContext alloc] initWithFormat:m_pixel_format shareContext:m_context];
|
||||||
if (context->m_context == nil)
|
if (context->m_context == nil)
|
||||||
|
@ -165,7 +168,7 @@ std::unique_ptr<Context> ContextAGL::CreateSharedContext(const WindowInfo& wi, E
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextAGL::CreateContext(NSOpenGLContext* share_context, int profile, bool make_current)
|
bool OpenGLContextAGL::CreateContext(NSOpenGLContext* share_context, int profile, bool make_current, Error* error)
|
||||||
{
|
{
|
||||||
if (m_context)
|
if (m_context)
|
||||||
{
|
{
|
||||||
|
@ -182,13 +185,16 @@ bool ContextAGL::CreateContext(NSOpenGLContext* share_context, int profile, bool
|
||||||
m_pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs.data()];
|
m_pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs.data()];
|
||||||
if (m_pixel_format == nil)
|
if (m_pixel_format == nil)
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("Failed to initialize pixel format");
|
Error::SetStringView(error, "Failed to initialize pixel format");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_context = [[NSOpenGLContext alloc] initWithFormat:m_pixel_format shareContext:nil];
|
m_context = [[NSOpenGLContext alloc] initWithFormat:m_pixel_format shareContext:nil];
|
||||||
if (m_context == nil)
|
if (m_context == nil)
|
||||||
|
{
|
||||||
|
Error::SetStringView(error, "NSOpenGLContext initWithFormat failed");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_wi.type == WindowInfo::Type::MacOS)
|
if (m_wi.type == WindowInfo::Type::MacOS)
|
||||||
BindContextToView();
|
BindContextToView();
|
||||||
|
@ -199,7 +205,7 @@ bool ContextAGL::CreateContext(NSOpenGLContext* share_context, int profile, bool
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextAGL::BindContextToView()
|
void OpenGLContextAGL::BindContextToView()
|
||||||
{
|
{
|
||||||
NSView* const view = GetView();
|
NSView* const view = GetView();
|
||||||
NSWindow* const window = [view window];
|
NSWindow* const window = [view window];
|
||||||
|
@ -218,4 +224,3 @@ void ContextAGL::BindContextToView()
|
||||||
else
|
else
|
||||||
dispatch_sync(dispatch_get_main_queue(), block);
|
dispatch_sync(dispatch_get_main_queue(), block);
|
||||||
}
|
}
|
||||||
} // namespace GL
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#include "context_egl.h"
|
#include "opengl_context_egl.h"
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/dynamic_library.h"
|
#include "common/dynamic_library.h"
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
Log_SetChannel(GL::Context);
|
Log_SetChannel(OpenGLContext);
|
||||||
|
|
||||||
static DynamicLibrary s_egl_library;
|
static DynamicLibrary s_egl_library;
|
||||||
static std::atomic_uint32_t s_egl_refcount = 0;
|
static std::atomic_uint32_t s_egl_refcount = 0;
|
||||||
|
@ -77,30 +77,29 @@ static std::vector<EGLint> EGLAttribToInt(const EGLAttrib* attribs)
|
||||||
return int_attribs;
|
return int_attribs;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace GL {
|
OpenGLContextEGL::OpenGLContextEGL(const WindowInfo& wi) : OpenGLContext(wi)
|
||||||
ContextEGL::ContextEGL(const WindowInfo& wi) : Context(wi)
|
|
||||||
{
|
{
|
||||||
LoadEGL();
|
LoadEGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextEGL::~ContextEGL()
|
OpenGLContextEGL::~OpenGLContextEGL()
|
||||||
{
|
{
|
||||||
DestroySurface();
|
DestroySurface();
|
||||||
DestroyContext();
|
DestroyContext();
|
||||||
UnloadEGL();
|
UnloadEGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextEGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
std::unique_ptr<OpenGLContext> OpenGLContextEGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
||||||
Error* error)
|
Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextEGL> context = std::make_unique<ContextEGL>(wi);
|
std::unique_ptr<OpenGLContextEGL> context = std::make_unique<OpenGLContextEGL>(wi);
|
||||||
if (!context->Initialize(versions_to_try, error))
|
if (!context->Initialize(versions_to_try, error))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::Initialize(std::span<const Version> versions_to_try, Error* error)
|
bool OpenGLContextEGL::Initialize(std::span<const Version> versions_to_try, Error* error)
|
||||||
{
|
{
|
||||||
if (!LoadGLADEGL(EGL_NO_DISPLAY, error))
|
if (!LoadGLADEGL(EGL_NO_DISPLAY, error))
|
||||||
return false;
|
return false;
|
||||||
|
@ -136,7 +135,7 @@ bool ContextEGL::Initialize(std::span<const Version> versions_to_try, Error* err
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLDisplay ContextEGL::GetPlatformDisplay(const EGLAttrib* attribs, Error* error)
|
EGLDisplay OpenGLContextEGL::GetPlatformDisplay(const EGLAttrib* attribs, Error* error)
|
||||||
{
|
{
|
||||||
EGLDisplay dpy = TryGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, attribs);
|
EGLDisplay dpy = TryGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, attribs);
|
||||||
if (dpy == EGL_NO_DISPLAY)
|
if (dpy == EGL_NO_DISPLAY)
|
||||||
|
@ -145,7 +144,7 @@ EGLDisplay ContextEGL::GetPlatformDisplay(const EGLAttrib* attribs, Error* error
|
||||||
return dpy;
|
return dpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLDisplay ContextEGL::TryGetPlatformDisplay(EGLenum platform, const EGLAttrib* attribs)
|
EGLDisplay OpenGLContextEGL::TryGetPlatformDisplay(EGLenum platform, const EGLAttrib* attribs)
|
||||||
{
|
{
|
||||||
const char* extensions_str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
const char* extensions_str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||||
if (!extensions_str)
|
if (!extensions_str)
|
||||||
|
@ -203,7 +202,7 @@ EGLDisplay ContextEGL::TryGetPlatformDisplay(EGLenum platform, const EGLAttrib*
|
||||||
return dpy;
|
return dpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLDisplay ContextEGL::GetFallbackDisplay(Error* error)
|
EGLDisplay OpenGLContextEGL::GetFallbackDisplay(Error* error)
|
||||||
{
|
{
|
||||||
Log_WarningPrint("Using fallback eglGetDisplay() path.");
|
Log_WarningPrint("Using fallback eglGetDisplay() path.");
|
||||||
EGLDisplay dpy = eglGetDisplay(m_wi.display_connection);
|
EGLDisplay dpy = eglGetDisplay(m_wi.display_connection);
|
||||||
|
@ -216,7 +215,7 @@ EGLDisplay ContextEGL::GetFallbackDisplay(Error* error)
|
||||||
return dpy;
|
return dpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLSurface ContextEGL::CreatePlatformSurface(EGLConfig config, const EGLAttrib* attribs, Error* error)
|
EGLSurface OpenGLContextEGL::CreatePlatformSurface(EGLConfig config, const EGLAttrib* attribs, Error* error)
|
||||||
{
|
{
|
||||||
EGLSurface surface = EGL_NO_SURFACE;
|
EGLSurface surface = EGL_NO_SURFACE;
|
||||||
if (GLAD_EGL_VERSION_1_5)
|
if (GLAD_EGL_VERSION_1_5)
|
||||||
|
@ -234,7 +233,7 @@ EGLSurface ContextEGL::CreatePlatformSurface(EGLConfig config, const EGLAttrib*
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLSurface ContextEGL::CreateFallbackSurface(EGLConfig config, const EGLAttrib* attribs, void* win, Error* error)
|
EGLSurface OpenGLContextEGL::CreateFallbackSurface(EGLConfig config, const EGLAttrib* attribs, void* win, Error* error)
|
||||||
{
|
{
|
||||||
Log_WarningPrint("Using fallback eglCreateWindowSurface() path.");
|
Log_WarningPrint("Using fallback eglCreateWindowSurface() path.");
|
||||||
|
|
||||||
|
@ -251,12 +250,12 @@ EGLSurface ContextEGL::CreateFallbackSurface(EGLConfig config, const EGLAttrib*
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ContextEGL::GetProcAddress(const char* name)
|
void* OpenGLContextEGL::GetProcAddress(const char* name)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<void*>(eglGetProcAddress(name));
|
return reinterpret_cast<void*>(eglGetProcAddress(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::ChangeSurface(const WindowInfo& new_wi)
|
bool OpenGLContextEGL::ChangeSurface(const WindowInfo& new_wi)
|
||||||
{
|
{
|
||||||
const bool was_current = (eglGetCurrentContext() == m_context);
|
const bool was_current = (eglGetCurrentContext() == m_context);
|
||||||
if (was_current)
|
if (was_current)
|
||||||
|
@ -281,7 +280,7 @@ bool ContextEGL::ChangeSurface(const WindowInfo& new_wi)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextEGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/)
|
void OpenGLContextEGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/)
|
||||||
{
|
{
|
||||||
if (new_surface_width == 0 && new_surface_height == 0)
|
if (new_surface_width == 0 && new_surface_height == 0)
|
||||||
{
|
{
|
||||||
|
@ -303,17 +302,17 @@ void ContextEGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_he
|
||||||
m_wi.surface_height = new_surface_height;
|
m_wi.surface_height = new_surface_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::SwapBuffers()
|
bool OpenGLContextEGL::SwapBuffers()
|
||||||
{
|
{
|
||||||
return eglSwapBuffers(m_display, m_surface);
|
return eglSwapBuffers(m_display, m_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::IsCurrent()
|
bool OpenGLContextEGL::IsCurrent()
|
||||||
{
|
{
|
||||||
return m_context && eglGetCurrentContext() == m_context;
|
return m_context && eglGetCurrentContext() == m_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::MakeCurrent()
|
bool OpenGLContextEGL::MakeCurrent()
|
||||||
{
|
{
|
||||||
if (!eglMakeCurrent(m_display, m_surface, m_surface, m_context))
|
if (!eglMakeCurrent(m_display, m_surface, m_surface, m_context))
|
||||||
{
|
{
|
||||||
|
@ -324,19 +323,19 @@ bool ContextEGL::MakeCurrent()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::DoneCurrent()
|
bool OpenGLContextEGL::DoneCurrent()
|
||||||
{
|
{
|
||||||
return eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
return eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::SetSwapInterval(s32 interval)
|
bool OpenGLContextEGL::SetSwapInterval(s32 interval)
|
||||||
{
|
{
|
||||||
return eglSwapInterval(m_display, interval);
|
return eglSwapInterval(m_display, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextEGL::CreateSharedContext(const WindowInfo& wi, Error* error)
|
std::unique_ptr<OpenGLContext> OpenGLContextEGL::CreateSharedContext(const WindowInfo& wi, Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextEGL> context = std::make_unique<ContextEGL>(wi);
|
std::unique_ptr<OpenGLContextEGL> context = std::make_unique<OpenGLContextEGL>(wi);
|
||||||
context->m_display = m_display;
|
context->m_display = m_display;
|
||||||
|
|
||||||
if (!context->CreateContextAndSurface(m_version, m_context, false))
|
if (!context->CreateContextAndSurface(m_version, m_context, false))
|
||||||
|
@ -348,7 +347,7 @@ std::unique_ptr<Context> ContextEGL::CreateSharedContext(const WindowInfo& wi, E
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::CreateSurface()
|
bool OpenGLContextEGL::CreateSurface()
|
||||||
{
|
{
|
||||||
if (m_wi.type == WindowInfo::Type::Surfaceless)
|
if (m_wi.type == WindowInfo::Type::Surfaceless)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +383,7 @@ bool ContextEGL::CreateSurface()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::CreatePBufferSurface()
|
bool OpenGLContextEGL::CreatePBufferSurface()
|
||||||
{
|
{
|
||||||
const u32 width = std::max<u32>(m_wi.surface_width, 1);
|
const u32 width = std::max<u32>(m_wi.surface_width, 1);
|
||||||
const u32 height = std::max<u32>(m_wi.surface_height, 1);
|
const u32 height = std::max<u32>(m_wi.surface_height, 1);
|
||||||
|
@ -407,7 +406,7 @@ bool ContextEGL::CreatePBufferSurface()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::CheckConfigSurfaceFormat(EGLConfig config, GPUTexture::Format format)
|
bool OpenGLContextEGL::CheckConfigSurfaceFormat(EGLConfig config, GPUTexture::Format format)
|
||||||
{
|
{
|
||||||
int red_size, green_size, blue_size, alpha_size;
|
int red_size, green_size, blue_size, alpha_size;
|
||||||
if (!eglGetConfigAttrib(m_display, config, EGL_RED_SIZE, &red_size) ||
|
if (!eglGetConfigAttrib(m_display, config, EGL_RED_SIZE, &red_size) ||
|
||||||
|
@ -437,7 +436,7 @@ bool ContextEGL::CheckConfigSurfaceFormat(EGLConfig config, GPUTexture::Format f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUTexture::Format ContextEGL::GetSurfaceTextureFormat() const
|
GPUTexture::Format OpenGLContextEGL::GetSurfaceTextureFormat() const
|
||||||
{
|
{
|
||||||
int red_size = 0, green_size = 0, blue_size = 0, alpha_size = 0;
|
int red_size = 0, green_size = 0, blue_size = 0, alpha_size = 0;
|
||||||
eglGetConfigAttrib(m_display, m_config, EGL_RED_SIZE, &red_size);
|
eglGetConfigAttrib(m_display, m_config, EGL_RED_SIZE, &red_size);
|
||||||
|
@ -464,7 +463,7 @@ GPUTexture::Format ContextEGL::GetSurfaceTextureFormat() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextEGL::DestroyContext()
|
void OpenGLContextEGL::DestroyContext()
|
||||||
{
|
{
|
||||||
if (eglGetCurrentContext() == m_context)
|
if (eglGetCurrentContext() == m_context)
|
||||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
@ -476,7 +475,7 @@ void ContextEGL::DestroyContext()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextEGL::DestroySurface()
|
void OpenGLContextEGL::DestroySurface()
|
||||||
{
|
{
|
||||||
if (eglGetCurrentSurface(EGL_DRAW) == m_surface)
|
if (eglGetCurrentSurface(EGL_DRAW) == m_surface)
|
||||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
@ -488,11 +487,12 @@ void ContextEGL::DestroySurface()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::CreateContext(const Version& version, EGLContext share_context)
|
bool OpenGLContextEGL::CreateContext(const Version& version, EGLContext share_context)
|
||||||
{
|
{
|
||||||
Log_DevPrintf(
|
Log_DevPrintf("Trying version %u.%u (%s)", version.major_version, version.minor_version,
|
||||||
"Trying version %u.%u (%s)", version.major_version, version.minor_version,
|
version.profile == OpenGLContext::Profile::ES ?
|
||||||
version.profile == Context::Profile::ES ? "ES" : (version.profile == Context::Profile::Core ? "Core" : "None"));
|
"ES" :
|
||||||
|
(version.profile == OpenGLContext::Profile::Core ? "Core" : "None"));
|
||||||
int surface_attribs[16] = {
|
int surface_attribs[16] = {
|
||||||
EGL_RENDERABLE_TYPE,
|
EGL_RENDERABLE_TYPE,
|
||||||
(version.profile == Profile::ES) ?
|
(version.profile == Profile::ES) ?
|
||||||
|
@ -600,16 +600,17 @@ bool ContextEGL::CreateContext(const Version& version, EGLContext share_context)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log_InfoPrintf(
|
Log_InfoPrintf("Got version %u.%u (%s)", version.major_version, version.minor_version,
|
||||||
"Got version %u.%u (%s)", version.major_version, version.minor_version,
|
version.profile == OpenGLContext::Profile::ES ?
|
||||||
version.profile == Context::Profile::ES ? "ES" : (version.profile == Context::Profile::Core ? "Core" : "None"));
|
"ES" :
|
||||||
|
(version.profile == OpenGLContext::Profile::Core ? "Core" : "None"));
|
||||||
|
|
||||||
m_config = config.value();
|
m_config = config.value();
|
||||||
m_version = version;
|
m_version = version;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGL::CreateContextAndSurface(const Version& version, EGLContext share_context, bool make_current)
|
bool OpenGLContextEGL::CreateContextAndSurface(const Version& version, EGLContext share_context, bool make_current)
|
||||||
{
|
{
|
||||||
if (!CreateContext(version, share_context))
|
if (!CreateContext(version, share_context))
|
||||||
return false;
|
return false;
|
||||||
|
@ -637,4 +638,3 @@ bool ContextEGL::CreateContextAndSurface(const Version& version, EGLContext shar
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // namespace GL
|
|
|
@ -3,19 +3,18 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "context.h"
|
#include "opengl_context.h"
|
||||||
|
|
||||||
#include "glad/egl.h"
|
#include "glad/egl.h"
|
||||||
|
|
||||||
namespace GL {
|
class OpenGLContextEGL : public OpenGLContext
|
||||||
|
|
||||||
class ContextEGL : public Context
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ContextEGL(const WindowInfo& wi);
|
OpenGLContextEGL(const WindowInfo& wi);
|
||||||
~ContextEGL() override;
|
~OpenGLContextEGL() override;
|
||||||
|
|
||||||
static std::unique_ptr<Context> Create(const WindowInfo& wi, std::span<const Version> versions_to_try, Error* error);
|
static std::unique_ptr<OpenGLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
||||||
|
Error* error);
|
||||||
|
|
||||||
void* GetProcAddress(const char* name) override;
|
void* GetProcAddress(const char* name) override;
|
||||||
virtual bool ChangeSurface(const WindowInfo& new_wi) override;
|
virtual bool ChangeSurface(const WindowInfo& new_wi) override;
|
||||||
|
@ -25,7 +24,7 @@ public:
|
||||||
bool MakeCurrent() override;
|
bool MakeCurrent() override;
|
||||||
bool DoneCurrent() override;
|
bool DoneCurrent() override;
|
||||||
bool SetSwapInterval(s32 interval) override;
|
bool SetSwapInterval(s32 interval) override;
|
||||||
virtual std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
virtual std::unique_ptr<OpenGLContext> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual EGLDisplay GetPlatformDisplay(const EGLAttrib* attribs, Error* error);
|
virtual EGLDisplay GetPlatformDisplay(const EGLAttrib* attribs, Error* error);
|
||||||
|
@ -36,7 +35,6 @@ protected:
|
||||||
EGLSurface CreateFallbackSurface(EGLConfig config, const EGLAttrib* attribs, void* window, Error* error);
|
EGLSurface CreateFallbackSurface(EGLConfig config, const EGLAttrib* attribs, void* window, Error* error);
|
||||||
|
|
||||||
bool Initialize(std::span<const Version> versions_to_try, Error* error);
|
bool Initialize(std::span<const Version> versions_to_try, Error* error);
|
||||||
bool CreateDisplay();
|
|
||||||
bool CreateContext(const Version& version, EGLContext share_context);
|
bool CreateContext(const Version& version, EGLContext share_context);
|
||||||
bool CreateContextAndSurface(const Version& version, EGLContext share_context, bool make_current);
|
bool CreateContextAndSurface(const Version& version, EGLContext share_context, bool make_current);
|
||||||
bool CreateSurface();
|
bool CreateSurface();
|
||||||
|
@ -52,5 +50,3 @@ protected:
|
||||||
|
|
||||||
EGLConfig m_config = {};
|
EGLConfig m_config = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GL
|
|
|
@ -1,22 +1,19 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#include "context_egl_wayland.h"
|
#include "opengl_context_egl_wayland.h"
|
||||||
|
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/log.h"
|
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
Log_SetChannel(ContextEGL);
|
|
||||||
|
|
||||||
namespace GL {
|
|
||||||
static const char* WAYLAND_EGL_MODNAME = "libwayland-egl.so.1";
|
static const char* WAYLAND_EGL_MODNAME = "libwayland-egl.so.1";
|
||||||
|
|
||||||
ContextEGLWayland::ContextEGLWayland(const WindowInfo& wi) : ContextEGL(wi)
|
OpenGLContextEGLWayland::OpenGLContextEGLWayland(const WindowInfo& wi) : OpenGLContextEGL(wi)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ContextEGLWayland::~ContextEGLWayland()
|
|
||||||
|
OpenGLContextEGLWayland::~OpenGLContextEGLWayland()
|
||||||
{
|
{
|
||||||
if (m_wl_window)
|
if (m_wl_window)
|
||||||
m_wl_egl_window_destroy(m_wl_window);
|
m_wl_egl_window_destroy(m_wl_window);
|
||||||
|
@ -24,36 +21,36 @@ ContextEGLWayland::~ContextEGLWayland()
|
||||||
dlclose(m_wl_module);
|
dlclose(m_wl_module);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextEGLWayland::Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
std::unique_ptr<OpenGLContext> OpenGLContextEGLWayland::Create(const WindowInfo& wi,
|
||||||
Error* error)
|
std::span<const Version> versions_to_try, Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextEGLWayland> context = std::make_unique<ContextEGLWayland>(wi);
|
std::unique_ptr<OpenGLContextEGLWayland> context = std::make_unique<OpenGLContextEGLWayland>(wi);
|
||||||
if (!context->LoadModule() || !context->Initialize(versions_to_try, error))
|
if (!context->LoadModule(error) || !context->Initialize(versions_to_try, error))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextEGLWayland::CreateSharedContext(const WindowInfo& wi, Error* error)
|
std::unique_ptr<OpenGLContext> OpenGLContextEGLWayland::CreateSharedContext(const WindowInfo& wi, Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextEGLWayland> context = std::make_unique<ContextEGLWayland>(wi);
|
std::unique_ptr<OpenGLContextEGLWayland> context = std::make_unique<OpenGLContextEGLWayland>(wi);
|
||||||
context->m_display = m_display;
|
context->m_display = m_display;
|
||||||
|
|
||||||
if (!context->LoadModule() || !context->CreateContextAndSurface(m_version, m_context, false))
|
if (!context->LoadModule(error) || !context->CreateContextAndSurface(m_version, m_context, false))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextEGLWayland::ResizeSurface(u32 new_surface_width, u32 new_surface_height)
|
void OpenGLContextEGLWayland::ResizeSurface(u32 new_surface_width, u32 new_surface_height)
|
||||||
{
|
{
|
||||||
if (m_wl_window)
|
if (m_wl_window)
|
||||||
m_wl_egl_window_resize(m_wl_window, new_surface_width, new_surface_height, 0, 0);
|
m_wl_egl_window_resize(m_wl_window, new_surface_width, new_surface_height, 0, 0);
|
||||||
|
|
||||||
ContextEGL::ResizeSurface(new_surface_width, new_surface_height);
|
OpenGLContextEGL::ResizeSurface(new_surface_width, new_surface_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLDisplay ContextEGLWayland::GetPlatformDisplay(const EGLAttrib* attribs, Error* error)
|
EGLDisplay OpenGLContextEGLWayland::GetPlatformDisplay(const EGLAttrib* attribs, Error* error)
|
||||||
{
|
{
|
||||||
EGLDisplay dpy = TryGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, attribs);
|
EGLDisplay dpy = TryGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, attribs);
|
||||||
if (dpy == EGL_NO_DISPLAY)
|
if (dpy == EGL_NO_DISPLAY)
|
||||||
|
@ -62,7 +59,7 @@ EGLDisplay ContextEGLWayland::GetPlatformDisplay(const EGLAttrib* attribs, Error
|
||||||
return dpy;
|
return dpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLSurface ContextEGLWayland::CreatePlatformSurface(EGLConfig config, const EGLAttrib* attribs, Error* error)
|
EGLSurface OpenGLContextEGLWayland::CreatePlatformSurface(EGLConfig config, const EGLAttrib* attribs, Error* error)
|
||||||
{
|
{
|
||||||
if (m_wl_window)
|
if (m_wl_window)
|
||||||
{
|
{
|
||||||
|
@ -100,12 +97,13 @@ EGLSurface ContextEGLWayland::CreatePlatformSurface(EGLConfig config, const EGLA
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextEGLWayland::LoadModule()
|
bool OpenGLContextEGLWayland::LoadModule(Error* error)
|
||||||
{
|
{
|
||||||
m_wl_module = dlopen(WAYLAND_EGL_MODNAME, RTLD_NOW | RTLD_GLOBAL);
|
m_wl_module = dlopen(WAYLAND_EGL_MODNAME, RTLD_NOW | RTLD_GLOBAL);
|
||||||
if (!m_wl_module)
|
if (!m_wl_module)
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("Failed to load %s.", WAYLAND_EGL_MODNAME);
|
const char* err = dlerror();
|
||||||
|
Error::SetStringFmt(error, "Loading {} failed: {}", WAYLAND_EGL_MODNAME, err ? err : "<UNKNOWN>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,10 +115,9 @@ bool ContextEGLWayland::LoadModule()
|
||||||
reinterpret_cast<decltype(m_wl_egl_window_resize)>(dlsym(m_wl_module, "wl_egl_window_resize"));
|
reinterpret_cast<decltype(m_wl_egl_window_resize)>(dlsym(m_wl_module, "wl_egl_window_resize"));
|
||||||
if (!m_wl_egl_window_create || !m_wl_egl_window_destroy || !m_wl_egl_window_resize)
|
if (!m_wl_egl_window_create || !m_wl_egl_window_destroy || !m_wl_egl_window_resize)
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("Failed to load one or more functions from %s.", WAYLAND_EGL_MODNAME);
|
Error::SetStringFmt(error, "Failed to load one or more functions from {}.", WAYLAND_EGL_MODNAME);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // namespace GL
|
|
|
@ -2,20 +2,21 @@
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "context_egl.h"
|
|
||||||
|
#include "opengl_context_egl.h"
|
||||||
|
|
||||||
#include <wayland-egl.h>
|
#include <wayland-egl.h>
|
||||||
|
|
||||||
namespace GL {
|
class OpenGLContextEGLWayland final : public OpenGLContextEGL
|
||||||
|
|
||||||
class ContextEGLWayland final : public ContextEGL
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ContextEGLWayland(const WindowInfo& wi);
|
OpenGLContextEGLWayland(const WindowInfo& wi);
|
||||||
~ContextEGLWayland() override;
|
~OpenGLContextEGLWayland() override;
|
||||||
|
|
||||||
static std::unique_ptr<Context> Create(const WindowInfo& wi, std::span<const Version> versions_to_try, Error* error);
|
static std::unique_ptr<OpenGLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
||||||
|
Error* error);
|
||||||
|
|
||||||
std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
std::unique_ptr<OpenGLContext> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
||||||
void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override;
|
void ResizeSurface(u32 new_surface_width = 0, u32 new_surface_height = 0) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -23,7 +24,7 @@ protected:
|
||||||
EGLSurface CreatePlatformSurface(EGLConfig config, const EGLAttrib* attribs, Error* error) override;
|
EGLSurface CreatePlatformSurface(EGLConfig config, const EGLAttrib* attribs, Error* error) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool LoadModule();
|
bool LoadModule(Error* error);
|
||||||
|
|
||||||
wl_egl_window* m_wl_window = nullptr;
|
wl_egl_window* m_wl_window = nullptr;
|
||||||
|
|
||||||
|
@ -32,5 +33,3 @@ private:
|
||||||
void (*m_wl_egl_window_destroy)(struct wl_egl_window* egl_window);
|
void (*m_wl_egl_window_destroy)(struct wl_egl_window* egl_window);
|
||||||
void (*m_wl_egl_window_resize)(struct wl_egl_window* egl_window, int width, int height, int dx, int dy);
|
void (*m_wl_egl_window_resize)(struct wl_egl_window* egl_window, int width, int height, int dx, int dy);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GL
|
|
42
src/util/opengl_context_egl_x11.cpp
Normal file
42
src/util/opengl_context_egl_x11.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
|
#include "opengl_context_egl_x11.h"
|
||||||
|
|
||||||
|
#include "common/error.h"
|
||||||
|
|
||||||
|
OpenGLContextEGLX11::OpenGLContextEGLX11(const WindowInfo& wi) : OpenGLContextEGL(wi)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenGLContextEGLX11::~OpenGLContextEGLX11() = default;
|
||||||
|
|
||||||
|
std::unique_ptr<OpenGLContext> OpenGLContextEGLX11::Create(const WindowInfo& wi,
|
||||||
|
std::span<const Version> versions_to_try, Error* error)
|
||||||
|
{
|
||||||
|
std::unique_ptr<OpenGLContextEGLX11> context = std::make_unique<OpenGLContextEGLX11>(wi);
|
||||||
|
if (!context->Initialize(versions_to_try, error))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<OpenGLContext> OpenGLContextEGLX11::CreateSharedContext(const WindowInfo& wi, Error* error)
|
||||||
|
{
|
||||||
|
std::unique_ptr<OpenGLContextEGLX11> context = std::make_unique<OpenGLContextEGLX11>(wi);
|
||||||
|
context->m_display = m_display;
|
||||||
|
|
||||||
|
if (!context->CreateContextAndSurface(m_version, m_context, false))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
EGLDisplay OpenGLContextEGLX11::GetPlatformDisplay(const EGLAttrib* attribs, Error* error)
|
||||||
|
{
|
||||||
|
EGLDisplay dpy = TryGetPlatformDisplay(EGL_PLATFORM_X11_KHR, attribs);
|
||||||
|
if (dpy == EGL_NO_DISPLAY)
|
||||||
|
dpy = GetFallbackDisplay(error);
|
||||||
|
|
||||||
|
return dpy;
|
||||||
|
}
|
21
src/util/opengl_context_egl_x11.h
Normal file
21
src/util/opengl_context_egl_x11.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "opengl_context_egl.h"
|
||||||
|
|
||||||
|
class OpenGLContextEGLX11 final : public OpenGLContextEGL
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpenGLContextEGLX11(const WindowInfo& wi);
|
||||||
|
~OpenGLContextEGLX11() override;
|
||||||
|
|
||||||
|
static std::unique_ptr<OpenGLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
||||||
|
Error* error);
|
||||||
|
|
||||||
|
std::unique_ptr<OpenGLContext> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EGLDisplay GetPlatformDisplay(const EGLAttrib* attribs, Error* error) override;
|
||||||
|
};
|
|
@ -1,15 +1,15 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#include "context_wgl.h"
|
#include "opengl_context_wgl.h"
|
||||||
#include "../opengl_loader.h"
|
#include "opengl_loader.h"
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/scoped_guard.h"
|
#include "common/scoped_guard.h"
|
||||||
|
|
||||||
Log_SetChannel(GL::Context);
|
Log_SetChannel(GL::OpenGLContext);
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic ignored "-Wmicrosoft-cast"
|
#pragma clang diagnostic ignored "-Wmicrosoft-cast"
|
||||||
|
@ -36,12 +36,11 @@ static bool ReloadWGL(HDC dc)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace GL {
|
OpenGLContextWGL::OpenGLContextWGL(const WindowInfo& wi) : OpenGLContext(wi)
|
||||||
ContextWGL::ContextWGL(const WindowInfo& wi) : Context(wi)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextWGL::~ContextWGL()
|
OpenGLContextWGL::~OpenGLContextWGL()
|
||||||
{
|
{
|
||||||
if (wglGetCurrentContext() == m_rc)
|
if (wglGetCurrentContext() == m_rc)
|
||||||
wglMakeCurrent(m_dc, nullptr);
|
wglMakeCurrent(m_dc, nullptr);
|
||||||
|
@ -52,17 +51,17 @@ ContextWGL::~ContextWGL()
|
||||||
ReleaseDC();
|
ReleaseDC();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextWGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
std::unique_ptr<OpenGLContext> OpenGLContextWGL::Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
||||||
Error* error)
|
Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextWGL> context = std::make_unique<ContextWGL>(wi);
|
std::unique_ptr<OpenGLContextWGL> context = std::make_unique<OpenGLContextWGL>(wi);
|
||||||
if (!context->Initialize(versions_to_try, error))
|
if (!context->Initialize(versions_to_try, error))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::Initialize(std::span<const Version> versions_to_try, Error* error)
|
bool OpenGLContextWGL::Initialize(std::span<const Version> versions_to_try, Error* error)
|
||||||
{
|
{
|
||||||
if (m_wi.type == WindowInfo::Type::Win32)
|
if (m_wi.type == WindowInfo::Type::Win32)
|
||||||
{
|
{
|
||||||
|
@ -98,12 +97,12 @@ bool ContextWGL::Initialize(std::span<const Version> versions_to_try, Error* err
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ContextWGL::GetProcAddress(const char* name)
|
void* OpenGLContextWGL::GetProcAddress(const char* name)
|
||||||
{
|
{
|
||||||
return GetProcAddressCallback(name);
|
return GetProcAddressCallback(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::ChangeSurface(const WindowInfo& new_wi)
|
bool OpenGLContextWGL::ChangeSurface(const WindowInfo& new_wi)
|
||||||
{
|
{
|
||||||
const bool was_current = (wglGetCurrentContext() == m_rc);
|
const bool was_current = (wglGetCurrentContext() == m_rc);
|
||||||
Error error;
|
Error error;
|
||||||
|
@ -127,7 +126,7 @@ bool ContextWGL::ChangeSurface(const WindowInfo& new_wi)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextWGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/)
|
void OpenGLContextWGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/)
|
||||||
{
|
{
|
||||||
RECT client_rc = {};
|
RECT client_rc = {};
|
||||||
GetClientRect(GetHWND(), &client_rc);
|
GetClientRect(GetHWND(), &client_rc);
|
||||||
|
@ -135,17 +134,17 @@ void ContextWGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_he
|
||||||
m_wi.surface_height = static_cast<u32>(client_rc.bottom - client_rc.top);
|
m_wi.surface_height = static_cast<u32>(client_rc.bottom - client_rc.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::SwapBuffers()
|
bool OpenGLContextWGL::SwapBuffers()
|
||||||
{
|
{
|
||||||
return ::SwapBuffers(m_dc);
|
return ::SwapBuffers(m_dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::IsCurrent()
|
bool OpenGLContextWGL::IsCurrent()
|
||||||
{
|
{
|
||||||
return (m_rc && wglGetCurrentContext() == m_rc);
|
return (m_rc && wglGetCurrentContext() == m_rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::MakeCurrent()
|
bool OpenGLContextWGL::MakeCurrent()
|
||||||
{
|
{
|
||||||
if (!wglMakeCurrent(m_dc, m_rc))
|
if (!wglMakeCurrent(m_dc, m_rc))
|
||||||
{
|
{
|
||||||
|
@ -156,12 +155,12 @@ bool ContextWGL::MakeCurrent()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::DoneCurrent()
|
bool OpenGLContextWGL::DoneCurrent()
|
||||||
{
|
{
|
||||||
return wglMakeCurrent(m_dc, nullptr);
|
return wglMakeCurrent(m_dc, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::SetSwapInterval(s32 interval)
|
bool OpenGLContextWGL::SetSwapInterval(s32 interval)
|
||||||
{
|
{
|
||||||
if (!GLAD_WGL_EXT_swap_control)
|
if (!GLAD_WGL_EXT_swap_control)
|
||||||
return false;
|
return false;
|
||||||
|
@ -169,9 +168,9 @@ bool ContextWGL::SetSwapInterval(s32 interval)
|
||||||
return wglSwapIntervalEXT(interval);
|
return wglSwapIntervalEXT(interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ContextWGL::CreateSharedContext(const WindowInfo& wi, Error* error)
|
std::unique_ptr<OpenGLContext> OpenGLContextWGL::CreateSharedContext(const WindowInfo& wi, Error* error)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ContextWGL> context = std::make_unique<ContextWGL>(wi);
|
std::unique_ptr<OpenGLContextWGL> context = std::make_unique<OpenGLContextWGL>(wi);
|
||||||
if (wi.type == WindowInfo::Type::Win32)
|
if (wi.type == WindowInfo::Type::Win32)
|
||||||
{
|
{
|
||||||
if (!context->InitializeDC(error))
|
if (!context->InitializeDC(error))
|
||||||
|
@ -198,7 +197,7 @@ std::unique_ptr<Context> ContextWGL::CreateSharedContext(const WindowInfo& wi, E
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC ContextWGL::GetDCAndSetPixelFormat(HWND hwnd, Error* error)
|
HDC OpenGLContextWGL::GetDCAndSetPixelFormat(HWND hwnd, Error* error)
|
||||||
{
|
{
|
||||||
PIXELFORMATDESCRIPTOR pfd = {};
|
PIXELFORMATDESCRIPTOR pfd = {};
|
||||||
pfd.nSize = sizeof(pfd);
|
pfd.nSize = sizeof(pfd);
|
||||||
|
@ -242,7 +241,7 @@ HDC ContextWGL::GetDCAndSetPixelFormat(HWND hwnd, Error* error)
|
||||||
return hDC;
|
return hDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::InitializeDC(Error* error)
|
bool OpenGLContextWGL::InitializeDC(Error* error)
|
||||||
{
|
{
|
||||||
if (m_wi.type == WindowInfo::Type::Win32)
|
if (m_wi.type == WindowInfo::Type::Win32)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +262,7 @@ bool ContextWGL::InitializeDC(Error* error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextWGL::ReleaseDC()
|
void OpenGLContextWGL::ReleaseDC()
|
||||||
{
|
{
|
||||||
if (m_pbuffer)
|
if (m_pbuffer)
|
||||||
{
|
{
|
||||||
|
@ -286,7 +285,7 @@ void ContextWGL::ReleaseDC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::CreatePBuffer(Error* error)
|
bool OpenGLContextWGL::CreatePBuffer(Error* error)
|
||||||
{
|
{
|
||||||
static bool window_class_registered = false;
|
static bool window_class_registered = false;
|
||||||
static const wchar_t* window_class_name = L"ContextWGLPBuffer";
|
static const wchar_t* window_class_name = L"ContextWGLPBuffer";
|
||||||
|
@ -387,7 +386,7 @@ bool ContextWGL::CreatePBuffer(Error* error)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::CreateAnyContext(HGLRC share_context, bool make_current, Error* error)
|
bool OpenGLContextWGL::CreateAnyContext(HGLRC share_context, bool make_current, Error* error)
|
||||||
{
|
{
|
||||||
m_rc = wglCreateContext(m_dc);
|
m_rc = wglCreateContext(m_dc);
|
||||||
if (!m_rc)
|
if (!m_rc)
|
||||||
|
@ -421,7 +420,8 @@ bool ContextWGL::CreateAnyContext(HGLRC share_context, bool make_current, Error*
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContextWGL::CreateVersionContext(const Version& version, HGLRC share_context, bool make_current, Error* error)
|
bool OpenGLContextWGL::CreateVersionContext(const Version& version, HGLRC share_context, bool make_current,
|
||||||
|
Error* error)
|
||||||
{
|
{
|
||||||
// we need create context attribs
|
// we need create context attribs
|
||||||
if (!GLAD_WGL_ARB_create_context)
|
if (!GLAD_WGL_ARB_create_context)
|
||||||
|
@ -501,4 +501,3 @@ bool ContextWGL::CreateVersionContext(const Version& version, HGLRC share_contex
|
||||||
m_rc = new_rc;
|
m_rc = new_rc;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // namespace GL
|
|
|
@ -2,9 +2,9 @@
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "context.h"
|
|
||||||
|
|
||||||
#include "../opengl_loader.h"
|
#include "opengl_context.h"
|
||||||
|
#include "opengl_loader.h"
|
||||||
|
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
|
|
||||||
|
@ -12,15 +12,14 @@
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
namespace GL {
|
class OpenGLContextWGL final : public OpenGLContext
|
||||||
|
|
||||||
class ContextWGL final : public Context
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ContextWGL(const WindowInfo& wi);
|
OpenGLContextWGL(const WindowInfo& wi);
|
||||||
~ContextWGL() override;
|
~OpenGLContextWGL() override;
|
||||||
|
|
||||||
static std::unique_ptr<Context> Create(const WindowInfo& wi, std::span<const Version> versions_to_try, Error* error);
|
static std::unique_ptr<OpenGLContext> Create(const WindowInfo& wi, std::span<const Version> versions_to_try,
|
||||||
|
Error* error);
|
||||||
|
|
||||||
void* GetProcAddress(const char* name) override;
|
void* GetProcAddress(const char* name) override;
|
||||||
bool ChangeSurface(const WindowInfo& new_wi) override;
|
bool ChangeSurface(const WindowInfo& new_wi) override;
|
||||||
|
@ -30,7 +29,7 @@ public:
|
||||||
bool MakeCurrent() override;
|
bool MakeCurrent() override;
|
||||||
bool DoneCurrent() override;
|
bool DoneCurrent() override;
|
||||||
bool SetSwapInterval(s32 interval) override;
|
bool SetSwapInterval(s32 interval) override;
|
||||||
std::unique_ptr<Context> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
std::unique_ptr<OpenGLContext> CreateSharedContext(const WindowInfo& wi, Error* error) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ALWAYS_INLINE HWND GetHWND() const { return static_cast<HWND>(m_wi.window_handle); }
|
ALWAYS_INLINE HWND GetHWND() const { return static_cast<HWND>(m_wi.window_handle); }
|
||||||
|
@ -55,5 +54,3 @@ private:
|
||||||
HDC m_dummy_dc = {};
|
HDC m_dummy_dc = {};
|
||||||
HPBUFFERARB m_pbuffer = {};
|
HPBUFFERARB m_pbuffer = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GL
|
|
|
@ -316,7 +316,7 @@ bool OpenGLDevice::CreateDevice(const std::string_view& adapter, bool threaded_p
|
||||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features,
|
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features,
|
||||||
Error* error)
|
Error* error)
|
||||||
{
|
{
|
||||||
m_gl_context = GL::Context::Create(m_window_info, error);
|
m_gl_context = OpenGLContext::Create(m_window_info, error);
|
||||||
if (!m_gl_context)
|
if (!m_gl_context)
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("Failed to create any GL context");
|
Log_ErrorPrintf("Failed to create any GL context");
|
||||||
|
@ -692,7 +692,7 @@ GPUDevice::AdapterAndModeList OpenGLDevice::GetAdapterAndModeList()
|
||||||
|
|
||||||
if (m_gl_context)
|
if (m_gl_context)
|
||||||
{
|
{
|
||||||
for (const GL::Context::FullscreenModeInfo& fmi : m_gl_context->EnumerateFullscreenModes())
|
for (const OpenGLContext::FullscreenModeInfo& fmi : m_gl_context->EnumerateFullscreenModes())
|
||||||
{
|
{
|
||||||
aml.fullscreen_modes.push_back(GetFullscreenModeString(fmi.width, fmi.height, fmi.refresh_rate));
|
aml.fullscreen_modes.push_back(GetFullscreenModeString(fmi.width, fmi.height, fmi.refresh_rate));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gl/context.h"
|
|
||||||
#include "gpu_device.h"
|
#include "gpu_device.h"
|
||||||
#include "gpu_framebuffer_manager.h"
|
#include "gpu_framebuffer_manager.h"
|
||||||
#include "gpu_shader_cache.h"
|
#include "gpu_shader_cache.h"
|
||||||
|
#include "opengl_context.h"
|
||||||
#include "opengl_loader.h"
|
#include "opengl_loader.h"
|
||||||
#include "opengl_pipeline.h"
|
#include "opengl_pipeline.h"
|
||||||
#include "opengl_texture.h"
|
#include "opengl_texture.h"
|
||||||
|
@ -168,7 +168,7 @@ private:
|
||||||
|
|
||||||
void SetVertexBufferOffsets(u32 base_vertex);
|
void SetVertexBufferOffsets(u32 base_vertex);
|
||||||
|
|
||||||
std::unique_ptr<GL::Context> m_gl_context;
|
std::unique_ptr<OpenGLContext> m_gl_context;
|
||||||
|
|
||||||
std::unique_ptr<OpenGLStreamBuffer> m_vertex_buffer;
|
std::unique_ptr<OpenGLStreamBuffer> m_vertex_buffer;
|
||||||
std::unique_ptr<OpenGLStreamBuffer> m_index_buffer;
|
std::unique_ptr<OpenGLStreamBuffer> m_index_buffer;
|
||||||
|
|
|
@ -19,12 +19,6 @@
|
||||||
<ClInclude Include="d3d12_texture.h" />
|
<ClInclude Include="d3d12_texture.h" />
|
||||||
<ClInclude Include="d3d_common.h" />
|
<ClInclude Include="d3d_common.h" />
|
||||||
<ClInclude Include="dinput_source.h" />
|
<ClInclude Include="dinput_source.h" />
|
||||||
<ClInclude Include="gl\context.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="gl\context_wgl.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="gpu_device.h" />
|
<ClInclude Include="gpu_device.h" />
|
||||||
<ClInclude Include="gpu_framebuffer_manager.h" />
|
<ClInclude Include="gpu_framebuffer_manager.h" />
|
||||||
<ClInclude Include="gpu_shader_cache.h" />
|
<ClInclude Include="gpu_shader_cache.h" />
|
||||||
|
@ -48,6 +42,24 @@
|
||||||
<ClInclude Include="metal_stream_buffer.h">
|
<ClInclude Include="metal_stream_buffer.h">
|
||||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="opengl_context.h">
|
||||||
|
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="opengl_context_agl.h">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="opengl_context_egl.h">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="opengl_context_egl_wayland.h">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="opengl_context_egl_x11.h">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="opengl_context_wgl.h">
|
||||||
|
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="opengl_device.h">
|
<ClInclude Include="opengl_device.h">
|
||||||
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -136,12 +148,6 @@
|
||||||
<ClCompile Include="d3d12_texture.cpp" />
|
<ClCompile Include="d3d12_texture.cpp" />
|
||||||
<ClCompile Include="d3d_common.cpp" />
|
<ClCompile Include="d3d_common.cpp" />
|
||||||
<ClCompile Include="dinput_source.cpp" />
|
<ClCompile Include="dinput_source.cpp" />
|
||||||
<ClCompile Include="gl\context.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gl\context_wgl.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gpu_device.cpp" />
|
<ClCompile Include="gpu_device.cpp" />
|
||||||
<ClCompile Include="gpu_shader_cache.cpp" />
|
<ClCompile Include="gpu_shader_cache.cpp" />
|
||||||
<ClCompile Include="gpu_texture.cpp" />
|
<ClCompile Include="gpu_texture.cpp" />
|
||||||
|
@ -159,6 +165,21 @@
|
||||||
<ClCompile Include="iso_reader.cpp" />
|
<ClCompile Include="iso_reader.cpp" />
|
||||||
<ClCompile Include="jit_code_buffer.cpp" />
|
<ClCompile Include="jit_code_buffer.cpp" />
|
||||||
<ClCompile Include="cd_subchannel_replacement.cpp" />
|
<ClCompile Include="cd_subchannel_replacement.cpp" />
|
||||||
|
<ClCompile Include="opengl_context.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="opengl_context_egl.cpp">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="opengl_context_egl_wayland.cpp">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="opengl_context_egl_x11.cpp">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="opengl_context_wgl.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="opengl_device.cpp">
|
<ClCompile Include="opengl_device.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -260,6 +281,9 @@
|
||||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
<FileType>Document</FileType>
|
<FileType>Document</FileType>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<None Include="opengl_context_agl.mm">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{57F6206D-F264-4B07-BAF8-11B9BBE1F455}</ProjectGuid>
|
<ProjectGuid>{57F6206D-F264-4B07-BAF8-11B9BBE1F455}</ProjectGuid>
|
||||||
|
|
|
@ -54,12 +54,6 @@
|
||||||
<ClInclude Include="gpu_shader_cache.h" />
|
<ClInclude Include="gpu_shader_cache.h" />
|
||||||
<ClInclude Include="gpu_texture.h" />
|
<ClInclude Include="gpu_texture.h" />
|
||||||
<ClInclude Include="metal_device.h" />
|
<ClInclude Include="metal_device.h" />
|
||||||
<ClInclude Include="gl\context_wgl.h">
|
|
||||||
<Filter>gl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="gl\context.h">
|
|
||||||
<Filter>gl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="postprocessing_shader_glsl.h" />
|
<ClInclude Include="postprocessing_shader_glsl.h" />
|
||||||
<ClInclude Include="d3d11_pipeline.h" />
|
<ClInclude Include="d3d11_pipeline.h" />
|
||||||
<ClInclude Include="d3d11_stream_buffer.h" />
|
<ClInclude Include="d3d11_stream_buffer.h" />
|
||||||
|
@ -72,6 +66,12 @@
|
||||||
<ClInclude Include="http_downloader.h" />
|
<ClInclude Include="http_downloader.h" />
|
||||||
<ClInclude Include="gpu_framebuffer_manager.h" />
|
<ClInclude Include="gpu_framebuffer_manager.h" />
|
||||||
<ClInclude Include="imgui_animated.h" />
|
<ClInclude Include="imgui_animated.h" />
|
||||||
|
<ClInclude Include="opengl_context.h" />
|
||||||
|
<ClInclude Include="opengl_context_agl.h" />
|
||||||
|
<ClInclude Include="opengl_context_egl.h" />
|
||||||
|
<ClInclude Include="opengl_context_egl_wayland.h" />
|
||||||
|
<ClInclude Include="opengl_context_egl_x11.h" />
|
||||||
|
<ClInclude Include="opengl_context_wgl.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="jit_code_buffer.cpp" />
|
<ClCompile Include="jit_code_buffer.cpp" />
|
||||||
|
@ -135,12 +135,6 @@
|
||||||
<ClCompile Include="gpu_device.cpp" />
|
<ClCompile Include="gpu_device.cpp" />
|
||||||
<ClCompile Include="gpu_shader_cache.cpp" />
|
<ClCompile Include="gpu_shader_cache.cpp" />
|
||||||
<ClCompile Include="gpu_texture.cpp" />
|
<ClCompile Include="gpu_texture.cpp" />
|
||||||
<ClCompile Include="gl\context_wgl.cpp">
|
|
||||||
<Filter>gl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gl\context.cpp">
|
|
||||||
<Filter>gl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="postprocessing_shader_glsl.cpp" />
|
<ClCompile Include="postprocessing_shader_glsl.cpp" />
|
||||||
<ClCompile Include="d3d11_pipeline.cpp" />
|
<ClCompile Include="d3d11_pipeline.cpp" />
|
||||||
<ClCompile Include="d3d11_stream_buffer.cpp" />
|
<ClCompile Include="d3d11_stream_buffer.cpp" />
|
||||||
|
@ -154,6 +148,11 @@
|
||||||
<ClCompile Include="metal_device.mm" />
|
<ClCompile Include="metal_device.mm" />
|
||||||
<ClCompile Include="metal_stream_buffer.mm" />
|
<ClCompile Include="metal_stream_buffer.mm" />
|
||||||
<ClCompile Include="zstd_byte_stream.cpp" />
|
<ClCompile Include="zstd_byte_stream.cpp" />
|
||||||
|
<ClCompile Include="opengl_context.cpp" />
|
||||||
|
<ClCompile Include="opengl_context_egl.cpp" />
|
||||||
|
<ClCompile Include="opengl_context_egl_wayland.cpp" />
|
||||||
|
<ClCompile Include="opengl_context_egl_x11.cpp" />
|
||||||
|
<ClCompile Include="opengl_context_wgl.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="gl">
|
<Filter Include="gl">
|
||||||
|
@ -162,5 +161,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="metal_shaders.metal" />
|
<None Include="metal_shaders.metal" />
|
||||||
|
<None Include="opengl_context_agl.mm" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in a new issue