renderer,sdl: use new logging

This commit is contained in:
Flyinghead 2019-07-01 17:41:15 +02:00
parent ad4218d617
commit 2c8094f987
8 changed files with 32 additions and 30 deletions

View File

@ -758,7 +758,7 @@ static bool RenderFrame()
gl4ShaderUniforms.extra_depth_scale = settings.rend.ExtraDepthScale;
DEBUG_LOG(RENDERER, "scale: %f, %f, %f, %f\n", gl4ShaderUniforms.scale_coefs[0], gl4ShaderUniforms.scale_coefs[1], gl4ShaderUniforms.scale_coefs[2], gl4ShaderUniforms.scale_coefs[3]);
//DEBUG_LOG(RENDERER, "scale: %f, %f, %f, %f", gl4ShaderUniforms.scale_coefs[0], gl4ShaderUniforms.scale_coefs[1], gl4ShaderUniforms.scale_coefs[2], gl4ShaderUniforms.scale_coefs[3]);
//VERT and RAM fog color constants
u8* fog_colvert_bgra=(u8*)&FOG_COL_VERT;

View File

@ -106,7 +106,7 @@ bool CustomTexture::Init()
DIR *dir = opendir(textures_path.c_str());
if (dir != NULL)
{
printf("Found custom textures directory: %s\n", textures_path.c_str());
INFO_LOG(RENDERER, "Found custom textures directory: %s", textures_path.c_str());
custom_textures_available = true;
closedir(dir);
loader_thread.Start();
@ -176,7 +176,7 @@ void CustomTexture::DumpTexture(u32 hash, int w, int h, GLuint textype, void *te
FILE *fp = fopen(path.str().c_str(), "wb");
if (fp == NULL)
{
printf("Failed to open %s for writing\n", path.str().c_str());
WARN_LOG(RENDERER, "Failed to open %s for writing", path.str().c_str());
return;
}
@ -228,7 +228,7 @@ void CustomTexture::DumpTexture(u32 hash, int w, int h, GLuint textype, void *te
}
break;
default:
printf("dumpTexture: unsupported picture format %x\n", textype);
WARN_LOG(RENDERER, "dumpTexture: unsupported picture format %x", textype);
fclose(fp);
free(rows[0]);
free(rows);

View File

@ -765,7 +765,7 @@ void GenSorted(int first, int count)
glBufferData(GL_ELEMENT_ARRAY_BUFFER, vidx_sort.size() * sizeof(u32), &vidx_sort[0], GL_STREAM_DRAW);
glCheck();
if (tess_gen) printf("Generated %.2fK Triangles !\n",tess_gen/1000.0);
if (tess_gen) DEBUG_LOG(RENDERER, "Generated %.2fK Triangles !", tess_gen / 1000.0);
}
}

View File

@ -1816,7 +1816,7 @@ bool RenderFrame()
ShaderUniforms.extra_depth_scale = settings.rend.ExtraDepthScale;
//printf("scale: %f, %f, %f, %f\n",ShaderUniforms.scale_coefs[0],ShaderUniforms.scale_coefs[1],ShaderUniforms.scale_coefs[2],ShaderUniforms.scale_coefs[3]);
//DEBUG_LOG(RENDERER, "scale: %f, %f, %f, %f", ShaderUniforms.scale_coefs[0], ShaderUniforms.scale_coefs[1], ShaderUniforms.scale_coefs[2], ShaderUniforms.scale_coefs[3]);
//VERT and RAM fog color constants

View File

@ -119,22 +119,24 @@ static void dumpRtTexture(u32 name, u32 w, u32 h) {
//Texture Cache :)
void TextureCacheData::PrintTextureName()
{
printf("Texture: %s ",tex?tex->name:"?format?");
char str[512];
sprintf(str, "Texture: %s ", tex ? tex->name : "?format?");
if (tcw.VQ_Comp)
printf(" VQ");
strcat(str, " VQ");
if (tcw.ScanOrder==0)
printf(" TW");
strcat(str, " TW");
if (tcw.MipMapped)
printf(" MM");
strcat(str, " MM");
if (tcw.StrideSel)
printf(" Stride");
strcat(str, " Stride");
printf(" %dx%d @ 0x%X",8<<tsp.TexU,8<<tsp.TexV,tcw.TexAddr<<3);
printf(" id=%d\n", texID);
sprintf(str + strlen(str), " %dx%d @ 0x%X", 8 << tsp.TexU, 8 << tsp.TexV, tcw.TexAddr << 3);
sprintf(str + strlen(str), " id=%d", texID);
DEBUG_LOG(RENDERER, "%s", str);
}
//Create GL texture from tsp/tcw
@ -192,7 +194,7 @@ void TextureCacheData::Create(bool isGL)
//Texture is stored 'planar' in memory, no deswizzle is needed
//verify(tcw.VQ_Comp==0);
if (tcw.VQ_Comp != 0)
printf("Warning: planar texture with VQ set (invalid)\n");
WARN_LOG(RENDERER, "Warning: planar texture with VQ set (invalid)");
//Planar textures support stride selection, mostly used for non power of 2 textures (videos)
int stride=w;
@ -231,7 +233,7 @@ void TextureCacheData::Create(bool isGL)
}
break;
default:
printf("Unhandled texture %d\n",tcw.PixelFmt);
WARN_LOG(RENDERER, "Unhandled texture format %d", tcw.PixelFmt);
size=w*h*2;
texconv = NULL;
texconv32 = NULL;
@ -278,7 +280,7 @@ void TextureCacheData::Update()
if (tcw.StrideSel && tcw.ScanOrder && (tex->PL || tex->PL32))
stride=(TEXT_CONTROL&31)*32; //I think this needs +1 ?
//PrintTextureName();
PrintTextureName();
u32 original_h = h;
if (sa_tex > VRAM_SIZE || size == 0 || sa + size > VRAM_SIZE)
{
@ -291,7 +293,7 @@ void TextureCacheData::Update()
}
else
{
printf("Warning: invalid texture. Address %08X %08X size %d\n", sa_tex, sa, size);
WARN_LOG(RENDERER, "Warning: invalid texture. Address %08X %08X size %d", sa_tex, sa, size);
return;
}
}
@ -362,7 +364,7 @@ void TextureCacheData::Update()
else
{
//fill it in with a temp color
printf("UNHANDLED TEXTURE\n");
WARN_LOG(RENDERER, "UNHANDLED TEXTURE");
pb16.init(w, h);
memset(pb16.data(), 0x80, w * h * 2);
temp_tex_buffer = pb16.data();
@ -846,7 +848,7 @@ void killtex()
}
TexCache.clear();
printf("Texture cache cleared\n");
INFO_LOG(RENDERER, "Texture cache cleared");
}
void rend_text_invl(vram_block* bl)

