Skip to content

Commit 85908f5

Browse files
authored
Draw to texture fix (#401)
* Commit in blit Closes #286 * Fix shatter samples This extra commit ensures that the demos work on macOS Same error as in #286 * Inline cf_commit This change inlines cf_commit into cf_draw_elements so that it does not need to be called separately. * Update docs after cf_commit removal
1 parent 3fb5876 commit 85908f5

File tree

10 files changed

+1
-39
lines changed

10 files changed

+1
-39
lines changed

docs/topics/low_level_graphics.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ for each canvas {
3838
}
3939
}
4040
}
41-
cf_commit();
4241
}
4342
```
4443

@@ -48,7 +47,6 @@ The important functions are are the apply functions. Each apply function is used
4847
- [`cf_apply_mesh`](../graphics/cf_apply_mesh.md)
4948
- [`cf_apply_shader`](../graphics/cf_apply_shader.md)
5049
- [`cf_draw_elements`](../graphics/cf_draw_elements.md)
51-
- [`cf_commit`](../graphics/cf_commit.md)
5250

5351
## Meshes
5452

docs/topics/renderer.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ CF renders through `SDL_Gpu`(https://wiki.libsdl.org/SDL3/CategoryGPU), a well-w
359359
* for each shader {
360360
* cf_apply_shader(shader, material);
361361
* cf_draw_elements(...);
362-
* cf_commit();
363362
* }
364363
* }
365364
* }
@@ -561,4 +560,4 @@ If you're familiar with Unity's old surface shaders, this is very similar in con
561560

562561
# Conclusion
563562

564-
And that's it! The CF renderer design offers a very high-performance batching solution, unifying rendering sprites, shapes, and text all together. It also offers shader customization that can be applied to renderable items (as well as canvases), making for a unique and effective renderer API.
563+
And that's it! The CF renderer design offers a very high-performance batching solution, unifying rendering sprites, shapes, and text all together. It also offers shader customization that can be applied to renderable items (as well as canvases), making for a unique and effective renderer API.

include/cute_graphics.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ extern "C" {
5353
* }
5454
* }
5555
* }
56-
* cf_commit();
5756
* }
5857
*/
5958

@@ -1878,15 +1877,6 @@ CF_API void CF_CALL cf_apply_shader(CF_Shader shader, CF_Material material);
18781877
*/
18791878
CF_API void CF_CALL cf_draw_elements(void);
18801879

1881-
/**
1882-
* @function cf_commit
1883-
* @category graphics
1884-
* @brief Submits all previous draw commands to the GPU.
1885-
* @remarks You must call this after calling `cf_apply_shader` to "complete" the rendering pass.
1886-
* @related CF_Canvas cf_apply_canvas cf_apply_mesh cf_apply_shader
1887-
*/
1888-
CF_API void CF_CALL cf_commit(void);
1889-
18901880
#ifdef __cplusplus
18911881
}
18921882
#endif // __cplusplus
@@ -1941,7 +1931,6 @@ CF_INLINE void apply_scissor(int x, int y, int w, int h) { cf_apply_scissor(x, y
19411931
CF_INLINE void apply_mesh(CF_Mesh mesh) { cf_apply_mesh(mesh); }
19421932
CF_INLINE void apply_shader(CF_Shader shader, CF_Material material) { cf_apply_shader(shader, material); }
19431933
CF_INLINE void draw_elements() { cf_draw_elements(); }
1944-
CF_INLINE void commit() { cf_commit(); }
19451934

19461935
}
19471936
void cf_clear_canvas(CF_Canvas canvas_handle);

samples/basic_indexed_rendering.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ int main(int argc, char* argv[])
6868
cf_apply_mesh(mesh);
6969
cf_apply_shader(shader, material);
7070
cf_draw_elements();
71-
cf_commit();
7271
cf_app_draw_onto_screen(false);
7372
}
7473

samples/basic_instancing.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ int main(int argc, char* argv[])
8686
cf_apply_mesh(mesh);
8787
cf_apply_shader(shader, material);
8888
cf_draw_elements();
89-
cf_commit();
9089
cf_app_draw_onto_screen(false);
9190
}
9291

samples/hello_triangle.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ int main(int argc, char* argv[])
8383
cf_apply_mesh(mesh);
8484
cf_apply_shader(shader, material);
8585
cf_draw_elements();
86-
cf_commit();
8786

8887
cf_app_draw_onto_screen(false);
8988
}

src/cute_draw.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@ static void s_draw_report(spritebatch_sprite_t* sprites, int count, int texture_
381381
}
382382

383383
cf_draw_elements();
384-
cf_commit();
385384

386385
draw->has_drawn_something = true;
387386
}

src/cute_graphics.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -649,16 +649,3 @@ void cf_draw_elements()
649649
#endif
650650
}
651651
}
652-
653-
void cf_sdlgpu_commit();
654-
void cf_gles_commit();
655-
void cf_commit()
656-
{
657-
if (app->gfx_backend_type == CF_BACKEND_TYPE_GLES3) {
658-
cf_gles_commit();
659-
} else {
660-
#ifndef CF_EMSCRIPTEN
661-
cf_sdlgpu_commit();
662-
#endif
663-
}
664-
}

src/cute_graphics_gles.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,10 +1648,6 @@ void cf_gles_draw_elements()
16481648

16491649
CF_POLL_OPENGL_ERROR();
16501650
++app->draw_call_count;
1651-
}
1652-
1653-
void cf_gles_commit()
1654-
{
16551651
g_ctx.target_state = s_default_state(g_ctx.canvas);
16561652
}
16571653

src/cute_graphics_sdlgpu.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,10 +1528,7 @@ void cf_sdlgpu_draw_elements()
15281528
}
15291529
}
15301530
app->draw_call_count++;
1531-
}
15321531

1533-
void cf_sdlgpu_commit()
1534-
{
15351532
SDL_EndGPURenderPass(g_ctx.canvas->pass);
15361533
}
15371534

0 commit comments

Comments
 (0)