Skip to content

Commit

Permalink
Premultiplied alpha (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
skejeton committed Mar 5, 2024
1 parent d78441f commit e544073
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 52 deletions.
6 changes: 6 additions & 0 deletions etc/shader.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ void main() {
@end

@fs th_fs
uniform th_fs_params {
float premultiply;
};
uniform texture2D tex;
uniform sampler smp;
layout (location = 0) out vec4 frag_color;
Expand All @@ -24,6 +27,9 @@ in vec4 color;

void main() {
frag_color = color * texture(sampler2D(tex, smp), uv);
if (premultiply > 0.5) {
frag_color.rgb *= frag_color.a;
}
}
@end

Expand Down
9 changes: 7 additions & 2 deletions src/canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ th_canvas_init()
{
.enabled = true,
.src_factor_alpha = SG_BLENDFACTOR_ONE,
.dst_factor_alpha = SG_BLENDFACTOR_ZERO,
.dst_factor_alpha = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.op_alpha = SG_BLENDOP_ADD,
.src_factor_rgb = SG_BLENDFACTOR_SRC_ALPHA,
.src_factor_rgb = SG_BLENDFACTOR_ONE,
.dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.op_rgb = SG_BLENDOP_ADD,
},
Expand Down Expand Up @@ -260,13 +260,18 @@ th_canvas_flush()
sg_update_buffer(buf, &SG_RANGE(thg->canvas_batch));
thg->canvas_bind.vertex_buffers[0] = buf;
finalize_last_phase();
th_fs_params_t fs_params = {0};
for (size_t i = 0; i < phases_len; i++) {
phase *phs = &phases[i];
switch (phs->scissor_stage) {
case SCISSOR_NONE:
thg->canvas_bind.fs.images[SLOT_tex] = phs->img->tex;
thg->canvas_bind.fs.samplers[SLOT_smp] = phs->img->smp;
// Targets are premultiplied
fs_params.premultiply = phs->img->target ? 0 : 1;
sg_apply_bindings(&thg->canvas_bind);
sg_apply_uniforms(
SG_SHADERSTAGE_FS, SLOT_th_fs_params, &SG_RANGE(fs_params));
sg_draw(
phs->start / BATCH_VERTEX, (phs->end - phs->start) / BATCH_VERTEX, 1);
break;
Expand Down
18 changes: 12 additions & 6 deletions src/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ th_image_create_render_target(int width, int height, int filter)
.depth_stencil_attachment.image = t->depth,
.label = "offscreen-pass"});

t->image->target = true;

return t;
}

Expand Down Expand Up @@ -360,10 +362,14 @@ th_image_remove_render_target(th_render_target *t, th_vf2 wp)
void
th_image_init()
{
thg->offscreen_pass_action =
(sg_pass_action){.colors[0] = {.store_action = SG_STOREACTION_STORE,
.load_action = SG_LOADACTION_CLEAR,
.clear_value = {0, 0, 0, 0}}};
thg->offscreen_pass_action = (sg_pass_action){
.colors[0] =
{
.store_action = SG_STOREACTION_STORE,
.load_action = SG_LOADACTION_CLEAR,
.clear_value = {0, 0, 0, 0},
},
};
thg->image_pip = sg_make_pipeline(&(sg_pipeline_desc){.shader = thg->main_shader,
.layout = {.attrs =
{
Expand All @@ -381,9 +387,9 @@ th_image_init()
{
.enabled = true,
.src_factor_alpha = SG_BLENDFACTOR_ONE,
.dst_factor_alpha = SG_BLENDFACTOR_ZERO,
.dst_factor_alpha = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.op_alpha = SG_BLENDOP_ADD,
.src_factor_rgb = SG_BLENDFACTOR_SRC_ALPHA,
.src_factor_rgb = SG_BLENDFACTOR_ONE,
.dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.op_rgb = SG_BLENDOP_ADD,
},
Expand Down
90 changes: 70 additions & 20 deletions src/shader-web.glsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
ATTR_th_vs_uv0 = 1
ATTR_th_vs_color0 = 2
Fragment shader: th_fs
Uniform block 'th_fs_params':
C struct: th_fs_params_t
Bind slot: SLOT_th_fs_params = 0
Image 'tex':
Type: SG_IMAGETYPE_2D
Sample Type: SG_IMAGESAMPLETYPE_FLOAT
Expand Down Expand Up @@ -53,6 +56,13 @@
SLOT_smp = 0;
Bind slot and C-struct for uniform block 'th_fs_params':
th_fs_params_t th_fs_params = {
.premultiply = ...;
};
sg_apply_uniforms(SG_SHADERSTAGE_[VS|FS], SLOT_th_fs_params, &SG_RANGE(th_fs_params));
*/
#include <stdint.h>
#include <stdbool.h>
Expand All @@ -70,15 +80,22 @@
#define ATTR_th_vs_color0 (2)
#define SLOT_tex (0)
#define SLOT_smp (0)
#define SLOT_th_fs_params (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct th_fs_params_t {
float premultiply;
uint8_t _pad_4[12];
} th_fs_params_t;
#pragma pack(pop)
/*
#version 300 es
layout(location = 0) in vec2 pos;
out vec2 uv;
layout(location = 1) in vec2 uv0;
out vec4 color;
layout(location = 2) in vec4 color0;
void main()
{
vec2 _15 = pos * 2.0;
Expand All @@ -87,7 +104,7 @@
uv = uv0;
color = color0;
}
*/
static const char th_vs_source_glsl300es[342] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
Expand Down Expand Up @@ -117,36 +134,64 @@ static const char th_vs_source_glsl300es[342] = {
#version 300 es
precision mediump float;
precision highp int;
uniform highp vec4 th_fs_params[1];
uniform highp sampler2D tex_smp;
layout(location = 0) out highp vec4 frag_color;
in highp vec4 color;
in highp vec2 uv;
void main()
{
frag_color = color * texture(tex_smp, uv);
if (th_fs_params[0].x > 0.5)
{
highp float _46 = frag_color.w;
highp vec4 _48 = frag_color;
highp vec3 _50 = _48.xyz * _46;
frag_color.x = _50.x;
frag_color.y = _50.y;
frag_color.z = _50.z;
}
}
*/
static const char th_fs_source_glsl300es[250] = {
static const char th_fs_source_glsl300es[538] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75,
0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,
0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,
0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,
0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,
0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,
0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,
0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,
0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,
0x20,0x75,0x76,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
0x34,0x20,0x74,0x68,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,
0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,
0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,
0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,
0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,
0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
0x72,0x20,0x2a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,
0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,
0x20,0x28,0x74,0x68,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,
0x5d,0x2e,0x78,0x20,0x3e,0x20,0x30,0x2e,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x36,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x34,0x38,0x20,
0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,
0x20,0x5f,0x35,0x30,0x20,0x3d,0x20,0x5f,0x34,0x38,0x2e,0x78,0x79,0x7a,0x20,0x2a,
0x20,0x5f,0x34,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,
0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x35,0x30,
0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x35,0x30,0x2e,0x79,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
0x6f,0x6c,0x6f,0x72,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x35,0x30,0x2e,0x7a,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00,
};
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader-web.glsl.h"
Expand All @@ -164,6 +209,11 @@ static inline const sg_shader_desc* th_shader_desc(sg_backend backend) {
desc.vs.entry = "main";
desc.fs.source = th_fs_source_glsl300es;
desc.fs.entry = "main";
desc.fs.uniform_blocks[0].size = 16;
desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.fs.uniform_blocks[0].uniforms[0].name = "th_fs_params";
desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.fs.uniform_blocks[0].uniforms[0].array_count = 1;
desc.fs.images[0].used = true;
desc.fs.images[0].multisampled = false;
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
Expand Down
86 changes: 67 additions & 19 deletions src/shader.glsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
ATTR_th_vs_uv0 = 1
ATTR_th_vs_color0 = 2
Fragment shader: th_fs
Uniform block 'th_fs_params':
C struct: th_fs_params_t
Bind slot: SLOT_th_fs_params = 0
Image 'tex':
Type: SG_IMAGETYPE_2D
Sample Type: SG_IMAGESAMPLETYPE_FLOAT
Expand Down Expand Up @@ -53,6 +56,13 @@
SLOT_smp = 0;
Bind slot and C-struct for uniform block 'th_fs_params':
th_fs_params_t th_fs_params = {
.premultiply = ...;
};
sg_apply_uniforms(SG_SHADERSTAGE_[VS|FS], SLOT_th_fs_params, &SG_RANGE(th_fs_params));
*/
#include <stdint.h>
#include <stdbool.h>
Expand All @@ -70,15 +80,22 @@
#define ATTR_th_vs_color0 (2)
#define SLOT_tex (0)
#define SLOT_smp (0)
#define SLOT_th_fs_params (0)
#pragma pack(push,1)
SOKOL_SHDC_ALIGN(16) typedef struct th_fs_params_t {
float premultiply;
uint8_t _pad_4[12];
} th_fs_params_t;
#pragma pack(pop)
/*
#version 330
layout(location = 0) in vec2 pos;
out vec2 uv;
layout(location = 1) in vec2 uv0;
out vec4 color;
layout(location = 2) in vec4 color0;
void main()
{
vec2 _15 = pos * 2.0;
Expand All @@ -87,7 +104,7 @@
uv = uv0;
color = color0;
}
*/
static const char th_vs_source_glsl330[339] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x6c,0x61,
Expand Down Expand Up @@ -115,32 +132,58 @@ static const char th_vs_source_glsl330[339] = {
};
/*
#version 330
uniform vec4 th_fs_params[1];
uniform sampler2D tex_smp;
layout(location = 0) out vec4 frag_color;
in vec4 color;
in vec2 uv;
void main()
{
frag_color = color * texture(tex_smp, uv);
if (th_fs_params[0].x > 0.5)
{
float _46 = frag_color.w;
vec4 _48 = frag_color;
vec3 _50 = _48.xyz * _46;
frag_color.x = _50.x;
frag_color.y = _50.y;
frag_color.z = _50.z;
}
}
*/
static const char th_fs_source_glsl330[177] = {
static const char th_fs_source_glsl330[441] = {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,
0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,
0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,
0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,
0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
0x00,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x68,0x5f,0x66,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,
0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,
0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,
0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,
0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,
0x6f,0x72,0x20,0x2a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,
0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,
0x66,0x20,0x28,0x74,0x68,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x30,0x5d,0x2e,0x78,0x20,0x3e,0x20,0x30,0x2e,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
0x5f,0x34,0x36,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,
0x20,0x5f,0x34,0x38,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,
0x5f,0x35,0x30,0x20,0x3d,0x20,0x5f,0x34,0x38,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,
0x5f,0x34,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x35,0x30,0x2e,
0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,
0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x35,0x30,0x2e,0x79,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
0x6c,0x6f,0x72,0x2e,0x7a,0x20,0x3d,0x20,0x5f,0x35,0x30,0x2e,0x7a,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00,
};
#if !defined(SOKOL_GFX_INCLUDED)
#error "Please include sokol_gfx.h before shader.glsl.h"
Expand All @@ -158,6 +201,11 @@ static inline const sg_shader_desc* th_shader_desc(sg_backend backend) {
desc.vs.entry = "main";
desc.fs.source = th_fs_source_glsl330;
desc.fs.entry = "main";
desc.fs.uniform_blocks[0].size = 16;
desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
desc.fs.uniform_blocks[0].uniforms[0].name = "th_fs_params";
desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
desc.fs.uniform_blocks[0].uniforms[0].array_count = 1;
desc.fs.images[0].used = true;
desc.fs.images[0].multisampled = false;
desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
Expand Down
Loading

0 comments on commit e544073

Please sign in to comment.