This commit is contained in:
Abdelrahman Said 2024-09-13 23:58:31 +01:00
parent ab71bbc438
commit fb1b8457d6

View File

@ -20,8 +20,8 @@ ShaderID register_shader(void *shader, VertexShader *vertex,
}
++(g_repository.count);
g_repository.shaders[g_repository.count] = shader;
g_repository.vertex_funcs[g_repository.count] = vertex;
g_repository.shaders[g_repository.count] = shader;
g_repository.vertex_funcs[g_repository.count] = vertex;
g_repository.fragment_funcs[g_repository.count] = fragment;
return (ShaderID){g_repository.count};
@ -29,12 +29,11 @@ ShaderID register_shader(void *shader, VertexShader *vertex,
VertexData run_vertex_shader(ShaderID shader, const VertexData *vert, u8 index,
const Model *model) {
if (IS_INVALID_SHADER(shader) || shader.id > g_repository.count || !vert ||
!model) {
if (IS_INVALID_SHADER(shader) || shader.id > g_repository.count || !vert || !model) {
return (VertexData){0};
}
void *shader_obj = g_repository.shaders[shader.id];
void *shader_obj = g_repository.shaders[shader.id];
VertexShader *vertex_func = g_repository.vertex_funcs[shader.id];
if (!shader_obj || !vertex_func) {
@ -50,7 +49,7 @@ FragmentResult run_fragment_shader(ShaderID shader, const V3f *barycentric,
return DISCARDED_FRAGMENT;
}
void *shader_obj = g_repository.shaders[shader.id];
void *shader_obj = g_repository.shaders[shader.id];
FragmentShader *fragment_func = g_repository.fragment_funcs[shader.id];
if (!shader_obj || !fragment_func) {