BACKENDS: Replace GLEW with GLAD, part of PR #3463

This commit is contained in:
Cameron Cawley 2021-06-19 13:58:31 +01:00 committed by Paweł Kołodziejski
parent 43d87cb029
commit 21b0d6ded1
30 changed files with 8604 additions and 597 deletions

View file

@ -14,13 +14,13 @@ jobs:
triplet: x86-windows
arch: x86
configFlags: --enable-faad --enable-mpeg2 --enable-discord
vcpkgPackages: 'curl discord-rpc faad2 fluidsynth freetype glew libflac libjpeg-turbo libmad libmpeg2 libogg libpng libtheora libvorbis sdl2 sdl2-net zlib giflib fribidi'
vcpkgPackages: 'curl discord-rpc faad2 fluidsynth freetype libflac libjpeg-turbo libmad libmpeg2 libogg libpng libtheora libvorbis sdl2 sdl2-net zlib giflib fribidi'
useNasm: 'true'
- platform: x64
arch: x64
triplet: x64-windows
configFlags: --enable-faad --enable-mpeg2 --enable-discord
vcpkgPackages: 'curl discord-rpc faad2 fluidsynth freetype glew libflac libjpeg-turbo libmad libmpeg2 libogg libpng libtheora libvorbis sdl2 sdl2-net zlib giflib fribidi'
vcpkgPackages: 'curl discord-rpc faad2 fluidsynth freetype libflac libjpeg-turbo libmad libmpeg2 libogg libpng libtheora libvorbis sdl2 sdl2-net zlib giflib fribidi'
- platform: arm64
arch: arm64
triplet: arm64-windows
@ -102,7 +102,7 @@ jobs:
- platform: macosx
buildFlags: -scheme ScummVM-macOS
configFlags: --disable-nasm --enable-faad --enable-mpeg2
brewPackages: a52dec faad2 flac fluid-synth freetype fribidi glew mad libmpeg2 libogg libpng libvorbis sdl2 sdl2_net theora giflib
brewPackages: a52dec faad2 flac fluid-synth freetype fribidi mad libmpeg2 libogg libpng libvorbis sdl2 sdl2_net theora giflib
- platform: ios7
buildFlags: -scheme ScummVM-iOS CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO
configFlags: --disable-nasm --disable-opengl --disable-theora --disable-taskbar --disable-tts --disable-fribidi
@ -149,10 +149,10 @@ jobs:
include:
- platform: ubuntu-latest
sdlConfig: sdl2-config
aptPackages: 'libsdl2-dev libsdl2-net-dev liba52-dev libjpeg-turbo8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libfribidi-dev libglew-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libunity-dev'
aptPackages: 'libsdl2-dev libsdl2-net-dev liba52-dev libjpeg-turbo8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libfribidi-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libunity-dev'
- platform: ubuntu-18.04
sdlConfig: sdl-config
aptPackages: 'libsdl1.2-dev libsdl-net1.2-dev liba52-dev libjpeg-turbo8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libfribidi-dev libglew-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libunity-dev'
aptPackages: 'libsdl1.2-dev libsdl-net1.2-dev liba52-dev libjpeg-turbo8-dev libmpeg2-4-dev libogg-dev libvorbis-dev libflac-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libfribidi-dev libcurl4-openssl-dev libgtk-3-dev libspeechd-dev libsndio-dev libunity-dev'
env:
SDL_CONFIG: ${{ matrix.sdlConfig }}
steps:

63
LICENSES/COPYING.GLAD Normal file
View file

@ -0,0 +1,63 @@
The glad source code:
The MIT License (MIT)
Copyright (c) 2013-2021 David Herberth
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The Khronos Specifications:
Copyright (c) 2013-2020 The Khronos Group Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
The EGL Specification and various headers:
Copyright (c) 2007-2016 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

View file

@ -353,7 +353,7 @@ dist-src: \
@#DEB-src?
# Common files
DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL COPYRIGHT NEWS.md README.md CONTRIBUTING.md)
DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL LICENSES/COPYING.GLAD COPYRIGHT NEWS.md README.md CONTRIBUTING.md)
ifdef USE_PANDOC
DIST_FILES_DOCS+=README$(PANDOCEXT) NEWS$(PANDOCEXT) CONTRIBUTING$(PANDOCEXT)
endif

View file

