-
-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Glew to epoxy #1681
Glew to epoxy #1681
Conversation
libepoxys last release is 2 years old so why not use the still actively developed glad library, which also supports Vulkan out of the box? |
GLAD2 depends on generated code and this code is separated for each API. |
GLEW's last release is 3 years old :) Though, there's a bad sign there: libepoxy doesn't have any fresh commits since the last release, while glew has. |
libepoxy is used by much more recent software, while glew usage is ancient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I've left mostly code style and some other small improvement request!
#include <epoxy/gl.h> | ||
#include "xrEngine/XR_IOConsole.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <epoxy/gl.h> | |
#include "xrEngine/XR_IOConsole.h" | |
#include "xrEngine/XR_IOConsole.h" | |
#include <epoxy/gl.h> | |
mode.format = SDL_PIXELFORMAT_RGBA8888; | ||
// Apply the pixel format to the device context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mode.format = SDL_PIXELFORMAT_RGBA8888; | |
// Apply the pixel format to the device context | |
mode.format = SDL_PIXELFORMAT_RGBA8888; | |
// Apply the pixel format to the device context |
@@ -103,6 +104,7 @@ void CHW::CreateDevice(SDL_Window* hWnd) | |||
const Uint32 flags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL; | |||
|
|||
m_helper_window = SDL_CreateWindow("OpenXRay OpenGL helper window", 0, 0, 1, 1, flags); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool GLKHRdebugSupported; | ||
bool GLARBtexturefloatSuppoted; | ||
bool GLARBvertexattribbindingSupported; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool GLKHRdebugSupported; | |
bool GLARBtexturefloatSuppoted; | |
bool GLARBvertexattribbindingSupported; | |
bool DebugSupported; | |
bool TextureFloatSuppoted; | |
bool VertexAttribBindingSupported; |
@@ -36,6 +36,7 @@ class glState | |||
D3D_DEPTH_STENCIL_STATE m_pDepthStencilState; | |||
D3D_BLEND_STATE m_pBlendState; | |||
float m_uiMipLODBias; | |||
bool GLEXTtexturefilteranisotropicSupported; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move it to HW
with TextureFilterAnisotropicSupported
name.
It's generally better to keep such stuff in one place, and also glState
can be created on-demand during the game run – that means it would always call epoxy_has_gl_extension
for each glState instance (there can be many of them) which is suboptimal.
@@ -162,14 +162,14 @@ void SetVertexDeclaration(const VertexElement* dxdecl) | |||
}); | |||
} | |||
|
|||
void ConvertVertexDeclaration(const VertexElement* dxdecl, SDeclaration* decl) | |||
void ConvertVertexDeclaration(const VertexElement* dxdecl, SDeclaration* decl, bool GLARBvertexattribbindingSupported) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks less good.
It's better to just use HW.GLARBvertexattribbindingSupported
(after renaming it should be HW.VertexAttribBindingSupported
) directly.
@@ -61,7 +61,7 @@ inline std::pair<char, GLuint> GLCompileShader(pcstr* buffer, size_t size, pcstr | |||
|
|||
const GLuint program = glCreateProgram(); | |||
R_ASSERT(program); | |||
if (GLEW_VERSION_4_3) | |||
if (epoxy_gl_version() >= 43) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check for HW.OpenGLVersion
instead of calling external function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, try to use this find module: https://github.com/WebKit/WebKit/blob/main/Source/cmake/FindEpoxy.cmake
It provides Epoxy::Epoxy
CMake target which can be used.
@@ -396,6 +396,7 @@ target_include_directories(xrRender_GL | |||
"${CMAKE_SOURCE_DIR}/Externals" | |||
"${CMAKE_SOURCE_DIR}/Externals/gli" | |||
"${CMAKE_SOURCE_DIR}/Externals/gli/external" | |||
"${epoxy_INCLUDE_DIR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed after switching to Epoxy::Epoxy
(#1681 (comment)).
@@ -408,8 +409,7 @@ target_link_libraries(xrRender_GL | |||
xrParticles | |||
xrScriptEngine | |||
xrImGui | |||
OpenGL::GL | |||
GLEW::GLEW | |||
"${epoxy_LIBRARY}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to switch to Epoxy::Epoxy
.
Maybe I'm being missunderstood here I'm all for replacing the ancient GLEW library. My point was rather to maybe consider using the glad library I linked which latest release is about 1 Month old and still actively developed while also supporting all OpenGL extensions as well as Vulkan (which we might want to use in the future). Also glad directly parses the official OpenGL and Vulkan spec to generate it's glue code so even if the library is ever abandoned the parser should still be able to generate bindings for never versions of OpenGL and Vulkan (at least untill they make fundamental changes to the spec). |
@AMS21 the @sobkas's concern is this:
I also had a concern that if you select OpenGL 4.6, then you won't be able to use e.g. OpenGL 3.3 or OpenGL 2.0. GLAD2 supports working with multiple APIs simultaneously. On it's website you just need to select maximal OpenGL version and any lower version would be included. |
So main concern with libepoxy is that it's author hadn't been active for two years. No commits, not even PR merges, etc. |
Superseded with #1684. |
Switch from ancient GLEW to libepoxy