Skip to content
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

Lower required OpenGL version from 3.3 -> 3.0 #1911

Merged
merged 1 commit into from Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -80,7 +80,7 @@ CMAKE_DEPENDENT_OPTION(MGA "Matrox Mystique graphics adapters" ON "DEV_BRANCH" O
CMAKE_DEPENDENT_OPTION(NO_SIO "Machines without emulated Super I/O chips" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OLIVETTI "Olivetti M290" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OPEN_AT "OpenAT" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OPENGL "OpenGL 3.3 Core renderer" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OPENGL "OpenGL 3.0 Core renderer" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(PAS16 "Pro Audio Spectrum 16" OFF "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(PS2M70T4 "IBM PS/2 model 70 (type 4)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(S3TRIO3D2X "S3 Trio3D/2X" ON "DEV_BRANCH" OFF)
Expand Down
471 changes: 46 additions & 425 deletions src/include/glad/glad.h

Large diffs are not rendered by default.

234 changes: 28 additions & 206 deletions src/win/glad.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/win/languages/cs-CZ.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/de-DE.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3-Kern)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0-Kern)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/en-GB.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/en-US.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/es-ES.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/fi-FI.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (ohjelmistopohjainen)", IDM_VID_SDL_SW
MENUITEM "SDL (&laitteistokiihdytetty)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/fr-FR.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Logiciel)", IDM_VID_SDL_SW
MENUITEM "SDL (&Materiel)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/hr-HR.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Softver)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardver)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 jezgra)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 jezgra)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/hu-HU.rc
Expand Up @@ -44,7 +44,7 @@ BEGIN
MENUITEM "&SDL (Szoftveres)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardveres)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/it-IT.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/ja-JP.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "SDL (ソフトウェア)(&S)", IDM_VID_SDL_SW
MENUITEM "SDL (ハードウェア)(&H)", IDM_VID_SDL_HW
MENUITEM "SDL (OpenGL)(&O)", IDM_VID_SDL_OPENGL
MENUITEM "OpenGL (3.3コア)(&G)", IDM_VID_OPENGL_CORE
MENUITEM "OpenGL (3.0コア)(&G)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "VNC(&V)", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/ko-KR.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "SDL (소프트웨어)(&S)", IDM_VID_SDL_SW
MENUITEM "SDL (하드웨어)(&H)", IDM_VID_SDL_HW
MENUITEM "SDL (OpenGL)(&O)", IDM_VID_SDL_OPENGL
MENUITEM "OpenGL (3.3 코어)(&G)", IDM_VID_OPENGL_CORE
MENUITEM "OpenGL (3.0 코어)(&G)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "VNC(&V)", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/pt-BR.rc
Expand Up @@ -42,7 +42,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (Núcleo 3.3)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (Núcleo 3.0)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/pt-PT.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (Núcleo 3.3)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (Núcleo 3.0)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/ru-RU.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/sl-SI.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (programsko)", IDM_VID_SDL_SW
MENUITEM "SDL (s&trojno)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (Jedro 3.3)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (Jedro 3.0)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/tr-TR.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (Yazılım)", IDM_VID_SDL_SW
MENUITEM "SDL (&Donanım)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/win/languages/zh-CN.rc
Expand Up @@ -41,7 +41,7 @@ BEGIN
MENUITEM "&SDL (软件)", IDM_VID_SDL_SW
MENUITEM "SDL (硬件 &H)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
MENUITEM "Open&GL (3.0 Core)", IDM_VID_OPENGL_CORE
#ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC
#endif
Expand Down
41 changes: 28 additions & 13 deletions src/win/win_opengl.c
Expand Up @@ -473,7 +473,7 @@ static void opengl_main(void* param)
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1"); /* Is this actually doing anything...? */

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);

if (GLAD_GL_ARB_debug_output)
Expand Down Expand Up @@ -526,7 +526,7 @@ static void opengl_main(void* param)
SDL_GL_DeleteContext(context);
opengl_fail();
}

