Skip to content

Commit 4b9974a

Browse files
committed
demo: Rebuild the pipeline on ssao checkbox flip
Before this part of functionality is moved to clap_frame(), keep the ssao enabling state in the main program and trigger pipeline rebuild on the state change. Signed-off-by: Alexander Shishkin <[email protected]>
1 parent fb1574b commit 4b9974a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

demo/ldjam56/onehandclap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static int exit_timeout = -1;
3939
static struct scene scene; /* XXX */
4040
// struct game_state game_state;
4141

42-
static bool shadow_msaa, model_msaa, edge_aa, edge_sobel;
42+
static bool shadow_msaa, model_msaa, edge_aa, edge_sobel, ssao;
4343

4444
static void build_main_pl(struct pipeline **pl)
4545
{
@@ -95,11 +95,13 @@ EMSCRIPTEN_KEEPALIVE void render_frame(void *data)
9595
if (shadow_msaa != s->render_options.shadow_msaa ||
9696
model_msaa != s->render_options.model_msaa ||
9797
edge_sobel != s->render_options.edge_sobel ||
98+
ssao != s->render_options.ssao ||
9899
edge_aa != s->render_options.edge_antialiasing) {
99100
shadow_msaa = s->render_options.shadow_msaa;
100101
model_msaa = s->render_options.model_msaa;
101102
edge_sobel = s->render_options.edge_sobel;
102103
edge_aa = s->render_options.edge_antialiasing;
104+
ssao = s->render_options.ssao;
103105
pipeline_clearout(scene.pl);
104106
build_main_pl(&scene.pl);
105107
}

demo/ldjam57/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static void cleanup(struct scene *s)
412412
darray_clearout(cobjs);
413413
}
414414

415-
static bool shadow_msaa, model_msaa, edge_aa, edge_sobel;
415+
static bool shadow_msaa, model_msaa, edge_aa, edge_sobel, ssao;
416416

417417
static void build_main_pl(struct pipeline **pl)
418418
{
@@ -465,11 +465,13 @@ EMSCRIPTEN_KEEPALIVE void render_frame(void *data)
465465
if (shadow_msaa != s->render_options.shadow_msaa ||
466466
model_msaa != s->render_options.model_msaa ||
467467
edge_sobel != s->render_options.edge_sobel ||
468+
ssao != s->render_options.ssao ||
468469
edge_aa != s->render_options.edge_antialiasing) {
469470
shadow_msaa = s->render_options.shadow_msaa;
470471
model_msaa = s->render_options.model_msaa;
471472
edge_sobel = s->render_options.edge_sobel;
472473
edge_aa = s->render_options.edge_antialiasing;
474+
ssao = s->render_options.ssao;
473475
pipeline_clearout(scene.pl);
474476
build_main_pl(&scene.pl);
475477
}

0 commit comments

Comments
 (0)