Remove PortableGL support

I was planning on using PortableGL as a software implementation of
OpenGL, but it's really slow (at least when compared to actual 2D
graphics software renderers). I'll have to actually add a separate
rendering backend for software rendering later instead of trying to
emulate OpenGL in software.
This commit is contained in:
刘皓 2025-03-16 22:15:24 -04:00
parent 0e786c4e48
commit 54e819f89c
No known key found for this signature in database
GPG key ID: 7901753DB465B711
13 changed files with 1 additions and 1755 deletions

View file

@ -517,7 +517,6 @@ if is_libretro
cmake.subproject('libsndfile', options: libsndfile_options).dependency('sndfile'), cmake.subproject('libsndfile', options: libsndfile_options).dependency('sndfile'),
cmake.subproject('pixman-region', options: pixman_region_options).dependency('pixman-region'), cmake.subproject('pixman-region', options: pixman_region_options).dependency('pixman-region'),
subproject('stb').get_variable('stb'), subproject('stb').get_variable('stb'),
subproject('portablegl').get_variable('portablegl'),
subproject('opengl-registry').get_variable('opengl_registry'), subproject('opengl-registry').get_variable('opengl_registry'),
subproject('freetype', default_options: freetype_options).get_variable('freetype_dep'), subproject('freetype', default_options: freetype_options).get_variable('freetype_dep'),
declare_dependency( declare_dependency(
@ -610,28 +609,8 @@ if is_libretro
include_directories('src/util/sigslot/adapter'), include_directories('src/util/sigslot/adapter'),
], ],
sources: global_sources + [ sources: global_sources + [
'shader/flatColor.pgl.c',
'shader/simple.pgl.c',
'shader/simpleAlpha.pgl.c',
'shader/simpleSprite.pgl.c',
'shader/alphaSprite.pgl.c',
'shader/trans.pgl.c',
'shader/transSimple.pgl.c',
'shader/hue.pgl.c',
'shader/simpleColor.pgl.c',
'shader/flashMap.pgl.c',
'shader/sprite.pgl.c',
'shader/plane.pgl.c',
'shader/gray.pgl.c',
'shader/tilemap.pgl.c',
'shader/bitmapBlit.pgl.c',
'shader/simpleMatrix.pgl.c',
'shader/blurH.pgl.c',
'shader/blurV.pgl.c',
'shader/tilemapvx.pgl.c',
'src/core.cpp', 'src/core.cpp',
'src/mkxp-threads.cpp', 'src/mkxp-threads.cpp',
'src/portablegl.cpp',
'src/sharedstate.cpp', 'src/sharedstate.cpp',
'src/stb_image.cpp', 'src/stb_image.cpp',
'src/audio/alstream.cpp', 'src/audio/alstream.cpp',
@ -655,8 +634,6 @@ if is_libretro
'src/display/gl/gl-fun.cpp', 'src/display/gl/gl-fun.cpp',
'src/display/gl/gl-meta.cpp', 'src/display/gl/gl-meta.cpp',
'src/display/gl/glstate.cpp', 'src/display/gl/glstate.cpp',
'src/display/gl/pgl-enum.cpp',
'src/display/gl/pgl-fun.cpp',
'src/display/gl/scene.cpp', 'src/display/gl/scene.cpp',
'src/display/gl/shader.cpp', 'src/display/gl/shader.cpp',
'src/display/gl/texpool.cpp', 'src/display/gl/texpool.cpp',

View file

@ -1,842 +0,0 @@
/*
** pgl-enum.cpp
**
** This file is part of mkxp.
**
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp 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 2 of the License, or
** (at your option) any later version.
**
** mkxp 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 mkxp. If not, see <http://www.gnu.org/licenses/>.
*/
#include <portablegl.h>
#include <GLES3/gl3.h>
#include <unordered_map>
std::unordered_map<GLenum, GLenum> mkxp_pgl_enum_map = {
{GL_NO_ERROR,
#undef GL_NO_ERROR
GL_NO_ERROR},
{GL_INVALID_ENUM,
#undef GL_INVALID_ENUM
GL_INVALID_ENUM},
{GL_INVALID_VALUE,
#undef GL_INVALID_VALUE
GL_INVALID_VALUE},
{GL_INVALID_OPERATION,
#undef GL_INVALID_OPERATION
GL_INVALID_OPERATION},
{GL_INVALID_FRAMEBUFFER_OPERATION,
#undef GL_INVALID_FRAMEBUFFER_OPERATION
GL_INVALID_FRAMEBUFFER_OPERATION},
{GL_OUT_OF_MEMORY,
#undef GL_OUT_OF_MEMORY
GL_OUT_OF_MEMORY},
{GL_ARRAY_BUFFER,
#undef GL_ARRAY_BUFFER
GL_ARRAY_BUFFER},
{GL_COPY_READ_BUFFER,
#undef GL_COPY_READ_BUFFER
GL_COPY_READ_BUFFER},
{GL_COPY_WRITE_BUFFER,
#undef GL_COPY_WRITE_BUFFER
GL_COPY_WRITE_BUFFER},
{GL_ELEMENT_ARRAY_BUFFER,
#undef GL_ELEMENT_ARRAY_BUFFER
GL_ELEMENT_ARRAY_BUFFER},
{GL_PIXEL_PACK_BUFFER,
#undef GL_PIXEL_PACK_BUFFER
GL_PIXEL_PACK_BUFFER},
{GL_PIXEL_UNPACK_BUFFER,
#undef GL_PIXEL_UNPACK_BUFFER
GL_PIXEL_UNPACK_BUFFER},
{GL_TRANSFORM_FEEDBACK_BUFFER,
#undef GL_TRANSFORM_FEEDBACK_BUFFER
GL_TRANSFORM_FEEDBACK_BUFFER},
{GL_UNIFORM_BUFFER,
#undef GL_UNIFORM_BUFFER
GL_UNIFORM_BUFFER},
{GL_FRAMEBUFFER,
#undef GL_FRAMEBUFFER
GL_FRAMEBUFFER},
{GL_DRAW_FRAMEBUFFER,
#undef GL_DRAW_FRAMEBUFFER
GL_DRAW_FRAMEBUFFER},
{GL_READ_FRAMEBUFFER,
#undef GL_READ_FRAMEBUFFER
GL_READ_FRAMEBUFFER},
{GL_COLOR_ATTACHMENT0,
#undef GL_COLOR_ATTACHMENT0
GL_COLOR_ATTACHMENT0},
{GL_COLOR_ATTACHMENT1,
#undef GL_COLOR_ATTACHMENT1
GL_COLOR_ATTACHMENT1},
{GL_COLOR_ATTACHMENT2,
#undef GL_COLOR_ATTACHMENT2
GL_COLOR_ATTACHMENT2},
{GL_COLOR_ATTACHMENT3,
#undef GL_COLOR_ATTACHMENT3
GL_COLOR_ATTACHMENT3},
{GL_COLOR_ATTACHMENT4,
#undef GL_COLOR_ATTACHMENT4
GL_COLOR_ATTACHMENT4},
{GL_COLOR_ATTACHMENT5,
#undef GL_COLOR_ATTACHMENT5
GL_COLOR_ATTACHMENT5},
{GL_COLOR_ATTACHMENT6,
#undef GL_COLOR_ATTACHMENT6
GL_COLOR_ATTACHMENT6},
{GL_COLOR_ATTACHMENT7,
#undef GL_COLOR_ATTACHMENT7
GL_COLOR_ATTACHMENT7},
{GL_DEPTH_ATTACHMENT,
#undef GL_DEPTH_ATTACHMENT
GL_DEPTH_ATTACHMENT},
{GL_STENCIL_ATTACHMENT,
#undef GL_STENCIL_ATTACHMENT
GL_STENCIL_ATTACHMENT},
{GL_DEPTH_STENCIL_ATTACHMENT,
#undef GL_DEPTH_STENCIL_ATTACHMENT
GL_DEPTH_STENCIL_ATTACHMENT},
{GL_RENDERBUFFER,
#undef GL_RENDERBUFFER
GL_RENDERBUFFER},
{GL_STREAM_DRAW,
#undef GL_STREAM_DRAW
GL_STREAM_DRAW},
{GL_STREAM_READ,
#undef GL_STREAM_READ
GL_STREAM_READ},
{GL_STREAM_COPY,
#undef GL_STREAM_COPY
GL_STREAM_COPY},
{GL_STATIC_DRAW,
#undef GL_STATIC_DRAW
GL_STATIC_DRAW},
{GL_STATIC_READ,
#undef GL_STATIC_READ
GL_STATIC_READ},
{GL_STATIC_COPY,
#undef GL_STATIC_COPY
GL_STATIC_COPY},
{GL_DYNAMIC_DRAW,
#undef GL_DYNAMIC_DRAW
GL_DYNAMIC_DRAW},
{GL_DYNAMIC_READ,
#undef GL_DYNAMIC_READ
GL_DYNAMIC_READ},
{GL_DYNAMIC_COPY,
#undef GL_DYNAMIC_COPY
GL_DYNAMIC_COPY},
{GL_POINTS,
#undef GL_POINTS
GL_POINTS},
{GL_LINES,
#undef GL_LINES
GL_LINES},
{GL_LINE_STRIP,
#undef GL_LINE_STRIP
GL_LINE_STRIP},
{GL_LINE_LOOP,
#undef GL_LINE_LOOP
GL_LINE_LOOP},
{GL_TRIANGLES,
#undef GL_TRIANGLES
GL_TRIANGLES},
{GL_TRIANGLE_STRIP,
#undef GL_TRIANGLE_STRIP
GL_TRIANGLE_STRIP},
{GL_TRIANGLE_FAN,
#undef GL_TRIANGLE_FAN
GL_TRIANGLE_FAN},
{GL_LESS,
#undef GL_LESS
GL_LESS},
{GL_LEQUAL,
#undef GL_LEQUAL
GL_LEQUAL},
{GL_GREATER,
#undef GL_GREATER
GL_GREATER},
{GL_GEQUAL,
#undef GL_GEQUAL
GL_GEQUAL},
{GL_EQUAL,
#undef GL_EQUAL
GL_EQUAL},
{GL_NOTEQUAL,
#undef GL_NOTEQUAL
GL_NOTEQUAL},
{GL_ALWAYS,
#undef GL_ALWAYS
GL_ALWAYS},
{GL_NEVER,
#undef GL_NEVER
GL_NEVER},
{GL_ZERO,
#undef GL_ZERO
GL_ZERO},
{GL_ONE,
#undef GL_ONE
GL_ONE},
{GL_SRC_COLOR,
#undef GL_SRC_COLOR
GL_SRC_COLOR},
{GL_ONE_MINUS_SRC_COLOR,
#undef GL_ONE_MINUS_SRC_COLOR
GL_ONE_MINUS_SRC_COLOR},
{GL_DST_COLOR,
#undef GL_DST_COLOR
GL_DST_COLOR},
{GL_ONE_MINUS_DST_COLOR,
#undef GL_ONE_MINUS_DST_COLOR
GL_ONE_MINUS_DST_COLOR},
{GL_SRC_ALPHA,
#undef GL_SRC_ALPHA
GL_SRC_ALPHA},
{GL_ONE_MINUS_SRC_ALPHA,
#undef GL_ONE_MINUS_SRC_ALPHA
GL_ONE_MINUS_SRC_ALPHA},
{GL_DST_ALPHA,
#undef GL_DST_ALPHA
GL_DST_ALPHA},
{GL_ONE_MINUS_DST_ALPHA,
#undef GL_ONE_MINUS_DST_ALPHA
GL_ONE_MINUS_DST_ALPHA},
{GL_CONSTANT_COLOR,
#undef GL_CONSTANT_COLOR
GL_CONSTANT_COLOR},
{GL_ONE_MINUS_CONSTANT_COLOR,
#undef GL_ONE_MINUS_CONSTANT_COLOR
GL_ONE_MINUS_CONSTANT_COLOR},
{GL_CONSTANT_ALPHA,
#undef GL_CONSTANT_ALPHA
GL_CONSTANT_ALPHA},
{GL_ONE_MINUS_CONSTANT_ALPHA,
#undef GL_ONE_MINUS_CONSTANT_ALPHA
GL_ONE_MINUS_CONSTANT_ALPHA},
{GL_SRC_ALPHA_SATURATE,
#undef GL_SRC_ALPHA_SATURATE
GL_SRC_ALPHA_SATURATE},
{GL_FUNC_ADD,
#undef GL_FUNC_ADD
GL_FUNC_ADD},
{GL_FUNC_SUBTRACT,
#undef GL_FUNC_SUBTRACT
GL_FUNC_SUBTRACT},
{GL_FUNC_REVERSE_SUBTRACT,
#undef GL_FUNC_REVERSE_SUBTRACT
GL_FUNC_REVERSE_SUBTRACT},
{GL_MIN,
#undef GL_MIN
GL_MIN},
{GL_MAX,
#undef GL_MAX
GL_MAX},
{GL_TEXTURE_2D,
#undef GL_TEXTURE_2D
GL_TEXTURE_2D},
{GL_TEXTURE_3D,
#undef GL_TEXTURE_3D
GL_TEXTURE_3D},
{GL_TEXTURE_2D_ARRAY,
#undef GL_TEXTURE_2D_ARRAY
GL_TEXTURE_2D_ARRAY},
{GL_TEXTURE_CUBE_MAP,
#undef GL_TEXTURE_CUBE_MAP
GL_TEXTURE_CUBE_MAP},
{GL_TEXTURE_CUBE_MAP_POSITIVE_X,
#undef GL_TEXTURE_CUBE_MAP_POSITIVE_X
GL_TEXTURE_CUBE_MAP_POSITIVE_X},
{GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
#undef GL_TEXTURE_CUBE_MAP_NEGATIVE_X
GL_TEXTURE_CUBE_MAP_NEGATIVE_X},
{GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
#undef GL_TEXTURE_CUBE_MAP_POSITIVE_Y
GL_TEXTURE_CUBE_MAP_POSITIVE_Y},
{GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
#undef GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y},
{GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
#undef GL_TEXTURE_CUBE_MAP_POSITIVE_Z
GL_TEXTURE_CUBE_MAP_POSITIVE_Z},
{GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
#undef GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z},
{GL_TEXTURE_BASE_LEVEL,
#undef GL_TEXTURE_BASE_LEVEL
GL_TEXTURE_BASE_LEVEL},
{GL_TEXTURE_COMPARE_FUNC,
#undef GL_TEXTURE_COMPARE_FUNC
GL_TEXTURE_COMPARE_FUNC},
{GL_TEXTURE_COMPARE_MODE,
#undef GL_TEXTURE_COMPARE_MODE
GL_TEXTURE_COMPARE_MODE},
{GL_TEXTURE_MIN_FILTER,
#undef GL_TEXTURE_MIN_FILTER
GL_TEXTURE_MIN_FILTER},
{GL_TEXTURE_MAG_FILTER,
#undef GL_TEXTURE_MAG_FILTER
GL_TEXTURE_MAG_FILTER},
{GL_TEXTURE_MIN_LOD,
#undef GL_TEXTURE_MIN_LOD
GL_TEXTURE_MIN_LOD},
{GL_TEXTURE_MAX_LOD,
#undef GL_TEXTURE_MAX_LOD
GL_TEXTURE_MAX_LOD},
{GL_TEXTURE_MAX_LEVEL,
#undef GL_TEXTURE_MAX_LEVEL
GL_TEXTURE_MAX_LEVEL},
{GL_TEXTURE_SWIZZLE_R,
#undef GL_TEXTURE_SWIZZLE_R
GL_TEXTURE_SWIZZLE_R},
{GL_TEXTURE_SWIZZLE_G,
#undef GL_TEXTURE_SWIZZLE_G
GL_TEXTURE_SWIZZLE_G},
{GL_TEXTURE_SWIZZLE_B,
#undef GL_TEXTURE_SWIZZLE_B
GL_TEXTURE_SWIZZLE_B},
{GL_TEXTURE_SWIZZLE_A,
#undef GL_TEXTURE_SWIZZLE_A
GL_TEXTURE_SWIZZLE_A},
{GL_TEXTURE_WRAP_S,
#undef GL_TEXTURE_WRAP_S
GL_TEXTURE_WRAP_S},
{GL_TEXTURE_WRAP_T,
#undef GL_TEXTURE_WRAP_T
GL_TEXTURE_WRAP_T},
{GL_TEXTURE_WRAP_R,
#undef GL_TEXTURE_WRAP_R
GL_TEXTURE_WRAP_R},
{GL_REPEAT,
#undef GL_REPEAT
GL_REPEAT},
{GL_CLAMP_TO_EDGE,
#undef GL_CLAMP_TO_EDGE
GL_CLAMP_TO_EDGE},
{GL_MIRRORED_REPEAT,
#undef GL_MIRRORED_REPEAT
GL_MIRRORED_REPEAT},
{GL_NEAREST,
#undef GL_NEAREST
GL_NEAREST},
{GL_LINEAR,
#undef GL_LINEAR
GL_LINEAR},
{GL_NEAREST_MIPMAP_NEAREST,
#undef GL_NEAREST_MIPMAP_NEAREST
GL_NEAREST_MIPMAP_NEAREST},
{GL_NEAREST_MIPMAP_LINEAR,
#undef GL_NEAREST_MIPMAP_LINEAR
GL_NEAREST_MIPMAP_LINEAR},
{GL_LINEAR_MIPMAP_NEAREST,
#undef GL_LINEAR_MIPMAP_NEAREST
GL_LINEAR_MIPMAP_NEAREST},
{GL_LINEAR_MIPMAP_LINEAR,
#undef GL_LINEAR_MIPMAP_LINEAR
GL_LINEAR_MIPMAP_LINEAR},
{GL_ALPHA,
#undef GL_ALPHA
GL_ALPHA},
{GL_LUMINANCE,
#undef GL_LUMINANCE
GL_LUMINANCE},
{GL_LUMINANCE_ALPHA,
#undef GL_LUMINANCE_ALPHA
GL_LUMINANCE_ALPHA},
{GL_RED,
#undef GL_RED
GL_RED},
{GL_RG,
#undef GL_RG
GL_RG},
{GL_RGB,
#undef GL_RGB
GL_RGB},
{GL_RGBA,
#undef GL_RGBA
GL_RGBA},
{GL_DEPTH_COMPONENT16,
#undef GL_DEPTH_COMPONENT16
GL_DEPTH_COMPONENT16},
{GL_DEPTH_COMPONENT24,
#undef GL_DEPTH_COMPONENT24
GL_DEPTH_COMPONENT24},
{GL_DEPTH_COMPONENT32F,
#undef GL_DEPTH_COMPONENT32F
GL_DEPTH_COMPONENT32F},
{GL_DEPTH24_STENCIL8,
#undef GL_DEPTH24_STENCIL8
GL_DEPTH24_STENCIL8},
{GL_DEPTH32F_STENCIL8,
#undef GL_DEPTH32F_STENCIL8
GL_DEPTH32F_STENCIL8},
{GL_STENCIL_INDEX8,
#undef GL_STENCIL_INDEX8
GL_STENCIL_INDEX8},
{GL_UNPACK_ALIGNMENT,
#undef GL_UNPACK_ALIGNMENT
GL_UNPACK_ALIGNMENT},
{GL_PACK_ALIGNMENT,
#undef GL_PACK_ALIGNMENT
GL_PACK_ALIGNMENT},
{GL_TEXTURE0,
#undef GL_TEXTURE0
GL_TEXTURE0},
{GL_TEXTURE1,
#undef GL_TEXTURE1
GL_TEXTURE1},
{GL_TEXTURE2,
#undef GL_TEXTURE2
GL_TEXTURE2},
{GL_TEXTURE3,
#undef GL_TEXTURE3
GL_TEXTURE3},
{GL_TEXTURE4,
#undef GL_TEXTURE4
GL_TEXTURE4},
{GL_TEXTURE5,
#undef GL_TEXTURE5
GL_TEXTURE5},
{GL_TEXTURE6,
#undef GL_TEXTURE6
GL_TEXTURE6},
{GL_TEXTURE7,
#undef GL_TEXTURE7
GL_TEXTURE7},
{GL_CULL_FACE,
#undef GL_CULL_FACE
GL_CULL_FACE},
{GL_DEPTH_TEST,
#undef GL_DEPTH_TEST
GL_DEPTH_TEST},
{GL_BLEND,
#undef GL_BLEND
GL_BLEND},
{GL_POLYGON_OFFSET_FILL,
#undef GL_POLYGON_OFFSET_FILL
GL_POLYGON_OFFSET_FILL},
{GL_SCISSOR_TEST,
#undef GL_SCISSOR_TEST
GL_SCISSOR_TEST},
{GL_STENCIL_TEST,
#undef GL_STENCIL_TEST
GL_STENCIL_TEST},
{GL_FRONT,
#undef GL_FRONT
GL_FRONT},
{GL_BACK,
#undef GL_BACK
GL_BACK},
{GL_FRONT_AND_BACK,
#undef GL_FRONT_AND_BACK
GL_FRONT_AND_BACK},
{GL_CCW,
#undef GL_CCW
GL_CCW},
{GL_CW,
#undef GL_CW
GL_CW},
{GL_INVERT,
#undef GL_INVERT
GL_INVERT},
{GL_KEEP,
#undef GL_KEEP
GL_KEEP},
{GL_REPLACE,
#undef GL_REPLACE
GL_REPLACE},
{GL_INCR,
#undef GL_INCR
GL_INCR},
{GL_INCR_WRAP,
#undef GL_INCR_WRAP
GL_INCR_WRAP},
{GL_DECR,
#undef GL_DECR
GL_DECR},
{GL_DECR_WRAP,
#undef GL_DECR_WRAP
GL_DECR_WRAP},
{GL_UNSIGNED_BYTE,
#undef GL_UNSIGNED_BYTE
GL_UNSIGNED_BYTE},
{GL_BYTE,
#undef GL_BYTE
GL_BYTE},
{GL_UNSIGNED_SHORT,
#undef GL_UNSIGNED_SHORT
GL_UNSIGNED_SHORT},
{GL_SHORT,
#undef GL_SHORT
GL_SHORT},
{GL_UNSIGNED_INT,
#undef GL_UNSIGNED_INT
GL_UNSIGNED_INT},
{GL_INT,
#undef GL_INT
GL_INT},
{GL_FLOAT,
#undef GL_FLOAT
GL_FLOAT},
{GL_VENDOR,
#undef GL_VENDOR
GL_VENDOR},
{GL_RENDERER,
#undef GL_RENDERER
GL_RENDERER},
{GL_VERSION,
#undef GL_VERSION
GL_VERSION},
{GL_SHADING_LANGUAGE_VERSION,
#undef GL_SHADING_LANGUAGE_VERSION
GL_SHADING_LANGUAGE_VERSION},
{GL_POLYGON_OFFSET_FACTOR,
#undef GL_POLYGON_OFFSET_FACTOR
GL_POLYGON_OFFSET_FACTOR},
{GL_POLYGON_OFFSET_UNITS,
#undef GL_POLYGON_OFFSET_UNITS
GL_POLYGON_OFFSET_UNITS},
{GL_DEPTH_CLEAR_VALUE,
#undef GL_DEPTH_CLEAR_VALUE
GL_DEPTH_CLEAR_VALUE},
{GL_DEPTH_RANGE,
#undef GL_DEPTH_RANGE
GL_DEPTH_RANGE},
{GL_STENCIL_REF,
#undef GL_STENCIL_REF
GL_STENCIL_REF},
{GL_STENCIL_VALUE_MASK,
#undef GL_STENCIL_VALUE_MASK
GL_STENCIL_VALUE_MASK},
{GL_STENCIL_FUNC,
#undef GL_STENCIL_FUNC
GL_STENCIL_FUNC},
{GL_STENCIL_FAIL,
#undef GL_STENCIL_FAIL
GL_STENCIL_FAIL},
{GL_STENCIL_PASS_DEPTH_FAIL,
#undef GL_STENCIL_PASS_DEPTH_FAIL
GL_STENCIL_PASS_DEPTH_FAIL},
{GL_STENCIL_PASS_DEPTH_PASS,
#undef GL_STENCIL_PASS_DEPTH_PASS
GL_STENCIL_PASS_DEPTH_PASS},
{GL_STENCIL_BACK_REF,
#undef GL_STENCIL_BACK_REF
GL_STENCIL_BACK_REF},
{GL_STENCIL_BACK_VALUE_MASK,
#undef GL_STENCIL_BACK_VALUE_MASK
GL_STENCIL_BACK_VALUE_MASK},
{GL_STENCIL_BACK_FUNC,
#undef GL_STENCIL_BACK_FUNC
GL_STENCIL_BACK_FUNC},
{GL_STENCIL_BACK_FAIL,
#undef GL_STENCIL_BACK_FAIL
GL_STENCIL_BACK_FAIL},
{GL_STENCIL_BACK_PASS_DEPTH_FAIL,
#undef GL_STENCIL_BACK_PASS_DEPTH_FAIL
GL_STENCIL_BACK_PASS_DEPTH_FAIL},
{GL_STENCIL_BACK_PASS_DEPTH_PASS,
#undef GL_STENCIL_BACK_PASS_DEPTH_PASS
GL_STENCIL_BACK_PASS_DEPTH_PASS},
{GL_BLEND_SRC_RGB,
#undef GL_BLEND_SRC_RGB
GL_BLEND_SRC_RGB},
{GL_BLEND_SRC_ALPHA,
#undef GL_BLEND_SRC_ALPHA
GL_BLEND_SRC_ALPHA},
{GL_BLEND_DST_RGB,
#undef GL_BLEND_DST_RGB
GL_BLEND_DST_RGB},
{GL_BLEND_DST_ALPHA,
#undef GL_BLEND_DST_ALPHA
GL_BLEND_DST_ALPHA},
{GL_BLEND_EQUATION_RGB,
#undef GL_BLEND_EQUATION_RGB
GL_BLEND_EQUATION_RGB},
{GL_BLEND_EQUATION_ALPHA,
#undef GL_BLEND_EQUATION_ALPHA
GL_BLEND_EQUATION_ALPHA},
{GL_CULL_FACE_MODE,
#undef GL_CULL_FACE_MODE
GL_CULL_FACE_MODE},
{GL_FRONT_FACE,
#undef GL_FRONT_FACE
GL_FRONT_FACE},
{GL_DEPTH_FUNC,
#undef GL_DEPTH_FUNC
GL_DEPTH_FUNC},
{GL_MAJOR_VERSION,
#undef GL_MAJOR_VERSION
GL_MAJOR_VERSION},
{GL_MINOR_VERSION,
#undef GL_MINOR_VERSION
GL_MINOR_VERSION},
{GL_TEXTURE_BINDING_2D,
#undef GL_TEXTURE_BINDING_2D
GL_TEXTURE_BINDING_2D},
{GL_TEXTURE_BINDING_2D_ARRAY,
#undef GL_TEXTURE_BINDING_2D_ARRAY
GL_TEXTURE_BINDING_2D_ARRAY},
{GL_TEXTURE_BINDING_3D,
#undef GL_TEXTURE_BINDING_3D
GL_TEXTURE_BINDING_3D},
{GL_TEXTURE_BINDING_CUBE_MAP,
#undef GL_TEXTURE_BINDING_CUBE_MAP
GL_TEXTURE_BINDING_CUBE_MAP},
{GL_ARRAY_BUFFER_BINDING,
#undef GL_ARRAY_BUFFER_BINDING
GL_ARRAY_BUFFER_BINDING},
{GL_ELEMENT_ARRAY_BUFFER_BINDING,
#undef GL_ELEMENT_ARRAY_BUFFER_BINDING
GL_ELEMENT_ARRAY_BUFFER_BINDING},
{GL_VERTEX_ARRAY_BINDING,
#undef GL_VERTEX_ARRAY_BINDING
GL_VERTEX_ARRAY_BINDING},
{GL_CURRENT_PROGRAM,
#undef GL_CURRENT_PROGRAM
GL_CURRENT_PROGRAM},
{GL_VIEWPORT,
#undef GL_VIEWPORT
GL_VIEWPORT},
{GL_SCISSOR_BOX,
#undef GL_SCISSOR_BOX
GL_SCISSOR_BOX},
{GL_VERTEX_SHADER,
#undef GL_VERTEX_SHADER
GL_VERTEX_SHADER},
{GL_FRAGMENT_SHADER,
#undef GL_FRAGMENT_SHADER
GL_FRAGMENT_SHADER},
{GL_INFO_LOG_LENGTH,
#undef GL_INFO_LOG_LENGTH
GL_INFO_LOG_LENGTH},
{GL_COMPILE_STATUS,
#undef GL_COMPILE_STATUS
GL_COMPILE_STATUS},
{GL_LINK_STATUS,
#undef GL_LINK_STATUS
GL_LINK_STATUS},
{GL_COLOR_BUFFER_BIT,
#undef GL_COLOR_BUFFER_BIT
GL_COLOR_BUFFER_BIT},
{GL_DEPTH_BUFFER_BIT,
#undef GL_DEPTH_BUFFER_BIT
GL_DEPTH_BUFFER_BIT},
{GL_STENCIL_BUFFER_BIT,
#undef GL_STENCIL_BUFFER_BIT
GL_STENCIL_BUFFER_BIT},
};

View file

@ -1,420 +0,0 @@
/*
** pgl-fun.cpp
**
** This file is part of mkxp.
**
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp 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 2 of the License, or
** (at your option) any later version.
**
** mkxp 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 mkxp. If not, see <http://www.gnu.org/licenses/>.
*/
#include <portablegl.h>
#include <KHR/khrplatform.h>
#include <string>
#include <unordered_map>
extern std::unordered_map<GLenum, GLenum> mkxp_pgl_enum_map;
static inline GLenum enumconv(GLenum x) {
const auto it = mkxp_pgl_enum_map.find(x);
return it == mkxp_pgl_enum_map.end() ? -1 : it->second;
}
static KHRONOS_APIENTRY void _glViewport(int x, int y, GLsizei width, GLsizei height) {
glViewport(x, y, width, height);
}
static KHRONOS_APIENTRY GLubyte *_glGetString(GLenum name) {
return glGetString(enumconv(name));
}
static KHRONOS_APIENTRY void _glGetBooleanv(GLenum pname, GLboolean* data) {
glGetBooleanv(enumconv(pname), data);
}
static KHRONOS_APIENTRY void _glGetFloatv(GLenum pname, GLfloat* data) {
return glGetFloatv(enumconv(pname), data);
}
static KHRONOS_APIENTRY void _glGetIntegerv(GLenum pname, GLint* data) {
glGetIntegerv(enumconv(pname), data);
}
static KHRONOS_APIENTRY GLboolean _glIsEnabled(GLenum cap) {
return glIsEnabled(enumconv(cap));
}
static KHRONOS_APIENTRY GLboolean _glIsProgram(GLuint program) {
return glIsProgram(program);
}
static KHRONOS_APIENTRY void _glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
glClearColor(red, green, blue, alpha);
}
static KHRONOS_APIENTRY void _glClearDepth(GLclampf depth) {
glClearDepth(depth);
}
static KHRONOS_APIENTRY void _glDepthFunc(GLenum func) {
glDepthFunc(enumconv(func));
}
static KHRONOS_APIENTRY void _glDepthRange(GLclampf nearVal, GLclampf farVal) {
glDepthRange(nearVal, farVal);
}
static KHRONOS_APIENTRY void _glDepthMask(GLboolean flag) {
glDepthMask(flag);
}
static KHRONOS_APIENTRY void _glBlendFunc(GLenum sfactor, GLenum dfactor) {
glBlendFunc(enumconv(sfactor), enumconv(dfactor));
}
static KHRONOS_APIENTRY void _glBlendEquation(GLenum mode) {
glBlendEquation(enumconv(mode));
}
static KHRONOS_APIENTRY void _glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
glBlendFuncSeparate(enumconv(srcRGB), enumconv(dstRGB), enumconv(srcAlpha), enumconv(dstAlpha));
}
static KHRONOS_APIENTRY void _glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
glBlendEquationSeparate(enumconv(modeRGB), enumconv(modeAlpha));
}
static KHRONOS_APIENTRY void _glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
glBlendColor(red, green, blue, alpha);
}
static KHRONOS_APIENTRY void _glClear(GLbitfield mask) {
glClear(GL_COLOR_BUFFER_BIT);
}
static KHRONOS_APIENTRY void _glProvokingVertex(GLenum provokeMode) {
glProvokingVertex(enumconv(provokeMode));
}
static KHRONOS_APIENTRY void _glEnable(GLenum cap) {
glEnable(enumconv(cap));
}
static KHRONOS_APIENTRY void _glDisable(GLenum cap) {
glDisable(enumconv(cap));
}
static KHRONOS_APIENTRY void _glCullFace(GLenum mode) {
glCullFace(enumconv(mode));
}
static KHRONOS_APIENTRY void _glFrontFace(GLenum mode) {
glFrontFace(enumconv(mode));
}
static KHRONOS_APIENTRY void _glPolygonMode(GLenum face, GLenum mode) {
glPolygonMode(enumconv(face), enumconv(mode));
}
static KHRONOS_APIENTRY void _glPointSize(GLfloat size) {
glPointSize(size);
}
static KHRONOS_APIENTRY void _glPointParameteri(GLenum pname, GLint param) {
glPointParameteri(enumconv(pname), param);
}
static KHRONOS_APIENTRY void _glLineWidth(GLfloat width) {
glLineWidth(width);
}
static KHRONOS_APIENTRY void _glLogicOp(GLenum opcode) {
glLogicOp(enumconv(opcode));
}
static KHRONOS_APIENTRY void _glPolygonOffset(GLfloat factor, GLfloat units) {
glPolygonOffset(factor, units);
}
static KHRONOS_APIENTRY void _glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
glScissor(x, y, width, height);
}
static KHRONOS_APIENTRY void _glStencilFunc(GLenum func, GLint ref, GLuint mask) {
glStencilFunc(enumconv(func), ref, mask);
}
static KHRONOS_APIENTRY void _glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) {
glStencilFuncSeparate(enumconv(face), enumconv(func), ref, mask);
}
static KHRONOS_APIENTRY void _glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass) {
glStencilOp(enumconv(sfail), enumconv(dpfail), enumconv(dppass));
}
static KHRONOS_APIENTRY void _glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) {
glStencilOpSeparate(enumconv(face), enumconv(sfail), enumconv(dpfail), enumconv(dppass));
}
static KHRONOS_APIENTRY void _glClearStencil(GLint s) {
glClearStencil(s);
}
static KHRONOS_APIENTRY void _glStencilMask(GLuint mask) {
glStencilMask(mask);
}
static KHRONOS_APIENTRY void _glStencilMaskSeparate(GLenum face, GLuint mask) {
glStencilMaskSeparate(enumconv(face), mask);
}
static KHRONOS_APIENTRY void _glGenTextures(GLsizei n, GLuint* textures) {
glGenTextures(n, textures);
}
static KHRONOS_APIENTRY void _glDeleteTextures(GLsizei n, const GLuint* textures) {
glDeleteTextures(n, textures);
}
static KHRONOS_APIENTRY void _glBindTexture(GLenum target, GLuint texture) {
glBindTexture(enumconv(target), texture);
}
static KHRONOS_APIENTRY void _glTexParameteri(GLenum target, GLenum pname, GLint param) {
glTexParameteri(enumconv(target), enumconv(pname), param);
}
static KHRONOS_APIENTRY void _glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) {
glTexParameterfv(enumconv(target), enumconv(pname), params);
}
static KHRONOS_APIENTRY void _glTextureParameteri(GLuint texture, GLenum pname, GLint param) {
glTextureParameteri(texture, enumconv(pname), param);
}
static KHRONOS_APIENTRY void _glPixelStorei(GLenum pname, GLint param) {
glPixelStorei(enumconv(pname), param);
}
static KHRONOS_APIENTRY void _glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid* data) {
glTexImage1D(enumconv(target), level, internalFormat, width, border, enumconv(format), enumconv(type), data);
}
static KHRONOS_APIENTRY void _glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data) {
glTexImage2D(enumconv(target), level, internalFormat, width, height, border, enumconv(format), enumconv(type), data);
}
static KHRONOS_APIENTRY void _glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data) {
glTexImage3D(enumconv(target), level, internalFormat, width, height, depth, border, enumconv(format), enumconv(type), data);
}
static KHRONOS_APIENTRY void _glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid* data) {
glTexSubImage1D(enumconv(target), level, xoffset, width, enumconv(format), enumconv(type), data);
}
static KHRONOS_APIENTRY void _glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data) {
glTexSubImage2D(enumconv(target), level, xoffset, yoffset, width, height, enumconv(format), enumconv(type), data);
}
static KHRONOS_APIENTRY void _glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* data) {
glTexSubImage3D(enumconv(target), level, xoffset, yoffset, zoffset, width, height, depth, enumconv(format), enumconv(type), data);
}
static KHRONOS_APIENTRY void _glGenVertexArrays(GLsizei n, GLuint* arrays) {
glGenVertexArrays(n, arrays);
}
static KHRONOS_APIENTRY void _glDeleteVertexArrays(GLsizei n, const GLuint* arrays) {
glDeleteVertexArrays(n, arrays);
}
static KHRONOS_APIENTRY void _glBindVertexArray(GLuint array) {
glBindVertexArray(array);
}
static KHRONOS_APIENTRY void _glGenBuffers(GLsizei n, GLuint* buffers) {
glGenBuffers(n, buffers);
}
static KHRONOS_APIENTRY void _glDeleteBuffers(GLsizei n, const GLuint* buffers) {
glDeleteBuffers(n, buffers);
}
static KHRONOS_APIENTRY void _glBindBuffer(GLenum target, GLuint buffer) {
glBindBuffer(enumconv(target), buffer);
}
static KHRONOS_APIENTRY void _glBufferData(GLenum target, GLsizei size, const GLvoid* data, GLenum usage) {
glBufferData(enumconv(target), size, data, enumconv(usage));
}
static KHRONOS_APIENTRY void _glBufferSubData(GLenum target, GLsizei offset, GLsizei size, const GLvoid* data) {
glBufferSubData(enumconv(target), offset, size, data);
}
static KHRONOS_APIENTRY void* _glMapBuffer(GLenum target, GLenum access) {
return glMapBuffer(enumconv(target), enumconv(access));
}
static KHRONOS_APIENTRY void _glVertexAttribDivisor(GLuint index, GLuint divisor) {
glVertexAttribDivisor(index, divisor);
}
static KHRONOS_APIENTRY void _glEnableVertexAttribArray(GLuint index) {
glEnableVertexAttribArray(index);
}
static KHRONOS_APIENTRY void _glDisableVertexAttribArray(GLuint index) {
glDisableVertexAttribArray(index);
}
static KHRONOS_APIENTRY void _glDrawArrays(GLenum mode, GLint first, GLsizei count) {
glDrawArrays(enumconv(mode), first, count);
}
static KHRONOS_APIENTRY void _glMultiDrawArrays(GLenum mode, const GLint* first, const GLsizei* count, GLsizei drawcount) {
glMultiDrawArrays(enumconv(mode), first, count, drawcount);
}
static KHRONOS_APIENTRY void _glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) {
glDrawElements(enumconv(mode), count, enumconv(type), indices);
}
static KHRONOS_APIENTRY void _glMultiDrawElements(GLenum mode, const GLsizei* count, GLenum type, const GLvoid* const* indices, GLsizei drawcount) {
glMultiDrawElements(enumconv(mode), count, enumconv(type), indices, drawcount);
}
static KHRONOS_APIENTRY void _glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount) {
glDrawArraysInstanced(enumconv(mode), first, count, primcount);
}
static KHRONOS_APIENTRY void _glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance) {
glDrawArraysInstancedBaseInstance(enumconv(mode), first, count, primcount, baseinstance);
}
static KHRONOS_APIENTRY void _glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei primcount) {
glDrawElementsInstanced(enumconv(mode), count, enumconv(type), indices, primcount);
}
static KHRONOS_APIENTRY void _glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei primcount, GLuint baseinstance) {
glDrawElementsInstancedBaseInstance(enumconv(mode), count, enumconv(type), indices, primcount, baseinstance);
}
static KHRONOS_APIENTRY void _glNamedBufferData(GLuint buffer, GLsizei size, const GLvoid* data, GLenum usage) {
glNamedBufferData(buffer, size, data, enumconv(usage));
}
static KHRONOS_APIENTRY void _glNamedBufferSubData(GLuint buffer, GLsizei offset, GLsizei size, const GLvoid* data) {
glNamedBufferSubData(buffer, offset, size, data);
}
static KHRONOS_APIENTRY void* _glMapNamedBuffer(GLuint buffer, GLenum access) {
return glMapNamedBuffer(buffer, enumconv(access));
}
static KHRONOS_APIENTRY void _glCreateTextures(GLenum target, GLsizei n, GLuint* textures) {
glCreateTextures(enumconv(target), n, textures);
}
static KHRONOS_APIENTRY void _glDeleteProgram(GLuint program) {
glDeleteProgram(program);
}
static KHRONOS_APIENTRY void _glUseProgram(GLuint program) {
glUseProgram(program);
}
#define BIND_PROC(x) {"gl" #x, (void *)_gl##x}
void *mkxp_pgl_get_proc_address(const char *proc_name) {
static std::unordered_map<std::string, void *> proc_map = {
BIND_PROC(Viewport),
BIND_PROC(GetString),
BIND_PROC(GetBooleanv),
BIND_PROC(GetFloatv),
BIND_PROC(GetIntegerv),
BIND_PROC(IsEnabled),
BIND_PROC(IsProgram),
BIND_PROC(ClearColor),
BIND_PROC(ClearDepth),
BIND_PROC(DepthFunc),
BIND_PROC(DepthRange),
BIND_PROC(DepthMask),
BIND_PROC(BlendFunc),
BIND_PROC(BlendEquation),
BIND_PROC(BlendFuncSeparate),
BIND_PROC(BlendEquationSeparate),
BIND_PROC(BlendColor),
BIND_PROC(Clear),
BIND_PROC(ProvokingVertex),
BIND_PROC(Enable),
BIND_PROC(Disable),
BIND_PROC(CullFace),
BIND_PROC(FrontFace),
BIND_PROC(PolygonMode),
BIND_PROC(PointSize),
BIND_PROC(PointParameteri),
BIND_PROC(LineWidth),
BIND_PROC(LogicOp),
BIND_PROC(PolygonOffset),
BIND_PROC(Scissor),
BIND_PROC(StencilFunc),
BIND_PROC(StencilFuncSeparate),
BIND_PROC(StencilOp),
BIND_PROC(StencilOpSeparate),
BIND_PROC(ClearStencil),
BIND_PROC(StencilMask),
BIND_PROC(StencilMaskSeparate),
BIND_PROC(GenTextures),
BIND_PROC(DeleteTextures),
BIND_PROC(BindTexture),
BIND_PROC(TexParameteri),
BIND_PROC(TexParameterfv),
BIND_PROC(TextureParameteri),
BIND_PROC(PixelStorei),
BIND_PROC(TexImage1D),
BIND_PROC(TexImage2D),
BIND_PROC(TexImage3D),
BIND_PROC(TexSubImage1D),
BIND_PROC(TexSubImage2D),
BIND_PROC(TexSubImage3D),
BIND_PROC(GenVertexArrays),
BIND_PROC(DeleteVertexArrays),
BIND_PROC(BindVertexArray),
BIND_PROC(GenBuffers),
BIND_PROC(DeleteBuffers),
BIND_PROC(BindBuffer),
BIND_PROC(BufferData),
BIND_PROC(BufferSubData),
BIND_PROC(MapBuffer),
BIND_PROC(VertexAttribDivisor),
BIND_PROC(EnableVertexAttribArray),
BIND_PROC(DisableVertexAttribArray),
BIND_PROC(DrawArrays),
BIND_PROC(MultiDrawArrays),
BIND_PROC(DrawElements),
BIND_PROC(MultiDrawElements),
BIND_PROC(DrawArraysInstanced),
BIND_PROC(DrawArraysInstancedBaseInstance),
BIND_PROC(DrawElementsInstanced),
BIND_PROC(DrawElementsInstancedBaseInstance),
BIND_PROC(NamedBufferData),
BIND_PROC(NamedBufferSubData),
BIND_PROC(MapNamedBuffer),
BIND_PROC(CreateTextures),
BIND_PROC(DeleteProgram),
BIND_PROC(UseProgram),
};
const auto it = proc_map.find(proc_name);
return it == proc_map.end() ? NULL : it->second;
}

