Switch To Desktop OpenGL 1.5
This commit is contained in:
parent
5668dcc852
commit
6388663b6c
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -7,9 +7,6 @@
|
||||
[submodule "dependencies/LIEF/src"]
|
||||
path = dependencies/LIEF/src
|
||||
url = https://github.com/lief-project/LIEF.git
|
||||
[submodule "media-layer/core/gles/dependencies/gles-compatibility-layer"]
|
||||
path = dependencies/gles-compatibility-layer/src
|
||||
url = https://gitea.thebrokenrail.com/minecraft-pi-reborn/gles-compatibility-layer.git
|
||||
[submodule "dependencies/stb_image/include"]
|
||||
path = dependencies/stb_image/include
|
||||
url = https://github.com/nothings/stb.git
|
||||
|
@ -23,7 +23,6 @@ if(BUILD_NATIVE_COMPONENTS AND NOT IS_ARM_TARGETING)
|
||||
set(DEFAULT_USE_MEDIA_LAYER_TRAMPOLINE TRUE)
|
||||
endif()
|
||||
mcpi_option(USE_MEDIA_LAYER_TRAMPOLINE "Whether To Enable The Media Layer Trampoline" BOOL "${DEFAULT_USE_MEDIA_LAYER_TRAMPOLINE}")
|
||||
mcpi_option(USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" BOOL TRUE)
|
||||
if(MCPI_USE_MEDIA_LAYER_TRAMPOLINE)
|
||||
set(BUILD_MEDIA_LAYER_CORE "${BUILD_NATIVE_COMPONENTS}")
|
||||
else()
|
||||
|
4
dependencies/CMakeLists.txt
vendored
4
dependencies/CMakeLists.txt
vendored
@ -22,10 +22,6 @@ add_subdirectory(runtime)
|
||||
if(BUILD_MEDIA_LAYER_CORE)
|
||||
add_subdirectory(glfw)
|
||||
endif()
|
||||
# GLES Compatibility Layer
|
||||
if(BUILD_MEDIA_LAYER_CORE AND MCPI_USE_GLES1_COMPATIBILITY_LAYER)
|
||||
add_subdirectory(gles-compatibility-layer)
|
||||
endif()
|
||||
# UTF8-CPP
|
||||
add_subdirectory(utf8cpp)
|
||||
# Symbol Prcoessor
|
||||
|
@ -1,4 +0,0 @@
|
||||
project(gles-compatibility-layer)
|
||||
|
||||
# GLES Compatibility Layer
|
||||
add_subdirectory(src)
|
1
dependencies/gles-compatibility-layer/src
vendored
1
dependencies/gles-compatibility-layer/src
vendored
@ -1 +0,0 @@
|
||||
Subproject commit fedc5ac21865fe44dcbc7adb0818af612205cd57
|
@ -3,7 +3,6 @@
|
||||
#cmakedefine MCPI_IS_APPIMAGE_BUILD
|
||||
#cmakedefine MCPI_IS_FLATPAK_BUILD
|
||||
#cmakedefine MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN
|
||||
#cmakedefine MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
#cmakedefine MCPI_APP_BASE_TITLE "@MCPI_APP_BASE_TITLE@"
|
||||
#cmakedefine MCPI_APP_TITLE "@MCPI_APP_TITLE@"
|
||||
#cmakedefine MCPI_APP_ID "@MCPI_APP_ID@"
|
||||
|
@ -16,12 +16,6 @@ if(BUILD_ARM_COMPONENTS)
|
||||
install(
|
||||
DIRECTORY "include/"
|
||||
DESTINATION "${MCPI_SDK_INCLUDE_DIR}/media-layer"
|
||||
PATTERN "${GLES_HEADERS}" EXCLUDE
|
||||
)
|
||||
get_filename_component(GLES_HEADERS "${GLES_HEADERS}" REALPATH)
|
||||
install(
|
||||
DIRECTORY "${GLES_HEADERS}/"
|
||||
DESTINATION "${MCPI_SDK_INCLUDE_DIR}/media-layer/GLES"
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -30,6 +24,7 @@ add_subdirectory(extras)
|
||||
|
||||
# Add Core
|
||||
if(BUILD_MEDIA_LAYER_CORE)
|
||||
add_subdirectory(gles)
|
||||
add_subdirectory(core)
|
||||
endif()
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
project(media-layer-core)
|
||||
|
||||
# OpenGL
|
||||
add_subdirectory(gles)
|
||||
|
||||
# SDL Re-Implementation Using GLFW
|
||||
set(CORE_SRC
|
||||
src/base.cpp
|
||||
|
@ -1,12 +0,0 @@
|
||||
project(media-layer-gles)
|
||||
|
||||
# Build
|
||||
if(MCPI_USE_GLES1_COMPATIBILITY_LAYER)
|
||||
# GLESv1_CM Compatibility Layer
|
||||
add_library(GLESv1_CM INTERFACE)
|
||||
target_link_libraries(GLESv1_CM INTERFACE gles-compatibility-layer)
|
||||
else()
|
||||
# Passthrough To glfwGetProcAddress()
|
||||
add_library(GLESv1_CM OBJECT src/passthrough.c)
|
||||
target_link_libraries(GLESv1_CM PRIVATE glfw media-layer-headers)
|
||||
endif()
|
@ -321,9 +321,6 @@ void media_force_egl() {
|
||||
// Init Media Layer
|
||||
#define GL_VERSION 0x1f02
|
||||
typedef const char *(*glGetString_t)(unsigned int name);
|
||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
extern "C" void init_gles_compatibility_layer(void *);
|
||||
#endif
|
||||
void SDL_WM_SetCaption(const char *title, __attribute__((unused)) const char *icon) {
|
||||
// Disable In Headless Mode
|
||||
if (reborn_is_headless()) {
|
||||
@ -337,15 +334,9 @@ void SDL_WM_SetCaption(const char *title, __attribute__((unused)) const char *ic
|
||||
ERR("Unable To Initialize GLFW");
|
||||
}
|
||||
|
||||
// Create OpenGL ES Context
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
#else
|
||||
// Create OpenGL Context
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
#endif
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
|
||||
// Use EGL
|
||||
if (force_egl) {
|
||||
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
|
||||
@ -374,14 +365,9 @@ void SDL_WM_SetCaption(const char *title, __attribute__((unused)) const char *ic
|
||||
// Make Window Context Current
|
||||
glfwMakeContextCurrent(glfw_window);
|
||||
|
||||
// Setup Compatibility Layer
|
||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
init_gles_compatibility_layer((void *) glfwGetProcAddress);
|
||||
#endif
|
||||
|
||||
// Debug
|
||||
const glGetString_t glGetString = (glGetString_t) glfwGetProcAddress("glGetString");
|
||||
DEBUG("Using %s", (*glGetString)(GL_VERSION));
|
||||
DEBUG("Using OpenGL %s", (*glGetString)(GL_VERSION));
|
||||
|
||||
// Init OpenAL
|
||||
_media_audio_init();
|
||||
|
5
media-layer/gles/CMakeLists.txt
Normal file
5
media-layer/gles/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
project(media-layer-gles)
|
||||
|
||||
# Build
|
||||
add_library(GLESv1_CM OBJECT src/passthrough.cpp)
|
||||
target_link_libraries(GLESv1_CM PRIVATE glfw media-layer-headers reborn-util)
|
@ -1,97 +1,122 @@
|
||||
#include <GLES/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "../../../../dependencies/gles-compatibility-layer/src/src/passthrough.h"
|
||||
#include <libreborn/libreborn.h>
|
||||
|
||||
// Load GL Function
|
||||
#define GL_FUNC(name, return_type, args) \
|
||||
typedef return_type (*real_##name##_t)args; \
|
||||
\
|
||||
real_##name##_t real_##name() { \
|
||||
static real_##name##_t func = nullptr; \
|
||||
if (!func) { \
|
||||
func = (real_##name##_t) glfwGetProcAddress(#name); \
|
||||
if (!func) { \
|
||||
ERR("Error Resolving OpenGL Symbol: " #name); \
|
||||
} \
|
||||
} \
|
||||
return func; \
|
||||
}
|
||||
|
||||
GL_FUNC(glFogfv, void, (GLenum pname, const GLfloat *params));
|
||||
void glFogfv(GLenum pname, const GLfloat *params) {
|
||||
void glFogfv(const GLenum pname, const GLfloat *params) {
|
||||
real_glFogfv()(pname, params);
|
||||
}
|
||||
GL_FUNC(glVertexPointer, void, (GLint size, GLenum type, GLsizei stride, const void *pointer));
|
||||
void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {
|
||||
void glVertexPointer(const GLint size, const GLenum type, const GLsizei stride, const void *pointer) {
|
||||
real_glVertexPointer()(size, type, stride, pointer);
|
||||
}
|
||||
GL_FUNC(glLineWidth, void, (GLfloat width));
|
||||
void glLineWidth(GLfloat width) {
|
||||
void glLineWidth(const GLfloat width) {
|
||||
real_glLineWidth()(width);
|
||||
}
|
||||
GL_FUNC(glBlendFunc, void, (GLenum sfactor, GLenum dfactor));
|
||||
void glBlendFunc(GLenum sfactor, GLenum dfactor) {
|
||||
void glBlendFunc(const GLenum sfactor, const GLenum dfactor) {
|
||||
real_glBlendFunc()(sfactor, dfactor);
|
||||
}
|
||||
GL_FUNC(glDrawArrays, void, (GLenum mode, GLint first, GLsizei count));
|
||||
void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
|
||||
void glDrawArrays(const GLenum mode, const GLint first, const GLsizei count) {
|
||||
real_glDrawArrays()(mode, first, count);
|
||||
}
|
||||
GL_FUNC(glMultiDrawArraysEXT, void, (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount));
|
||||
void glMultiDrawArrays(const GLenum mode, const GLint *first, const GLsizei *count, const GLsizei drawcount) {
|
||||
real_glMultiDrawArraysEXT()(mode, first, count, drawcount);
|
||||
}
|
||||
GL_FUNC(glColor4f, void, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha));
|
||||
void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
|
||||
void glColor4f(const GLfloat red, const GLfloat green, const GLfloat blue, const GLfloat alpha) {
|
||||
real_glColor4f()(red, green, blue, alpha);
|
||||
}
|
||||
GL_FUNC(glClear, void, (GLbitfield mask));
|
||||
void glClear(GLbitfield mask) {
|
||||
void glClear(const GLbitfield mask) {
|
||||
real_glClear()(mask);
|
||||
}
|
||||
GL_FUNC(glBufferData, void, (GLenum target, GLsizeiptr size, const void *data, GLenum usage));
|
||||
void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) {
|
||||
void glBufferData(const GLenum target, const GLsizeiptr size, const void *data, const GLenum usage) {
|
||||
real_glBufferData()(target, size, data, usage);
|
||||
}
|
||||
GL_FUNC(glFogx, void, (GLenum pname, GLfixed param));
|
||||
void glFogx(GLenum pname, GLfixed param) {
|
||||
real_glFogx()(pname, param);
|
||||
GL_FUNC(glBufferSubData, void, (GLenum target, GLintptr offset, GLsizeiptr size, const void *data));
|
||||
void glBufferSubData(const GLenum target, const GLintptr offset, const GLsizeiptr size, const void *data) {
|
||||
real_glBufferSubData()(target, offset, size, data);
|
||||
}
|
||||
GL_FUNC(glFogi, void, (GLenum pname, GLint param));
|
||||
void glFogx(const GLenum pname, const GLfixed param) {
|
||||
real_glFogi()(pname, param);
|
||||
}
|
||||
GL_FUNC(glFogf, void, (GLenum pname, GLfloat param));
|
||||
void glFogf(GLenum pname, GLfloat param) {
|
||||
void glFogf(const GLenum pname, const GLfloat param) {
|
||||
real_glFogf()(pname, param);
|
||||
}
|
||||
GL_FUNC(glMatrixMode, void, (GLenum mode));
|
||||
void glMatrixMode(GLenum mode) {
|
||||
void glMatrixMode(const GLenum mode) {
|
||||
real_glMatrixMode()(mode);
|
||||
}
|
||||
GL_FUNC(glColorPointer, void, (GLint size, GLenum type, GLsizei stride, const void *pointer));
|
||||
void glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {
|
||||
void glColorPointer(const GLint size, const GLenum type, const GLsizei stride, const void *pointer) {
|
||||
real_glColorPointer()(size, type, stride, pointer);
|
||||
}
|
||||
GL_FUNC(glScissor, void, (GLint x, GLint y, GLsizei width, GLsizei height));
|
||||
void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||
void glScissor(const GLint x, const GLint y, const GLsizei width, const GLsizei height) {
|
||||
real_glScissor()(x, y, width, height);
|
||||
}
|
||||
GL_FUNC(glTexParameteri, void, (GLenum target, GLenum pname, GLint param));
|
||||
void glTexParameteri(GLenum target, GLenum pname, GLint param) {
|
||||
void glTexParameteri(const GLenum target, const GLenum pname, const GLint param) {
|
||||
real_glTexParameteri()(target, pname, param);
|
||||
}
|
||||
GL_FUNC(glTexImage2D, void, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels));
|
||||
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels) {
|
||||
void glTexImage2D(const GLenum target, const GLint level, const GLint internalformat, const GLsizei width, const GLsizei height, const GLint border, const GLenum format, const GLenum type, const void *pixels) {
|
||||
real_glTexImage2D()(target, level, internalformat, width, height, border, format, type, pixels);
|
||||
}
|
||||
GL_FUNC(glEnable, void, (GLenum cap));
|
||||
void glEnable(GLenum cap) {
|
||||
void glEnable(const GLenum cap) {
|
||||
real_glEnable()(cap);
|
||||
}
|
||||
GL_FUNC(glEnableClientState, void, (GLenum array));
|
||||
void glEnableClientState(GLenum array) {
|
||||
void glEnableClientState(const GLenum array) {
|
||||
real_glEnableClientState()(array);
|
||||
}
|
||||
GL_FUNC(glPolygonOffset, void, (GLfloat factor, GLfloat units));
|
||||
void glPolygonOffset(GLfloat factor, GLfloat units) {
|
||||
void glPolygonOffset(const GLfloat factor, const GLfloat units) {
|
||||
real_glPolygonOffset()(factor, units);
|
||||
}
|
||||
GL_FUNC(glDisableClientState, void, (GLenum array));
|
||||
void glDisableClientState(GLenum array) {
|
||||
void glDisableClientState(const GLenum array) {
|
||||
real_glDisableClientState()(array);
|
||||
}
|
||||
GL_FUNC(glDepthRangef, void, (GLclampf near, GLclampf far));
|
||||
void glDepthRangef(GLclampf near, GLclampf far) {
|
||||
real_glDepthRangef()(near, far);
|
||||
GL_FUNC(glDepthRange, void, (GLclampd near, GLclampd far));
|
||||
void glDepthRangef(const GLclampf near, const GLclampf far) {
|
||||
real_glDepthRange()(near, far);
|
||||
}
|
||||
GL_FUNC(glDepthFunc, void, (GLenum func));
|
||||
void glDepthFunc(GLenum func) {
|
||||
void glDepthFunc(const GLenum func) {
|
||||
real_glDepthFunc()(func);
|
||||
}
|
||||
GL_FUNC(glBindBuffer, void, (GLenum target, GLuint buffer));
|
||||
void glBindBuffer(GLenum target, GLuint buffer) {
|
||||
void glBindBuffer(const GLenum target, const GLuint buffer) {
|
||||
real_glBindBuffer()(target, buffer);
|
||||
}
|
||||
GL_FUNC(glClearColor, void, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha));
|
||||
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
|
||||
void glClearColor(const GLclampf red, const GLclampf green, const GLclampf blue, const GLclampf alpha) {
|
||||
real_glClearColor()(red, green, blue, alpha);
|
||||
}
|
||||
GL_FUNC(glPopMatrix, void, ());
|
||||
@ -103,7 +128,7 @@ void glLoadIdentity() {
|
||||
real_glLoadIdentity()();
|
||||
}
|
||||
GL_FUNC(glScalef, void, (GLfloat x, GLfloat y, GLfloat z));
|
||||
void glScalef(GLfloat x, GLfloat y, GLfloat z) {
|
||||
void glScalef(const GLfloat x, const GLfloat y, const GLfloat z) {
|
||||
real_glScalef()(x, y, z);
|
||||
}
|
||||
GL_FUNC(glPushMatrix, void, ());
|
||||
@ -111,11 +136,11 @@ void glPushMatrix() {
|
||||
real_glPushMatrix()();
|
||||
}
|
||||
GL_FUNC(glDepthMask, void, (GLboolean flag));
|
||||
void glDepthMask(GLboolean flag) {
|
||||
void glDepthMask(const GLboolean flag) {
|
||||
real_glDepthMask()(flag);
|
||||
}
|
||||
GL_FUNC(glHint, void, (GLenum target, GLenum mode));
|
||||
void glHint(GLenum target, GLenum mode) {
|
||||
void glHint(const GLenum target, const GLenum mode) {
|
||||
real_glHint()(target, mode);
|
||||
}
|
||||
GL_FUNC(glMultMatrixf, void, (const GLfloat *m));
|
||||
@ -123,86 +148,86 @@ void glMultMatrixf(const GLfloat *m) {
|
||||
real_glMultMatrixf()(m);
|
||||
}
|
||||
GL_FUNC(glTexCoordPointer, void, (GLint size, GLenum type, GLsizei stride, const void *pointer));
|
||||
void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {
|
||||
void glTexCoordPointer(const GLint size, const GLenum type, const GLsizei stride, const void *pointer) {
|
||||
real_glTexCoordPointer()(size, type, stride, pointer);
|
||||
}
|
||||
GL_FUNC(glDeleteBuffers, void, (GLsizei n, const GLuint *buffers));
|
||||
void glDeleteBuffers(GLsizei n, const GLuint *buffers) {
|
||||
void glDeleteBuffers(const GLsizei n, const GLuint *buffers) {
|
||||
real_glDeleteBuffers()(n, buffers);
|
||||
}
|
||||
GL_FUNC(glColorMask, void, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha));
|
||||
void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
|
||||
void glColorMask(const GLboolean red, const GLboolean green, const GLboolean blue, const GLboolean alpha) {
|
||||
real_glColorMask()(red, green, blue, alpha);
|
||||
}
|
||||
GL_FUNC(glTexSubImage2D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels));
|
||||
void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) {
|
||||
void glTexSubImage2D(const GLenum target, const GLint level, const GLint xoffset, const GLint yoffset, const GLsizei width, const GLsizei height, const GLenum format, const GLenum type, const void *pixels) {
|
||||
real_glTexSubImage2D()(target, level, xoffset, yoffset, width, height, format, type, pixels);
|
||||
}
|
||||
GL_FUNC(glGenTextures, void, (GLsizei n, GLuint *textures));
|
||||
void glGenTextures(GLsizei n, GLuint *textures) {
|
||||
void glGenTextures(const GLsizei n, GLuint *textures) {
|
||||
real_glGenTextures()(n, textures);
|
||||
}
|
||||
GL_FUNC(glDeleteTextures, void, (GLsizei n, const GLuint *textures));
|
||||
void glDeleteTextures(GLsizei n, const GLuint *textures) {
|
||||
void glDeleteTextures(const GLsizei n, const GLuint *textures) {
|
||||
real_glDeleteTextures()(n, textures);
|
||||
}
|
||||
GL_FUNC(glAlphaFunc, void, (GLenum func, GLclampf ref));
|
||||
void glAlphaFunc(GLenum func, GLclampf ref) {
|
||||
void glAlphaFunc(const GLenum func, const GLclampf ref) {
|
||||
real_glAlphaFunc()(func, ref);
|
||||
}
|
||||
GL_FUNC(glGetFloatv, void, (GLenum pname, GLfloat *params));
|
||||
void glGetFloatv(GLenum pname, GLfloat *params) {
|
||||
void glGetFloatv(const GLenum pname, GLfloat *params) {
|
||||
real_glGetFloatv()(pname, params);
|
||||
}
|
||||
GL_FUNC(glBindTexture, void, (GLenum target, GLuint texture));
|
||||
void glBindTexture(GLenum target, GLuint texture) {
|
||||
void glBindTexture(const GLenum target, const GLuint texture) {
|
||||
real_glBindTexture()(target, texture);
|
||||
}
|
||||
GL_FUNC(glTranslatef, void, (GLfloat x, GLfloat y, GLfloat z));
|
||||
void glTranslatef(GLfloat x, GLfloat y, GLfloat z) {
|
||||
void glTranslatef(const GLfloat x, const GLfloat y, const GLfloat z) {
|
||||
real_glTranslatef()(x, y, z);
|
||||
}
|
||||
GL_FUNC(glShadeModel, void, (GLenum mode));
|
||||
void glShadeModel(GLenum mode) {
|
||||
void glShadeModel(const GLenum mode) {
|
||||
real_glShadeModel()(mode);
|
||||
}
|
||||
GL_FUNC(glOrthof, void, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far));
|
||||
void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far) {
|
||||
real_glOrthof()(left, right, bottom, top, near, far);
|
||||
GL_FUNC(glOrtho, void, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far));
|
||||
void glOrthof(const GLfloat left, const GLfloat right, const GLfloat bottom, const GLfloat top, const GLfloat near, const GLfloat far) {
|
||||
real_glOrtho()(left, right, bottom, top, near, far);
|
||||
}
|
||||
GL_FUNC(glDisable, void, (GLenum cap));
|
||||
void glDisable(GLenum cap) {
|
||||
void glDisable(const GLenum cap) {
|
||||
real_glDisable()(cap);
|
||||
}
|
||||
GL_FUNC(glCullFace, void, (GLenum mode));
|
||||
void glCullFace(GLenum mode) {
|
||||
void glCullFace(const GLenum mode) {
|
||||
real_glCullFace()(mode);
|
||||
}
|
||||
GL_FUNC(glRotatef, void, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z));
|
||||
void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
|
||||
void glRotatef(const GLfloat angle, const GLfloat x, const GLfloat y, const GLfloat z) {
|
||||
real_glRotatef()(angle, x, y, z);
|
||||
}
|
||||
GL_FUNC(glViewport, void, (GLint x, GLint y, GLsizei width, GLsizei height));
|
||||
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||
void glViewport(const GLint x, const GLint y, const GLsizei width, const GLsizei height) {
|
||||
real_glViewport()(x, y, width, height);
|
||||
}
|
||||
GL_FUNC(glNormal3f, void, (GLfloat nx, GLfloat ny, GLfloat nz));
|
||||
void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) {
|
||||
void glNormal3f(const GLfloat nx, const GLfloat ny, const GLfloat nz) {
|
||||
real_glNormal3f()(nx, ny, nz);
|
||||
}
|
||||
GL_FUNC(glIsEnabled, GLboolean, (GLenum cap));
|
||||
GLboolean glIsEnabled(GLenum cap) {
|
||||
GLboolean glIsEnabled(const GLenum cap) {
|
||||
return real_glIsEnabled()(cap);
|
||||
}
|
||||
GL_FUNC(glGetIntegerv, void, (GLenum pname, GLint *data));
|
||||
void glGetIntegerv(GLenum pname, GLint *data) {
|
||||
void glGetIntegerv(const GLenum pname, GLint *data) {
|
||||
real_glGetIntegerv()(pname, data);
|
||||
}
|
||||
GL_FUNC(glReadPixels, void, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data));
|
||||
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data) {
|
||||
void glReadPixels(const GLint x, const GLint y, const GLsizei width, const GLsizei height, const GLenum format, const GLenum type, void *data) {
|
||||
real_glReadPixels()(x, y, width, height, format, type, data);
|
||||
}
|
||||
GL_FUNC(glGenBuffers, void, (GLsizei n, GLuint *buffers));
|
||||
void glGenBuffers(GLsizei n, GLuint *buffers) {
|
||||
void glGenBuffers(const GLsizei n, GLuint *buffers) {
|
||||
real_glGenBuffers()(n, buffers);
|
||||
}
|
@ -1 +0,0 @@
|
||||
../../dependencies/gles-compatibility-layer/src/include/GLES
|
164
media-layer/include/GLES/gl.h
Normal file
164
media-layer/include/GLES/gl.h
Normal file
@ -0,0 +1,164 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GL_FALSE 0
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_MODELVIEW_MATRIX 0xba6
|
||||
#define GL_PROJECTION_MATRIX 0xba7
|
||||
#define GL_VIEWPORT 0xba2
|
||||
#define GL_DEPTH_TEST 0xb71
|
||||
#define GL_PACK_ALIGNMENT 0xd05
|
||||
#define GL_UNPACK_ALIGNMENT 0xcf5
|
||||
#define GL_SRC_ALPHA 0x302
|
||||
#define GL_DST_ALPHA 0x304
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x303
|
||||
#define GL_MODELVIEW 0x1700
|
||||
#define GL_PROJECTION 0x1701
|
||||
#define GL_TEXTURE 0x1702
|
||||
#define GL_VERTEX_ARRAY 0x8074
|
||||
#define GL_COLOR_ARRAY 0x8076
|
||||
#define GL_TEXTURE_COORD_ARRAY 0x8078
|
||||
#define GL_GREATER 0x204
|
||||
#define GL_ALPHA_TEST 0xbc0
|
||||
#define GL_TEXTURE_2D 0xde1
|
||||
#define GL_COLOR_MATERIAL 0xb57
|
||||
#define GL_PERSPECTIVE_CORRECTION_HINT 0xc50
|
||||
#define GL_FOG 0xb60
|
||||
#define GL_LINEAR 0x2601
|
||||
#define GL_EXP 0x800
|
||||
#define GL_FOG_DENSITY 0xb62
|
||||
#define GL_FOG_START 0xb63
|
||||
#define GL_FOG_END 0xb64
|
||||
#define GL_FOG_MODE 0xb65
|
||||
#define GL_FOG_COLOR 0xb66
|
||||
#define GL_BLEND 0xbe2
|
||||
#define GL_TRIANGLES 0x4
|
||||
#define GL_TRIANGLE_STRIP 0x5
|
||||
#define GL_TRIANGLE_FAN 0x6
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_BACK 0x405
|
||||
#define GL_CULL_FACE 0xb44
|
||||
#define GL_LEQUAL 0x203
|
||||
#define GL_EQUAL 0x202
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x307
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x301
|
||||
#define GL_ZERO 0
|
||||
#define GL_FLAT 0x1d00
|
||||
#define GL_SMOOTH 0x1d01
|
||||
#define GL_SCISSOR_TEST 0xc11
|
||||
#define GL_TRUE 1
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_SRC_COLOR 0x300
|
||||
#define GL_DST_COLOR 0x306
|
||||
#define GL_ONE 1
|
||||
#define GL_LINES 0x1
|
||||
#define GL_LINE_STRIP 0x3
|
||||
#define GL_STATIC_DRAW 0x88e4
|
||||
#define GL_DYNAMIC_DRAW 0x88e8
|
||||
#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_TEXTURE_WRAP_T 0x2803
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812f
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
#define GL_DEPTH_BUFFER_BIT 0x100
|
||||
#define GL_COLOR_BUFFER_BIT 0x4000
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_ACCUM 0x100
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_NONE 0
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846e
|
||||
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
typedef int GLint;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned int GLuint;
|
||||
typedef ssize_t GLsizeiptr;
|
||||
typedef intptr_t GLintptr;
|
||||
typedef int32_t GLfixed;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef unsigned int GLenum;
|
||||
typedef char GLchar;
|
||||
typedef void GLvoid;
|
||||
|
||||
void glFogfv(GLenum pname, const GLfloat *params);
|
||||
void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
void glLineWidth(GLfloat width);
|
||||
void glBlendFunc(GLenum sfactor, GLenum dfactor);
|
||||
void glDrawArrays(GLenum mode, GLint first, GLsizei count);
|
||||
void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
void glClear(GLbitfield mask);
|
||||
void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
void glFogx(GLenum pname, GLfixed param);
|
||||
void glFogf(GLenum pname, GLfloat param);
|
||||
void glMatrixMode(GLenum mode);
|
||||
void glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void glTexParameteri(GLenum target, GLenum pname, GLint param);
|
||||
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
void glEnable(GLenum cap);
|
||||
void glEnableClientState(GLenum array);
|
||||
void glPolygonOffset(GLfloat factor, GLfloat units);
|
||||
void glDisableClientState(GLenum array);
|
||||
void glDepthRangef(GLclampf near, GLclampf far);
|
||||
void glDepthFunc(GLenum func);
|
||||
void glBindBuffer(GLenum target, GLuint buffer);
|
||||
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
void glPopMatrix();
|
||||
void glLoadIdentity();
|
||||
void glScalef(GLfloat x, GLfloat y, GLfloat z);
|
||||
void glPushMatrix();
|
||||
void glDepthMask(GLboolean flag);
|
||||
void glHint(GLenum target, GLenum mode);
|
||||
void glMultMatrixf(const GLfloat *m);
|
||||
void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
void glDeleteBuffers(GLsizei n, const GLuint *buffers);
|
||||
void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
void glGenTextures(GLsizei n, GLuint *textures);
|
||||
void glDeleteTextures(GLsizei n, const GLuint *textures);
|
||||
void glAlphaFunc(GLenum func, GLclampf ref);
|
||||
void glGetFloatv(GLenum pname, GLfloat *params);
|
||||
void glBindTexture(GLenum target, GLuint texture);
|
||||
void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
|
||||
void glShadeModel(GLenum mode);
|
||||
void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far);
|
||||
void glDisable(GLenum cap);
|
||||
void glCullFace(GLenum mode);
|
||||
void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
GLboolean glIsEnabled(GLenum cap);
|
||||
void glGetIntegerv(GLenum pname, GLint *data);
|
||||
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data);
|
||||
void glGenBuffers(GLsizei n, GLuint *buffers);
|
||||
GLenum glGetError();
|
||||
void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
void glPixelStorei(GLenum pname, GLint param);
|
||||
void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -6,7 +6,7 @@
|
||||
#include "common/common.h"
|
||||
|
||||
#ifdef MEDIA_LAYER_TRAMPOLINE_GUEST
|
||||
static int get_glFogfv_params_length(GLenum pname) {
|
||||
static int get_glFogfv_params_length(const GLenum pname) {
|
||||
return pname == GL_FOG_COLOR ? 4 : 1;
|
||||
}
|
||||
#endif
|
||||
@ -90,12 +90,13 @@ static gl_state_t gl_state;
|
||||
state.type = type; \
|
||||
state.stride = stride; \
|
||||
state.pointer = uint32_t(pointer); \
|
||||
trampoline(true, state); \
|
||||
trampoline(true, gl_state.bound_array_buffer, state); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define CALL_GL_POINTER(unique_id, name) \
|
||||
CALL(unique_id, name, unused, ()) \
|
||||
glBindBuffer(GL_ARRAY_BUFFER, args.next<GLuint>()); \
|
||||
gl_array_details_t state = args.next<gl_array_details_t>(); \
|
||||
func(state.size, state.type, state.stride, (const void *) uintptr_t(state.pointer)); \
|
||||
return 0; \
|
||||
@ -138,7 +139,6 @@ CALL(15, glDrawArrays, void, (GLenum mode, GLint first, GLsizei count))
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
CALL(70, glMultiDrawArrays, void, (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount))
|
||||
#ifdef MEDIA_LAYER_TRAMPOLINE_GUEST
|
||||
trampoline(true, gl_state, mode, copy_array(drawcount, first), copy_array(drawcount, count));
|
||||
@ -153,7 +153,6 @@ CALL(70, glMultiDrawArrays, void, (GLenum mode, const GLint *first, const GLsize
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
CALL(16, glColor4f, void, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha))
|
||||
#ifdef MEDIA_LAYER_TRAMPOLINE_GUEST
|
||||
@ -335,8 +334,6 @@ CALL_GL_POINTER(41, glTexCoordPointer)
|
||||
#ifdef MEDIA_LAYER_TRAMPOLINE_GUEST
|
||||
void glDisableClientState(const GLenum array) {
|
||||
gl_state.get_array_enabled(array) = false;
|
||||
// Not needed when using compatibility layer
|
||||
#ifndef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
switch (array) {
|
||||
case GL_VERTEX_ARRAY: {
|
||||
gl_array_details.glVertexPointer.size = -1;
|
||||
@ -351,7 +348,6 @@ void glDisableClientState(const GLenum array) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -382,12 +378,9 @@ void glBindBuffer(const GLenum target, const GLuint buffer) {
|
||||
} else {
|
||||
ERR("Unsupported Buffer Binding: %u", target);
|
||||
}
|
||||
// Not needed when using compatibility layer
|
||||
#ifndef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
gl_array_details.glVertexPointer.size = -1;
|
||||
gl_array_details.glColorPointer.size = -1;
|
||||
gl_array_details.glTexCoordPointer.size = -1;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -84,17 +84,13 @@ static void multidraw_renderSameAsLast(const LevelRenderer *self, const float b)
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, VERTEX_SIZE, (void *) 0x14);
|
||||
|
||||
// Draw
|
||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
if (supports_multidraw()) {
|
||||
glMultiDrawArrays(GL_TRIANGLES, multidraw_firsts, multidraw_counts, multidraw_total);
|
||||
} else {
|
||||
#endif
|
||||
for (int i = 0; i < multidraw_total; i++) {
|
||||
glDrawArrays(GL_TRIANGLES, multidraw_firsts[i], multidraw_counts[i]);
|
||||
}
|
||||
#ifdef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
}
|
||||
#endif
|
||||
|
||||
// Cleanup
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
|
Loading…
Reference in New Issue
Block a user