From 5e6328e83bcc2d26d61ca9c084450a0af2bda341 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sun, 25 Feb 2024 15:08:26 -0800 Subject: Use new error function. --- gfx/src/asset/texture.c | 14 +++++++------- gfx/src/render/framebuffer.c | 10 +++++----- gfx/src/render/renderbuffer.c | 4 ++-- gfx/src/scene/light.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gfx/src/asset/texture.c b/gfx/src/asset/texture.c index d15f09f..3a82788 100644 --- a/gfx/src/asset/texture.c +++ b/gfx/src/asset/texture.c @@ -61,7 +61,7 @@ Texture* gfx_texture_load( stbi_set_flip_vertically_on_load(0); pixels[0] = stbi_load(filepath, &width, &height, &components, 0); if (!pixels[0]) { - set_error("Failed to load texture file: %s", filepath); + log_error("Failed to load texture file: %s", filepath); } break; } @@ -74,11 +74,11 @@ Texture* gfx_texture_load( stbi_uc* image_pixels = stbi_load(filepath, &width, &height, &components, 0); if (!image_pixels) { - set_error("Failed to load texture file: %s", filepath); + log_error("Failed to load texture file: %s", filepath); break; } if (i > 0 && components != old_components) { - set_error("All textures in a cubemap must have the same number of " + log_error("All textures in a cubemap must have the same number of " "components"); break; } @@ -93,7 +93,7 @@ Texture* gfx_texture_load( break; case AssetFromMemory: // TODO: Load textures from memory. - set_error("Loading textures from memory is not yet implemented"); + log_error("Loading textures from memory is not yet implemented"); return 0; } @@ -132,7 +132,7 @@ Texture* gfx_texture_load( desc.format = TextureSRGB8; break; default: - set_error("Unsupported texture colour space: %d", cmd->colour_space); + log_error("Unsupported texture colour space: %d", cmd->colour_space); return 0; } break; @@ -145,12 +145,12 @@ Texture* gfx_texture_load( desc.format = TextureSRGBA8; break; default: - set_error("Unsupported texture colour space: %d", cmd->colour_space); + log_error("Unsupported texture colour space: %d", cmd->colour_space); return 0; } break; default: - set_error("Unsupported number of texture components: %d", components); + log_error("Unsupported number of texture components: %d", components); return 0; } diff --git a/gfx/src/render/framebuffer.c b/gfx/src/render/framebuffer.c index 2ea2165..76d9002 100644 --- a/gfx/src/render/framebuffer.c +++ b/gfx/src/render/framebuffer.c @@ -52,7 +52,7 @@ static void framebuffer_attach_depth( // TODO: Could distinguish between colour and depth attachment types to make // this a compile-time error. case FrameBufferCubemapTexture: - set_error("Cannot use a cubemap texture as a depth framebuffer attachment"); + log_error("Cannot use a cubemap texture as a depth framebuffer attachment"); break; case FrameBufferRenderBuffer: glFramebufferRenderbuffer( @@ -71,7 +71,7 @@ bool gfx_init_framebuffer( glGenFramebuffers(1, &framebuffer->id); if (!framebuffer->id) { - set_error("glGenFramebuffers() failed"); + log_error("glGenFramebuffers() failed"); return false; } @@ -85,7 +85,7 @@ bool gfx_init_framebuffer( framebuffer_attach_colour(framebuffer, &desc->colour); framebuffer_attach_depth(framebuffer, &desc->depth); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - set_error("glCheckFramebufferStatus() failed"); + log_error("glCheckFramebufferStatus() failed"); gfx_del_framebuffer(framebuffer); return false; } @@ -105,7 +105,7 @@ bool gfx_framebuffer_attach_colour( glBindFramebuffer(GL_FRAMEBUFFER, framebuffer->id); framebuffer_attach_colour(framebuffer, attachment); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - set_error("glCheckFramebufferStatus() failed"); + log_error("glCheckFramebufferStatus() failed"); return false; } return true; @@ -120,7 +120,7 @@ bool gfx_framebuffer_attach_depth( glBindFramebuffer(GL_FRAMEBUFFER, framebuffer->id); framebuffer_attach_depth(framebuffer, attachment); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - set_error("glCheckFramebufferStatus() failed"); + log_error("glCheckFramebufferStatus() failed"); return false; } return true; diff --git a/gfx/src/render/renderbuffer.c b/gfx/src/render/renderbuffer.c index 23f9524..2753f3b 100644 --- a/gfx/src/render/renderbuffer.c +++ b/gfx/src/render/renderbuffer.c @@ -11,7 +11,7 @@ bool gfx_init_renderbuffer( glGenRenderbuffers(1, &renderbuffer->id); if (!renderbuffer->id) { - set_error("glGenRenderbuffers failed"); + log_error("glGenRenderbuffers failed"); return false; } @@ -27,7 +27,7 @@ bool gfx_init_renderbuffer( void gfx_del_renderbuffer(RenderBuffer* renderbuffer) { assert(renderbuffer); - + if (renderbuffer->id) { glDeleteRenderbuffers(1, &renderbuffer->id); renderbuffer->id = 0; diff --git a/gfx/src/scene/light.c b/gfx/src/scene/light.c index 1046c82..adbec8d 100644 --- a/gfx/src/scene/light.c +++ b/gfx/src/scene/light.c @@ -23,7 +23,7 @@ Light* gfx_make_light(const LightDesc* desc) { make_environment_light(light, &desc->light.environment); break; default: - set_error("Unhandled light type"); + log_error("Unhandled light type"); gfx_destroy_light(&light); return 0; } -- cgit v1.2.3