Skip to content

Commit

Permalink
feat: update sokol to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
zeromake committed Apr 26, 2024
1 parent bfbd48b commit c2baa77
Show file tree
Hide file tree
Showing 185 changed files with 229 additions and 188 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ To enable web builds you need to setup the [emscripten](https://emscripten.org/i
> # generate to docs dir
```

#### Todo

- [ ] [4-5-4-sharpen](src/4-5-framebuffers/4-sharpen.c)
- [ ] [4-5-5-blur](src/4-5-framebuffers/5-blur.c)
- [ ] [4-10-1-instancing](src/4-10-instancing/1-instancing.c)
2 changes: 1 addition & 1 deletion docs/1-3-1.js

Large diffs are not rendered by default.

Binary file modified docs/1-3-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-4-1.js

Large diffs are not rendered by default.

Binary file modified docs/1-4-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-4-2.js

Large diffs are not rendered by default.

Binary file modified docs/1-4-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-4-3.js

Large diffs are not rendered by default.

Binary file modified docs/1-4-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-5-1.js

Large diffs are not rendered by default.

Binary file modified docs/1-5-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-5-2.js

Large diffs are not rendered by default.

Binary file modified docs/1-5-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-5-3.js

Large diffs are not rendered by default.

Binary file modified docs/1-5-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-6-1.js

Large diffs are not rendered by default.

Binary file modified docs/1-6-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-6-2.js

Large diffs are not rendered by default.

Binary file modified docs/1-6-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-6-3.js

Large diffs are not rendered by default.

Binary file modified docs/1-6-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-7-1.js

Large diffs are not rendered by default.

Binary file modified docs/1-7-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-7-2.js

Large diffs are not rendered by default.

Binary file modified docs/1-7-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-8-1.js

Large diffs are not rendered by default.

Binary file modified docs/1-8-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-8-2.js

Large diffs are not rendered by default.

Binary file modified docs/1-8-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-8-3.js

Large diffs are not rendered by default.

Binary file modified docs/1-8-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-9-1.js

Large diffs are not rendered by default.

Binary file modified docs/1-9-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-9-2.js

Large diffs are not rendered by default.

Binary file modified docs/1-9-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/1-9-3.js

Large diffs are not rendered by default.

Binary file modified docs/1-9-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-1-1.js

Large diffs are not rendered by default.

Binary file modified docs/2-1-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-2-1.js

Large diffs are not rendered by default.

Binary file modified docs/2-2-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-2-2.js

Large diffs are not rendered by default.

Binary file modified docs/2-2-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-2-3.js

Large diffs are not rendered by default.

Binary file modified docs/2-2-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-3-1.js

Large diffs are not rendered by default.

Binary file modified docs/2-3-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-3-2.js

Large diffs are not rendered by default.

Binary file modified docs/2-3-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-3-3.js

Large diffs are not rendered by default.

Binary file modified docs/2-3-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-4-1.js

Large diffs are not rendered by default.

Binary file modified docs/2-4-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-4-2.js

Large diffs are not rendered by default.

Binary file modified docs/2-4-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-5-1.js

Large diffs are not rendered by default.

Binary file modified docs/2-5-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-5-2.js

Large diffs are not rendered by default.

Binary file modified docs/2-5-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-5-3.js

Large diffs are not rendered by default.

Binary file modified docs/2-5-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-5-4.js

Large diffs are not rendered by default.

Binary file modified docs/2-5-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/2-6-1.js

Large diffs are not rendered by default.

Binary file modified docs/2-6-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/3-1-1.js

Large diffs are not rendered by default.

Binary file modified docs/3-1-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/3-1-2.js

Large diffs are not rendered by default.

Binary file modified docs/3-1-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-1-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-1-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-1-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-1-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-1-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-1-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-1-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-1-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-10-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-10-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-10-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-10-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-10-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-10-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-10-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-10-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-11-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-11-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-11-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-11-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-11-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-11-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-11-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-11-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-2-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-2-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-3-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-3-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-3-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-3-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-3-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-3-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-3-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-3-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-4-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-4-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-5-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-5-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-5-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-5-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-5-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-5-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-5-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-5-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-5-5.js

Large diffs are not rendered by default.

Binary file modified docs/4-5-5.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-5-6.js

Large diffs are not rendered by default.

Binary file modified docs/4-5-6.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-6-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-6-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-6-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-6-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-6-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-6-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-6-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-6-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-6-5.js

Large diffs are not rendered by default.

Binary file modified docs/4-6-5.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-8-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-8-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-8-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-8-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-8-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-8-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-8-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-8-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-9-1.js

Large diffs are not rendered by default.

Binary file modified docs/4-9-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-9-2.js

Large diffs are not rendered by default.

Binary file modified docs/4-9-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-9-3.js

Large diffs are not rendered by default.

Binary file modified docs/4-9-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/4-9-4.js

Large diffs are not rendered by default.

Binary file modified docs/4-9-4.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-1-1.js

Large diffs are not rendered by default.

Binary file modified docs/5-1-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-2-1.js

Large diffs are not rendered by default.

Binary file modified docs/5-2-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-3-1.js

Large diffs are not rendered by default.

Binary file modified docs/5-3-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-3-2.js

Large diffs are not rendered by default.

Binary file modified docs/5-3-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-3-3.js

Large diffs are not rendered by default.

Binary file modified docs/5-3-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-4-1.js

Large diffs are not rendered by default.

Binary file modified docs/5-4-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-4-2.js

Large diffs are not rendered by default.

Binary file modified docs/5-4-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-4-3.js

Large diffs are not rendered by default.

Binary file modified docs/5-4-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-5-1.js

Large diffs are not rendered by default.

Binary file modified docs/5-5-1.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-5-2.js

Large diffs are not rendered by default.

Binary file modified docs/5-5-2.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/5-5-3.js

Large diffs are not rendered by default.

Binary file modified docs/5-5-3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ <h1><a class="main-menu-link" href="https://github.com/zeromake/learnopengl-exam
<li> written in C, compiled to WebAssembly </li>
<li> shader dialect GLSL v450, cross-compiled to GLSL v300es (WebGL2) </li>
<li> uses <a href="https://github.com/floooh/sokol">Sokol libraries</a> for cross platform support </li>
<li> last updated: 2024-01-03 06:55:02 +00:00 </i>
<li> last updated: 2024-04-26 12:50:30 +00:00 </i>
</ul>
</section>

Expand Down
16 changes: 8 additions & 8 deletions src/4-11-anti-aliasing/2-offscreen-msaa.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
/* application state */
static struct {
struct {
sg_attachments pass;
sg_attachments_desc pass_desc;
sg_attachments attachment;
sg_attachments_desc attachment_desc;
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind;
Expand All @@ -30,9 +30,9 @@ static struct {
/* called initially and when window size changes */
void create_offscreen_pass(int width, int height) {
/* destroy previous resource (can be called for invalid id) */
sg_destroy_attachments(state.offscreen.pass);
sg_destroy_image(state.offscreen.pass_desc.colors[0].image);
sg_destroy_image(state.offscreen.pass_desc.depth_stencil.image);
sg_destroy_attachments(state.offscreen.attachment);
sg_destroy_image(state.offscreen.attachment_desc.colors[0].image);
sg_destroy_image(state.offscreen.attachment_desc.depth_stencil.image);

/* create offscreen rendertarget images and pass */
sg_sampler_desc color_smp_desc = {
Expand Down Expand Up @@ -60,12 +60,12 @@ void create_offscreen_pass(int width, int height) {
depth_img_desc.type = SG_IMAGETYPE_2D;
sg_image depth_img = sg_make_image(&depth_img_desc);

state.offscreen.pass_desc = (sg_attachments_desc){
state.offscreen.attachment_desc = (sg_attachments_desc){
.colors[0].image = color_img,
.depth_stencil.image = depth_img,
.label = "offscreen-pass"
};
state.offscreen.pass = sg_make_attachments(&state.offscreen.pass_desc);
state.offscreen.attachment = sg_make_attachments(&state.offscreen.attachment_desc);

/* also need to update the fullscreen-quad texture bindings */
state.display.bind.fs.images[SLOT__diffuse_texture] = color_img;
Expand Down Expand Up @@ -210,7 +210,7 @@ void frame(void) {
};

/* the offscreen pass, rendering an rotating, untextured cube into a render target image */
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.pass });
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.attachment });
sg_apply_pipeline(state.offscreen.pip);
sg_apply_bindings(&state.offscreen.bind);

Expand Down
16 changes: 8 additions & 8 deletions src/4-11-anti-aliasing/3-grayscale-msaa.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
/* application state */
static struct {
struct {
sg_attachments pass;
sg_attachments_desc pass_desc;
sg_attachments attachment;
sg_attachments_desc attachment_desc;
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind;
Expand All @@ -29,9 +29,9 @@ static struct {
/* called initially and when window size changes */
void create_offscreen_pass(int width, int height) {
/* destroy previous resource (can be called for invalid id) */
sg_destroy_attachments(state.offscreen.pass);
sg_destroy_image(state.offscreen.pass_desc.colors[0].image);
sg_destroy_image(state.offscreen.pass_desc.depth_stencil.image);
sg_destroy_attachments(state.offscreen.attachment);
sg_destroy_image(state.offscreen.attachment_desc.colors[0].image);
sg_destroy_image(state.offscreen.attachment_desc.depth_stencil.image);

/* create offscreen rendertarget images and pass */
sg_sampler_desc color_smp_desc = {
Expand All @@ -58,12 +58,12 @@ void create_offscreen_pass(int width, int height) {
depth_img_desc.label = "depth-image";
sg_image depth_img = sg_make_image(&depth_img_desc);

state.offscreen.pass_desc = (sg_attachments_desc){
state.offscreen.attachment_desc = (sg_attachments_desc){
.colors[0].image = color_img,
.depth_stencil.image = depth_img,
.label = "offscreen-pass"
};
state.offscreen.pass = sg_make_attachments(&state.offscreen.pass_desc);
state.offscreen.attachment = sg_make_attachments(&state.offscreen.attachment_desc);

/* also need to update the fullscreen-quad texture bindings */
state.display.bind.fs.images[SLOT__diffuse_texture] = color_img;
Expand Down Expand Up @@ -206,7 +206,7 @@ void frame(void) {
};

/* the offscreen pass, rendering an rotating, untextured cube into a render target image */
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.pass });
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.attachment });
sg_apply_pipeline(state.offscreen.pip);
sg_apply_bindings(&state.offscreen.bind);

Expand Down
16 changes: 8 additions & 8 deletions src/4-5-framebuffers/1-render-to-texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
/* application state */
static struct {
struct {
sg_attachments pass;
sg_attachments_desc pass_desc;
sg_attachments attachment;
sg_attachments_desc attachment_desc;
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind_cube;
Expand All @@ -37,9 +37,9 @@ static void fail_callback() {
/* called initially and when window size changes */
void create_offscreen_pass(int width, int height) {
/* destroy previous resource (can be called for invalid id) */
sg_destroy_attachments(state.offscreen.pass);
sg_destroy_image(state.offscreen.pass_desc.colors[0].image);
sg_destroy_image(state.offscreen.pass_desc.depth_stencil.image);
sg_destroy_attachments(state.offscreen.attachment);
sg_destroy_image(state.offscreen.attachment_desc.colors[0].image);
sg_destroy_image(state.offscreen.attachment_desc.depth_stencil.image);

/* create offscreen rendertarget images and pass */
sg_sampler_desc color_smp_desc = {
Expand All @@ -65,12 +65,12 @@ void create_offscreen_pass(int width, int height) {
depth_img_desc.label = "depth-image";
sg_image depth_img = sg_make_image(&depth_img_desc);

state.offscreen.pass_desc = (sg_attachments_desc){
state.offscreen.attachment_desc = (sg_attachments_desc){
.colors[0].image = color_img,
.depth_stencil.image = depth_img,
.label = "offscreen-pass"
};
state.offscreen.pass = sg_make_attachments(&state.offscreen.pass_desc);
state.offscreen.attachment = sg_make_attachments(&state.offscreen.attachment_desc);

/* also need to update the fullscreen-quad texture bindings */
state.display.bind.fs.images[SLOT__diffuse_texture] = color_img;
Expand Down Expand Up @@ -253,7 +253,7 @@ void frame(void) {
};

/* the offscreen pass, rendering an rotating, untextured cube into a render target image */
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.pass });
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.attachment });
sg_apply_pipeline(state.offscreen.pip);
sg_apply_bindings(&state.offscreen.bind_cube);

Expand Down
16 changes: 8 additions & 8 deletions src/4-5-framebuffers/2-inversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
/* application state */
static struct {
struct {
sg_attachments pass;
sg_attachments_desc pass_desc;
sg_attachments attachment;
sg_attachments_desc attachment_desc;
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind_cube;
Expand All @@ -36,9 +36,9 @@ static void fail_callback() {
/* called initially and when window size changes */
void create_offscreen_pass(int width, int height) {
/* destroy previous resource (can be called for invalid id) */
sg_destroy_attachments(state.offscreen.pass);
sg_destroy_image(state.offscreen.pass_desc.colors[0].image);
sg_destroy_image(state.offscreen.pass_desc.depth_stencil.image);
sg_destroy_attachments(state.offscreen.attachment);
sg_destroy_image(state.offscreen.attachment_desc.colors[0].image);
sg_destroy_image(state.offscreen.attachment_desc.depth_stencil.image);

/* create offscreen rendertarget images and pass */
sg_sampler_desc color_smp_desc = {
Expand All @@ -64,12 +64,12 @@ void create_offscreen_pass(int width, int height) {
depth_img_desc.label = "depth-image";
sg_image depth_img = sg_make_image(&depth_img_desc);

state.offscreen.pass_desc = (sg_attachments_desc){
state.offscreen.attachment_desc = (sg_attachments_desc){
.colors[0].image = color_img,
.depth_stencil.image = depth_img,
.label = "offscreen-pass"
};
state.offscreen.pass = sg_make_attachments(&state.offscreen.pass_desc);
state.offscreen.attachment = sg_make_attachments(&state.offscreen.attachment_desc);

/* also need to update the fullscreen-quad texture bindings */
state.display.bind.fs.images[SLOT__diffuse_texture] = color_img;
Expand Down Expand Up @@ -252,7 +252,7 @@ void frame(void) {
};

/* the offscreen pass, rendering an rotating, untextured cube into a render target image */
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.pass });
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.attachment });
sg_apply_pipeline(state.offscreen.pip);
sg_apply_bindings(&state.offscreen.bind_cube);

Expand Down
16 changes: 8 additions & 8 deletions src/4-5-framebuffers/3-grayscale.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
/* application state */
static struct {
struct {
sg_attachments pass;
sg_attachments_desc pass_desc;
sg_attachments attachment;
sg_attachments_desc attachment_desc;
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind_cube;
Expand All @@ -36,9 +36,9 @@ static void fail_callback() {
/* called initially and when window size changes */
void create_offscreen_pass(int width, int height) {
/* destroy previous resource (can be called for invalid id) */
sg_destroy_attachments(state.offscreen.pass);
sg_destroy_image(state.offscreen.pass_desc.colors[0].image);
sg_destroy_image(state.offscreen.pass_desc.depth_stencil.image);
sg_destroy_attachments(state.offscreen.attachment);
sg_destroy_image(state.offscreen.attachment_desc.colors[0].image);
sg_destroy_image(state.offscreen.attachment_desc.depth_stencil.image);

/* create offscreen rendertarget images and pass */
sg_sampler_desc color_smp_desc = {
Expand All @@ -64,12 +64,12 @@ void create_offscreen_pass(int width, int height) {
depth_img_desc.label = "depth-image";
sg_image depth_img = sg_make_image(&depth_img_desc);

state.offscreen.pass_desc = (sg_attachments_desc){
state.offscreen.attachment_desc = (sg_attachments_desc){
.colors[0].image = color_img,
.depth_stencil.image = depth_img,
.label = "offscreen-pass"
};
state.offscreen.pass = sg_make_attachments(&state.offscreen.pass_desc);
state.offscreen.attachment = sg_make_attachments(&state.offscreen.attachment_desc);

/* also need to update the fullscreen-quad texture bindings */
state.display.bind.fs.images[SLOT__diffuse_texture] = color_img;
Expand Down Expand Up @@ -252,7 +252,7 @@ void frame(void) {
};

/* the offscreen pass, rendering an rotating, untextured cube into a render target image */
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.pass });
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.attachment });
sg_apply_pipeline(state.offscreen.pip);
sg_apply_bindings(&state.offscreen.bind_cube);

Expand Down
16 changes: 8 additions & 8 deletions src/4-5-framebuffers/4-sharpen.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
/* application state */
static struct {
struct {
sg_attachments pass;
sg_attachments_desc pass_desc;
sg_attachments attachment;
sg_attachments_desc attachment_desc;
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind_cube;
Expand All @@ -36,9 +36,9 @@ static void fail_callback() {
/* called initially and when window size changes */
void create_offscreen_pass(int width, int height) {
/* destroy previous resource (can be called for invalid id) */
sg_destroy_attachments(state.offscreen.pass);
sg_destroy_image(state.offscreen.pass_desc.colors[0].image);
sg_destroy_image(state.offscreen.pass_desc.depth_stencil.image);
sg_destroy_attachments(state.offscreen.attachment);
sg_destroy_image(state.offscreen.attachment_desc.colors[0].image);
sg_destroy_image(state.offscreen.attachment_desc.depth_stencil.image);

/* create offscreen rendertarget images and pass */
sg_sampler_desc color_smp_desc = {
Expand All @@ -64,12 +64,12 @@ void create_offscreen_pass(int width, int height) {
depth_img_desc.label = "depth-image";
sg_image depth_img = sg_make_image(&depth_img_desc);

state.offscreen.pass_desc = (sg_attachments_desc){
state.offscreen.attachment_desc = (sg_attachments_desc){
.colors[0].image = color_img,
.depth_stencil.image = depth_img,
.label = "offscreen-pass"
};
state.offscreen.pass = sg_make_attachments(&state.offscreen.pass_desc);
state.offscreen.attachment = sg_make_attachments(&state.offscreen.attachment_desc);

/* also need to update the fullscreen-quad texture bindings */
state.display.bind.fs.images[SLOT__diffuse_texture] = color_img;
Expand Down Expand Up @@ -252,7 +252,7 @@ void frame(void) {
};

/* the offscreen pass, rendering an rotating, untextured cube into a render target image */
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.pass });
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.attachment });
sg_apply_pipeline(state.offscreen.pip);
sg_apply_bindings(&state.offscreen.bind_cube);

Expand Down
16 changes: 8 additions & 8 deletions src/4-5-framebuffers/5-blur.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
/* application state */
static struct {
struct {
sg_attachments pass;
sg_attachments_desc pass_desc;
sg_attachments attachment;
sg_attachments_desc attachment_desc;
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind_cube;
Expand All @@ -36,9 +36,9 @@ static void fail_callback() {
/* called initially and when window size changes */
void create_offscreen_pass(int width, int height) {
/* destroy previous resource (can be called for invalid id) */
sg_destroy_attachments(state.offscreen.pass);
sg_destroy_image(state.offscreen.pass_desc.colors[0].image);
sg_destroy_image(state.offscreen.pass_desc.depth_stencil.image);
sg_destroy_attachments(state.offscreen.attachment);
sg_destroy_image(state.offscreen.attachment_desc.colors[0].image);
sg_destroy_image(state.offscreen.attachment_desc.depth_stencil.image);

/* create offscreen rendertarget images and pass */
sg_sampler_desc color_smp_desc = {
Expand All @@ -64,12 +64,12 @@ void create_offscreen_pass(int width, int height) {
depth_img_desc.label = "depth-image";
sg_image depth_img = sg_make_image(&depth_img_desc);

state.offscreen.pass_desc = (sg_attachments_desc){
state.offscreen.attachment_desc = (sg_attachments_desc){
.colors[0].image = color_img,
.depth_stencil.image = depth_img,
.label = "offscreen-pass"
};
state.offscreen.pass = sg_make_attachments(&state.offscreen.pass_desc);
state.offscreen.attachment = sg_make_attachments(&state.offscreen.attachment_desc);

/* also need to update the fullscreen-quad texture bindings */
state.display.bind.fs.images[SLOT__diffuse_texture] = color_img;
Expand Down Expand Up @@ -252,7 +252,7 @@ void frame(void) {
};

/* the offscreen pass, rendering an rotating, untextured cube into a render target image */
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.pass });
sg_begin_pass(&(sg_pass){ .action = state.offscreen.pass_action, .attachments = state.offscreen.attachment });
sg_apply_pipeline(state.offscreen.pip);
sg_apply_bindings(&state.offscreen.bind_cube);

Expand Down
Loading

0 comments on commit c2baa77

Please sign in to comment.