Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for sokol-gfx pass cleanup #24

Merged
merged 1 commit into from Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/gfx.c
Expand Up @@ -41,7 +41,7 @@ void gfx_preinit(void) {
.buffer_pool_size = 16,
.image_pool_size = 8,
.pipeline_pool_size = 8,
.context = sapp_sgcontext(),
.environment = sglue_environment(),
.logger.func = slog_func,
});
}
Expand Down Expand Up @@ -147,18 +147,20 @@ void gfx_new_frame(float disp_width, float disp_height) {

void gfx_begin(void) {
assert(gfx.valid);
sg_pass_action pass_action = {
.colors[0] = {
.load_action = SG_LOADACTION_CLEAR,
.clear_value = {
.r = gfx.palette.background.x,
.g = gfx.palette.background.y,
.b = gfx.palette.background.z,
.a = 1.0f,
},
sg_begin_pass(&(sg_pass){
.action = {
.colors[0] = {
.load_action = SG_LOADACTION_CLEAR,
.clear_value = {
.r = gfx.palette.background.x,
.g = gfx.palette.background.y,
.b = gfx.palette.background.z,
.a = 1.0f,
},
}
},
};
sg_begin_default_pass(&pass_action, sapp_width(), sapp_height());
.swapchain = sglue_swapchain()
});
}

void gfx_draw(void) {
Expand Down
12 changes: 6 additions & 6 deletions src/ui.cc
Expand Up @@ -220,7 +220,7 @@ static struct {
int pos;
char buf[MAX_TRACEDUMP_SIZE];
} tracedump;
sg_imgui_t sgimgui;
sgimgui_t sgimgui;
} ui;

static void ui_menu(void);
Expand Down Expand Up @@ -273,8 +273,8 @@ void ui_init() {
assert(!ui.valid);

// setup sokol-gfx debugging UI
const sg_imgui_desc_t sgimgui_desc = {};
sg_imgui_init(&ui.sgimgui, &sgimgui_desc);
const sgimgui_desc_t sgimgui_desc = {};
sgimgui_init(&ui.sgimgui, &sgimgui_desc);

// default window open state
ui.window_open.cpu_controls = true;
Expand Down Expand Up @@ -404,7 +404,7 @@ void ui_init() {

void ui_shutdown() {
assert(ui.valid);
sg_imgui_discard(&ui.sgimgui);
sgimgui_discard(&ui.sgimgui);
ui_nodeexplorer_discard();
ui_asm_discard();
ui_dasm_discard(&ui.dasm);
Expand Down Expand Up @@ -651,7 +651,7 @@ void ui_frame() {

void ui_draw() {
assert(ui.valid);
sg_imgui_draw(&ui.sgimgui);
sgimgui_draw(&ui.sgimgui);
simgui_render();
}

Expand Down Expand Up @@ -807,7 +807,7 @@ static void ui_menu(void) {
}
ImGui::EndMenu();
}
sg_imgui_draw_menu(&ui.sgimgui, "Sokol");
sgimgui_draw_menu(&ui.sgimgui, "Sokol");
if (ImGui::BeginMenu("Help")) {
ImGui::MenuItem("Assembler", 0, &ui.window_open.help_asm);
ImGui::MenuItem("Opcode Table", 0, &ui.window_open.help_opcodes);
Expand Down