--- a/src/2d.c Sun Jun 22 11:15:53 2025 +0200 +++ b/src/2d.c Sun Jun 22 11:36:37 2025 +0200 @@ -64,10 +64,11 @@ asc_error("Loading rectangle shader failed."); return NULL; } + // TODO: find better way to deal with inheritance (&shader->program just looks bad) AscRectangleShader *shader = asc_shader_create(codes, sizeof(*shader)); - if (shader == NULL) { + if (asc_shader_invalid(&shader->program)) { asc_shader_free_codes(codes); - return NULL; + return (AscShaderProgram*) shader; } shader->size = glGetUniformLocation(shader->program.gl_id, "size"); if (asc_test_flag(flags, ASC_RECTANGLE_SHADER_FLAG_FILL)) { @@ -132,7 +133,8 @@ // Look up and activate shader const AscRectangleShader *shader = asc_shader_lookup_or_create( shader_ids[shader_flags], asc_rectangle_shader_create, shader_flags); - if (shader == NULL) return; + // TODO: how to remove the following cast? + if (asc_shader_invalid((AscShaderProgram*)shader)) return; asc_shader_use(&shader->program, camera); // Upload uniforms