update ark + fix omp parallel for deadlock

main
Dominik Madarász 2023-10-14 22:00:30 +02:00
parent 64a7eade9f
commit 759ace3441
8 changed files with 57 additions and 42 deletions

@ -1 +1 @@
Subproject commit 494a0e216d2b4984065994372960d15f197c1e07
Subproject commit 157a5b6b152ab165a72a98ab9e05f4d47ad0b0de

View File

@ -336624,6 +336624,7 @@ void vfs_reload() {
// vfs_resolve() will use these art_folder locations as hints when cook-on-demand is in progress.
// cook-on-demand will not be able to resolve a virtual pathfile if there are no cooked assets on disk,
// unless there is a record of what's actually on disk somewhere, and that's where the hints belong to.
if( COOK_ON_DEMAND )
for each_substring(ART,",",art_folder) {
vfs_mount_hints(art_folder);
}
@ -336659,6 +336660,8 @@ void ark_list( const char *infile, zip **z ) {
static
bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) {
const char *path_bak = path;
zip *z = NULL; tar *t = NULL; pak *p = NULL; dir *d = NULL;
int is_folder = ('/' == path[strlen(path)-1]);
if( is_folder ) d = dir_open(path, "rb");
@ -336702,6 +336705,8 @@ bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) {
// append to list
array_push(*entries, (struct vfs_entry){filename, fileid, filesize});
}
PRINTF("Mounted VFS volume '%s' (%u entries)\n", path_bak, fn_count[dir->type](dir->archive) );
}
return 1;
@ -347154,22 +347159,22 @@ int postfx_load_from_mem( postfx *fx, const char *name, const char *fs ) {
passfx *p = &fx->pass[ slot & 63 ];
p->name = STRDUP(name);
const char *vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
// patch fragment
char *fs2 = (char*)CALLOC(1, 128*1024);
strcat(fs2, vfs_read("shaders/fs_2_4_preamble.glsl"));
if( strstr(fs, "mainImage") ) {
strcat(fs2, vfs_read("shaders/fs_main_shadertoy.glsl") );
// preload stuff
static const char *vs = 0;
static const char *preamble = 0;
static const char *shadertoy = 0;
static char *fs2 = 0;
do_once {
vs = STRDUP(vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl"));
preamble = STRDUP(vfs_read("shaders/fs_2_4_preamble.glsl"));
shadertoy = STRDUP(vfs_read("shaders/fs_main_shadertoy.glsl"));
fs2 = (char*)CALLOC(1, 128*1024);
}
strcat(fs2, fs);
// patch fragment
snprintf(fs2, 128*1024, "%s%s%s", preamble, strstr(fs, "mainImage") ? shadertoy : "", fs );
p->program = shader(vs, fs2, "vtexcoord", "fragColor" , NULL);
FREE(fs2);
glUseProgram(p->program); // needed?
for( int i = 0; i < countof(p->uniforms); ++i ) p->uniforms[i] = -1;
@ -357016,8 +357021,8 @@ static void v4k_post_init(float refresh_rate) {
for( i = 0; i <= 2; ++i ) {
if(i == 0) ui_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up
if(i == 0) scene_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up
if(i == 0) window_icon(va("%s.png", app_name()));
if(i == 1) input_init();
if(i == 2) window_icon(va("%s.png", app_name()));
}
// display window

View File

@ -600,6 +600,7 @@ void vfs_reload() {
// vfs_resolve() will use these art_folder locations as hints when cook-on-demand is in progress.
// cook-on-demand will not be able to resolve a virtual pathfile if there are no cooked assets on disk,
// unless there is a record of what's actually on disk somewhere, and that's where the hints belong to.
if( COOK_ON_DEMAND )
for each_substring(ART,",",art_folder) {
vfs_mount_hints(art_folder);
}
@ -635,6 +636,8 @@ void ark_list( const char *infile, zip **z ) {
static
bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) {
const char *path_bak = path;
zip *z = NULL; tar *t = NULL; pak *p = NULL; dir *d = NULL;
int is_folder = ('/' == path[strlen(path)-1]);
if( is_folder ) d = dir_open(path, "rb");
@ -678,6 +681,8 @@ bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) {
// append to list
array_push(*entries, (struct vfs_entry){filename, fileid, filesize});
}
PRINTF("Mounted VFS volume '%s' (%u entries)\n", path_bak, fn_count[dir->type](dir->archive) );
}
return 1;

View File

@ -32,8 +32,8 @@ static void v4k_post_init(float refresh_rate) {
for( i = 0; i <= 2; ++i ) {
if(i == 0) ui_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up
if(i == 0) scene_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up
if(i == 0) window_icon(va("%s.png", app_name()));
if(i == 1) input_init();
if(i == 2) window_icon(va("%s.png", app_name()));
}
// display window

View File

@ -3228,22 +3228,22 @@ int postfx_load_from_mem( postfx *fx, const char *name, const char *fs ) {
passfx *p = &fx->pass[ slot & 63 ];
p->name = STRDUP(name);
const char *vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
// patch fragment
char *fs2 = (char*)CALLOC(1, 128*1024);
strcat(fs2, vfs_read("shaders/fs_2_4_preamble.glsl"));
if( strstr(fs, "mainImage") ) {
strcat(fs2, vfs_read("shaders/fs_main_shadertoy.glsl") );
// preload stuff
static const char *vs = 0;
static const char *preamble = 0;
static const char *shadertoy = 0;
static char *fs2 = 0;
do_once {
vs = STRDUP(vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl"));
preamble = STRDUP(vfs_read("shaders/fs_2_4_preamble.glsl"));
shadertoy = STRDUP(vfs_read("shaders/fs_main_shadertoy.glsl"));
fs2 = (char*)CALLOC(1, 128*1024);
}
strcat(fs2, fs);
// patch fragment
snprintf(fs2, 128*1024, "%s%s%s", preamble, strstr(fs, "mainImage") ? shadertoy : "", fs );
p->program = shader(vs, fs2, "vtexcoord", "fragColor" , NULL);
FREE(fs2);
glUseProgram(p->program); // needed?
for( int i = 0; i < countof(p->uniforms); ++i ) p->uniforms[i] = -1;

View File

@ -5586,6 +5586,7 @@ void vfs_reload() {
// vfs_resolve() will use these art_folder locations as hints when cook-on-demand is in progress.
// cook-on-demand will not be able to resolve a virtual pathfile if there are no cooked assets on disk,
// unless there is a record of what's actually on disk somewhere, and that's where the hints belong to.
if( COOK_ON_DEMAND )
for each_substring(ART,",",art_folder) {
vfs_mount_hints(art_folder);
}
@ -5621,6 +5622,8 @@ void ark_list( const char *infile, zip **z ) {
static
bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) {
const char *path_bak = path;
zip *z = NULL; tar *t = NULL; pak *p = NULL; dir *d = NULL;
int is_folder = ('/' == path[strlen(path)-1]);
if( is_folder ) d = dir_open(path, "rb");
@ -5664,6 +5667,8 @@ bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) {
// append to list
array_push(*entries, (struct vfs_entry){filename, fileid, filesize});
}
PRINTF("Mounted VFS volume '%s' (%u entries)\n", path_bak, fn_count[dir->type](dir->archive) );
}
return 1;
@ -16116,22 +16121,22 @@ int postfx_load_from_mem( postfx *fx, const char *name, const char *fs ) {
passfx *p = &fx->pass[ slot & 63 ];
p->name = STRDUP(name);
const char *vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
// patch fragment
char *fs2 = (char*)CALLOC(1, 128*1024);
strcat(fs2, vfs_read("shaders/fs_2_4_preamble.glsl"));
if( strstr(fs, "mainImage") ) {
strcat(fs2, vfs_read("shaders/fs_main_shadertoy.glsl") );
// preload stuff
static const char *vs = 0;
static const char *preamble = 0;
static const char *shadertoy = 0;
static char *fs2 = 0;
do_once {
vs = STRDUP(vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl"));
preamble = STRDUP(vfs_read("shaders/fs_2_4_preamble.glsl"));
shadertoy = STRDUP(vfs_read("shaders/fs_main_shadertoy.glsl"));
fs2 = (char*)CALLOC(1, 128*1024);
}
strcat(fs2, fs);
// patch fragment
snprintf(fs2, 128*1024, "%s%s%s", preamble, strstr(fs, "mainImage") ? shadertoy : "", fs );
p->program = shader(vs, fs2, "vtexcoord", "fragColor" , NULL);
FREE(fs2);
glUseProgram(p->program); // needed?
for( int i = 0; i < countof(p->uniforms); ++i ) p->uniforms[i] = -1;
@ -25978,8 +25983,8 @@ static void v4k_post_init(float refresh_rate) {
for( i = 0; i <= 2; ++i ) {
if(i == 0) ui_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up
if(i == 0) scene_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up
if(i == 0) window_icon(va("%s.png", app_name()));
if(i == 1) input_init();
if(i == 2) window_icon(va("%s.png", app_name()));
}
// display window

View File

@ -25,7 +25,7 @@
//
// Where, each archive-entry is {
// [zero] 472-byte aligned zero padding
// [mark] 64-bit magic id 'Ark\x1' (if \1krA is found, swap endianness)
// [mark] 64-bit magic id 'ArK1' (if 1KrA is found, swap endianness)
// [time] 64-bit time stamp in seconds (unix epoch)
// [dlen] 64-bit data length
// [hash] 64-bit data hash
@ -39,7 +39,7 @@
#include <stdlib.h>
#include <string.h>
#define ARK1 'ArK\x1'
#define ARK1 'ArK1'
#define ARK1_PADDING (512 - 40) // 472
#ifndef ARK_PRINTF

Binary file not shown.