You've already forked flecs_tests
Fix assertion logging failure and rendering pipeline validation errors.
This commit is contained in:
2
makefile
2
makefile
@@ -67,7 +67,7 @@ debug: $(FETCH) $(SHADER_HEADERS) $(C_SOURCES) $(IMGUI_SOURCES) $(CGLM_SOURCES)
|
||||
$(CC) $(C_SOURCES) $(IMGUI_SOURCES) $(CGLM_SOURCES) \
|
||||
-o $(TARGET) \
|
||||
$(EMCC_FLAGS) \
|
||||
-g --profiling-funcs -gsource-map \
|
||||
-g3 --profiling-funcs -gsource-map \
|
||||
-sASSERTIONS \
|
||||
-I$(LIB_DIR)/sokol \
|
||||
-I$(LIB_DIR)/imgui \
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
static void log_fn(const char* tag, uint32_t log_level, uint32_t log_item_id, const char* message_or_null, uint32_t line_nr, const char* filename_or_null, void* user_data)
|
||||
{
|
||||
if(log_level < 3) return;
|
||||
fprintf(stderr, "[%s - %s]: (%d) %s \tat %s:%d\r\n", tag, log_level == 0 ? "FATAL" : log_level == 1 ? "ERROR" : log_level == 2 ? "WARNING" : "INFO", log_item_id, message_or_null, filename_or_null, line_nr);
|
||||
}
|
||||
|
||||
@@ -36,9 +35,8 @@ static void log_fn(const char* tag, uint32_t log_level, uint32_t log_item_id, co
|
||||
#define COMPUTE_VIEWIDX_indices 4
|
||||
#define COMPUTE_VIEWIDX_SDF 5
|
||||
|
||||
#define DISPLAY_VIEWIDX_tiles 0
|
||||
#define DISPLAY_VIEWIDX_SDF 1
|
||||
#define DISPLAY_VIEWIDX_Sampler 2
|
||||
#define DISPLAY_VIEWIDX_SDF 0
|
||||
#define DISPLAY_VIEWIDX_Sampler 1
|
||||
|
||||
static float clampf(float x, float a, float b)
|
||||
{
|
||||
|
||||
@@ -5,55 +5,43 @@ unsigned char src_shaders_display_wgsl[] = {
|
||||
0x20, 0x20, 0x20, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x75, 0x33,
|
||||
0x32, 0x2c, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x76, 0x70, 0x3a,
|
||||
0x20, 0x6d, 0x61, 0x74, 0x34, 0x78, 0x34, 0x66, 0x2c, 0x0d, 0x0a, 0x7d,
|
||||
0x0d, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x54, 0x69, 0x6c,
|
||||
0x65, 0x20, 0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x77, 0x6f, 0x72,
|
||||
0x6c, 0x64, 0x5f, 0x6d, 0x69, 0x6e, 0x3a, 0x20, 0x76, 0x65, 0x63, 0x32,
|
||||
0x66, 0x2c, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x77, 0x6f, 0x72, 0x6c,
|
||||
0x64, 0x5f, 0x6d, 0x61, 0x78, 0x3a, 0x20, 0x76, 0x65, 0x63, 0x32, 0x66,
|
||||
0x2c, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65,
|
||||
0x74, 0x3a, 0x20, 0x75, 0x33, 0x32, 0x2c, 0x0d, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x63, 0x69, 0x72, 0x63, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x3a, 0x20, 0x75, 0x33, 0x32, 0x2c, 0x0d, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x20, 0x75, 0x33, 0x32, 0x2c,
|
||||
0x0d, 0x0a, 0x7d, 0x3b, 0x0d, 0x0a, 0x0d, 0x0a, 0x40, 0x67, 0x72, 0x6f,
|
||||
0x75, 0x70, 0x28, 0x30, 0x29, 0x20, 0x40, 0x62, 0x69, 0x6e, 0x64, 0x69,
|
||||
0x6e, 0x67, 0x28, 0x30, 0x29, 0x20, 0x76, 0x61, 0x72, 0x3c, 0x75, 0x6e,
|
||||
0x69, 0x66, 0x6f, 0x72, 0x6d, 0x3e, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f,
|
||||
0x72, 0x6d, 0x73, 0x3a, 0x20, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d,
|
||||
0x73, 0x3b, 0x0d, 0x0a, 0x0d, 0x0a, 0x40, 0x67, 0x72, 0x6f, 0x75, 0x70,
|
||||
0x28, 0x31, 0x29, 0x20, 0x40, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67,
|
||||
0x28, 0x30, 0x29, 0x20, 0x76, 0x61, 0x72, 0x3c, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x61, 0x67, 0x65, 0x3e, 0x20, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x3a, 0x20,
|
||||
0x61, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x54, 0x69, 0x6c, 0x65, 0x3e, 0x3b,
|
||||
0x0d, 0x0a, 0x0d, 0x0a, 0x40, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x28, 0x30,
|
||||
0x29, 0x20, 0x40, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x28, 0x30,
|
||||
0x29, 0x20, 0x76, 0x61, 0x72, 0x3c, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72,
|
||||
0x6d, 0x3e, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x3a,
|
||||
0x20, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x3b, 0x0d, 0x0a,
|
||||
0x0d, 0x0a, 0x40, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x28, 0x31, 0x29, 0x20,
|
||||
0x40, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x28, 0x31, 0x29, 0x20,
|
||||
0x76, 0x61, 0x72, 0x20, 0x73, 0x64, 0x66, 0x5f, 0x62, 0x75, 0x66, 0x66,
|
||||
0x65, 0x72, 0x20, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65,
|
||||
0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x32, 0x64, 0x3c,
|
||||
0x72, 0x31, 0x36, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2c, 0x20, 0x72, 0x65,
|
||||
0x61, 0x64, 0x3e, 0x3b, 0x0d, 0x0a, 0x40, 0x67, 0x72, 0x6f, 0x75, 0x70,
|
||||
0x28, 0x31, 0x29, 0x20, 0x40, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67,
|
||||
0x28, 0x32, 0x29, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x64, 0x66, 0x5f,
|
||||
0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x3a, 0x20, 0x73, 0x61, 0x6d,
|
||||
0x70, 0x6c, 0x65, 0x72, 0x3b, 0x0d, 0x0a, 0x0d, 0x0a, 0x40, 0x76, 0x65,
|
||||
0x72, 0x74, 0x65, 0x78, 0x20, 0x66, 0x6e, 0x20, 0x76, 0x73, 0x5f, 0x6d,
|
||||
0x61, 0x69, 0x6e, 0x28, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x28, 0x30, 0x29, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x3a, 0x20, 0x76, 0x65, 0x63, 0x32, 0x66, 0x29, 0x20, 0x2d, 0x3e,
|
||||
0x20, 0x40, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x28, 0x70, 0x6f,
|
||||
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x29, 0x20, 0x76, 0x65, 0x63, 0x34,
|
||||
0x66, 0x20, 0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74,
|
||||
0x40, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x28, 0x30, 0x29, 0x20,
|
||||
0x76, 0x61, 0x72, 0x20, 0x73, 0x64, 0x66, 0x20, 0x3a, 0x20, 0x74, 0x65,
|
||||
0x78, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x32, 0x64, 0x3c, 0x66, 0x33, 0x32,
|
||||
0x3e, 0x3b, 0x0d, 0x0a, 0x40, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x28, 0x31,
|
||||
0x29, 0x20, 0x40, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x28, 0x31,
|
||||
0x29, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x64, 0x66, 0x5f, 0x73, 0x61,
|
||||
0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x3a, 0x20, 0x73, 0x61, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x72, 0x3b, 0x0d, 0x0a, 0x0d, 0x0a, 0x40, 0x76, 0x65, 0x72,
|
||||
0x74, 0x65, 0x78, 0x20, 0x66, 0x6e, 0x20, 0x76, 0x73, 0x5f, 0x6d, 0x61,
|
||||
0x69, 0x6e, 0x28, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x28, 0x30, 0x29, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x3a, 0x20, 0x76, 0x65, 0x63, 0x32, 0x66, 0x29, 0x20, 0x2d, 0x3e, 0x20,
|
||||
0x40, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x28, 0x70, 0x6f, 0x73,
|
||||
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x29, 0x20, 0x76, 0x65, 0x63, 0x34, 0x66,
|
||||
0x0d, 0x0a, 0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74,
|
||||
0x75, 0x72, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x34, 0x66, 0x28, 0x70, 0x6f,
|
||||
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c,
|
||||
0x20, 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x75, 0x6e, 0x69, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x6d, 0x76, 0x70, 0x3b, 0x0d, 0x0a, 0x7d,
|
||||
0x0d, 0x0a, 0x0d, 0x0a, 0x40, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x20, 0x66, 0x6e, 0x20, 0x66, 0x73, 0x5f, 0x6d, 0x61, 0x69, 0x6e,
|
||||
0x28, 0x29, 0x20, 0x2d, 0x3e, 0x20, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x28, 0x30, 0x29, 0x20, 0x76, 0x65, 0x63, 0x34, 0x66,
|
||||
0x20, 0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75,
|
||||
0x72, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x34, 0x66, 0x28, 0x31, 0x2e, 0x30,
|
||||
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20,
|
||||
0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0d, 0x0a, 0x7d
|
||||
0x28, 0x40, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x28, 0x70, 0x6f,
|
||||
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x29, 0x20, 0x70, 0x6f, 0x73, 0x69,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x76, 0x65, 0x63, 0x34, 0x66, 0x29,
|
||||
0x20, 0x2d, 0x3e, 0x20, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x28, 0x30, 0x29, 0x20, 0x76, 0x65, 0x63, 0x34, 0x66, 0x0d, 0x0a,
|
||||
0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
|
||||
0x6e, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x53, 0x61, 0x6d,
|
||||
0x70, 0x6c, 0x65, 0x28, 0x73, 0x64, 0x66, 0x2c, 0x20, 0x73, 0x64, 0x66,
|
||||
0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x70, 0x6f,
|
||||
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0d,
|
||||
0x0a, 0x7d
|
||||
};
|
||||
unsigned int src_shaders_display_wgsl_len = 668;
|
||||
unsigned int src_shaders_display_wgsl_len = 518;
|
||||
|
||||
66
src/main.c
66
src/main.c
@@ -85,8 +85,6 @@ static void refresh_SDF(userdata_t* ud)
|
||||
pool_view_grow(ud->compute.bindings.views[COMPUTE_VIEWIDX_tiles], sizeof(tile_task_t), tile_count, ud->scene.cache.tiles);
|
||||
pool_view_grow(ud->compute.bindings.views[COMPUTE_VIEWIDX_indices], sizeof(uint32_t), ud->scene.cache.num_indices, ud->scene.cache.indices);
|
||||
|
||||
ud->compute.bindings.views[COMPUTE_VIEWIDX_SDF] = ud->scene.texture;
|
||||
|
||||
sg_begin_pass(&ud->compute.pass);
|
||||
sg_apply_pipeline(ud->compute.pipeline);
|
||||
sg_apply_bindings(&ud->compute.bindings);
|
||||
@@ -139,7 +137,7 @@ static void frame(void* _userdata)
|
||||
userdata_t* ud = (userdata_t*) _userdata;
|
||||
|
||||
ud->renderer.uniforms.frame = sapp_frame_count();
|
||||
ud->renderer.uniforms.time += sapp_frame_duration_unfiltered();
|
||||
ud->renderer.uniforms.time += (uint32_t) ceil(sapp_frame_duration_unfiltered() / 1000.0f);
|
||||
|
||||
refresh_SDF(ud);
|
||||
|
||||
@@ -157,12 +155,10 @@ static void frame(void* _userdata)
|
||||
igText("%.3fms", sapp_frame_duration_unfiltered() * 1000);
|
||||
igEnd();
|
||||
|
||||
ud->renderer.uniforms.frame = sapp_frame_count();
|
||||
ud->renderer.uniforms.time += (uint32_t) ceil(sapp_frame_duration_unfiltered() / 1000.0f);
|
||||
sg_apply_pipeline(ud->renderer.pipeline);
|
||||
sg_apply_uniforms(0, &SG_RANGE(ud->renderer.uniforms));
|
||||
sg_apply_bindings(&ud->renderer.bindings);
|
||||
sg_draw(0, 4, 1);
|
||||
sg_draw(0, 6, 1);
|
||||
|
||||
simgui_render();
|
||||
sg_end_pass();
|
||||
@@ -315,7 +311,7 @@ static void init(void* _userdata)
|
||||
}),
|
||||
},
|
||||
}),
|
||||
.views[COMPUTE_VIEWIDX_SDF] = (sg_view) {0},
|
||||
.views[COMPUTE_VIEWIDX_SDF] = ud->scene.texture,
|
||||
},
|
||||
.pass = { .compute = true, .label = "Compute Pass" }
|
||||
};
|
||||
@@ -345,35 +341,14 @@ static void init(void* _userdata)
|
||||
.base_type = SG_SHADERATTRBASETYPE_FLOAT,
|
||||
},
|
||||
.views = {
|
||||
[DISPLAY_VIEWIDX_tiles] = {
|
||||
.storage_buffer = {
|
||||
.stage = SG_SHADERSTAGE_FRAGMENT,
|
||||
.wgsl_group1_binding_n = DISPLAY_VIEWIDX_tiles,
|
||||
.readonly = true,
|
||||
}
|
||||
},
|
||||
[DISPLAY_VIEWIDX_SDF] = {
|
||||
.texture = {
|
||||
.image_type = SG_IMAGETYPE_ARRAY,
|
||||
.image_type = SG_IMAGETYPE_2D,
|
||||
.stage = SG_SHADERSTAGE_FRAGMENT,
|
||||
.wgsl_group1_binding_n = DISPLAY_VIEWIDX_SDF,
|
||||
.sample_type = SG_IMAGESAMPLETYPE_FLOAT,
|
||||
}
|
||||
}
|
||||
},
|
||||
.samplers = {
|
||||
[0] = {
|
||||
.sampler_type = SG_SAMPLERTYPE_FILTERING,
|
||||
.stage = SG_SHADERSTAGE_FRAGMENT,
|
||||
.wgsl_group1_binding_n = DISPLAY_VIEWIDX_Sampler,
|
||||
}
|
||||
},
|
||||
.texture_sampler_pairs = {
|
||||
[0] = {
|
||||
.sampler_slot = 0,
|
||||
.view_slot = DISPLAY_VIEWIDX_SDF,
|
||||
.stage = SG_SHADERSTAGE_FRAGMENT,
|
||||
}
|
||||
},
|
||||
.uniform_blocks = {
|
||||
[0] = {
|
||||
@@ -383,8 +358,18 @@ static void init(void* _userdata)
|
||||
},
|
||||
},
|
||||
.label = "Display Shader",
|
||||
.samplers[DISPLAY_VIEWIDX_Sampler] = {
|
||||
.sampler_type = SG_SAMPLERTYPE_FILTERING,
|
||||
.stage = SG_SHADERSTAGE_FRAGMENT,
|
||||
.wgsl_group1_binding_n = DISPLAY_VIEWIDX_Sampler,
|
||||
},
|
||||
.texture_sampler_pairs[0] = {
|
||||
.sampler_slot = DISPLAY_VIEWIDX_Sampler,
|
||||
.view_slot = DISPLAY_VIEWIDX_SDF,
|
||||
.stage = SG_SHADERSTAGE_FRAGMENT,
|
||||
},
|
||||
}),
|
||||
.cull_mode = SG_CULLMODE_FRONT,
|
||||
.cull_mode = SG_CULLMODE_NONE,
|
||||
.index_type = SG_INDEXTYPE_UINT16,
|
||||
.layout.attrs = {
|
||||
[0].format = SG_VERTEXFORMAT_FLOAT2,
|
||||
@@ -395,18 +380,27 @@ static void init(void* _userdata)
|
||||
.index_buffer = sg_make_buffer(&(sg_buffer_desc) {
|
||||
.label = "Index buffer",
|
||||
.usage.index_buffer = true,
|
||||
.size = sizeof(uint16_t),
|
||||
.size = sizeof(indices),
|
||||
.data = SG_RANGE(indices),
|
||||
}),
|
||||
.vertex_buffers = sg_make_buffer(&(sg_buffer_desc) {
|
||||
.vertex_buffers = {
|
||||
[0] = sg_make_buffer(&(sg_buffer_desc) {
|
||||
.label = "Vertex buffer",
|
||||
.usage.vertex_buffer = true,
|
||||
.size = sizeof(vec2),
|
||||
.size = sizeof(quad),
|
||||
.data = SG_RANGE(quad),
|
||||
}),
|
||||
})
|
||||
},
|
||||
.views = {
|
||||
[DISPLAY_VIEWIDX_tiles] = ud->compute.bindings.views[COMPUTE_VIEWIDX_tiles],
|
||||
[DISPLAY_VIEWIDX_SDF] = ud->compute.bindings.views[COMPUTE_VIEWIDX_SDF],
|
||||
[DISPLAY_VIEWIDX_SDF] = sg_make_view(&(sg_view_desc) {
|
||||
.texture.image = sg_query_view_image(ud->scene.texture),
|
||||
.label = "SDF texture view",
|
||||
}),
|
||||
},
|
||||
.samplers = {
|
||||
[DISPLAY_VIEWIDX_Sampler] = sg_make_sampler(&(sg_sampler_desc) {
|
||||
.label = "SDF sampler",
|
||||
}),
|
||||
}
|
||||
},
|
||||
.uniforms = {
|
||||
|
||||
@@ -3,24 +3,18 @@ struct Uniforms {
|
||||
frame: u32,
|
||||
mvp: mat4x4f,
|
||||
}
|
||||
struct Tile {
|
||||
world_min: vec2f,
|
||||
world_max: vec2f,
|
||||
offset: u32,
|
||||
circle_count: u32,
|
||||
count: u32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
|
||||
|
||||
@group(1) @binding(0) var<storage> tiles: array<Tile>;
|
||||
@group(1) @binding(1) var sdf_buffer : texture_storage_2d<r16float, read>;
|
||||
@group(1) @binding(2) var sdf_sampler: sampler;
|
||||
@group(1) @binding(0) var sdf : texture_2d<f32>;
|
||||
@group(1) @binding(1) var sdf_sampler : sampler;
|
||||
|
||||
@vertex fn vs_main(@location(0) position: vec2f) -> @builtin(position) vec4f {
|
||||
@vertex fn vs_main(@location(0) position: vec2f) -> @builtin(position) vec4f
|
||||
{
|
||||
return vec4f(position, 0.0, 1.0) * uniforms.mvp;
|
||||
}
|
||||
|
||||
@fragment fn fs_main() -> @location(0) vec4f {
|
||||
return vec4f(1.0, 0.0, 0.0, 1.0);
|
||||
@fragment fn fs_main(@builtin(position) position: vec4f) -> @location(0) vec4f
|
||||
{
|
||||
return textureSample(sdf, sdf_sampler, position.xy);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ static uint32_t scene_init(scene_t* s, vec2 world_size) {
|
||||
s->world_size = world_size;
|
||||
s->texture = sg_make_view(&(sg_view_desc) {
|
||||
.label = "SDF tiles view",
|
||||
.texture = {
|
||||
.storage_image = {
|
||||
.image = sg_make_image(&(sg_image_desc) {
|
||||
.width = (uint32_t) ceilf(world_size.x),
|
||||
.height = (uint32_t) ceilf(world_size.y),
|
||||
|
||||
Reference in New Issue
Block a user