Changeset View
Changeset View
Standalone View
Standalone View
source/ps/GameSetup/HWDetect.cpp
Show All 37 Lines | |||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/ConfigDB.h" | #include "ps/ConfigDB.h" | ||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#include "ps/UserReport.h" | #include "ps/UserReport.h" | ||||
#include "ps/VideoMode.h" | #include "ps/VideoMode.h" | ||||
#include "ps/GameSetup/Config.h" | #include "ps/GameSetup/Config.h" | ||||
#ifdef SDL_VIDEO_DRIVER_X11 | #ifdef SDL_VIDEO_DRIVER_X11 | ||||
#include <GL/glx.h> | #include "third_party/glad/glad_glx.h" | ||||
#include "SDL_syswm.h" | #include <SDL_syswm.h> | ||||
// Define the GLX_MESA_query_renderer macros if built with | // Define the GLX_MESA_query_renderer macros if built with | ||||
// an old Mesa (<10.0) that doesn't provide them | // an old Mesa (<10.0) that doesn't provide them | ||||
#ifndef GLX_MESA_query_renderer | #ifndef GLX_MESA_query_renderer | ||||
#define GLX_MESA_query_renderer 1 | #define GLX_MESA_query_renderer 1 | ||||
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183 | #define GLX_RENDERER_VENDOR_ID_MESA 0x8183 | ||||
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184 | #define GLX_RENDERER_DEVICE_ID_MESA 0x8184 | ||||
#define GLX_RENDERER_VERSION_MESA 0x8185 | #define GLX_RENDERER_VERSION_MESA 0x8185 | ||||
#define GLX_RENDERER_ACCELERATED_MESA 0x8186 | #define GLX_RENDERER_ACCELERATED_MESA 0x8186 | ||||
#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 | #define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 | ||||
#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 | #define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 | ||||
#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 | #define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 | ||||
#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A | #define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A | ||||
#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B | #define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B | ||||
#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C | #define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C | ||||
#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D | #define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D | ||||
#define GLX_RENDERER_ID_MESA 0x818E | #define GLX_RENDERER_ID_MESA 0x818E | ||||
#endif /* GLX_MESA_query_renderer */ | #endif /* GLX_MESA_query_renderer */ | ||||
#endif | #endif | ||||
Stan: @nwtour can you try this with gles? | |||||
Done Inline Actions
I tried: In file included from ../../../source/ps/GameSetup/HWDetect.cpp:64: ../../../libraries/source/glad/include/glad/gles2.h:40:4: error: #error OpenGL ES 3 header already included (API: gles2), remove previous include! #error OpenGL ES 3 header already included (API: gles2), remove previous include! ^~~~~ make[1]: *** [engine.make:342: obj/engine_Release/HWDetect.o] Ошибка 1 nwtour: > @nwtour can you try this with gles?
I tried:
```
In file included from ../../.. | |||||
Done Inline ActionsLooks like I made a mistake when generating the header (opengles 3.2 inatead of 2.0) but I can't figure where __gl3_h_ is defined Stan: Looks like I made a mistake when generating the header (opengles 3.2 inatead of 2.0) but I… | |||||
Done Inline Actions
In file included from ../../../source/lib/ogl.h:33, from ../../../source/ps/GameSetup/HWDetect.cpp:20: ../../../libraries/source/glad/include/glad/gl.h:42:2: error: invalid preprocessing directive #warn #warn here defgl3 ^~~~ In file included from ../../../source/ps/GameSetup/HWDetect.cpp:64: ../../../libraries/source/glad/include/glad/gles2.h:40:4: error: #error OpenGL ES 3 header already included (API: gles2), remove previous include! #error OpenGL ES 3 header already included (API: gles2), remove previous include! nwtour: > Looks like I made a mistake when generating the header (opengles 3.2 inatead of 2.0) but I… | |||||
Done Inline Actions
#if CONFIG2_GLES # include <glad/gles2.h> #else # include <glad/gl.h> #endif in source/lib/ogl.h fix compilation of HWDetect.cpp nwtour: > Looks like I made a mistake when generating the header (opengles 3.2 inatead of 2.0) but I… | |||||
static void ReportGLLimits(ScriptInterface& scriptInterface, JS::HandleValue settings); | static void ReportGLLimits(ScriptInterface& scriptInterface, JS::HandleValue settings); | ||||
#if ARCH_X86_X64 | #if ARCH_X86_X64 | ||||
void ConvertCaches(ScriptInterface& scriptInterface, x86_x64::IdxCache idxCache, JS::MutableHandleValue ret) | void ConvertCaches(ScriptInterface& scriptInterface, x86_x64::IdxCache idxCache, JS::MutableHandleValue ret) | ||||
{ | { | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
▲ Show 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | #define STRING(id) do { \ | ||||
const char* c = (const char*)glGetString(GL_##id); \ | const char* c = (const char*)glGetString(GL_##id); \ | ||||
if (!c) c = ""; \ | if (!c) c = ""; \ | ||||
if (ogl_SquelchError(GL_INVALID_ENUM)) c = errstr; \ | if (ogl_SquelchError(GL_INVALID_ENUM)) c = errstr; \ | ||||
scriptInterface.SetProperty(settings, "GL_" #id, std::string(c)); \ | scriptInterface.SetProperty(settings, "GL_" #id, std::string(c)); \ | ||||
} while (false) | } while (false) | ||||
#define QUERY(target, pname) do { \ | #define QUERY(target, pname) do { \ | ||||
GLint i = -1; \ | GLint i = -1; \ | ||||
pglGetQueryivARB(GL_##target, GL_##pname, &i); \ | glGetQueryivARB(GL_##target, GL_##pname, &i); \ | ||||
if (ogl_SquelchError(GL_INVALID_ENUM)) \ | if (ogl_SquelchError(GL_INVALID_ENUM)) \ | ||||
scriptInterface.SetProperty(settings, "GL_" #target ".GL_" #pname, errstr); \ | scriptInterface.SetProperty(settings, "GL_" #target ".GL_" #pname, errstr); \ | ||||
else \ | else \ | ||||
scriptInterface.SetProperty(settings, "GL_" #target ".GL_" #pname, i); \ | scriptInterface.SetProperty(settings, "GL_" #target ".GL_" #pname, i); \ | ||||
} while (false) | } while (false) | ||||
#define VERTEXPROGRAM(id) do { \ | #define VERTEXPROGRAM(id) do { \ | ||||
GLint i = -1; \ | GLint i = -1; \ | ||||
pglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_##id, &i); \ | glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_##id, &i); \ | ||||
if (ogl_SquelchError(GL_INVALID_ENUM)) \ | if (ogl_SquelchError(GL_INVALID_ENUM)) \ | ||||
scriptInterface.SetProperty(settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, errstr); \ | scriptInterface.SetProperty(settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, errstr); \ | ||||
else \ | else \ | ||||
scriptInterface.SetProperty(settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, i); \ | scriptInterface.SetProperty(settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, i); \ | ||||
} while (false) | } while (false) | ||||
#define FRAGMENTPROGRAM(id) do { \ | #define FRAGMENTPROGRAM(id) do { \ | ||||
GLint i = -1; \ | GLint i = -1; \ | ||||
pglGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_##id, &i); \ | glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_##id, &i); \ | ||||
if (ogl_SquelchError(GL_INVALID_ENUM)) \ | if (ogl_SquelchError(GL_INVALID_ENUM)) \ | ||||
scriptInterface.SetProperty(settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, errstr); \ | scriptInterface.SetProperty(settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, errstr); \ | ||||
else \ | else \ | ||||
scriptInterface.SetProperty(settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, i); \ | scriptInterface.SetProperty(settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, i); \ | ||||
} while (false) | } while (false) | ||||
#define BOOL(id) INTEGER(id) | #define BOOL(id) INTEGER(id) | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | #if !CONFIG2_GLES | ||||
} | } | ||||
if (ogl_HaveExtension("GL_ARB_fragment_shader")) | if (ogl_HaveExtension("GL_ARB_fragment_shader")) | ||||
{ | { | ||||
INTEGER(MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB); | INTEGER(MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB); | ||||
} | } | ||||
if (ogl_HaveExtension("GL_ARB_vertex_shader") || ogl_HaveExtension("GL_ARB_fragment_shader") || | if (ogl_HaveExtension("GL_ARB_vertex_shader") || ogl_HaveExtension("GL_ARB_fragment_shader") || | ||||
ogl_HaveExtension("GL_ARB_vertex_program") || ogl_HaveExtension("GL_ARB_fragment_program")) | ogl_HaveExtension("GL_ARB_vertex_program") || ogl_HaveExtension("GL_ARB_fragment_program")) | ||||
{ | { | ||||
INTEGER(MAX_TEXTURE_IMAGE_UNITS_ARB); | INTEGER(MAX_TEXTURE_IMAGE_UNITS_ARB); | ||||
INTEGER(MAX_TEXTURE_COORDS_ARB); | INTEGER(MAX_TEXTURE_COORDS_ARB); | ||||
} | } | ||||
if (ogl_HaveExtension("GL_ARB_draw_buffers")) | if (ogl_HaveExtension("GL_ARB_draw_buffers")) | ||||
{ | { | ||||
INTEGER(MAX_DRAW_BUFFERS_ARB); | INTEGER(MAX_DRAW_BUFFERS_ARB); | ||||
} | } | ||||
// Core OpenGL 3.0: | // Core OpenGL 3.0: | ||||
if (ogl_HaveExtension("GL_EXT_gpu_shader4")) | if (ogl_HaveExtension("GL_EXT_gpu_shader4")) | ||||
{ | { | ||||
INTEGER(MIN_PROGRAM_TEXEL_OFFSET); // no _EXT version of these in glext.h | INTEGER(MIN_PROGRAM_TEXEL_OFFSET_EXT); | ||||
INTEGER(MAX_PROGRAM_TEXEL_OFFSET); | INTEGER(MAX_PROGRAM_TEXEL_OFFSET_EXT); | ||||
} | } | ||||
if (ogl_HaveExtension("GL_EXT_framebuffer_object")) | if (ogl_HaveExtension("GL_EXT_framebuffer_object")) | ||||
{ | { | ||||
INTEGER(MAX_COLOR_ATTACHMENTS_EXT); | INTEGER(MAX_COLOR_ATTACHMENTS_EXT); | ||||
INTEGER(MAX_RENDERBUFFER_SIZE_EXT); | INTEGER(MAX_RENDERBUFFER_SIZE_EXT); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | |||||
#endif // CONFIG2_GLES | #endif // CONFIG2_GLES | ||||
#ifdef SDL_VIDEO_DRIVER_X11 | #ifdef SDL_VIDEO_DRIVER_X11 | ||||
#define GLXQCR_INTEGER(id) do { \ | #define GLXQCR_INTEGER(id) do { \ | ||||
unsigned int i = UINT_MAX; \ | unsigned int i = UINT_MAX; \ | ||||
if (pglXQueryCurrentRendererIntegerMESA(id, &i)) \ | if (glXQueryCurrentRendererIntegerMESA(id, &i)) \ | ||||
scriptInterface.SetProperty(settings, #id, i); \ | scriptInterface.SetProperty(settings, #id, i); \ | ||||
} while (false) | } while (false) | ||||
#define GLXQCR_INTEGER2(id) do { \ | #define GLXQCR_INTEGER2(id) do { \ | ||||
unsigned int i[2] = { UINT_MAX, UINT_MAX }; \ | unsigned int i[2] = { UINT_MAX, UINT_MAX }; \ | ||||
if (pglXQueryCurrentRendererIntegerMESA(id, i)) { \ | if (glXQueryCurrentRendererIntegerMESA(id, i)) { \ | ||||
scriptInterface.SetProperty(settings, #id "[0]", i[0]); \ | scriptInterface.SetProperty(settings, #id "[0]", i[0]); \ | ||||
scriptInterface.SetProperty(settings, #id "[1]", i[1]); \ | scriptInterface.SetProperty(settings, #id "[1]", i[1]); \ | ||||
} \ | } \ | ||||
} while (false) | } while (false) | ||||
#define GLXQCR_INTEGER3(id) do { \ | #define GLXQCR_INTEGER3(id) do { \ | ||||
unsigned int i[3] = { UINT_MAX, UINT_MAX, UINT_MAX }; \ | unsigned int i[3] = { UINT_MAX, UINT_MAX, UINT_MAX }; \ | ||||
if (pglXQueryCurrentRendererIntegerMESA(id, i)) { \ | if (glXQueryCurrentRendererIntegerMESA(id, i)) { \ | ||||
scriptInterface.SetProperty(settings, #id "[0]", i[0]); \ | scriptInterface.SetProperty(settings, #id "[0]", i[0]); \ | ||||
scriptInterface.SetProperty(settings, #id "[1]", i[1]); \ | scriptInterface.SetProperty(settings, #id "[1]", i[1]); \ | ||||
scriptInterface.SetProperty(settings, #id "[2]", i[2]); \ | scriptInterface.SetProperty(settings, #id "[2]", i[2]); \ | ||||
} \ | } \ | ||||
} while (false) | } while (false) | ||||
#define GLXQCR_STRING(id) do { \ | #define GLXQCR_STRING(id) do { \ | ||||
const char* str = pglXQueryCurrentRendererStringMESA(id); \ | const char* str = glXQueryCurrentRendererStringMESA(id); \ | ||||
if (str) \ | if (str) \ | ||||
scriptInterface.SetProperty(settings, #id ".string", str); \ | scriptInterface.SetProperty(settings, #id ".string", str); \ | ||||
} while (false) | } while (false) | ||||
SDL_SysWMinfo wminfo; | SDL_SysWMinfo wminfo; | ||||
SDL_VERSION(&wminfo.version); | SDL_VERSION(&wminfo.version); | ||||
const int ret = SDL_GetWindowWMInfo(g_VideoMode.GetWindow(), &wminfo); | const int ret = SDL_GetWindowWMInfo(g_VideoMode.GetWindow(), &wminfo); | ||||
if (ret && wminfo.subsystem == SDL_SYSWM_X11) | if (ret && wminfo.subsystem == SDL_SYSWM_X11) | ||||
{ | { | ||||
Display* dpy = wminfo.info.x11.display; | Display* dpy = wminfo.info.x11.display; | ||||
int scrnum = DefaultScreen(dpy); | int scrnum = DefaultScreen(dpy); | ||||
if (gladLoadGLX(dpy, scrnum)) { | |||||
const char* glxexts = glXQueryExtensionsString(dpy, scrnum); | const char* glxexts = glXQueryExtensionsString(dpy, scrnum); | ||||
scriptInterface.SetProperty(settings, "glx_extensions", glxexts); | scriptInterface.SetProperty(settings, "glx_extensions", glxexts); | ||||
if (strstr(glxexts, "GLX_MESA_query_renderer") && pglXQueryCurrentRendererIntegerMESA && pglXQueryCurrentRendererStringMESA) | if (strstr(glxexts, "GLX_MESA_query_renderer") && glXQueryCurrentRendererIntegerMESA && glXQueryCurrentRendererStringMESA) | ||||
{ | { | ||||
GLXQCR_INTEGER(GLX_RENDERER_VENDOR_ID_MESA); | GLXQCR_INTEGER(GLX_RENDERER_VENDOR_ID_MESA); | ||||
GLXQCR_INTEGER(GLX_RENDERER_DEVICE_ID_MESA); | GLXQCR_INTEGER(GLX_RENDERER_DEVICE_ID_MESA); | ||||
GLXQCR_INTEGER3(GLX_RENDERER_VERSION_MESA); | GLXQCR_INTEGER3(GLX_RENDERER_VERSION_MESA); | ||||
GLXQCR_INTEGER(GLX_RENDERER_ACCELERATED_MESA); | GLXQCR_INTEGER(GLX_RENDERER_ACCELERATED_MESA); | ||||
GLXQCR_INTEGER(GLX_RENDERER_VIDEO_MEMORY_MESA); | GLXQCR_INTEGER(GLX_RENDERER_VIDEO_MEMORY_MESA); | ||||
GLXQCR_INTEGER(GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA); | GLXQCR_INTEGER(GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA); | ||||
GLXQCR_INTEGER(GLX_RENDERER_PREFERRED_PROFILE_MESA); | GLXQCR_INTEGER(GLX_RENDERER_PREFERRED_PROFILE_MESA); | ||||
GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA); | GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA); | ||||
GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA); | GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA); | ||||
GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA); | GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA); | ||||
GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA); | GLXQCR_INTEGER2(GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA); | ||||
GLXQCR_STRING(GLX_RENDERER_VENDOR_ID_MESA); | GLXQCR_STRING(GLX_RENDERER_VENDOR_ID_MESA); | ||||
GLXQCR_STRING(GLX_RENDERER_DEVICE_ID_MESA); | GLXQCR_STRING(GLX_RENDERER_DEVICE_ID_MESA); | ||||
} | } | ||||
} | } | ||||
} | |||||
#endif // SDL_VIDEO_DRIVER_X11 | #endif // SDL_VIDEO_DRIVER_X11 | ||||
} | } |
Wildfire Games · Phabricator
@nwtour can you try this with gles?