feat: resource module now notifies render module of loaded shaders
This commit is contained in:
parent
fa4517f9b5
commit
0468dc9780
|
@ -1,4 +1,5 @@
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
#include "render.h"
|
||||||
#include "stdbool.h"
|
#include "stdbool.h"
|
||||||
#include "utils/hash_map.h"
|
#include "utils/hash_map.h"
|
||||||
#include "utils/dictionary.h"
|
#include "utils/dictionary.h"
|
||||||
|
@ -211,11 +212,13 @@ static
|
||||||
void Internal_LoadShaderResource(ResourceContainer *resource) {
|
void Internal_LoadShaderResource(ResourceContainer *resource) {
|
||||||
resource->shader = LoadShader(TextFormat("%s/%s.vs", resource->path, resource->name), TextFormat("%s/%s.fs", resource->path, resource->name));
|
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.");
|
ASSERT_RETURN(IsShaderReady(resource->shader),, "Internal_LoadShaderResource: Shader failed to load.");
|
||||||
|
Internal_OnShaderLoaded((ShaderResource){.resource = &resource->shader, .handle = resource});
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void Internal_UnloadShaderResource(ResourceContainer *resource) {
|
void Internal_UnloadShaderResource(ResourceContainer *resource) {
|
||||||
UnloadShader(resource->shader);
|
UnloadShader(resource->shader);
|
||||||
resource->shader = (Shader){0};
|
resource->shader = (Shader){0};
|
||||||
|
Internal_OnShaderUnloaded((ShaderResource){.resource = &resource->shader, .handle = resource});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue