Add render_command_buffer handle type
Also unify handle types via macro
This commit is contained in:
parent
c23f03e622
commit
765e263979
@ -126,7 +126,7 @@ rt_pipeline_handle RT_RENDERER_API_FN(CompilePipeline)(const rt_pipeline_info *i
|
||||
}
|
||||
rt_pipeline_slot *slot = _first_free;
|
||||
_first_free = slot->next_free;
|
||||
slot->version = (slot->version + 1) & RT_GFX_HANDLE_MAX_VERSION;
|
||||
slot->version = (slot->version + 1) & RT_RENDER_BACKEND_HANDLE_MAX_VERSION;
|
||||
|
||||
/* No other thread that calls compile gets the same slot.
|
||||
* Another thread accessing the slot via GetPipeline would get a version mismatch.
|
||||
|
@ -147,7 +147,7 @@ rt_render_target_handle RT_RENDERER_API_FN(CreateRenderTarget)(const rt_render_t
|
||||
}
|
||||
rt_render_target_slot *slot = _first_free;
|
||||
_first_free = slot->next_free;
|
||||
slot->version = (slot->version + 1) & RT_GFX_HANDLE_MAX_VERSION;
|
||||
slot->version = (slot->version + 1) & RT_RENDER_BACKEND_HANDLE_MAX_VERSION;
|
||||
|
||||
/* No other thread that calls compile gets the same slot.
|
||||
* Another thread accessing the slot via GetPipeline would get a version mismatch.
|
||||
|
@ -1,3 +1,4 @@
|
||||
#define RT_DONT_DEFINE_MAIN_LOOP_GLOBAL
|
||||
#include "main_loop.h"
|
||||
#include "runtime.h"
|
||||
#include "config.h"
|
||||
|
@ -23,8 +23,10 @@ typedef struct {
|
||||
volatile int shutdown;
|
||||
} rt_main_loop;
|
||||
|
||||
#ifndef RT_DONT_DEFINE_MAIN_LOOP_GLOBAL
|
||||
/* The applications main-loop */
|
||||
extern RT_DLLIMPORT rt_main_loop g_main_loop;
|
||||
#endif
|
||||
|
||||
RT_DLLEXPORT rt_result rtInitMainLoop(rt_main_loop_update_fn *update_cb,
|
||||
rt_main_loop_render_fn *render_cb);
|
||||
|
@ -88,17 +88,19 @@ typedef struct {
|
||||
|
||||
/* Handles for backend objects */
|
||||
|
||||
#define RT_GFX_HANDLE_MAX_VERSION 255
|
||||
#define RT_RENDER_BACKEND_HANDLE_MAX_VERSION 255
|
||||
|
||||
typedef struct {
|
||||
uint32_t version : 8;
|
||||
uint32_t index : 24;
|
||||
} rt_pipeline_handle;
|
||||
#define RT_RENDER_BACKEND_HANDLE(name) \
|
||||
typedef struct { \
|
||||
uint32_t version : 8; \
|
||||
uint32_t index : 24; \
|
||||
} name
|
||||
|
||||
typedef struct {
|
||||
uint32_t version : 8;
|
||||
uint32_t index : 24;
|
||||
} rt_render_target_handle;
|
||||
RT_RENDER_BACKEND_HANDLE(rt_pipeline_handle);
|
||||
RT_RENDER_BACKEND_HANDLE(rt_render_target_handle);
|
||||
RT_RENDER_BACKEND_HANDLE(rt_render_command_buffer_handle);
|
||||
|
||||
#undef RT_RENDER_BACKEND_HANDLE
|
||||
|
||||
typedef void rt_register_renderer_cvars_fn(void);
|
||||
typedef rt_result rt_init_renderer_fn(const rt_renderer_init_info *info);
|
||||
|
Loading…
Reference in New Issue
Block a user