[Fix] (texture.cpp|loader.h): Fix the compilation when DEBUG is enabled.

Signed-off-by: BZLZHH <admin@bzlzhh.top>
This commit is contained in:
BZLZHH 2025-03-01 09:23:32 +08:00
parent 5771bdc4e0
commit 9575e7d7ca
2 changed files with 22 additions and 20 deletions

View File

@ -80,8 +80,9 @@ void internal_convert(GLenum* internal_format, GLenum* type, GLenum* format) {
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
LOG_D("Find GL_DEPTH_COMPONENT: internalFormat: %s, format: %s, type: %s", glEnumToString(*internal_format), glEnumToString(*format), glEnumToString(*type)) LOG_D("Find GL_DEPTH_COMPONENT: internalFormat: %s, format: %s, type: %s", glEnumToString(*internal_format), glEnumToString(*format), glEnumToString(*type))
if(type) if(type) {
*type = GL_UNSIGNED_INT; *type = GL_UNSIGNED_INT;
}
break; break;
case GL_DEPTH_STENCIL: case GL_DEPTH_STENCIL:
@ -567,7 +568,7 @@ void glRenderbufferStorage(GLenum target, GLenum internalFormat, GLsizei width,
if (realInternalFormat != 0 && ERR == GL_NO_ERROR) if (realInternalFormat != 0 && ERR == GL_NO_ERROR)
internalFormat = (GLenum)realInternalFormat; internalFormat = (GLenum)realInternalFormat;
else else
internalFormat = GL_DEPTH_COMPONENT24; internalFormat = GL_DEPTH_COMPONENT;
CLEAR_GL_ERROR_NO_INIT CLEAR_GL_ERROR_NO_INIT
@ -594,7 +595,7 @@ void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum int
if (realInternalFormat != 0 && ERR == GL_NO_ERROR) if (realInternalFormat != 0 && ERR == GL_NO_ERROR)
internalFormat = (GLenum)realInternalFormat; internalFormat = (GLenum)realInternalFormat;
else else
internalFormat = GL_DEPTH_COMPONENT24; internalFormat = GL_DEPTH_COMPONENT;
LOG_D("glRenderbufferStorageMultisample, target: %d, samples: %d, internalFormat: %d, width: %d, height: %d", LOG_D("glRenderbufferStorageMultisample, target: %d, samples: %d, internalFormat: %d, width: %d, height: %d",
@ -826,6 +827,7 @@ void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format
x, y, width, height, format, type, pixels) x, y, width, height, format, type, pixels)
static int count = 0; static int count = 0;
GLenum prevFormat = format;
if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) { if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) {
format = GL_RGBA; format = GL_RGBA;

View File

@ -94,13 +94,13 @@ static name##_PTR egl_##name = NULL; \
#define NATIVE_FUNCTION_HEAD(type,name,...) \ #define NATIVE_FUNCTION_HEAD(type,name,...) \
GLAPI GLAPIENTRY type name##ARB(__VA_ARGS__) __attribute__((alias(#name))); \ extern "C" GLAPI GLAPIENTRY type name##ARB(__VA_ARGS__) __attribute__((alias(#name))); \
GLAPI GLAPIENTRY type name(__VA_ARGS__) { extern "C" GLAPI GLAPIENTRY type name(__VA_ARGS__) {
#if GLOBAL_DEBUG #if GLOBAL_DEBUG
#define NATIVE_FUNCTION_END(type,name,...) \ #define NATIVE_FUNCTION_END(type,name,...) \
LOG_D("Use native function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); \ LOG_D("Use native function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); \
LOAD_RAW_GLES(name, type, __VA_ARGS__); \ LOAD_GLES_FUNC(name); \
type ret = gles_##name(__VA_ARGS__); \ type ret = gles_##name(__VA_ARGS__); \
LOAD_GLES_FUNC(glGetError) \ LOAD_GLES_FUNC(glGetError) \
GLenum ERR = gles_glGetError(); \ GLenum ERR = gles_glGetError(); \
@ -121,7 +121,7 @@ GLAPI GLAPIENTRY type name(__VA_ARGS__) {
#if GLOBAL_DEBUG #if GLOBAL_DEBUG
#define NATIVE_FUNCTION_END_NO_RETURN(type,name,...) \ #define NATIVE_FUNCTION_END_NO_RETURN(type,name,...) \
LOG_D("Use native function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); \ LOG_D("Use native function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); \
LOAD_RAW_GLES(name, type, __VA_ARGS__); \ LOAD_GLES_FUNC(name); \
gles_##name(__VA_ARGS__); \ gles_##name(__VA_ARGS__); \
CHECK_GL_ERROR \ CHECK_GL_ERROR \
} }
@ -134,7 +134,7 @@ GLAPI GLAPIENTRY type name(__VA_ARGS__) {
#endif #endif
#define STUB_FUNCTION_HEAD(type,name,...) \ #define STUB_FUNCTION_HEAD(type,name,...) \
GLAPI GLAPIENTRY type name(__VA_ARGS__) { extern "C" GLAPI GLAPIENTRY type name(__VA_ARGS__) {
#define STUB_FUNCTION_END(type,name,...) \ #define STUB_FUNCTION_END(type,name,...) \
LOG_W("Stub function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); \ LOG_W("Stub function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); \