Skip to content

Commit

Permalink
Merge pull request #362 from JohnnyonFlame/iconoclasts_hacks_rebase
Browse files Browse the repository at this point in the history
GOA_CLONE definitions, EGL wrapper fixes, GLX Stubs and Iconoclasts hacks
  • Loading branch information
ptitSeb committed Nov 8, 2021
2 parents 1b1e56a + 93c1388 commit 4f2151a
Show file tree
Hide file tree
Showing 16 changed files with 282 additions and 51 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ option(PANDORA "Set to ON if targeting an OpenPandora device" ${PANDORA})
option(PYRA "Set to ON if targeting an Dragonbox Pyra device" ${PYRA})
option(BCMHOST "Set to ON if targeting an RPi(2) device" ${BCMHOST})
option(ODROID "Set to ON if targeting an ODroid device" ${ODROID})
option(GOA_CLONE "Set to ON if targeting GO Advance clones, like RG351p/v, Gameforce Chi, RGB10..." ${GOA_CLONE})
option(ANDROID "Set to ON if targeting an Android device" ${ANDROID})
option(CHIP "Set to ON if targeting an C.H.I.P. device" ${CHIP})
option(AMIGAOS4 "Set to ON if targeting an AmigaOS4/Warp3D platform (activate NOEGL and NOX11)" ${AMIGAOS4})
Expand All @@ -25,6 +26,7 @@ option(NO_LOADER "disable library loader (useful for static library with NOEGL,
option(NO_INIT_CONSTRUCTOR "disable automatic initialization (useful for static library, use include/gl4esinit.h)" ${NO_INIT_CONSTRUCTOR})
option(USE_ANDROID_LOG "Set to ON to use Android log instead of stdio" ${USE_ANDROID_LOG})
option(EGL_WRAPPER "Set to ON to build EGL wrapper" ${EGL_WRAPPER})
option(GLX_STUBS "Set to ON to build GLX function stubs" ${GLX_STUBS})

include(CheckSymbolExists)
check_symbol_exists(backtrace "execinfo.h" HAS_BACKTRACE)
Expand Down Expand Up @@ -88,6 +90,14 @@ if(ODROID)
add_definitions(-DODROID)
endif()

# GOA_CLONE
if(GOA_CLONE)
add_definitions(-DGOA_CLONE)
add_definitions(-mcpu=cortex-a35 -mfpu=neon-vfpv3 -march=armv8-a+crc+simd+crypto -mfloat-abi=hard -ftree-vectorize -fsingle-precision-constant -ffast-math)
set(EGL_WRAPPER ON)
set(GLX_STUBS ON)
endif()

# Android
if(ANDROID)
add_definitions(-DANDROID)
Expand Down Expand Up @@ -156,6 +166,10 @@ if(NO_INIT_CONSTRUCTOR)
add_definitions(-DNO_INIT_CONSTRUCTOR)
endif()

if(GLX_STUBS)
add_definitions(-DGLX_STUBS)
endif()

#DEFAULT_ES=2
if(DEFAULT_ES EQUAL 2)
add_definitions(-DDEFAULT_ES=2)
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND NOT NO_LOADER)
${CMAKE_CURRENT_SOURCE_DIR}/glx/hardext.c
${CMAKE_CURRENT_SOURCE_DIR}/glx/gbm.c
${CMAKE_CURRENT_SOURCE_DIR}/glx/glx.c
${CMAKE_CURRENT_SOURCE_DIR}/glx/glx_stubs.c
${CMAKE_CURRENT_SOURCE_DIR}/glx/lookup.c
${CMAKE_CURRENT_SOURCE_DIR}/glx/rpi.c
${CMAKE_CURRENT_SOURCE_DIR}/glx/streaming.c
Expand Down
78 changes: 45 additions & 33 deletions src/egl/egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ EGLDisplay gl4es_eglGetCurrentDisplay(void) {
return egl_eglGetCurrentDisplay();
}

EGLDisplay gl4es_eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list) {
LOAD_EGL_EXT(eglGetPlatformDisplay);
if (egl_eglGetPlatformDisplay)
return egl_eglGetPlatformDisplay(platform, native_display, attrib_list);
else {
LOAD_EGL(eglGetDisplay);
return egl_eglGetDisplay((EGLNativeDisplayType)native_display);
}
}

EGLBoolean gl4es_eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) {
LOAD_EGL(eglQueryContext);
return egl_eglQueryContext(dpy, ctx, attribute, value);
Expand All @@ -189,37 +199,39 @@ EGLBoolean gl4es_eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePix
return egl_eglCopyBuffers(dpy, surface, target);
}

EGLint eglGetError(void) AliasExport("gl4es_eglGetError");
EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id) AliasExport("gl4es_eglGetDisplay");
EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) AliasExport("gl4es_eglInitialize");
EGLBoolean eglTerminate(EGLDisplay dpy) AliasExport("gl4es_eglTerminate");
const char * eglQueryString(EGLDisplay dpy, EGLint name) AliasExport("gl4es_eglQueryString");
EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) AliasExport("gl4es_eglGetConfigs");
EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) AliasExport("gl4es_eglChooseConfig");
EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) AliasExport("gl4es_eglGetConfigAttrib");
EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list) AliasExport("gl4es_eglCreateWindowSurface");
EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) AliasExport("gl4es_eglCreatePbufferSurface");
EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) AliasExport("gl4es_eglCreatePixmapSurface");
EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) AliasExport("gl4es_eglDestroySurface");
EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) AliasExport("gl4es_eglQuerySurface");
EGLBoolean eglBindAPI(EGLenum api) AliasExport("gl4es_eglBindAPI");
EGLenum eglQueryAPI(void) AliasExport("gl4es_eglQueryAPI");
EGLBoolean eglWaitClient(void) AliasExport("gl4es_eglWaitClient");
EGLBoolean eglReleaseThread(void) AliasExport("gl4es_eglReleaseThread");
EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list) AliasExport("gl4es_eglCreatePbufferFromClientBuffer");
EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) AliasExport("gl4es_eglSurfaceAttrib");
EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) AliasExport("gl4es_eglBindTexImage");
EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) AliasExport("gl4es_eglReleaseTexImage");
EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) AliasExport("gl4es_eglSwapInterval");
EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) AliasExport("gl4es_eglCreateContext");
EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) AliasExport("gl4es_eglDestroyContext");
EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) AliasExport("gl4es_eglMakeCurrent");
EGLContext eglGetCurrentContext(void) AliasExport("gl4es_eglGetCurrentContext");
EGLSurface eglGetCurrentSurface(EGLint readdraw) AliasExport("gl4es_eglGetCurrentSurface");
EGLDisplay eglGetCurrentDisplay(void) AliasExport("gl4es_eglGetCurrentDisplay");
EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) AliasExport("gl4es_eglQueryContext");
EGLBoolean eglWaitGL(void) AliasExport("gl4es_eglWaitGL");
EGLBoolean eglWaitNative(EGLint engine) AliasExport("gl4es_eglWaitNative");
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) AliasExport("gl4es_eglSwapBuffers");
EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) AliasExport("gl4es_eglCopyBuffers");
AliasExport(EGLint, eglGetError,,(void));
AliasExport(EGLDisplay, eglGetDisplay,,(EGLNativeDisplayType display_id));
AliasExport(EGLBoolean, eglInitialize,,(EGLDisplay dpy, EGLint *major, EGLint *minor));
AliasExport(EGLBoolean, eglTerminate,,(EGLDisplay dpy));
AliasExport(const char *, eglQueryString,,(EGLDisplay dpy, EGLint name));
AliasExport(EGLBoolean, eglGetConfigs,,(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config));
AliasExport(EGLBoolean, eglChooseConfig,,(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config));
AliasExport(EGLBoolean, eglGetConfigAttrib,,(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value));
AliasExport(EGLSurface, eglCreateWindowSurface,,(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list));
AliasExport(EGLSurface, eglCreatePbufferSurface,,(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list));
AliasExport(EGLSurface, eglCreatePixmapSurface,,(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list));
AliasExport(EGLBoolean, eglDestroySurface,,(EGLDisplay dpy, EGLSurface surface));
AliasExport(EGLBoolean, eglQuerySurface,,(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value));
AliasExport(EGLBoolean, eglBindAPI,,(EGLenum api));
AliasExport(EGLenum, eglQueryAPI,,(void));
AliasExport(EGLBoolean, eglWaitClient,,(void));
AliasExport(EGLBoolean, eglReleaseThread,,(void));
AliasExport(EGLSurface, eglCreatePbufferFromClientBuffer,,(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list));
AliasExport(EGLBoolean, eglSurfaceAttrib,,(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value));
AliasExport(EGLBoolean, eglBindTexImage,,(EGLDisplay dpy, EGLSurface surface, EGLint buffer));
AliasExport(EGLBoolean, eglReleaseTexImage,,(EGLDisplay dpy, EGLSurface surface, EGLint buffer));
AliasExport(EGLBoolean, eglSwapInterval,,(EGLDisplay dpy, EGLint interval));
AliasExport(EGLContext, eglCreateContext,,(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list));
AliasExport(EGLBoolean, eglDestroyContext,,(EGLDisplay dpy, EGLContext ctx));
AliasExport(EGLBoolean, eglMakeCurrent,,(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx));
AliasExport(EGLContext, eglGetCurrentContext,,(void));
AliasExport(EGLSurface, eglGetCurrentSurface,,(EGLint readdraw));
AliasExport(EGLDisplay, eglGetCurrentDisplay,,(void));
AliasExport(EGLDisplay, eglGetPlatformDisplay,, (EGLenum platform, void *native_display, const EGLAttrib *attrib_list));
AliasExport(EGLDisplay, eglGetPlatformDisplay, EXT, (EGLenum platform, void *native_display, const EGLAttrib *attrib_list));
AliasExport(EGLBoolean, eglQueryContext,,(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value));
AliasExport(EGLBoolean, eglWaitGL,,(void));
AliasExport(EGLBoolean, eglWaitNative,,(EGLint engine));
AliasExport(EGLBoolean, eglSwapBuffers,,(EGLDisplay dpy, EGLSurface surface));
AliasExport(EGLBoolean, eglCopyBuffers,,(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target));

1 change: 1 addition & 0 deletions src/egl/egl.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ EGLBoolean gl4es_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read
EGLContext gl4es_eglGetCurrentContext(void);
EGLSurface gl4es_eglGetCurrentSurface(EGLint readdraw);
EGLDisplay gl4es_eglGetCurrentDisplay(void);
EGLDisplay gl4es_eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
EGLBoolean gl4es_eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
EGLBoolean gl4es_eglWaitGL(void);
EGLBoolean gl4es_eglWaitNative(EGLint engine);
Expand Down
6 changes: 5 additions & 1 deletion src/egl/lookup.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <string.h>

#include "../gl/attributes.h"
#include "../gl/init.h"
#include "../gl/logs.h"
Expand Down Expand Up @@ -45,6 +47,8 @@ void* gl4es_eglGetProcAddress(const char *name) {
_EX(eglGetCurrentContext);
_EX(eglGetCurrentSurface);
_EX(eglGetCurrentDisplay);
_EX(eglGetPlatformDisplay);
_EXT(eglGetPlatformDisplay);
_EX(eglQueryContext);
_EX(eglWaitGL);
_EX(eglWaitNative);
Expand All @@ -58,5 +62,5 @@ void* gl4es_eglGetProcAddress(const char *name) {
return gl4es_GetProcAddress(name);
}

__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *name) AliasExport("gl4es_eglGetProcAddress");
AliasExport(__eglMustCastToProperFunctionPointerType, eglGetProcAddress,, (const char *name));

13 changes: 11 additions & 2 deletions src/gl/framebuffers.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,10 @@ void APIENTRY_GL4ES gl4es_glFramebufferTexture2D(GLenum target, GLenum attachmen
LOGE("texture for FBO not found, name=%u\n", texture);
} else {
texture = tex->glname;
// check if texture is shrinked...
if (tex->shrink || tex->useratio || (tex->adjust && (hardext.npot==1 || hardext.npot==2) && !globals4es.potframebuffer)) {
tex->fbtex_ratio = (globals4es.fbtexscale > 0.0f) ? globals4es.fbtexscale : 0.0f;

// check if texture is shrinked or if fb texture is being scaled...
if (globals4es.fbtexscale > 0.0f || tex->shrink || tex->useratio || (tex->adjust && (hardext.npot==1 || hardext.npot==2) && !globals4es.potframebuffer)) {
LOGD("%s texture for FBO\n",(tex->useratio)?"going back to npot size pot'ed":"unshrinking shrinked");
if(tex->shrink || tex->useratio) {
if(tex->useratio) {
Expand All @@ -461,6 +463,13 @@ void APIENTRY_GL4ES gl4es_glFramebufferTexture2D(GLenum target, GLenum attachmen
tex->height *= 1<<tex->shrink;
}
}

// Use FBO Ratio
if (tex->fbtex_ratio > 0.0f) {
tex->width *= tex->fbtex_ratio;
tex->height *= tex->fbtex_ratio;
}

tex->nwidth = (hardext.npot>0 || hardext.esversion>1)?tex->width:npot(tex->width);
tex->nheight = (hardext.npot>0 || hardext.esversion>1)?tex->height:npot(tex->height);
tex->adjustxy[0] = (float)tex->width / tex->nwidth;
Expand Down
9 changes: 7 additions & 2 deletions src/gl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void fpe_shader_reset_internals();

globals4es_t globals4es = {0};

#if defined(PANDORA) || defined(CHIP)
#if defined(PANDORA) || defined(CHIP) || defined(GOA_CLONE)
static void fast_math() {
// enable Cortex A8 RunFast
int v = 0;
Expand Down Expand Up @@ -385,7 +385,7 @@ void initialize_gl4es() {
}

if(IsEnvVarTrue("LIBGL_FASTMATH")) {
#if defined(PANDORA) || defined(CHIP)
#if defined(PANDORA) || defined(CHIP) || defined(GOA_CLONE)
SHUT_LOGD("Enable FastMath for cortex-a8\n");
fast_math();
#else
Expand Down Expand Up @@ -685,6 +685,11 @@ void initialize_gl4es() {
}
}
}

env(LIBGL_SKIPTEXCOPIES, globals4es.skiptexcopies, "Texture Copies will be skipped");
if(GetEnvVarFloat("LIBGL_FB_TEX_SCALE",&globals4es.fbtexscale,0.0f)) {
SHUT_LOGD("Framebuffer Textures will be scaled by %.2f\n", globals4es.fbtexscale);
}
}


Expand Down
2 changes: 2 additions & 0 deletions src/gl/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ typedef struct _globals4es {
int glxnative;
int normalize; // force normal normalization (workaround a bug)
int blitfb0;
int skiptexcopies;
float fbtexscale;
#ifndef NO_GBM
char drmcard[50];
#endif
Expand Down
20 changes: 20 additions & 0 deletions src/gl/raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ void APIENTRY_GL4ES gl4es_glWindowPos3f(GLfloat x, GLfloat y, GLfloat z) {
}

void APIENTRY_GL4ES gl4es_glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
if (glstate->fbo.current_fb->id != 0) {
gltexture_t *tex = gl4es_getTexture(glstate->fbo.current_fb->t_color[0], glstate->fbo.current_fb->color[0]);
if (tex->fbtex_ratio > 0.0f) {
width *= tex->fbtex_ratio;
height *= tex->fbtex_ratio;
x *= tex->fbtex_ratio;
y *= tex->fbtex_ratio;
}
}

if(!glstate->list.pending)
PUSH_IF_COMPILING(glViewport);
if( glstate->raster.viewport.x!=x ||
Expand All @@ -84,6 +94,16 @@ void APIENTRY_GL4ES gl4es_glViewport(GLint x, GLint y, GLsizei width, GLsizei he
}

void APIENTRY_GL4ES gl4es_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
if (glstate->fbo.current_fb->id != 0) {
gltexture_t *tex = gl4es_getTexture(glstate->fbo.current_fb->t_color[0], glstate->fbo.current_fb->color[0]);
if (tex->fbtex_ratio > 0.0f) {
width *= tex->fbtex_ratio;
height *= tex->fbtex_ratio;
x *= tex->fbtex_ratio;
y *= tex->fbtex_ratio;
}
}

if(!glstate->list.pending)
PUSH_IF_COMPILING(glScissor);
#ifdef AMIGAOS4
Expand Down
54 changes: 54 additions & 0 deletions src/gl/shader_hacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,60 @@ static const hack_t gl4es_hacks[] = {
"\tFogOffsetU = 0.5 / FogTexSize;\r\n"
"\tFogScaleU = ( FogTexSize - 1.0 ) / FogTexSize;\r\n"
}},
// for Iconoclasts
// Disable hotspot shaders 1
#ifdef GOA_CLONE
{
"void main()\n"
"{\n"
" vec4 p = texture2D(texture, texture_coordinate0);\n"
" float factor = (0.5 - p.r) * magnification;\n"
" vec2 t = texture_coordinate1;\n"
" t.x += (t.x - hotspotX) * factor;\n"
" t.y += (t.y - hotspotY) * factor;\n"
" gl_FragColor = sample_backtex(background_texture, t) * gl_Color;\n"
"}",
1,
{
"void main() { discard; }"
}
},
// Disable hotspot shaders 2
{
"void main()\n"
"{\n"
" vec4 p = texture2D(texture, texture_coordinate0) * gl_Color;\n"
" if (p.a != 0.0) {\n"
" float zoomFactor = (0.0 - (p.r + p.g + p.b) / 3.0) * magnification;\n"
" vec2 t = texture_coordinate1;\n"
" t.x += (t.x - hotspotX + offx / texture_size.x) * zoomFactor;\n"
" t.y += (t.y - hotspotY + offy / texture_size.y) * zoomFactor;\n"
" gl_FragColor = sample_backtex(background_texture, t);\n"
" return;\n"
" }\n"
" gl_FragColor = p;\n"
"}",
1,
{
"void main() { discard; }"
}
},
// Disable hotspot shaders 3
{
"void main()\n"
"{\n"
" vec4 p = texture2D(texture, texture_coordinate0) * gl_Color;\n"
" float factor = (0.0 - (p.r + p.g + p.b) / 3.0) * magnification;\n"
" vec2 t = background_offset.xy - texture_coordinate1 * \n"
" (background_offset.xy * 2.0 - vec2(1.0));\n"
" t.x += (t.x - hotspotX) * factor;\n"
" t.y += (t.y - hotspotY) * factor;\n"
" gl_FragColor = sample_backtex(background_texture, t);\n"
"}",
1,
{"void main() { discard; }"}
}
#endif
};

// For Stellaris
Expand Down
14 changes: 14 additions & 0 deletions src/gl/shaderconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,20 @@ char* ConvertShader(const char* pEntry, int isVertex, shaderconv_need_t *need)
Tmp = InplaceInsert(GetLine(Tmp, headline), textureCubeGradAlt, Tmp, &tmpsize);
}
}

// Some drivers have troubles with "\\\r\n" or "\\\n" sequences on preprocessor macros
newptr = Tmp;
while (*newptr!=0x00) {
if (*newptr == '\\') {
if (*(newptr+1) == '\r' && *(newptr+2) == '\n')
memmove(newptr, newptr+3, strlen(newptr+3)+1);
else if (*(newptr+1) == '\n')
memmove(newptr, newptr+2, strlen(newptr+2)+1);
}

newptr++;
}

// now check to remove trailling "f" after float, as it's not supported too
newptr = Tmp;
// simple state machine...
Expand Down
1 change: 1 addition & 0 deletions src/gl/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ typedef struct {
GLvoid *data; // in case we want to keep a copy of it (it that case, always RGBA/GL_UNSIGNED_BYTE
glsampler_t sampler; // internal sampler if not superceeded by glBindSampler
glsampler_t actual; // actual sampler
float fbtex_ratio; // Lower rendering resolution
} gltexture_t;

KHASH_MAP_DECLARE_INT(tex, gltexture_t *);
Expand Down
10 changes: 10 additions & 0 deletions src/gl/texture_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ void APIENTRY_GL4ES gl4es_glCopyTexImage2D(GLenum target, GLint level, GLenum
// actualy bound if targetting shared TEX2D
realize_bound(glstate->texture.active, target);

if (globals4es.skiptexcopies) {
DBG(printf("glCopyTexImage2D skipped.\n"));
return;
}

errorGL();

// "Unmap" if buffer mapped...
Expand Down Expand Up @@ -101,6 +106,11 @@ void APIENTRY_GL4ES gl4es_glCopyTexSubImage2D(GLenum target, GLint level, GLint
DBG(printf("glCopyTexSubImage2D(%s, %i, %i, %i, %i, %i, %i, %i), bounded texture=%u format/type=%s, %s\n", PrintEnum(target), level, xoffset, yoffset, x, y, width, height, (glstate->texture.bound[glstate->texture.active][itarget])?glstate->texture.bound[glstate->texture.active][itarget]->texture:0, PrintEnum((glstate->texture.bound[glstate->texture.active][itarget])?glstate->texture.bound[glstate->texture.active][itarget]->format:0), PrintEnum((glstate->texture.bound[glstate->texture.active][itarget])?glstate->texture.bound[glstate->texture.active][itarget]->type:0));)
// PUSH_IF_COMPILING(glCopyTexSubImage2D);
FLUSH_BEGINEND;

if (globals4es.skiptexcopies) {
DBG(printf("glCopyTexSubImage2D skipped.\n"));
return;
}

LOAD_GLES(glCopyTexSubImage2D);
errorGL();
Expand Down
Loading

0 comments on commit 4f2151a

Please sign in to comment.