Files
RedScarfEngine/graphics/src/renderer.c
T
Piotr Krygier 493afb05e6 Initial commit
This is working repository now. I had to clean this up due to
my f_ups, that made this simple repo around 200MB large.

Signed-off-by: Piotr Krygier <piotrkrygier@everyonecancode@xyz>
2026-02-10 10:24:45 +01:00

42 lines
1.0 KiB
C

/**
* @file renderer.c
* @author Piotr Krygier (everyonecancode@gmail.com)
* @brief
* @version 0.1
* @date 2025-10-15
*
* @copyright Copyright (c) 2025
*
*/
#include "renderer.h"
#include <SDL3/SDL_log.h>
#include <stdint.h>
#include "src/graphics_context.h"
#include "utilities/commons.h"
#include "utilities/errors_common.h"
rse_err_t renderer_get_new_id(struct graphics_context_t* context, uint32_t* id)
{
if (context->renderer_data.renderers_count >= RENDERER_MAX_COUNT) {
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Reached maximum number of renderers");
return RSE_ERROR_INTERNAL_ERROR;
}
*id = context->renderer_data.renderers_count++;
return RSE_ERROR_NO_ERROR;
}
rse_err_t renderer_set_render_function(struct graphics_context_t* context,
uint32_t renderer_id,
renderer_function_t renderer_function)
{
context->renderer_data.renderers[renderer_id].render_function = renderer_function;
return RSE_ERROR_NO_ERROR;
}