mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
build: replace gl_core_3_3.c with GLEW
This commit is contained in:
parent
0e04acd901
commit
a02eb0762a
26 changed files with 151 additions and 12129 deletions
|
@ -61,6 +61,11 @@ runs:
|
|||
shell: bash
|
||||
run: sudo port -N install pcre2 +universal
|
||||
|
||||
- name: "Build dependency: GLEW (universal)"
|
||||
if: steps.restore-cache.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: sudo port -N install glew +universal
|
||||
|
||||
- name: "Build dependency: libsdl2 (universal)"
|
||||
if: steps.restore-cache.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include "debug.h"
|
||||
#include "gfx/context.h"
|
||||
#include "gfx/gl/gl_core_3_3.h"
|
||||
#include "gfx/gl/utils.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "gfx/3d/vertex_stream.h"
|
||||
|
||||
#include "gfx/gl/gl_core_3_3.h"
|
||||
#include "gfx/gl/utils.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#define M_PREALLOC_VERTEX_COUNT 8000
|
||||
|
||||
static const GLenum GL_PRIM_MODES[] = {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "gfx/context.h"
|
||||
|
||||
#include "game/shell.h"
|
||||
#include "gfx/gl/gl_core_3_3.h"
|
||||
#include "gfx/gl/utils.h"
|
||||
#include "gfx/renderers/fbo_renderer.h"
|
||||
#include "gfx/renderers/legacy_renderer.h"
|
||||
|
@ -9,6 +8,7 @@
|
|||
#include "log.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -132,6 +132,16 @@ bool GFX_Context_Attach(void *window_handle, GFX_GL_BACKEND backend)
|
|||
"Can't activate OpenGL context: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
// Instruct GLEW to load non-Core Profile extensions with OpenGL 2.1,
|
||||
// as we rely on `GL_ARB_explicit_attrib_location` and
|
||||
// `GL_EXT_gpu_shader4`.
|
||||
if (m_Context.config.backend == GFX_GL_21) {
|
||||
glewExperimental = GL_TRUE; // Global state
|
||||
}
|
||||
if (glewInit() != GLEW_OK) {
|
||||
Shell_ExitSystem("Can't initialize GLEW for OpenGL extension loading");
|
||||
}
|
||||
|
||||
LOG_INFO("OpenGL vendor string: %s", glGetString(GL_VENDOR));
|
||||
LOG_INFO("OpenGL renderer string: %s", glGetString(GL_RENDERER));
|
||||
LOG_INFO("OpenGL version string: %s", glGetString(GL_VERSION));
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
|
||||
#include "debug.h"
|
||||
#include "gfx/context.h"
|
||||
#include "gfx/gl/gl_core_3_3.h"
|
||||
#include "gfx/gl/utils.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
struct GFX_FADE_RENDERER {
|
||||
GFX_GL_VERTEX_ARRAY surface_format;
|
||||
GFX_GL_BUFFER surface_buffer;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
#include "gfx/gl/utils.h"
|
||||
|
||||
#include "gfx/gl/gl_core_3_3.h"
|
||||
#include <GL/glew.h>
|
||||
|
||||
const char *GFX_GL_GetErrorString(GLenum err)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "gfx/common.h"
|
||||
#include "gfx/context.h"
|
||||
#include "gfx/gl/buffer.h"
|
||||
#include "gfx/gl/gl_core_3_3.h"
|
||||
#include "gfx/gl/program.h"
|
||||
#include "gfx/gl/sampler.h"
|
||||
#include "gfx/gl/texture.h"
|
||||
|
@ -14,6 +13,7 @@
|
|||
#include "log.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../engine/image.h"
|
||||
#include "../gl/gl_core_3_3.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
#include "../common.h"
|
||||
#include "../config.h"
|
||||
#include "../gl/gl_core_3_3.h"
|
||||
#include "../gl/program.h"
|
||||
#include "../gl/sampler.h"
|
||||
#include "../gl/texture.h"
|
||||
#include "vertex_stream.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#define GFX_MAX_TEXTURES 128
|
||||
#define GFX_NO_TEXTURE (-1)
|
||||
#define GFX_ENV_MAP_TEXTURE (-2)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gl_core_3_3.h"
|
||||
#include <GL/glew.h>
|
||||
|
||||
typedef struct {
|
||||
bool initialized;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "../gl/gl_core_3_3.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
typedef struct {
|
||||
bool initialized;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../gl/gl_core_3_3.h"
|
||||
#include <GL/glew.h>
|
||||
|
||||
typedef struct {
|
||||
bool initialized;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../gl/gl_core_3_3.h"
|
||||
#include <GL/glew.h>
|
||||
|
||||
typedef struct {
|
||||
bool initialized;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../log.h"
|
||||
#include "../gl/gl_core_3_3.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#define GFX_GL_CheckError() \
|
||||
{ \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../gl/gl_core_3_3.h"
|
||||
#include <GL/glew.h>
|
||||
|
||||
typedef struct {
|
||||
bool initialized;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gl/gl_core_3_3.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <stdint.h>
|
||||
|
||||
bool GFX_Screenshot_CaptureToFile(const char *path);
|
||||
|
|
|
@ -23,6 +23,7 @@ build_opts = [
|
|||
'-Wno-gnu-empty-initializer',
|
||||
'-Wno-gnu-zero-variadic-macro-arguments',
|
||||
'-DMESON_BUILD',
|
||||
'-DGLEW_NO_GLU',
|
||||
'-fms-extensions',
|
||||
'-fno-omit-frame-pointer',
|
||||
# end of common options
|
||||
|
@ -46,6 +47,7 @@ dep_avcodec = dependency('libavcodec', static: staticdeps)
|
|||
dep_avformat = dependency('libavformat', static: staticdeps)
|
||||
dep_avutil = dependency('libavutil', static: staticdeps)
|
||||
dep_sdl2 = dependency('SDL2', static: staticdeps)
|
||||
dep_glew = dependency('glew', static: staticdeps)
|
||||
dep_pcre2 = dependency('libpcre2-8', static: staticdeps)
|
||||
dep_backtrace = c_compiler.find_library('backtrace', static: true, required: false)
|
||||
dep_swscale = dependency('libswscale', static: staticdeps)
|
||||
|
@ -183,7 +185,6 @@ sources = [
|
|||
'gfx/context.c',
|
||||
'gfx/fade/fade_renderer.c',
|
||||
'gfx/gl/buffer.c',
|
||||
'gfx/gl/gl_core_3_3.c',
|
||||
'gfx/gl/program.c',
|
||||
'gfx/gl/sampler.c',
|
||||
'gfx/gl/texture.c',
|
||||
|
@ -211,6 +212,7 @@ dependencies = [
|
|||
dep_avformat,
|
||||
dep_avutil,
|
||||
dep_sdl2,
|
||||
dep_glew,
|
||||
dep_pcre2,
|
||||
dep_backtrace,
|
||||
dep_swresample,
|
||||
|
|
|
@ -27,6 +27,7 @@ build_opts = [
|
|||
'-Wno-gnu-empty-initializer',
|
||||
'-Wno-gnu-zero-variadic-macro-arguments',
|
||||
'-DMESON_BUILD',
|
||||
'-DGLEW_NO_GLU',
|
||||
'-fms-extensions',
|
||||
'-fno-omit-frame-pointer',
|
||||
# end of common options
|
||||
|
@ -51,6 +52,7 @@ dep_mathlibrary = c_compiler.find_library('m', static: staticdeps, required : fa
|
|||
dep_swscale = dependency('libswscale', static: staticdeps)
|
||||
dep_swresample = dependency('libswresample', static: staticdeps)
|
||||
dep_sdl2 = dependency('SDL2', static: staticdeps)
|
||||
dep_glew = dependency('glew', static: staticdeps)
|
||||
dep_zlib = null_dep
|
||||
|
||||
if not staticdeps
|
||||
|
@ -279,6 +281,7 @@ dependencies = [
|
|||
dep_avutil,
|
||||
dep_mathlibrary,
|
||||
dep_sdl2,
|
||||
dep_glew,
|
||||
dep_swresample,
|
||||
dep_swscale,
|
||||
dep_zlib,
|
||||
|
|
|
@ -27,6 +27,7 @@ build_opts = [
|
|||
'-Wno-gnu-empty-initializer',
|
||||
'-Wno-gnu-zero-variadic-macro-arguments',
|
||||
'-DMESON_BUILD',
|
||||
'-DGLEW_NO_GLU',
|
||||
'-fms-extensions',
|
||||
'-fno-omit-frame-pointer',
|
||||
# end of common options
|
||||
|
|
|
@ -9,7 +9,7 @@ from shared.files import find_versioned_files, is_binary_file
|
|||
from shared.linting import LintContext, lint_repo, lint_bulk_files, lint_file
|
||||
from shared.paths import REPO_DIR
|
||||
|
||||
IGNORED_PATTERNS = ["*.patch", "*.bin", "gl_core_3_3.h"]
|
||||
IGNORED_PATTERNS = ["*.patch", "*.bin"]
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
|
|
|
@ -99,6 +99,28 @@ RUN cd SDL \
|
|||
|
||||
|
||||
|
||||
# GLEW
|
||||
FROM base AS glew
|
||||
RUN git clone https://github.com/nigels-com/glew.git
|
||||
RUN apt-get install -y \
|
||||
build-essential \
|
||||
libxmu-dev \
|
||||
libxi-dev \
|
||||
libgl-dev \
|
||||
python3
|
||||
RUN cd glew/auto \
|
||||
&& PYTHON=python3 make
|
||||
RUN mkdir -p /ext/lib \
|
||||
&& export \
|
||||
GLEW_NO_GLU=-DGLEW_NO_GLU \
|
||||
GLEW_DEST=/ext \
|
||||
&& cd glew \
|
||||
&& make \
|
||||
&& make install
|
||||
RUN sed -i "s/Cflags: .*/\\0 -DGLEW_STATIC /" /ext/lib/pkgconfig/glew.pc
|
||||
|
||||
|
||||
|
||||
# TR1X
|
||||
FROM base
|
||||
|
||||
|
@ -134,6 +156,7 @@ COPY --from=libav /ext/ /ext/
|
|||
COPY --from=sdl /ext/ /ext/
|
||||
COPY --from=backtrace /ext/ /ext/
|
||||
COPY --from=pcre2 /ext/ /ext/
|
||||
COPY --from=glew /ext/ /ext/
|
||||
|
||||
ENV PYTHONPATH=/app/tools/
|
||||
ENTRYPOINT ["/app/tools/tr1/docker/game-linux/entrypoint.sh"]
|
||||
|
|
|
@ -35,6 +35,7 @@ RUN cd pcre2 \
|
|||
&& make install
|
||||
|
||||
|
||||
|
||||
# zlib
|
||||
FROM mingw AS zlib
|
||||
RUN git clone https://github.com/madler/zlib --branch=v1.3.1
|
||||
|
@ -48,6 +49,7 @@ RUN cd zlib \
|
|||
-j 4 install
|
||||
|
||||
|
||||
|
||||
# libav
|
||||
FROM mingw AS libav
|
||||
RUN apt-get install -y \
|
||||
|
@ -127,6 +129,29 @@ RUN cp -rL uthash-2.3.0/* /ext/
|
|||
|
||||
|
||||
|
||||
# GLEW
|
||||
FROM mingw as glew
|
||||
RUN git clone https://github.com/nigels-com/glew.git
|
||||
RUN apt-get install -y \
|
||||
build-essential \
|
||||
libxmu-dev \
|
||||
libxi-dev \
|
||||
libgl-dev \
|
||||
python3
|
||||
RUN cd glew/auto \
|
||||
&& PYTHON=python3 make
|
||||
RUN mkdir -p /ext/lib \
|
||||
&& export \
|
||||
SYSTEM=linux-mingw32 \
|
||||
GLEW_NO_GLU=-DGLEW_NO_GLU \
|
||||
GLEW_DEST=/ext \
|
||||
&& cd glew \
|
||||
&& make \
|
||||
&& make install
|
||||
RUN sed -i "s/Cflags: .*/\\0 -DGLEW_STATIC/" /ext/lib/pkgconfig/glew.pc
|
||||
|
||||
|
||||
|
||||
# TR1X
|
||||
FROM mingw
|
||||
|
||||
|
@ -134,12 +159,6 @@ FROM mingw
|
|||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=pcre2 /ext/ /ext/
|
||||
COPY --from=zlib /ext/ /ext/
|
||||
COPY --from=libav /ext/ /ext/
|
||||
COPY --from=sdl /ext/ /ext/
|
||||
COPY --from=uthash /ext/ /ext/
|
||||
|
||||
# system dependencies
|
||||
# configure pkgconfig manually
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=967969
|
||||
|
@ -153,6 +172,13 @@ RUN apt-get install -y \
|
|||
meson \
|
||||
ninja
|
||||
|
||||
COPY --from=pcre2 /ext/ /ext/
|
||||
COPY --from=zlib /ext/ /ext/
|
||||
COPY --from=libav /ext/ /ext/
|
||||
COPY --from=sdl /ext/ /ext/
|
||||
COPY --from=uthash /ext/ /ext/
|
||||
COPY --from=glew /ext/ /ext/
|
||||
|
||||
ENV PKG_CONFIG_LIBDIR=/ext/lib/
|
||||
ENV PKG_CONFIG_PATH=/ext/lib/pkgconfig/
|
||||
ENV C_INCLUDE_PATH=/ext/include/
|
||||
|
|
|
@ -99,6 +99,28 @@ RUN cd SDL \
|
|||
|
||||
|
||||
|
||||
# GLEW
|
||||
FROM base AS glew
|
||||
RUN git clone https://github.com/nigels-com/glew.git
|
||||
RUN apt-get install -y \
|
||||
build-essential \
|
||||
libxmu-dev \
|
||||
libxi-dev \
|
||||
libgl-dev \
|
||||
python3
|
||||
RUN cd glew/auto \
|
||||
&& PYTHON=python3 make
|
||||
RUN mkdir -p /ext/lib \
|
||||
&& export \
|
||||
GLEW_NO_GLU=-DGLEW_NO_GLU \
|
||||
GLEW_DEST=/ext \
|
||||
&& cd glew \
|
||||
&& make \
|
||||
&& make install
|
||||
RUN sed -i "s/Cflags: .*/\\0 -DGLEW_STATIC /" /ext/lib/pkgconfig/glew.pc
|
||||
|
||||
|
||||
|
||||
# TR2X
|
||||
FROM base
|
||||
|
||||
|
@ -134,6 +156,7 @@ COPY --from=libav /ext/ /ext/
|
|||
COPY --from=sdl /ext/ /ext/
|
||||
COPY --from=backtrace /ext/ /ext/
|
||||
COPY --from=pcre2 /ext/ /ext/
|
||||
COPY --from=glew /ext/ /ext/
|
||||
|
||||
ENV PYTHONPATH=/app/tools/
|
||||
ENTRYPOINT ["/app/tools/tr2/docker/game-linux/entrypoint.sh"]
|
||||
|
|
|
@ -112,6 +112,29 @@ RUN cp -rL uthash-2.3.0/* /ext/
|
|||
|
||||
|
||||
|
||||
# GLEW
|
||||
FROM mingw as glew
|
||||
RUN git clone https://github.com/nigels-com/glew.git
|
||||
RUN apt-get install -y \
|
||||
build-essential \
|
||||
libxmu-dev \
|
||||
libxi-dev \
|
||||
libgl-dev \
|
||||
python3
|
||||
RUN cd glew/auto \
|
||||
&& PYTHON=python3 make
|
||||
RUN mkdir -p /ext/lib \
|
||||
&& export \
|
||||
SYSTEM=linux-mingw32 \
|
||||
GLEW_NO_GLU=-DGLEW_NO_GLU \
|
||||
GLEW_DEST=/ext \
|
||||
&& cd glew \
|
||||
&& make \
|
||||
&& make install
|
||||
RUN sed -i "s/Cflags: .*/\\0 -DGLEW_STATIC/" /ext/lib/pkgconfig/glew.pc
|
||||
|
||||
|
||||
|
||||
# TR2X
|
||||
FROM mingw
|
||||
|
||||
|
@ -119,12 +142,6 @@ FROM mingw
|
|||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=pcre2 /ext/ /ext/
|
||||
COPY --from=zlib /ext/ /ext/
|
||||
COPY --from=libav /ext/ /ext/
|
||||
COPY --from=sdl /ext/ /ext/
|
||||
COPY --from=uthash /ext/ /ext/
|
||||
|
||||
# system dependencies
|
||||
# configure pkgconfig manually
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=967969
|
||||
|
@ -138,6 +155,13 @@ RUN apt-get install -y \
|
|||
meson \
|
||||
ninja
|
||||
|
||||
COPY --from=pcre2 /ext/ /ext/
|
||||
COPY --from=zlib /ext/ /ext/
|
||||
COPY --from=libav /ext/ /ext/
|
||||
COPY --from=sdl /ext/ /ext/
|
||||
COPY --from=uthash /ext/ /ext/
|
||||
COPY --from=glew /ext/ /ext/
|
||||
|
||||
ENV PKG_CONFIG_LIBDIR=/ext/lib/
|
||||
ENV PKG_CONFIG_PATH=/ext/lib/pkgconfig/
|
||||
ENV C_INCLUDE_PATH=/ext/include/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue