summaryrefslogtreecommitdiff
path: root/examples/triangle/ex_triangle.c
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-05-11 17:30:58 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-05-11 17:30:58 +1000
commit08d7e23fd5ed95953822a72ba11d4b6cd96b2846 (patch)
tree6d251658bacb6a892a01e88ba3b98da338b9206e /examples/triangle/ex_triangle.c
parentfa6b939d49398a11d76080029204e7462b22914e (diff)
prototyping shader data
Diffstat (limited to 'examples/triangle/ex_triangle.c')
-rw-r--r--examples/triangle/ex_triangle.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/examples/triangle/ex_triangle.c b/examples/triangle/ex_triangle.c
index dc82156..c6f0e54 100644
--- a/examples/triangle/ex_triangle.c
+++ b/examples/triangle/ex_triangle.c
@@ -12,8 +12,6 @@
#include "ral_types.h"
#include "render.h"
-// Example setting up a renderer
-
extern core g_core;
const custom_vertex vertices[] = {
@@ -28,8 +26,6 @@ int main() {
core_bringup();
arena scratch = arena_create(malloc(1024 * 1024), 1024 * 1024);
- DEBUG("render capacity %d", g_core.default_scene.renderables->capacity);
-
gpu_renderpass_desc pass_description = {};
gpu_renderpass* renderpass = gpu_renderpass_create(&pass_description);
@@ -65,19 +61,13 @@ int main() {
// Main loop
while (!should_exit(&g_core)) {
- glfwPollEvents();
input_update(&g_core.input);
- // render_frame_begin(&g_core.renderer);
-
- static f64 x = 0.0;
- x += 0.01;
-
if (!gpu_backend_begin_frame()) {
continue;
}
gpu_cmd_encoder* enc = gpu_get_default_cmd_encoder();
- // begin recording
+ // Begin recording
gpu_cmd_encoder_begin(*enc);
gpu_cmd_encoder_begin_render(enc, renderpass);
encode_bind_pipeline(enc, PIPELINE_GRAPHICS, gfx_pipeline);
@@ -86,18 +76,16 @@ int main() {
// Record draw calls
encode_set_vertex_buffer(enc, triangle_vert_buf);
encode_set_index_buffer(enc, triangle_index_buf);
- gpu_temp_draw(6);
+ encode_draw_indexed(enc, 6);
// End recording
gpu_cmd_encoder_end_render(enc);
- gpu_cmd_buffer buf = gpu_cmd_encoder_finish(enc);
- gpu_queue_submit(&buf);
+ gpu_cmd_buffer buf = gpu_cmd_encoder_finish(
+ enc); // Command buffer is no longer recording and is ready to submit
// Submit
+ gpu_queue_submit(&buf);
gpu_backend_end_frame();
-
- // render_frame_end(&g_core.renderer);
- // glfwSwapBuffers(core->renderer.window);
}
renderer_shutdown(&g_core.renderer);