diff options
| author | onelin <oscar@nelin.dk> | 2025-12-03 21:21:54 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-12-18 21:14:18 +0000 |
| commit | eb06c9d49fddd6ffd5725bf8a33c2eab8cfd94c7 (patch) | |
| tree | 3889668b09aecf35473ccfb18409f3072f1beb5f /src/daw.c | |
| parent | 841c0da02c6d042578f45ed46f443852f8aa3148 (diff) | |
Add support for depth & stencil buffers
Diffstat (limited to 'src/daw.c')
| -rw-r--r-- | src/daw.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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; } |
