wip multithreaded texture load
This commit is contained in:
@ -46,7 +46,7 @@ typedef struct TextureCache {
|
||||
bool is_dirty; /* current atlas needs to be recreated */
|
||||
} TextureCache;
|
||||
|
||||
/* type safe structure for persistent texture handles */
|
||||
/* type safe structure for frame persistent texture handles */
|
||||
typedef struct TextureKey { uint16_t id; } TextureKey;
|
||||
|
||||
/* tests whether given key structure corresponds to any texture */
|
||||
@ -56,17 +56,12 @@ typedef struct TextureKey { uint16_t id; } TextureKey;
|
||||
void textures_cache_init(struct TextureCache *cache, SDL_Window *window);
|
||||
void textures_cache_deinit(struct TextureCache *cache);
|
||||
|
||||
/* loads an image if it isn't in the cache, otherwise a no-op. */
|
||||
/* can be called from anywhere at any time after init, useful if you want to */
|
||||
/* preload textures you know will definitely be used */
|
||||
// void textures_load(struct texture_cache *cache, const char *path);
|
||||
|
||||
/* repacks the current texture atlas based on the texture cache if needed */
|
||||
/* any previously returned srcrect results are invalidated after that */
|
||||
/* call it every time before rendering */
|
||||
void textures_update_atlas(TextureCache *cache);
|
||||
|
||||
/* returns a persistent handle to some texture in cache, loading it if needed */
|
||||
/* returns a frame persistent handle to some texture in cache, loading it if needed */
|
||||
/* check the result with m_texture_key_is_valid() */
|
||||
TextureKey textures_get_key(TextureCache *cache, const char *path);
|
||||
|
||||
@ -96,4 +91,7 @@ void textures_reset_state(void);
|
||||
/* warn: surface->pixels must be freed along side the surface itself */
|
||||
SDL_Surface *textures_load_surface(const char *path);
|
||||
|
||||
/* note: will only take an effect after `textures_update_atlas` */
|
||||
bool textures_load_workers_thread(void);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user