diff options
Diffstat (limited to 'src/graphics.cc')
| -rw-r--r-- | src/graphics.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/graphics.cc b/src/graphics.cc index 40e67ab..cd606b2 100644 --- a/src/graphics.cc +++ b/src/graphics.cc @@ -6,6 +6,7 @@ #include <cstring> +#include "cglm/vec4.h" #include "utils.h" #include "wlstate.h" @@ -98,7 +99,7 @@ void wayc_graphics_deinit(struct graphics_s* graphics) { enum renderer_error_e wayc_renderer_init(struct renderer_s* renderer, struct window_s* window, struct graphics_s* graphics, i32 width, - i32 height) { + i32 height, vec4 ccolor) { wayc_notnull(renderer); wayc_notnull(window); wayc_notnull(graphics); @@ -125,6 +126,7 @@ enum renderer_error_e wayc_renderer_init(struct renderer_s* renderer, renderer->esurface = esurface; renderer->width = width; renderer->height = height; + glm_vec4_copy(ccolor, renderer->ccolor); wayc_renderer_use(renderer); if (gladLoadGLLoader((GLADloadproc)eglGetProcAddress) == 0) { @@ -145,9 +147,21 @@ void wayc_renderer_begin(struct renderer_s* renderer) { swap.gl = gl_swap; swap.width = renderer->width; swap.height = renderer->height; + swap.sample_count = 1; + + sg_color_attachment_action color_action = {}; + color_action.load_action = SG_LOADACTION_CLEAR; + color_action.clear_value = { + WAYC_X(renderer->ccolor), WAYC_Y(renderer->ccolor), + WAYC_Z(renderer->ccolor), WAYC_A(renderer->ccolor)}; + color_action.store_action = SG_STOREACTION_STORE; + + sg_pass_action action = {}; + action.colors[0] = color_action; sg_pass pass = {}; pass.swapchain = swap; + pass.action = action; sg_begin_pass(&pass); } |
