feat: resource module now notifies render module of loaded shaders

This commit is contained in:
Sara 2024-09-19 11:35:07 +02:00
parent fa4517f9b5
commit 0468dc9780

View file

@ -1,4 +1,5 @@
#include "resources.h"
#include "render.h"
#include "stdbool.h"
#include "utils/hash_map.h"
#include "utils/dictionary.h"
@ -211,11 +212,13 @@ static
void Internal_LoadShaderResource(ResourceContainer *resource) {
resource->shader = LoadShader(TextFormat("%s/%s.vs", resource->path, resource->name), TextFormat("%s/%s.fs", resource->path, resource->name));
ASSERT_RETURN(IsShaderReady(resource->shader),, "Internal_LoadShaderResource: Shader failed to load.");
Internal_OnShaderLoaded((ShaderResource){.resource = &resource->shader, .handle = resource});
}
static
void Internal_UnloadShaderResource(ResourceContainer *resource) {
UnloadShader(resource->shader);
resource->shader = (Shader){0};
Internal_OnShaderUnloaded((ShaderResource){.resource = &resource->shader, .handle = resource});
}