summaryrefslogtreecommitdiff
path: root/src/daw.c
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2025-12-03 21:21:54 +0000
committeronelin <oscar@nelin.dk>2025-12-18 21:14:18 +0000
commiteb06c9d49fddd6ffd5725bf8a33c2eab8cfd94c7 (patch)
tree3889668b09aecf35473ccfb18409f3072f1beb5f /src/daw.c
parent841c0da02c6d042578f45ed46f443852f8aa3148 (diff)
Add support for depth & stencil buffers
Diffstat (limited to 'src/daw.c')
-rw-r--r--src/daw.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/daw.c b/src/daw.c
index 2687f11..4a99d33 100644
--- a/src/daw.c
+++ b/src/daw.c
@@ -245,13 +245,21 @@ i32 engine_run(Instance* p, StateType initial_state, void* state_arg) {
// Create only 1 additional framebuffer, in addition to the default
// one. This is used to render a texture that is represented as a quad
// on the default framebuffer.
+ ivec2 wsz;
+ window_get_size(&wsz);
FramebufferParameters p[] = {
- {.num_attached_buffers = 1, {1600,1600}},
+ {.num_attached_buffers = 2, .dimensions = {wsz[0], wsz[1], 0}},
};
u32 t[] = {
- BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_texture), BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_TEXTURE_FMT_RGBA8)
+ BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_texture), BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_FMT_RGBA8),
+ // The depth buffer could also be a texture like so:
+ // BUFFERPARAMETER_SET_PARAMETER(
+ // BUFFERPARAMETER_SET_TYPE(0, BufferType_texture),
+ // BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_FMT_DEPTH
+ // ),
+ BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_render), BUFFERPARAMETER_RENDERBUFFER_DEPTH | BUFFERPARAMETER_FMT_DEPTH),
};
- window_init_renderstack(w, 1, 1, p, t);
+ window_init_renderstack(w, 1, 2, p, t);
//w->render_targets->cam[0] = &default_renderbuffer_camera;
}