View file

@ -1,2 +0,0 @@
#define PORTABLEGL_IMPLEMENTATION
#include <portablegl.h>

View file

@ -3,4 +3,3 @@ url = https://github.com/KhronosGroup/OpenGL-Registry
revision = b53ca669bea4715b6d5fa53c459f47a1fecd7944 revision = b53ca669bea4715b6d5fa53c459f47a1fecd7944
depth = 1 depth = 1
patch_directory = opengl-registry patch_directory = opengl-registry
diff_files = opengl-registry-portablegl.patch

View file

@ -1,67 +0,0 @@
# Makes the Khronos OpenGL headers use the OpenGL types defined by PortableGL to avoid type conflicts when both the Khronos OpenGL headers and the PortableGL headers are being used.
--- a/api/GLES3/gl3.h
+++ b/api/GLES3/gl3.h
@@ -1,6 +1,6 @@
#ifndef __gles2_gl3_h_
#define __gles2_gl3_h_ 1
-
+#include <portablegl.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -40,26 +40,26 @@ extern "C" {
#ifndef GL_ES_VERSION_2_0
#define GL_ES_VERSION_2_0 1
#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef khronos_int16_t GLshort;
-typedef khronos_uint16_t GLushort;
-typedef void GLvoid;
+
+
+
+
+
+
typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
+
+
+
+
+
+
+
+
+
+
+
+
+
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
@@ -651,7 +651,7 @@ GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei
#ifndef GL_ES_VERSION_3_0
#define GL_ES_VERSION_3_0 1
-typedef khronos_uint16_t GLhalf;
+
#define GL_READ_BUFFER 0x0C02
#define GL_UNPACK_ROW_LENGTH 0x0CF2
#define GL_UNPACK_SKIP_ROWS 0x0CF3

