Add loaded shader fragments into registry
This commit is contained in:
parent
a22f719ea8
commit
d481aa4d19
|
@ -39,7 +39,8 @@ struct ShaderRegistry {
|
||||||
void register_shader(struct ShaderRegistry *r, char *name, int type, GLuint id) {
|
void register_shader(struct ShaderRegistry *r, char *name, int type, GLuint id) {
|
||||||
// Allocate storage for the name
|
// Allocate storage for the name
|
||||||
int name_size = strlen(name);
|
int name_size = strlen(name);
|
||||||
char *n = (char*) malloc(name_size * sizeof(char));
|
char *n = (char*) calloc(name_size, sizeof(char));
|
||||||
|
strncpy(n, name, strlen(name));
|
||||||
|
|
||||||
// Grow and copy
|
// Grow and copy
|
||||||
int new_size = r->size + 1;
|
int new_size = r->size + 1;
|
||||||
|
@ -220,6 +221,7 @@ int loadShadersFromFile(const char* file_path, struct ShaderRegistry *registry)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to registry
|
// Add to registry
|
||||||
|
register_shader(registry, name, shader_type, shader_id);
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
free(line_copy);
|
free(line_copy);
|
||||||
|
|
Loading…
Reference in New Issue