@ -19,6 +19,8 @@
*
*/
#define GLAD_GL_IMPLEMENTATION
#include "backends/graphics/opengl/opengl-sys.h"
#include "backends/graphics/opengl/opengl-graphics.h"
#include "backends/graphics/opengl/shader.h"
@ -43,9 +45,7 @@ void Context::reset() {
packedPixelsSupported = false;
textureEdgeClampSupported = false;
#define GL_FUNC_DEF(ret, name, param) name = nullptr;
#include "backends/graphics/opengl/opengl-func.h"
#undef GL_FUNC_DEF
isInitialized = false;
activePipeline = nullptr;
}
@ -78,45 +78,43 @@ void OpenGLGraphicsManager::setContextType(ContextType type) {
g_context.type = type;
}
#ifdef USE_GLAD
static GLADapiproc loadFunc(void *userptr, const char *name) {
OpenGLGraphicsManager *openglGraphicsManager = (OpenGLGraphicsManager *)userptr;
return (GLADapiproc)openglGraphicsManager->getProcAddress(name);
}
#endif
void OpenGLGraphicsManager::initializeGLContext() {
// Initialize default state.
g_context.reset();
// Load all functions.
// We use horrible trickery to silence C++ compilers.
// See backends/plugins/sdl/sdl-provider.cpp for more information.
assert(sizeof(void (*)()) == sizeof(void *));
#ifdef USE_GLAD
switch (g_context.type) {
case kContextGL:
gladLoadGLUserPtr(loadFunc, this);
break;
#define LOAD_FUNC(name, loadName) { \
void *fn = getProcAddress(#loadName); \
memcpy(&g_context.name, &fn, sizeof(fn)); \
}
case kContextGLES:
gladLoadGLES1UserPtr(loadFunc, this);
break;
#define GL_EXT_FUNC_DEF(ret, name, param) LOAD_FUNC(name, name)
case kContextGLES2:
gladLoadGLES2UserPtr(loadFunc, this);
break;
#ifdef USE_BUILTIN_OPENGL
#define GL_FUNC_DEF(ret, name, param) g_context.name = &name
// GL_FUNC2_DEF will be defined in opengl-func.h
#else
#define GL_FUNC_DEF GL_EXT_FUNC_DEF
#define GL_FUNC_2_DEF(ret, name, extName, param) \
if (g_context.type == kContextGL) { \
LOAD_FUNC(name, extName); \
} else { \
LOAD_FUNC(name, name); \
default:
break;
}
#endif
#include "backends/graphics/opengl/opengl-func.h"
#undef GL_FUNC_2_DEF
#undef GL_FUNC_DEF
#undef GL_EXT_FUNC_DEF
#undef LOAD_FUNC
g_context.isInitialized = true;
// Obtain maximum texture size.
GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_context.maxTextureSize));
debug(5, "OpenGL maximum texture size: %d", g_context.maxTextureSize);
const char *verString = (const char *)g_context.glGetString(GL_VERSION);
const char *verString = (const char *)glGetString(GL_VERSION);
debug(5, "OpenGL version: %s", verString);
const char *glVersionFormat;
@ -131,7 +129,7 @@ void OpenGLGraphicsManager::initializeGLContext() {
warning("Could not parse GL version '%s'", verString);
}
const char *extString = (const char *)g_context.glGetString(GL_EXTENSIONS);
const char *extString = (const char *)glGetString(GL_EXTENSIONS);
debug(5, "OpenGL extensions: %s", extString);
bool ARBShaderObjects = false;
@ -207,9 +205,9 @@ void OpenGLGraphicsManager::initializeGLContext() {
// Log features supported by GL context.
if (g_context.shadersSupported)
debug(5, "GLSL version: %s", g_context.glGetString(GL_SHADING_LANGUAGE_VERSION));
debug(5, "OpenGL vendor: %s", g_context.glGetString(GL_VENDOR));
debug(5, "OpenGL renderer: %s", g_context.glGetString(GL_RENDERER));
debug(5, "GLSL version: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
debug(5, "OpenGL vendor: %s", glGetString(GL_VENDOR));
debug(5, "OpenGL renderer: %s", glGetString(GL_RENDERER));
debug(5, "OpenGL: NPOT texture support: %d", g_context.NPOTSupported);
debug(5, "OpenGL: Shader support: %d", g_context.shadersSupported);
debug(5, "OpenGL: Multitexture support: %d", g_context.multitextureSupported);

View file

@ -55,7 +55,7 @@ Common::String getGLErrStr(GLenum error) {
void checkGLError(const char *expr, const char *file, int line) {
GLenum error;
while ((error = g_context.glGetError()) != GL_NO_ERROR) {
while ((error = glGetError()) != GL_NO_ERROR) {
// We cannot use error here because we do not know whether we have a
// working screen or not.
warning("GL ERROR: %s on %s (%s:%d)", getGLErrStr(error).c_str(), expr, file, line);

View file

@ -1,263 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* This file is based on Mesa 3-D's gl.h and GLES/gl.h from Khronos Registry.
*
* Mesa 3-D's gl.h file is distributed under the following license:
* Mesa 3-D graphics library
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*
* GLES/gl.h from Khronos Registry is distributed under the following license:
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
#ifndef BACKENDS_GRAPHICS_OPENGL_OPENGL_DEFS_H
#define BACKENDS_GRAPHICS_OPENGL_OPENGL_DEFS_H
#include "common/scummsys.h"
/*
* Datatypes
*/
typedef uint GLenum;
typedef uint8 GLboolean;
typedef uint GLbitfield;
typedef void GLvoid;
typedef int8 GLbyte; /* 1-byte signed */
typedef int16 GLshort; /* 2-byte signed */
typedef int32 GLint; /* 4-byte signed */
typedef uint8 GLubyte; /* 1-byte unsigned */
typedef uint16 GLushort; /* 2-byte unsigned */
typedef uint32 GLuint; /* 4-byte unsigned */
typedef int32 GLsizei; /* 4-byte signed */
typedef float GLfloat; /* single precision float */
typedef float GLclampf; /* single precision float in [0,1] */
typedef double GLdouble; /* double precision float */
typedef double GLclampd; /* double precision float in [0,1] */
typedef char GLchar;
#if defined(MACOSX)
typedef void *GLhandleARB;
#else
typedef uint GLhandleARB;
#endif
// This is an addition from us to alias ARB shader object extensions to
// OpenGL (ES) 2.0 style functions. It only works when GLhandleARB and GLuint
// are type compatible.
typedef GLhandleARB GLprogram;
typedef GLhandleARB GLshader;
/*
* Constants
*/
/* Boolean constants */
#define GL_FALSE 0
#define GL_TRUE 1
/* StringName */
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
/* ErrorCode */
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_STACK_OVERFLOW 0x0503
#define GL_STACK_UNDERFLOW 0x0504
#define GL_OUT_OF_MEMORY 0x0505
/* ClearBufferMask */
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
/* Scissor box */
#define GL_SCISSOR_BOX 0x0C10
#define GL_SCISSOR_TEST 0x0C11
/* MatrixMode */
#define GL_MATRIX_MODE 0x0BA0
#define GL_MODELVIEW 0x1700
#define GL_PROJECTION 0x1701
#define GL_TEXTURE 0x1702
/* EnableCap */
#define GL_FOG 0x0B60
#define GL_LIGHTING 0x0B50
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_ALPHA_TEST 0x0BC0
#define GL_BLEND 0x0BE2
#define GL_DITHER 0x0BD0
#define GL_DEPTH_TEST 0x0B71
#define GL_VERTEX_ARRAY 0x8074
#define GL_COLOR_ARRAY 0x8076
#define GL_TEXTURE_COORD_ARRAY 0x8078
/* ShadingModel */
#define GL_FLAT 0x1D00
#define GL_SMOOTH 0x1D01
/* HintMode */
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
/* HintTarget */
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
#define GL_POINT_SMOOTH_HINT 0x0C51
#define GL_LINE_SMOOTH_HINT 0x0C52
#define GL_FOG_HINT 0x0C54
#define GL_GENERATE_MIPMAP_HINT 0x8192
/* BlendingFactorDest */
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* PixelFormat */
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_BGR 0x80E0
#define GL_BGRA 0x80E1
#define GL_RED 0x1903
#define GL_R8 0x8229
/* PixelStoreParameter */
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
/* DataType */
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
/* Implementation limits */
#define GL_MAX_TEXTURE_SIZE 0x0D33
/* TextureMagFilter */
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
/* TextureParameterName */
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
/* TextureWrapMode */
#define GL_CLAMP 0x2900
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
/* BeginMode */
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* Shaders */
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
/* Programs */
#define GL_COMPILE_STATUS 0x8B81
#define GL_LINK_STATUS 0x8B82
#define GL_INFO_LOG_LENGTH 0x8B84
#define GL_CURRENT_PROGRAM 0x8B8D
/* Textures */
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
/* GetPName */
#define GL_VIEWPORT 0x0BA2
#define GL_FRAMEBUFFER_BINDING 0x8CA6
/* Framebuffer objects */
#define GL_COLOR_ATTACHMENT0 0x8CE0
#define GL_FRAMEBUFFER 0x8D40
#endif

View file

@ -1,155 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* This file is based on Mesa 3-D's gl.h and GLES/gl.h from Khronos Registry.
*
* Mesa 3-D's gl.h file is distributed under the following license:
* Mesa 3-D graphics library
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*
* GLES/gl.h from Khronos Registry is distributed under the following license:
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/*
* This file is a template file to be used inside specific locations in the
* OpenGL graphics code. It is not to be included otherwise. It intentionally
* does not contain include guards because it can be required to include it
* multiple times in a source file.
*
* Functions are defined by three different user supplied macros:
* GL_FUNC_DEF: Define a (builtin) OpenGL (ES) function.
* GL_FUNC_2_DEF: Define a OpenGL (ES) 2.0 function which can be provided by
* extensions in OpenGL 1.x contexts.
* GL_EXT_FUNC_DEF: Define an OpenGL (ES) extension function.
*/
#if !defined(GL_FUNC_2_DEF)
#define GL_FUNC_2_DEF(ret, name, extName, param) GL_FUNC_DEF(ret, name, param)
#define DEFINED_GL_FUNC_2_DEF
#endif
#if !defined(GL_EXT_FUNC_DEF)
#define GL_EXT_FUNC_DEF(ret, name, param) GL_FUNC_DEF(ret, name, param)
#define DEFINED_GL_EXT_FUNC_DEF
#endif
GL_FUNC_DEF(void, glEnable, (GLenum cap));
GL_FUNC_DEF(void, glDisable, (GLenum cap));
GL_FUNC_DEF(GLboolean, glIsEnabled, (GLenum cap));
GL_FUNC_DEF(void, glClear, (GLbitfield mask));
GL_FUNC_DEF(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height));
GL_FUNC_DEF(void, glHint, (GLenum target, GLenum mode));
GL_FUNC_DEF(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha));
GL_FUNC_DEF(void, glBlendFunc, (GLenum sfactor, GLenum dfactor));
GL_FUNC_DEF(void, glPixelStorei, (GLenum pname, GLint param));
GL_FUNC_DEF(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height));
GL_FUNC_DEF(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels));
GL_FUNC_DEF(void, glGetIntegerv, (GLenum pname, GLint *params));
GL_FUNC_DEF(void, glDeleteTextures, (GLsizei n, const GLuint *textures));
GL_FUNC_DEF(void, glGenTextures, (GLsizei n, GLuint *textures));
GL_FUNC_DEF(void, glBindTexture, (GLenum target, GLuint texture));
GL_FUNC_DEF(void, glTexParameteri, (GLenum target, GLenum pname, GLint param));
GL_FUNC_DEF(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels));
GL_FUNC_DEF(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count));
GL_FUNC_DEF(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels));
GL_FUNC_DEF(const GLubyte *, glGetString, (GLenum name));
GL_FUNC_DEF(GLenum, glGetError, ());
#if !USE_FORCED_GLES2
GL_FUNC_DEF(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha));
GL_FUNC_DEF(void, glMatrixMode, (GLenum mode));
GL_FUNC_DEF(void, glLoadIdentity, ());
GL_FUNC_DEF(void, glLoadMatrixf, (const GLfloat *m));
GL_FUNC_DEF(void, glShadeModel, (GLenum mode));
GL_FUNC_DEF(void, glEnableClientState, (GLenum array));
GL_FUNC_DEF(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
GL_FUNC_DEF(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
#endif
#if !USE_FORCED_GLES
GL_FUNC_2_DEF(void, glEnableVertexAttribArray, glEnableVertexAttribArrayARB, (GLuint index));
GL_FUNC_2_DEF(void, glDisableVertexAttribArray, glDisableVertexAttribArrayARB, (GLuint index));
GL_FUNC_2_DEF(void, glUniform1i, glUniform1iARB, (GLint location, GLint v0));
GL_FUNC_2_DEF(void, glUniform1f, glUniform1fARB, (GLint location, GLfloat v0));
GL_FUNC_2_DEF(void, glUniformMatrix4fv, glUniformMatrix4fvARB, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value));
GL_FUNC_2_DEF(void, glVertexAttrib4f, glVertexAttrib4fARB, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w));
GL_FUNC_2_DEF(void, glVertexAttribPointer, glVertexAttribPointerARB, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer));
GL_FUNC_2_DEF(GLprogram, glCreateProgram, glCreateProgramObjectARB, ());
GL_FUNC_2_DEF(void, glDeleteProgram, glDeleteObjectARB, (GLprogram program));
GL_FUNC_2_DEF(void, glAttachShader, glAttachObjectARB, (GLprogram program, GLshader shader));
GL_FUNC_2_DEF(void, glDetachShader, glDetachObjectARB, (GLprogram program, GLshader shader));
GL_FUNC_2_DEF(void, glLinkProgram, glLinkProgramARB, (GLprogram program));
GL_FUNC_2_DEF(void, glUseProgram, glUseProgramObjectARB, (GLprogram program));
GL_FUNC_2_DEF(void, glGetProgramiv, glGetObjectParameterivARB, (GLprogram program, GLenum pname, GLint *params));
GL_FUNC_2_DEF(void, glGetProgramInfoLog, glGetInfoLogARB, (GLprogram program, GLsizei bufSize, GLsizei *length, GLchar *infoLog));
GL_FUNC_2_DEF(void, glBindAttribLocation, glBindAttribLocationARB, (GLprogram program, GLuint index, const GLchar *name));
GL_FUNC_2_DEF(GLint, glGetAttribLocation, glGetAttribLocationARB, (GLprogram program, const GLchar *name));
GL_FUNC_2_DEF(GLint, glGetUniformLocation, glGetUniformLocationARB, (GLprogram program, const GLchar *name));
GL_FUNC_2_DEF(GLshader, glCreateShader, glCreateShaderObjectARB, (GLenum type));
GL_FUNC_2_DEF(void, glDeleteShader, glDeleteObjectARB, (GLshader shader));
GL_FUNC_2_DEF(void, glGetShaderiv, glGetObjectParameterivARB, (GLshader shader, GLenum pname, GLint *params));
GL_FUNC_2_DEF(void, glGetShaderInfoLog, glGetInfoLogARB, (GLshader shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog));
GL_FUNC_2_DEF(void, glShaderSource, glShaderSourceARB, (GLshader shader, GLsizei count, const GLchar *const *string, const GLint *length));
GL_FUNC_2_DEF(void, glCompileShader, glCompileShaderARB, (GLshader shader));
GL_FUNC_2_DEF(void, glBindFramebuffer, glBindFramebufferEXT, (GLenum target, GLuint renderbuffer));
GL_FUNC_2_DEF(void, glDeleteFramebuffers, glDeleteFramebuffersEXT, (GLsizei n, const GLuint *framebuffers));
GL_FUNC_2_DEF(void, glGenFramebuffers, glGenFramebuffersEXT, (GLsizei n, GLuint *renderbuffers));
GL_FUNC_2_DEF(void, glFramebufferTexture2D, glFramebufferTexture2DEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level));
GL_FUNC_2_DEF(GLenum, glCheckFramebufferStatus, glCheckFramebufferStatusEXT, (GLenum target));
GL_FUNC_2_DEF(void, glActiveTexture, glActiveTextureARB, (GLenum texture));
#endif
#ifdef DEFINED_GL_EXT_FUNC_DEF
#undef DEFINED_GL_EXT_FUNC_DEF
#undef GL_EXT_FUNC_DEF
#endif
#ifdef DEFINED_GL_FUNC_2_DEF
#undef DEFINED_GL_FUNC_2_DEF
#undef GL_FUNC_2_DEF
#endif