if (GLAD_GL_ARB_debug_output)
{
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
Expand Down Expand Up @@ -592,14 +592,17 @@ static void opengl_main(void* param)
}
}

/* Check if commands that use buffers have been completed. */
for (int i = 0; i < BUFFERCOUNT; i++)
if (GLAD_GL_ARB_sync)
{
if (blit_info[i].sync != NULL && glClientWaitSync(blit_info[i].sync, GL_SYNC_FLUSH_COMMANDS_BIT, 0) != GL_TIMEOUT_EXPIRED)
/* Check if commands that use buffers have been completed. */
for (int i = 0; i < BUFFERCOUNT; i++)
{
glDeleteSync(blit_info[i].sync);
blit_info[i].sync = NULL;
atomic_flag_clear(&blit_info[i].in_use);
if (blit_info[i].sync != NULL && glClientWaitSync(blit_info[i].sync, GL_SYNC_FLUSH_COMMANDS_BIT, 0) != GL_TIMEOUT_EXPIRED)
{
glDeleteSync(blit_info[i].sync);
blit_info[i].sync = NULL;
atomic_flag_clear(&blit_info[i].in_use);
}
}
}

Expand Down Expand Up @@ -653,8 +656,17 @@ static void opengl_main(void* param)
glPixelStorei(GL_UNPACK_ROW_LENGTH, ROW_LENGTH);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, info->w, info->h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);

/* Add fence to track when above gl commands are complete. */
info->sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
if (GLAD_GL_ARB_sync)
{
/* Add fence to track when above gl commands are complete. */
info->sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
}
else
{
/* No sync objects; block until commands are complete. */
glFinish();
atomic_flag_clear(&info->in_use);
}

read_pos = (read_pos + 1) % BUFFERCOUNT;

Expand Down Expand Up @@ -788,10 +800,13 @@ static void opengl_main(void* param)
SDL_ShowCursor(show_cursor);
}

for (int i = 0; i < BUFFERCOUNT; i++)
if (GLAD_GL_ARB_sync)
{
if (blit_info[i].sync != NULL)
glDeleteSync(blit_info[i].sync);
for (int i = 0; i < BUFFERCOUNT; i++)
{
if (blit_info[i].sync != NULL)
glDeleteSync(blit_info[i].sync);
}
}

finalize_glcontext(&gl);
Expand Down
8 changes: 4 additions & 4 deletions src/win/win_opengl_glslp.c
Expand Up @@ -43,7 +43,7 @@
/**
* @brief Default vertex shader.
*/
static const GLchar* vertex_shader = "#version 330 core\n\
static const GLchar* vertex_shader = "#version 130\n\
in vec2 VertexCoord;\n\
in vec2 TexCoord;\n\
out vec2 tex;\n\
Expand All @@ -55,7 +55,7 @@ void main(){\n\
/**
* @brief Default fragment shader.
*/
static const GLchar* fragment_shader = "#version 330 core\n\
static const GLchar* fragment_shader = "#version 130\n\
in vec2 tex;\n\
uniform sampler2D texsampler;\n\
out vec4 color;\n\
Expand Down Expand Up @@ -173,8 +173,8 @@ GLuint load_custom_shaders(const char* path)
{
int success = 1;

const char* vertex_sources[2] = { "#version 330 core\n#define VERTEX\n", shader };
const char* fragment_sources[2] = { "#version 330 core\n#define FRAGMENT\n", shader };
const char* vertex_sources[2] = { "#version 130\n#define VERTEX\n", shader };
const char* fragment_sources[2] = { "#version 130\n#define FRAGMENT\n", shader };

GLuint vertex_id = glCreateShader(GL_VERTEX_SHADER);
GLuint fragment_id = glCreateShader(GL_FRAGMENT_SHADER);
Expand Down