rtengine/src/runtime/assets.h
2024-01-16 16:10:56 +01:00

40 lines
832 B
C

#ifndef RT_ASSETS_H
#define RT_ASSETS_H
#include <stdint.h>
#include "runtime.h"
/* Unique identifier for an asset. */
typedef uint32_t rt_uid;
#define RT_INVALID_UID 0
/* Used to identify renderer backend dependent assets. */
enum {
RT_INVALID_RENDERER_BACKEND_CODE = 0,
RT_RENDERER_BACKEND_CODE_VK = 1,
RT_RENDERER_BACKEND_CODE_ONE_PAST_LAST,
};
typedef uint8_t rt_renderer_backend_code;
enum {
RT_UNKNOWN_ASSET = RT_CUSTOM_ERROR_START,
RT_BUFFER_ALLOC_FAILED,
RT_LOAD_FAILED,
RT_ASSET_CACHE_FULL,
};
/* Load an asset without using the cache */
RT_DLLEXPORT rt_result rtLoadAssetDirect(rt_uid uid, void **buffer, size_t *size);
typedef struct {
void *data;
size_t size;
rt_result result;
} rt_get_asset_result;
RT_DLLEXPORT rt_get_asset_result rtGetAsset(rt_uid uid);
#endif