View file

@ -1,2 +1,2 @@
project('opengl-registry', 'c', meson_version: '>=1.3.0') project('opengl-registry', 'c', meson_version: '>=1.3.0')
opengl_registry = declare_dependency(include_directories: 'api', dependencies: [subproject('egl-registry').get_variable('egl_registry'), subproject('portablegl').get_variable('portablegl')]) opengl_registry = declare_dependency(include_directories: 'api', dependencies: [subproject('egl-registry').get_variable('egl_registry')])

View file

@ -1,174 +0,0 @@
# Renames all the GL_MAX_* macros defined by PortableGL to PGL_MAX_* to avoid conflicts with the Khronos OpenGL headers.
--- a/portablegl.h
+++ b/portablegl.h
@@ -2450,7 +2450,7 @@ enum
#define GL_FALSE 0
#define GL_TRUE 1
-#define GL_STENCIL_BITS 8
+#define PGL_STENCIL_BITS 8
// Just GL_STENCIL_BITS of 1's, not an official GL enum/value
//#define PGL_STENCIL_MASK ((1 << GL_STENCIL_BITS)-1)
@@ -2460,10 +2460,10 @@ enum
// Feel free to change these
#define PGL_MAX_VERTICES 500000
-#define GL_MAX_VERTEX_ATTRIBS 8
-#define GL_MAX_VERTEX_OUTPUT_COMPONENTS (4*GL_MAX_VERTEX_ATTRIBS)
-#define GL_MAX_DRAW_BUFFERS 4
-#define GL_MAX_COLOR_ATTACHMENTS 4
+#define PGL_MAX_VERTEX_ATTRIBS 8
+#define PGL_MAX_VERTEX_OUTPUT_COMPONENTS (4*PGL_MAX_VERTEX_ATTRIBS)
+#define PGL_MAX_DRAW_BUFFERS 4
+#define PGL_MAX_COLOR_ATTACHMENTS 4
//TODO use prefix like GL_SMOOTH? PGL_SMOOTH?
enum { PGL_SMOOTH, PGL_FLAT, PGL_NOPERSPECTIVE };
@@ -2522,7 +2522,7 @@ typedef struct glProgram
frag_func fragment_shader;
void* uniform;
GLsizei vs_output_size;
- GLenum interpolation[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ GLenum interpolation[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
GLboolean fragdepth_or_discard;
@@ -2571,7 +2571,7 @@ void init_glVertex_Attrib(glVertex_Attrib* v);
typedef struct glVertex_Array
{
- glVertex_Attrib vertex_attribs[GL_MAX_VERTEX_ATTRIBS];
+ glVertex_Attrib vertex_attribs[PGL_MAX_VERTEX_ATTRIBS];
//GLuint n_array_bufs;
GLuint element_buffer;
@@ -2893,10 +2893,10 @@ typedef struct glContext
// TODO make some or all of these locals, measure performance
// impact. Would be necessary in the long term if I ever
// parallelize more
- vec4 vertex_attribs_vs[GL_MAX_VERTEX_ATTRIBS];
+ vec4 vertex_attribs_vs[PGL_MAX_VERTEX_ATTRIBS];
Shader_Builtins builtins;
Vertex_Shader_output vs_output;
- float fs_input[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ float fs_input[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
GLboolean depth_test;
GLboolean line_smooth;
@@ -3032,7 +3032,7 @@ typedef struct pgl_prog_info
vert_func vs;
frag_func fs;
int vs_out_sz;
- GLenum interp[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ GLenum interp[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
GLboolean uses_fragdepth_or_discard;
} pgl_prog_info;
@@ -5924,8 +5924,8 @@ static void vertex_stage(const GLvoid* indices, GLsizei count, GLsizei instance_
//also initialize the vertex_attrib space
// TODO does creating enabled array actually help perf? At what number
// of GL_MAX_VERTEX_ATTRIBS and vertices does it become a benefit?
- int enabled[GL_MAX_VERTEX_ATTRIBS] = { 0 };
- for (i=0, j=0; i<GL_MAX_VERTEX_ATTRIBS; ++i) {
+ int enabled[PGL_MAX_VERTEX_ATTRIBS] = { 0 };
+ for (i=0, j=0; i<PGL_MAX_VERTEX_ATTRIBS; ++i) {
if (v[i].enabled) {
if (v[i].divisor == 0) {
enabled[j++] = i;
@@ -5979,7 +5979,7 @@ static void vertex_stage(const GLvoid* indices, GLsizei count, GLsizei instance_
//TODO make fs_input static? or a member of glContext?
static void draw_point(glVertex* vert, float poly_offset)
{
- float fs_input[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ float fs_input[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
vec3 point = vec4_to_vec3h(vert->screen_space);
point.z += poly_offset; // couldn't this put it outside of [-1,1]?
@@ -6203,8 +6203,8 @@ static void draw_line_clip(glVertex* v1, glVertex* v2)
p1 = v1->clip_space;
p2 = v2->clip_space;
- float v1_out[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
- float v2_out[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ float v1_out[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ float v2_out[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
vec3 hp1, hp2;
@@ -6901,8 +6901,8 @@ static void draw_triangle_clip(glVertex* v0, glVertex* v1, glVertex* v2, unsigne
float tt;
//quite a bit of stack if there's a lot of clipping ...
- float tmp1_out[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
- float tmp2_out[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ float tmp1_out[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ float tmp2_out[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
tmp1.vs_out = tmp1_out;
tmp2.vs_out = tmp2_out;
@@ -7136,14 +7136,14 @@ static void draw_triangle_fill(glVertex* v0, glVertex* v1, glVertex* v2, unsigne
Line l20 = make_Line(hp2.x, hp2.y, hp0.x, hp0.y);
float alpha, beta, gamma, tmp, tmp2, z;
- float fs_input[GL_MAX_VERTEX_OUTPUT_COMPONENTS];
- float perspective[GL_MAX_VERTEX_OUTPUT_COMPONENTS*3];
+ float fs_input[PGL_MAX_VERTEX_OUTPUT_COMPONENTS];
+ float perspective[PGL_MAX_VERTEX_OUTPUT_COMPONENTS*3];
float* vs_output = &c->vs_output.output_buf.a[0];
for (int i=0; i<c->vs_output.size; ++i) {
perspective[i] = v0->vs_out[i]/p0.w;
- perspective[GL_MAX_VERTEX_OUTPUT_COMPONENTS + i] = v1->vs_out[i]/p1.w;
- perspective[2*GL_MAX_VERTEX_OUTPUT_COMPONENTS + i] = v2->vs_out[i]/p2.w;
+ perspective[PGL_MAX_VERTEX_OUTPUT_COMPONENTS + i] = v1->vs_out[i]/p1.w;
+ perspective[2*PGL_MAX_VERTEX_OUTPUT_COMPONENTS + i] = v2->vs_out[i]/p2.w;
}
float inv_w0 = 1/p0.w; //is this worth it? faster than just dividing by w down below?
float inv_w1 = 1/p1.w;
@@ -7190,7 +7190,7 @@ static void draw_triangle_fill(glVertex* v0, glVertex* v1, glVertex* v2, unsigne
for (int i=0; i<c->vs_output.size; ++i) {
if (c->vs_output.interpolation[i] == PGL_SMOOTH) {
- tmp = alpha*perspective[i] + beta*perspective[GL_MAX_VERTEX_OUTPUT_COMPONENTS + i] + gamma*perspective[2*GL_MAX_VERTEX_OUTPUT_COMPONENTS + i];
+ tmp = alpha*perspective[i] + beta*perspective[PGL_MAX_VERTEX_OUTPUT_COMPONENTS + i] + gamma*perspective[2*PGL_MAX_VERTEX_OUTPUT_COMPONENTS + i];
fs_input[i] = tmp/tmp2;
@@ -7705,7 +7705,7 @@ void default_fs(float* fs_input, Shader_Builtins* builtins, void* uniforms)
void init_glVertex_Array(glVertex_Array* v)
{
v->deleted = GL_FALSE;
- for (int i=0; i<GL_MAX_VERTEX_ATTRIBS; ++i)
+ for (int i=0; i<PGL_MAX_VERTEX_ATTRIBS; ++i)
init_glVertex_Attrib(&v->vertex_attribs[i]);
}
@@ -8937,7 +8937,7 @@ void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean norm
// but you can easily remove c->cur_vertex_array from the check
// below to enable client arrays for all VAOs and it will
// still work just fine
- if (index >= GL_MAX_VERTEX_ATTRIBS || size < 1 || size > 4 ||
+ if (index >= PGL_MAX_VERTEX_ATTRIBS || size < 1 || size > 4 ||
(c->cur_vertex_array && !c->bound_buffers[GL_ARRAY_BUFFER-GL_ARRAY_BUFFER] && pointer)) {
if (!c->error)
c->error = GL_INVALID_OPERATION;
@@ -8990,7 +8990,7 @@ void glDisableVertexAttribArray(GLuint index)
void glVertexAttribDivisor(GLuint index, GLuint divisor)
{
- if (index >= GL_MAX_VERTEX_ATTRIBS) {
+ if (index >= PGL_MAX_VERTEX_ATTRIBS) {
if (!c->error)
c->error = GL_INVALID_VALUE;
return;
@@ -9694,7 +9694,7 @@ GLuint pglCreateProgram(vert_func vertex_shader, frag_func fragment_shader, GLsi
return 0;
}
- if (n < 0 || n > GL_MAX_VERTEX_OUTPUT_COMPONENTS) {
+ if (n < 0 || n > PGL_MAX_VERTEX_OUTPUT_COMPONENTS) {
if (!c->error)
c->error = GL_INVALID_VALUE;
return 0;

View file

@ -1,31 +0,0 @@
# Applies C++ name mangling to all of PortableGL's functions so that they don't conflict with the functions in Emscripten's OpenGL implementation.
# Otherwise, the Emscripten build crashes on startup because the Emscripten version of RetroArch also depends on OpenGL, and it will incorrectly try to use our OpenGL implementation instead of Emscripten's.
--- a/portablegl.h
+++ b/portablegl.h
@@ -296,9 +296,9 @@ IN THE SOFTWARE.
#define GL_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+
+
+
@@ -3299,9 +3299,9 @@ void put_wide_line_simple(Color the_color, float width, float x1, float y1, floa
void put_triangle(Color c1, Color c2, Color c3, vec2 p1, vec2 p2, vec2 p3);
-#ifdef __cplusplus
-}
-#endif
+
+
+
// end GL_H
#endif

View file

@ -1,132 +0,0 @@
# Renames all the shader texture functions to reduce probability of symbol conflicts with the libretro frontend.
--- a/portablegl.h
+++ b/portablegl.h
@@ -2988,9 +2988,9 @@ typedef struct glContext
cvector_glVertex glverts;
} glContext;
-
-
-
+#ifdef __cplusplus
+extern "C" {
+#endif
/*************************************
* GLSL(ish) functions
*************************************/
@@ -3004,15 +3004,15 @@ typedef struct glContext
//int clampi(int i, int min, int max);
//shader texture functions
-vec4 texture1D(GLuint tex, float x);
-vec4 texture2D(GLuint tex, float x, float y);
-vec4 texture3D(GLuint tex, float x, float y, float z);
-vec4 texture2DArray(GLuint tex, float x, float y, int z);
-vec4 texture_rect(GLuint tex, float x, float y);
-vec4 texture_cubemap(GLuint texture, float x, float y, float z);
-
-
-
+vec4 mkxp_pgl_texture1D(GLuint tex, float x);
+vec4 mkxp_pgl_texture2D(GLuint tex, float x, float y);
+vec4 mkxp_pgl_texture3D(GLuint tex, float x, float y, float z);
+vec4 mkxp_pgl_texture2DArray(GLuint tex, float x, float y, int z);
+vec4 mkxp_pgl_texture_rect(GLuint tex, float x, float y);
+vec4 mkxp_pgl_texture_cubemap(GLuint texture, float x, float y, float z);
+#ifdef __cplusplus
+}
+#endif
typedef struct pgl_uniforms
@@ -10230,7 +10230,7 @@ static int wrap(int i, int size, GLenum mode)
// used in the following 4 texture access functions
// Not sure if it's actually necessary since wrap() clamps
#define EPSILON 0.000001
-vec4 texture1D(GLuint tex, float x)
+vec4 mkxp_pgl_texture1D(GLuint tex, float x)
{
int i0, i1;
@@ -10276,7 +10276,7 @@ vec4 texture1D(GLuint tex, float x)
}
}
-vec4 texture2D(GLuint tex, float x, float y)
+vec4 mkxp_pgl_texture2D(GLuint tex, float x, float y)
{
int i0, j0, i1, j1;
@@ -10341,7 +10341,7 @@ vec4 texture2D(GLuint tex, float x, float y)
}
}
-vec4 texture3D(GLuint tex, float x, float y, float z)
+vec4 mkxp_pgl_texture3D(GLuint tex, float x, float y, float z)
{
int i0, j0, i1, j1, k0, k1;
@@ -10427,7 +10427,7 @@ vec4 texture3D(GLuint tex, float x, float y, float z)
}
// for now this should work
-vec4 texture2DArray(GLuint tex, float x, float y, int z)
+vec4 mkxp_pgl_texture2DArray(GLuint tex, float x, float y, int z)
{
int i0, j0, i1, j1;
@@ -10490,7 +10490,7 @@ vec4 texture2DArray(GLuint tex, float x, float y, int z)
}
}
-vec4 texture_rect(GLuint tex, float x, float y)
+vec4 mkxp_pgl_texture_rect(GLuint tex, float x, float y)
{
int i0, j0, i1, j1;
@@ -10552,7 +10552,7 @@ vec4 texture_rect(GLuint tex, float x, float y)
}
}
-vec4 texture_cubemap(GLuint texture, float x, float y, float z)
+vec4 mkxp_pgl_texture_cubemap(GLuint texture, float x, float y, float z)
{
glTexture* tex = &c->textures.a[texture];
Color* texdata = (Color*)tex->data;
@@ -11592,7 +11592,7 @@ static void pgl_tex_rplc_fs(float* fs_input, Shader_Builtins* builtins, void* un
vec2 tex_coords = ((vec2*)fs_input)[0];
GLuint tex = ((pgl_uniforms*)uniforms)->tex0;
- builtins->gl_FragColor = texture2D(tex, tex_coords.x, tex_coords.y);
+ builtins->gl_FragColor = mkxp_pgl_texture2D(tex, tex_coords.x, tex_coords.y);
}
@@ -11613,7 +11613,7 @@ static void pgl_tex_rect_rplc_fs(float* fs_input, Shader_Builtins* builtins, voi
vec2 tex_coords = ((vec2*)fs_input)[0];
GLuint tex = ((pgl_uniforms*)uniforms)->tex0;
- builtins->gl_FragColor = texture_rect(tex, tex_coords.x, tex_coords.y);
+ builtins->gl_FragColor = mkxp_pgl_texture_rect(tex, tex_coords.x, tex_coords.y);
}
@@ -11637,7 +11637,7 @@ static void pgl_tex_modulate_fs(float* fs_input, Shader_Builtins* builtins, void
GLuint tex = u->tex0;
- builtins->gl_FragColor = mult_vec4s(u->color, texture2D(tex, tex_coords.x, tex_coords.y));
+ builtins->gl_FragColor = mult_vec4s(u->color, mkxp_pgl_texture2D(tex, tex_coords.x, tex_coords.y));
}
@@ -11686,7 +11686,7 @@ static void pgl_tex_pnt_light_diff_fs(float* fs_input, Shader_Builtins* builtins
GLuint tex = u->tex0;
- builtins->gl_FragColor = mult_vec4s(((vec4*)fs_input)[0], texture2D(tex, tex_coords.x, tex_coords.y));
+ builtins->gl_FragColor = mult_vec4s(((vec4*)fs_input)[0], mkxp_pgl_texture2D(tex, tex_coords.x, tex_coords.y));
}

View file

@ -1,54 +0,0 @@
# Changes some of PortableGL's types to more accurately match those of the real OpenGL API.
--- a/portablegl.h
+++ b/portablegl.h
@@ -2054,11 +2054,11 @@ typedef uint64_t GLuint64;
// the pgl macro wrapper)
typedef int32_t GLsizei;
-typedef int32_t GLenum;
+typedef uint32_t GLenum;
typedef int32_t GLbitfield;
typedef intptr_t GLintptr;
-typedef uintptr_t GLsizeiptr;
+typedef ssize_t GLsizeiptr;
typedef void GLvoid;
typedef float GLfloat;
@@ -2558,7 +2558,7 @@ typedef struct glVertex_Attrib
GLint size; // number of components 1-4
GLenum type; // GL_FLOAT, default
GLsizei stride; //
- GLsizeiptr offset; //
+ uintptr_t offset; //
GLboolean normalized;
GLuint buf;
GLboolean enabled;
@@ -5835,7 +5835,7 @@ static vec4 get_v_attrib(glVertex_Attrib* v, GLsizei i)
// is always NULL so this works for both but we have to cast
// the pointer to GLsizeiptr because adding an offset to a NULL pointer
// is undefined. So, do the math as numbers and convert back to a pointer
- GLsizeiptr buf_data = (GLsizeiptr)c->buffers.a[v->buf].data;
+ uintptr_t buf_data = (uintptr_t)c->buffers.a[v->buf].data;
u8* u8p = (u8*)(buf_data + v->offset + v->stride*i);
i8* i8p = (i8*)u8p;
@@ -5944,7 +5944,7 @@ static void vertex_stage(const GLvoid* indices, GLsizei count, GLsizei instance_
// https://www.khronos.org/opengl/wiki/Built-in_Variable_(GLSL)#Vertex_shader_inputs
c->builtins.gl_InstanceID = instance_id;
c->builtins.gl_BaseInstance = base_instance;
- GLsizeiptr first = (GLsizeiptr)indices;
+ uintptr_t first = (uintptr_t)indices;
if (!use_elems_type) {
for (vert=0, i=first; i<first+count; ++i, ++vert) {
@@ -8973,7 +8973,7 @@ void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean norm
// offset can still really a pointer if using the 0 VAO
// and no bound ARRAY_BUFFER. !v->buf and !(buf data) see vertex_stage()
- v->offset = (GLsizeiptr)pointer;
+ v->offset = (uintptr_t)pointer;
// I put ARRAY_BUFFER-itself instead of 0 to reinforce that bound_buffers is indexed that way, buffer type - GL_ARRAY_BUFFER
v->buf = c->bound_buffers[GL_ARRAY_BUFFER-GL_ARRAY_BUFFER];
}

View file

@ -1,2 +0,0 @@
project('portablegl', 'c', meson_version: '>=1.3.0')
portablegl = declare_dependency(include_directories: '.')

View file

@ -1,6 +0,0 @@
[wrap-git]
url = https://github.com/rswinkle/PortableGL
revision = 0.98.0
depth = 1
patch_directory = portablegl
diff_files = portablegl-defines.patch, portablegl-emscripten-symbol-conflict.patch, portablegl-texture.patch, portablegl-types.patch