diff options
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/queue_libplacebo.c | 19 | ||||
| -rw-r--r-- | src/render/renderer_libplacebo.c | 33 | ||||
| -rw-r--r-- | src/render/renderer_tiger.c | 11 |
3 files changed, 32 insertions, 31 deletions
diff --git a/src/render/queue_libplacebo.c b/src/render/queue_libplacebo.c index 65a713e..dd62975 100644 --- a/src/render/queue_libplacebo.c +++ b/src/render/queue_libplacebo.c @@ -1,3 +1,4 @@ +#define AL_LOG_SECTION "frame_queue_libplacebo" #include <al/lib.h> #include <al/log.h> #ifdef CAMU_HAVE_FFMPEG @@ -17,12 +18,12 @@ static bool queue_lp_configure_subtitiles(struct camu_frame_queue *queue, u32 wi if (!lq->ass) return false; lq->ass_renderer = ass_renderer_init(lq->ass); if (!lq->ass_renderer) { - al_log_error("frame_queue_libplacebo", "Failed to initialize ass renderer."); + log_error("Failed to initialize ass renderer."); return false; } lq->ass_track = ass_new_track(lq->ass); if (!lq->ass_track) { - al_log_error("frame_queue_libplacebo", "Failed to create ass track."); + log_error("Failed to create ass track."); return false; } ass_set_frame_size(lq->ass_renderer, width, height); @@ -67,7 +68,7 @@ static bool map_frame(pl_gpu gpu, pl_tex *tex, const struct pl_source_frame *src pixel_stride = 1; break; default: - al_log_error("frame_queue_libplacebo", "Unsuppored pixel format."); + log_error("Unsuppored pixel format."); al_assert_and_return(false); } @@ -94,7 +95,7 @@ static bool map_frame(pl_gpu gpu, pl_tex *tex, const struct pl_source_frame *src camu_codec_frame_discard(frame); if (!ok) { - al_log_error("frame_queue_libplacebo", "Failed to upload texture."); + log_error("Failed to upload texture."); return false; } @@ -147,7 +148,7 @@ static struct camu_overlay_lp *create_subtitle_overlay(pl_gpu gpu, ASS_Image *as .ptr = ass_frame->bitmap )); if (!ok) { - al_log_error("frame_queue_libplacebo", "Failed to upload subtitle bitmap."); + log_error("Failed to upload subtitle bitmap."); continue; } @@ -222,7 +223,7 @@ static bool map_av_frame(pl_gpu gpu, pl_tex *tex, const struct pl_source_frame * // https://github.com/streetpea/chiaki-ng/blob/dd145ec2c802814e98fb833d3a9692169aa67315/gui/src/qmlbackend.cpp#L786 if (!ok && frame->hw_frames_ctx) { if (!lq->copy_frame_fallback) { - al_log_warn("frame_queue_libplacebo", "Falling back to software copy."); + log_warn("Falling back to software copy."); lq->copy_frame_fallback = true; lq->swframe = av_frame_alloc(); enum AVPixelFormat *fmts; @@ -240,7 +241,7 @@ static bool map_av_frame(pl_gpu gpu, pl_tex *tex, const struct pl_source_frame * )); av_frame_unref(lq->swframe); } else { - al_log_error("frame_queue_libplacebo", "Failed to transfer hwframe from the device (%s).", av_err2str(ret)); + log_error("Failed to transfer hwframe from the device (%s).", av_err2str(ret)); } } @@ -270,7 +271,7 @@ static bool map_av_frame(pl_gpu gpu, pl_tex *tex, const struct pl_source_frame * av_frame_free(&frame); if (!ok) { - al_log_error("frame_queue_libplacebo", "Failed to map AVFrame."); + log_error("Failed to map AVFrame."); return false; } @@ -304,7 +305,7 @@ static void discard_av_frame(const struct pl_source_frame *src) { AVFrame *frame = src->frame_data; av_frame_free(&frame); - al_log_warn("frame_queue_libplacebo", "Dropped frame with PTS %.3f.", src->pts); + log_warn("Dropped frame with PTS %.3f.", src->pts); } static void queue_lp_push_av_frame(struct camu_frame_queue *queue, AVFrame *frame, f64 pts) diff --git a/src/render/renderer_libplacebo.c b/src/render/renderer_libplacebo.c index bd9a981..71b156a 100644 --- a/src/render/renderer_libplacebo.c +++ b/src/render/renderer_libplacebo.c @@ -1,5 +1,6 @@ -#include <al/lib.h> +#define AL_LOG_SECTION "renderer_libplacebo" #include <al/log.h> +#include <al/lib.h> #include <nnwt/file.h> #ifdef CAMU_HAVE_FFMPEG #include <libplacebo/utils/libav.h> @@ -55,9 +56,9 @@ static void log_callback(void *userdata, enum pl_log_level level, const char *me { (void)userdata; if (level < PL_LOG_INFO) { - al_log_info("render_libplacebo", message); + log_info(message); } else { - al_log_debug("render_libplacebo", message); + log_debug(message); } } @@ -105,13 +106,13 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid .num_extensions = num, )); if (!lr->vk_inst) { - al_log_error("render_libplacebo", "Failed to create vulkan instance."); + log_error("Failed to create vulkan instance."); goto err; } err = vk_create_surface(priv, lr->vk_inst->instance, &lr->surface); if (err != VK_SUCCESS) { - al_log_error("render_libplacebo", "Failed to create vulkan surface."); + log_error("Failed to create vulkan surface."); goto err; } @@ -122,7 +123,7 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid .surface = lr->surface )); if (!lr->vk) { - al_log_error("render_libplacebo", "Failed to create vulkan device."); + log_error("Failed to create vulkan device."); goto err; } @@ -131,20 +132,20 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid .present_mode = VK_PRESENT_MODE_FIFO_KHR )); if (!lr->swapchain) { - al_log_error("render_libplacebo", "Failed to create vulkan swapchain."); + log_error("Failed to create vulkan swapchain."); goto err; } lr->gpu = lr->vk->gpu; - al_log_info("render_libplacebo", "Using Vulkan."); + log_info("Using Vulkan."); #elif defined CAMU_RENDERER_DX11 (void)priv; lr->d3d11 = pl_d3d11_create(lr->logger, pl_d3d11_params( .debug = false )); if (!lr->d3d11) { - al_log_error("render_libplacebo", "Failed to create D3D11 device."); + log_error("Failed to create D3D11 device."); goto err; } @@ -152,13 +153,13 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid .window = win32_window, )); if (!lr->swapchain) { - al_log_error("render_libplacebo", "Failed to create D3D11 swapchain."); + log_error("Failed to create D3D11 swapchain."); goto err; } lr->gpu = lr->d3d11->gpu; - al_log_info("render_libplacebo", "Using DirectX 11."); + log_info("Using DirectX 11."); #elif defined CAMU_RENDERER_OPENGL (void)gl_load_loader; lr->gl = pl_opengl_create(lr->logger, pl_opengl_params( @@ -175,7 +176,7 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid .priv = priv, )); if (!lr->gl) { - al_log_error("render_libplacebo", "Failed to create GL device."); + log_error("Failed to create GL device."); goto err; } @@ -185,13 +186,13 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid .priv = priv )); if (!lr->swapchain) { - al_log_error("render_libplacebo", "Failed to create GL swapchain."); + log_error("Failed to create GL swapchain."); goto err; } lr->gpu = lr->gl->gpu; - al_log_info("render_libplacebo", "Using OpenGL."); + log_info("Using OpenGL."); #endif lr->renderer = pl_renderer_create(lr->logger, lr->gpu); @@ -357,7 +358,7 @@ static void renderer_lp_render(struct camu_renderer *renderer, struct camu_scree } if (!pl_swapchain_submit_frame(lr->swapchain)) { - al_log_error("render_libplacebo", "Failed to submit frame, likely fatal."); + log_error("Failed to submit frame, likely fatal."); } lr->have_frame = false; @@ -372,7 +373,7 @@ static void renderer_lp_render(struct camu_renderer *renderer, struct camu_scree f64 tick = nn_get_tick(); f64 frame_time = tick - lr->last_render_tick; if (frame_time > (1.0 / 24.0)) { // 24fps is totally arbitrary. - al_log_info("render_libplacebo", "FRAME_TIME: %fs (%.2ffps)", frame_time, 1.0 / frame_time); + log_info("FRAME_TIME: %fs (%.2ffps)", frame_time, 1.0 / frame_time); } lr->last_render_tick = tick; #endif diff --git a/src/render/renderer_tiger.c b/src/render/renderer_tiger.c index ab6e85b..eb99e0c 100644 --- a/src/render/renderer_tiger.c +++ b/src/render/renderer_tiger.c @@ -1,5 +1,6 @@ -#include <al/lib.h> +#define AL_LOG_SECTION "renderer_tiger" #include <al/log.h> +#include <al/lib.h> #include <linmath.h> #include "../screen/view.h" @@ -66,15 +67,13 @@ static bool compile_shaders(struct camu_renderer_tiger *tr) GLuint vs_shader = glCreateShader(GL_VERTEX_SHADER); if (!compile(vs_shader, default_vs, error)) { - al_log_error("render_tiger", "Failed to compile vertex shader (%.*s)", - sizeof(error), error); + log_error("Failed to compile vertex shader (%.*s)", sizeof(error), error); return false; } GLuint fs_shader = glCreateShader(GL_FRAGMENT_SHADER); if (!compile(fs_shader, default_fs, error)) { - al_log_error("render_tiger", "Failed to compile fragment shader (%.*s)", - sizeof(error), error); + log_error("Failed to compile fragment shader (%.*s)", sizeof(error), error); return false; } @@ -152,7 +151,7 @@ static bool renderer_tiger_create_renderer(struct camu_renderer *renderer, u32 * GLint pos = glGetAttribLocation(tr->program, "a_Position"); glVertexAttribPointer(pos, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (void *)0); if (stl_gl_check_error()) { - al_log_error("render_tiger", "glVertexAttribPointer returned error, use GLES context."); + log_error("glVertexAttribPointer returned error, use GLES context."); al_assert_and_return(false); } glEnableVertexAttribArray(pos); |