View file

@ -305,7 +305,7 @@ private:
*/
Pipeline *_pipeline;
protected:
public:
/**
* Query the address of an OpenGL function by name.
*
@ -319,6 +319,7 @@ protected:
*/
virtual void *getProcAddress(const char *name) const = 0;
protected:
/**
* Try to determine the internal parameters for a given pixel format.
*

View file

@ -25,9 +25,6 @@
#include "common/scummsys.h"
#include "backends/graphics/opengl/debug.h"
#ifdef SDL_BACKEND
#include "backends/platform/sdl/sdl-sys.h"
#endif
// On OS X we only support GL contexts. The reason is that Apple's GL interface
// uses "void *" for GLhandleARB which is not type compatible with GLint. This
@ -60,25 +57,16 @@
#ifdef __ANDROID__
#include <GLES/gl.h>
#include <GLES2/gl2.h>
// These types are ScummVM specific
typedef GLuint GLprogram;
typedef GLuint GLshader;
#define USE_BUILTIN_OPENGL
#else
#include "backends/graphics/opengl/opengl-defs.h"
#include "graphics/opengl/glad.h"
#define USE_GLAD
#endif
#ifdef SDL_BACKEND
// Win32 needs OpenGL functions declared with APIENTRY.
// However, SDL does not define APIENTRY in it's SDL.h file on non-Windows
// targets, thus if it is not available, we just dummy define it.
#ifndef APIENTRY
#define APIENTRY
#endif
#define GL_CALL_CONV APIENTRY
#else
#define GL_CALL_CONV
#endif
// This is an addition from us to alias ARB shader object extensions to
// OpenGL (ES) 2.0 style functions. It only works when GLhandleARB and GLuint
// are type compatible.
typedef GLuint GLprogram;
typedef GLuint GLshader;
namespace OpenGL {
@ -98,6 +86,9 @@ struct Context {
/** The type of the active context. */
ContextType type;
/** Whether the context is initialized or not. */
bool isInitialized;
/**
* Reset context.
*
@ -135,10 +126,6 @@ struct Context {
/** Whether texture coordinate edge clamping is available or not. */
bool textureEdgeClampSupported;
#define GL_FUNC_DEF(ret, name, param) ret (GL_CALL_CONV *name)param
#include "backends/graphics/opengl/opengl-func.h"
#undef GL_FUNC_DEF
//
// Wrapper functionality to handle fixed-function pipelines and
// programmable pipelines in the same fashion.
@ -172,13 +159,13 @@ extern Context g_context;
} // End of namespace OpenGL
#define GL_CALL(x) GL_WRAP_DEBUG(g_context.x, x)
#define GL_CALL(x) GL_WRAP_DEBUG(x, x)
#define GL_CALL_SAFE(func, params) \
do { \
if (g_context.func) { \
if (g_context.isInitialized) { \
GL_CALL(func params); \
} \
} while (0)
#define GL_ASSIGN(var, x) GL_WRAP_DEBUG(var = g_context.x, x)
#define GL_ASSIGN(var, x) GL_WRAP_DEBUG(var = x, x)
#endif

View file

@ -305,9 +305,6 @@ void OpenGLSdlGraphics3dManager::setupScreen() {
debug("INFO: OpenGL Double Buffer: %d", glflag);
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &glflag);
debug("INFO: OpenGL Stencil buffer bits: %d", glflag);
#ifdef USE_GLEW
debug("INFO: GLEW Version: %s", glewGetString(GLEW_VERSION));
#endif
#ifdef USE_OPENGL_SHADERS
debug("INFO: GLSL version: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
#endif
@ -340,19 +337,6 @@ void OpenGLSdlGraphics3dManager::createOrUpdateScreen() {
g_system->quit();
}
#ifdef USE_GLEW
GLenum err = glewInit();
#ifdef GLEW_ERROR_NO_GLX_DISPLAY
if (err == GLEW_ERROR_NO_GLX_DISPLAY) {
// Wayland: https://github.com/nigels-com/glew/issues/172
} else
#endif
if (err != GLEW_OK) {
warning("Error: %s", glewGetErrorString(err));
g_system->quit();
}
#endif
#if SDL_VERSION_ATLEAST(2, 0, 1)
int obtainedWidth = 0, obtainedHeight = 0;
SDL_GL_GetDrawableSize(_window->getSDLWindow(), &obtainedWidth, &obtainedHeight);

View file

@ -55,7 +55,7 @@ install: build
install -m0644 dists/engine-data/*.cpt debian/scummvm/opt/scummvm/share
install -m0644 -d debian/scummvm/usr/share/doc/scummvm
install -m0644 AUTHORS COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL COPYRIGHT NEWS.md README.md debian/scummvm/usr/share/doc/scummvm
install -m0644 AUTHORS COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL LICENSES/COPYING.GLAD COPYRIGHT NEWS.md README.md debian/scummvm/usr/share/doc/scummvm
binary: binary-arch
binary-arch: build install

View file

@ -27,6 +27,7 @@ win32-data: all
cp $(srcdir)/LICENSES/COPYING.LUA $(WIN32PATH)/COPYING.LUA.txt
cp $(srcdir)/LICENSES/COPYING.MIT $(WIN32PATH)/COPYING.MIT.txt
cp $(srcdir)/LICENSES/COPYING.TINYGL $(WIN32PATH)/COPYING.TINYGL.txt
cp $(srcdir)/LICENSES/COPYING.GLAD $(WIN32PATH)/COPYING.GLAD.txt
cp $(srcdir)/COPYRIGHT $(WIN32PATH)/COPYRIGHT.txt
cp $(srcdir)/doc/cz/PrectiMe $(WIN32PATH)/doc/cz/PrectiMe.txt
cp $(srcdir)/doc/QuickStart $(WIN32PATH)/doc/QuickStart.txt

View file

@ -67,6 +67,7 @@ pkg_licenses_install = """
"..\\..\\..\\..\\COPYING.MIT" - "!:\\data\\scummvm\\COPYING.MIT"
"..\\..\\..\\..\\COPYING.OFL" - "!:\\data\\scummvm\\COPYING.OFL"
"..\\..\\..\\..\\COPYING.TINYGL" - "!:\\data\\scummvm\\COPYING.TINYGL"
"..\\..\\..\\..\\COPYING.GLAD" - "!:\\data\\scummvm\\COPYING.GLAD"
"..\\..\\..\\..\\COPYING" - "!:\\data\\scummvm\\COPYING"
"..\\..\\..\\..\\AUTHORS" - "!:\\data\\scummvm\\AUTHORS", FT, TC
"..\\..\\..\\..\\README.md" - "!:\\data\\scummvm\\README.md"

View file

@ -201,8 +201,5 @@ const char gScummVMFeatures[] = ""
#endif
#ifdef USE_GLES2
"OpenGL ES 2 "
#endif
#ifdef USE_GLEW
"GLEW "
#endif
;

63
configure vendored
View file

@ -158,7 +158,6 @@ _theoradec=auto
_faad=auto
_fluidsynth=auto
_fluidlite=auto
_glew=auto
_opengl_mode=auto
_opengl_game=auto
_opengl_game_classic=auto
@ -951,9 +950,6 @@ Optional Libraries:
--disable-opengl-game-shaders disable use of modern OpenGL with shaders
--force-opengl-game-es2 only detect OpenGL ES2
--with-glew-prefix=DIR prefix where GLEW is installed (optional)
--disable-glew disable GLEW support [autodetect]
--with-jpeg-prefix=DIR Prefix where libjpeg is installed (optional)
--disable-jpeg disable JPEG decoder [autodetect]
@ -1166,8 +1162,6 @@ for ac_option in $@; do
--disable-tts) _tts=no ;;
--enable-gtk) _gtk=yes ;;
--disable-gtk) _gtk=no ;;
--enable-glew) _glew=yes ;;
--disable-glew) _glew=no ;;
--disable-opengl-game) _opengl_game=no ;;
--disable-opengl-game-classic) _opengl_game_classic=no ;;
--disable-opengl-game-shaders) _opengl_game_shaders=no ;;
@ -1322,11 +1316,6 @@ for ac_option in $@; do
OPENGL_CFLAGS="-I$arg/include"
OPENGL_LIBS="-L$arg/lib"
;;
--with-glew-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
GLEW_CFLAGS="-I$arg/include"
GLEW_LIBS="-L$arg/lib"
;;
--with-discord-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
DISCORD_CFLAGS="-I$arg/include"
@ -5423,52 +5412,6 @@ case $_opengl_mode in
esac
#
# Check for GLEW
#
echocheck "GL Extension Wrangler (GLEW)"
if test "$_glew" != "no" && test "$_opengl" = "no"; then
_glew=no
echo "cannot use GLEW without OpenGL"
elif test "$_glew" != "no" && test "$_opengl_game_es2" = "yes"; then
_glew=no
echo "not needed with OpenGL ES v2"
else
case $_host_os in
mingw*)
_GLEW_CFLAGS="-DGLEW_STATIC"
_GLEW_LIBS="-lglew32 -lopengl32"
;;
*)
_GLEW_LIBS="-lGLEW"
;;
esac
if test "$_glew" = auto; then
_glew=no
cat > $TMPC << EOF
#include <GL/glew.h>
int main(void) {
glewInit();
return 0;
}
EOF
cc_check $DEFINES $GLEW_CFLAGS $_GLEW_CFLAGS $GLEW_LIBS $_GLEW_LIBS && _glew=yes
fi
if test "$_glew" = yes ; then
append_var LIBS "$GLEW_LIBS $_GLEW_LIBS"
append_var INCLUDES "$GLEW_CFLAGS $_GLEW_CFLAGS"
append_var LIBS_3D "$GLEW_LIBS $_GLEW_LIBS"
fi
echo "$_glew"
fi
define_in_config_if_yes "$_glew" "USE_GLEW"
#
# Check for OpenGL (ES) for game
#
@ -5548,11 +5491,7 @@ EOF
_opengl_game_classic=yes
fi
if test "$_opengl_game_shaders" = auto; then
_opengl_game_shaders=$_glew
fi
if test "$_opengl_game_shaders" = yes && test "$_opengl_game_es2" = no && test "$_glew" = no; then
echo "WARNING: OpenGL Shader support requires GLEW!"
_opengl_game_shaders=no
_opengl_game_shaders=yes
fi
elif test "$_opengl_game_es2" = "yes" ; then
append_var INCLUDES "$OPENGL_CFLAGS"

View file

@ -53,7 +53,6 @@ const CMakeProvider::Library *CMakeProvider::getLibraryFromFeature(const char *f
{ "fribidi", "fribidi", kSDLVersionAny, nullptr, nullptr, nullptr, nullptr, "fribidi" },
{ "discord", "discord", kSDLVersionAny, nullptr, nullptr, nullptr, nullptr, "discord-rpc"},
{ "opengl", nullptr, kSDLVersionAny, "FindOpenGL", "OpenGL", "OPENGL_INCLUDE_DIR", "OPENGL_gl_LIBRARY", nullptr },
{ "glew", "glew", kSDLVersionAny, "FindGLEW", "GLEW", "GLEW_INCLUDE_DIR", "GLEW_LIBRARIES", nullptr },
{ "libcurl", "libcurl", kSDLVersionAny, "FindCURL", "CURL", "CURL_INCLUDE_DIRS", "CURL_LIBRARIES", nullptr },
{ "sdlnet", nullptr, kSDLVersion1, "FindSDL_net", "SDL_net", "SDL_NET_INCLUDE_DIRS", "SDL_NET_LIBRARIES", nullptr },
{ "sdlnet", "SDL2_net", kSDLVersion2, nullptr, nullptr, nullptr, nullptr, "SDL2_net" }

View file

@ -336,7 +336,6 @@ int main(int argc, char *argv[]) {
setFeatureBuildState("opengl_game", setup.features, false);
setFeatureBuildState("opengl_shaders", setup.features, false);
setFeatureBuildState("opengles2", setup.features, false);
setFeatureBuildState("glew", setup.features, false);
}
// Disable engines for which we are missing dependencies
@ -1083,7 +1082,6 @@ const Feature s_features[] = {
{ "libcurl", "USE_LIBCURL", true, true, "libcurl support" },
{ "sdlnet", "USE_SDL_NET", true, true, "SDL_net support" },
{ "discord", "USE_DISCORD", true, false, "Discord support" },
{ "glew", "USE_GLEW", true, true, "GLEW support" },
// Feature flags
{ "bink", "USE_BINK", false, true, "Bink video support" },
@ -1646,6 +1644,7 @@ void ProjectProvider::createProject(BuildSetup &setup) {
in.push_back(setup.srcDir + "/LICENSES/COPYING.LUA");
in.push_back(setup.srcDir + "/LICENSES/COPYING.MIT");
in.push_back(setup.srcDir + "/LICENSES/COPYING.TINYGL");
in.push_back(setup.srcDir + "/LICENSES/COPYING.GLAD");
in.push_back(setup.srcDir + "/COPYRIGHT");
in.push_back(setup.srcDir + "/NEWS.md");
in.push_back(setup.srcDir + "/README.md");

View file

@ -75,7 +75,6 @@ std::string MSVCProvider::getLibraryFromFeature(const char *feature, const Build
{ "sdlnet", "SDL_net.lib", nullptr, "iphlpapi.lib", nullptr },
{ "sdl2net", "SDL2_net.lib", nullptr, "iphlpapi.lib", "SDL_net.lib" },
{ "discord", "discord-rpc.lib", nullptr, nullptr, nullptr },
{ "glew", "glew32.lib", "glew32d.lib", nullptr, nullptr },
// Feature flags with library dependencies
{ "updates", "winsparkle.lib", nullptr, nullptr, nullptr },
{ "tts", nullptr, nullptr, "sapi.lib", nullptr },

View file

@ -502,9 +502,6 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
}
if (CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
DEF_LOCALLIB_STATIC("libtheoradec");
if (CONTAINS_DEFINE(setup.defines, "USE_GLEW")) {
DEF_LOCALLIB_STATIC("libGLEW");
}
}
if (CONTAINS_DEFINE(setup.defines, "USE_ZLIB")) {
DEF_SYSTBD("libz");
@ -709,9 +706,6 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
if (CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
frameworks_osx.push_back("libtheoradec.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_GLEW")) {
frameworks_osx.push_back("libGLEW.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_ZLIB")) {
frameworks_osx.push_back("libz.tbd");
}
@ -871,6 +865,7 @@ XcodeProvider::ValueList& XcodeProvider::getResourceFiles() const {
files.push_back("LICENSES/COPYING.LUA");
files.push_back("LICENSES/COPYING.MIT");
files.push_back("LICENSES/COPYING.TINYGL");
files.push_back("LICENSES/COPYING.GLAD");
files.push_back("NEWS.md");
files.push_back("README.md");
}

View file

@ -8,6 +8,7 @@ f 0644 root sys usr/ScummVM/COPYING.ISC LICENSES/COPYING.ISC scummvm.man.readme
f 0644 root sys usr/ScummVM/COPYING.LUA LICENSES/COPYING.LUA scummvm.man.readme
f 0644 root sys usr/ScummVM/COPYING.MIT LICENSES/COPYING.MIT scummvm.man.readme
f 0644 root sys usr/ScummVM/COPYING.TINYGL LICENSES/COPYING.TINYGL scummvm.man.readme
f 0644 root sys usr/ScummVM/COPYING.GLAD LICENSES/COPYING.GLAD scummvm.man.readme
f 0644 root sys usr/ScummVM/COPYRIGHT COPYRIGHT scummvm.man.readme
f 0644 root sys usr/ScummVM/NEWS.md NEWS.module scummvm.man.readme
f 0644 root sys usr/ScummVM/README.md README.md scummvm.man.readme

View file

@ -86,7 +86,7 @@ fi
#------------------------------------------------------------------------------
%files
%defattr(0644,root,root,0755)
%doc AUTHORS README.md NEWS.md COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL COPYRIGHT
%doc AUTHORS README.md NEWS.md COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL LICENSES/COPYING.GLAD COPYRIGHT
%attr(0755,root,root)%{_bindir}/scummvm
%{_datadir}/applications/*
%{_datadir}/pixmaps/scummvm.xpm

View file

@ -86,7 +86,7 @@ fi
#------------------------------------------------------------------------------
%files
%defattr(0644,root,root,0755)
%doc AUTHORS README.md NEWS.md COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL COPYRIGHT
%doc AUTHORS README.md NEWS.md COPYING LICENSES/COPYING.BSD LICENSES/COPYING.LGPL LICENSES/COPYING.FREEFONT LICENSES/COPYING.OFL LICENSES/COPYING.ISC LICENSES/COPYING.LUA LICENSES/COPYING.MIT LICENSES/COPYING.TINYGL LICENSES/COPYING.GLAD COPYRIGHT
%attr(0755,root,root)%{_bindir}/scummvm
%{_datadir}/applications/*
%{_datadir}/pixmaps/scummvm.xpm

View file

@ -220,6 +220,7 @@ Name: {group}\Copying.ISC; Filename: {app}\LICENSES\COPYING.ISC.txt; WorkingDir:
Name: {group}\Copying.LUA; Filename: {app}\LICENSES\COPYING.LUA.txt; WorkingDir: {app}; Comment: COPYING.LUA; Flags: createonlyiffileexists
Name: {group}\Copying.MIT; Filename: {app}\LICENSES\COPYING.MIT.txt; WorkingDir: {app}; Comment: COPYING.MIT; Flags: createonlyiffileexists
Name: {group}\Copying.TINYGL; Filename: {app}\LICENSES\COPYING.TINYGL.txt; WorkingDir: {app}; Comment: COPYING.TINYGL; Flags: createonlyiffileexists
Name: {group}\Copying.GLAD; Filename: {app}\LICENSES\COPYING.GLAD.txt; WorkingDir: {app}; Comment: COPYING.GLAD; Flags: createonlyiffileexists
Name: {group}\Copyright; Filename: {app}\COPYRIGHT.txt; WorkingDir: {app}; Comment: COPYRIGHT; Flags: createonlyiffileexists
; NEWS

View file

@ -7,6 +7,7 @@ COPYING.LUA.txt
COPYING.MIT.txt
COPYING.OFL.txt
COPYING.TINYGL
COPYING.GLAD
COPYING.txt
COPYRIGHT.txt
drascula.dat

View file

@ -45,7 +45,7 @@
#include "engines/grim/registry.h"
#if defined (SDL_BACKEND) && defined(GL_ARB_fragment_program) && !defined(USE_GLEW)
#if defined (SDL_BACKEND) && defined(GL_ARB_fragment_program) && !defined(USE_GLAD)
// We need SDL.h for SDL_GL_GetProcAddress.
#include "backends/platform/sdl/sdl-sys.h"
@ -164,7 +164,7 @@ void GfxOpenGL::initExtensions() {
}
#if defined (SDL_BACKEND) && defined(GL_ARB_fragment_program)
#ifndef USE_GLEW
#ifndef USE_GLAD
union {
void *obj_ptr;
void (APIENTRY *func_ptr)();

View file

@ -30,6 +30,20 @@
#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
#ifdef USE_GLAD
#ifdef SDL_BACKEND
#include "backends/platform/sdl/sdl-sys.h"
static GLADapiproc loadFunc(void *userptr, const char *name) {
return (GLADapiproc)SDL_GL_GetProcAddress(name);
}
#else
#error Not implemented
#endif
#endif
namespace Common {
DECLARE_SINGLETON(OpenGL::ContextGL);
}
@ -59,6 +73,21 @@ void ContextGL::initialize(ContextOGLType contextType) {
type = contextType;
#ifdef USE_GLAD
switch (type) {
case kOGLContextGL:
gladLoadGLUserPtr(loadFunc, this);
break;
case kOGLContextGLES2:
gladLoadGLES2UserPtr(loadFunc, this);
break;
default:
break;
}
#endif
// Obtain maximum texture size.
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&maxTextureSize);
debug(5, "OpenGL maximum texture size: %d", maxTextureSize);

View file

@ -24,7 +24,7 @@
#if (defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)) && !defined(AMIGAOS) && !defined(__MORPHOS__)
#if defined(SDL_BACKEND) && !defined(USE_GLEW) && !defined(USE_GLES2)
#if defined(SDL_BACKEND) && !defined(USE_GLAD) && !defined(USE_GLES2)
#define GL_GLEXT_PROTOTYPES // For the GL_EXT_framebuffer_object extension
#include "graphics/opengl/framebuffer.h"
#ifndef GL_ARB_framebuffer_object
@ -53,7 +53,7 @@
namespace OpenGL {
#if defined(SDL_BACKEND) && !defined(USE_GLEW) && !defined(USE_GLES2)
#if defined(SDL_BACKEND) && !defined(USE_GLAD) && !defined(USE_GLES2)
static bool framebuffer_object_functions = false;
static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebuffer;
static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbuffer;
@ -108,7 +108,7 @@ static void grabFramebufferObjectPointers() {
u.obj_ptr = SDL_GL_GetProcAddress("glRenderbufferStorageMultisample");
glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)u.func_ptr;
}
#endif // defined(SDL_BACKEND) && !defined(USE_GLEW) && !defined(USE_GLES2)
#endif // defined(SDL_BACKEND) && !defined(USE_GLAD) && !defined(USE_GLES2)
@ -125,7 +125,7 @@ FrameBuffer::FrameBuffer(uint width, uint height) :
error("FrameBuffer Objects are not supported by the current OpenGL context");
}
#if defined(SDL_BACKEND) && !defined(USE_GLEW) && !defined(USE_GLES2)
#if defined(SDL_BACKEND) && !defined(USE_GLAD) && !defined(USE_GLES2)
grabFramebufferObjectPointers();
#endif

8435
graphics/opengl/glad.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -45,17 +45,14 @@
#define GL_UNPACK_ROW_LENGTH 0x0CF2
#endif
#elif defined(USE_GLEW)
#include <GL/glew.h>
#elif defined(SDL_BACKEND) && defined(USE_OPENGL_GAME)
#include <SDL_opengl.h>
#elif defined(USE_OPENGL_GAME)
#include <GL/gl.h>
#endif
#endif
#if !defined(GL_MAX_SAMPLES)
// The Android SDK and SDL1 don't declare GL_MAX_SAMPLES
#define GL_MAX_SAMPLES 0x8D57
#endif
#else
#define USE_GLAD
#include "graphics/opengl/glad.h"
#endif
#endif

View file

@ -461,9 +461,6 @@ endif
OSX_STATIC_LIBS += -framework Sparkle -Wl,-rpath,@loader_path/../Frameworks
endif
endif
ifdef USE_GLEW
OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libGLEW.a
endif
# Special target to create a static linked binary for Mac OS X.
# We use -force_cpusubtype_ALL to ensure the binary runs on every
@ -496,6 +493,7 @@ osxsnap: bundle
mv ./ScummVM-snapshot/COPYING.LUA ./ScummVM-snapshot/License\ \(Lua\)
mv ./ScummVM-snapshot/COPYING.MIT ./ScummVM-snapshot/License\ \(MIT\)
mv ./ScummVM-snapshot/COPYING.TINYGL ./ScummVM-snapshot/License\ \(TinyGL\)
mv ./ScummVM-snapshot/COPYING.GLAD ./ScummVM-snapshot/License\ \(Glad\)
$(XCODETOOLSPATH)/SetFile -t ttro -c ttxt ./ScummVM-snapshot/*
mkdir ScummVM-snapshot/doc
cp $(srcdir)/doc/QuickStart ./ScummVM-snapshot/doc/QuickStart