View File

@ -298,13 +298,13 @@ static bool CheckShader(GLuint handle, const char* desc)
glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
if ((GLboolean)status == GL_FALSE)
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc);
WARN_LOG(RENDERER, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!", desc);
if (log_length > 0)
{
ImVector<char> buf;
buf.resize((int)(log_length + 1));
glGetShaderInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
fprintf(stderr, "%s\n", buf.begin());
WARN_LOG(RENDERER, "%s", buf.begin());
}
return (GLboolean)status == GL_TRUE;
}
@ -316,13 +316,13 @@ static bool CheckProgram(GLuint handle, const char* desc)
glGetProgramiv(handle, GL_LINK_STATUS, &status);
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
if ((GLboolean)status == GL_FALSE)
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! (with GLSL '%s')\n", desc, g_GlslVersionString);
WARN_LOG(RENDERER, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! (with GLSL '%s')", desc, g_GlslVersionString);
if (log_length > 0)
{
ImVector<char> buf;
buf.resize((int)(log_length + 1));
glGetProgramInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
fprintf(stderr, "%s\n", buf.begin());
WARN_LOG(RENDERER, "%s", buf.begin());
}
return (GLboolean)status == GL_TRUE;
}

View File

@ -52,7 +52,7 @@ static void sdl_open_joystick(int index)
if (pJoystick == NULL)
{
printf("SDL: Cannot open joystick %d\n", index + 1);
INFO_LOG(INPUT, "SDL: Cannot open joystick %d", index + 1);
return;
}
std::shared_ptr<SDLGamepadDevice> gamepad = std::make_shared<SDLGamepadDevice>(index < MAPLE_PORTS ? index : -1, pJoystick);
@ -266,7 +266,7 @@ void sdl_window_create()
if (!SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(window), &ddpi, &hdpi, &vdpi))
screen_dpi = (int)roundf(max(hdpi, vdpi));
printf("Created SDL Window (%ix%i) and GL Context successfully\n", window_width, window_height);
INFO_LOG(RENDERER, "Created SDL Window (%ix%i) and GL Context successfully", window_width, window_height);
}
bool gl_init(void* wind, void* disp)

View File

@ -49,7 +49,7 @@ public:
{
_name = SDL_JoystickName(sdl_joystick);
sdl_joystick_instance = SDL_JoystickInstanceID(sdl_joystick);
printf("SDL: Opened joystick on port %d: '%s' ", maple_port, _name.c_str());
INFO_LOG(INPUT, "SDL: Opened joystick on port %d: '%s'", maple_port, _name.c_str());
SDL_JoystickGUID guid = SDL_JoystickGetGUID(sdl_joystick);
char buf[33];
SDL_JoystickGetGUIDString(guid, buf, sizeof(buf));
@ -62,17 +62,17 @@ public:
if (_name == "Microsoft X-Box 360 pad")
{
input_mapper = new Xbox360InputMapping();
printf("using Xbox 360 mapping\n");
INFO_LOG(INPUT, "using Xbox 360 mapping");
}
else
{
input_mapper = new DefaultInputMapping();
printf("using default mapping\n");
INFO_LOG(INPUT, "using default mapping");
}
save_mapping();
}
else
printf("using custom mapping '%s'\n", input_mapper->name.c_str());
INFO_LOG(INPUT, "using custom mapping '%s'", input_mapper->name.c_str());
sdl_haptic = SDL_HapticOpenFromJoystick(sdl_joystick);
if (SDL_HapticRumbleInit(sdl_haptic) != 0)
{
@ -108,7 +108,7 @@ public:
void close()
{
printf("SDL: Joystick '%s' on port %d disconnected\n", _name.c_str(), maple_port());
INFO_LOG(INPUT, "SDL: Joystick '%s' on port %d disconnected", _name.c_str(), maple_port());
if (sdl_haptic != NULL)
SDL_HapticClose(sdl_haptic);
SDL_JoystickClose(sdl_joystick);