fwk: sync up

main
Dominik Madarász 2023-09-11 12:23:33 +02:00
parent afd2399ec0
commit 5841bfbff2
8 changed files with 72 additions and 42 deletions

View File

@ -20,12 +20,12 @@
// status: CUBE(1)+BLUR(1): ok // status: CUBE(1)+BLUR(1): ok
// status: CUBE(1)+BLUR(0): ok // status: CUBE(1)+BLUR(0): ok
// status: CUBE(?)+BLUR(?): no { // status: CUBE(?)+BLUR(?): no {
// 003.470s|!cannot find uniform 'shadowMap' in shader program 21 |shader_uniform|fwk_render.c:772 // 003.470s|!cannot find uniform 'shadowMap' in shader program 21 |shader_uniform|v4k_render.c:772
// 001: 00007FF7AF6A3FDA callstack (C:\prj\thread\FWK\fwk_system.c:250) // 001: 00007FF7AF6A3FDA callstack (C:\prj\thread\V4K\v4k_system.c:250)
// 002: 00007FF7AF8E7CBC shader_uniform (C:\prj\thread\FWK\fwk_render.c:772) // 002: 00007FF7AF8E7CBC shader_uniform (C:\prj\thread\V4K\v4k_render.c:772)
// 003: 00007FF7AF691C27 shader_int (C:\prj\thread\FWK\fwk_render.c:777) // 003: 00007FF7AF691C27 shader_int (C:\prj\thread\V4K\v4k_render.c:777)
// 004: 00007FF7AF8F54EF color_begin (C:\prj\thread\FWK\spot.c:525) // 004: 00007FF7AF8F54EF color_begin (C:\prj\thread\V4K\spot.c:525)
// 005: 00007FF7AF8F5BF7 main (C:\prj\thread\FWK\spot.c:607) // 005: 00007FF7AF8F5BF7 main (C:\prj\thread\V4K\spot.c:607)
// } // }
#ifndef VSMCUBE #ifndef VSMCUBE

View File

@ -2360,7 +2360,7 @@ int texture_width;
void shader_colormap(const char *name, colormap_t cm); void shader_colormap(const char *name, colormap_t cm);
unsigned shader_get_active(); unsigned shader_get_active();
void shader_destroy(unsigned shader); void shader_destroy(unsigned shader);
enum BUFFER_ACCESS_MODE { enum BUFFER_MODE {
BUFFER_READ, BUFFER_READ,
BUFFER_WRITE, BUFFER_WRITE,
BUFFER_READ_WRITE BUFFER_READ_WRITE
@ -2371,7 +2371,7 @@ BUFFER_READ_WRITE
void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access); void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
void image_write_barrier(); void image_write_barrier();
void write_barrier(); void write_barrier();
enum SSBO_USAGE_MODE { enum SSBO_USAGE {
STATIC_DRAW, STATIC_DRAW,
STATIC_READ, STATIC_READ,
STATIC_COPY, STATIC_COPY,

View File

@ -16491,14 +16491,13 @@ API void shader_colormap(const char *name, colormap_t cm);
API unsigned shader_get_active(); API unsigned shader_get_active();
API void shader_destroy(unsigned shader); API void shader_destroy(unsigned shader);
enum BUFFER_ACCESS_MODE { // compute shaders
enum BUFFER_MODE {
BUFFER_READ, BUFFER_READ,
BUFFER_WRITE, BUFFER_WRITE,
BUFFER_READ_WRITE BUFFER_READ_WRITE
}; };
// compute shaders
/// Loads the compute shader and compiles a GL program. /// Loads the compute shader and compiles a GL program.
/// return: GL program, 0 if failed. /// return: GL program, 0 if failed.
/// cs: shader source code /// cs: shader source code
@ -16517,7 +16516,7 @@ API void compute_dispatch(unsigned wx, unsigned wy, unsigned wz);
/// level: texture level access (MIP0, MIP1, ...) /// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer /// layer: bind layer
/// access: texture access policy /// access: texture access policy
/// see: ACCESS_MODE /// see: BUFFER_MODE
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access); API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access);
/// Binds a texture to the program /// Binds a texture to the program
@ -16528,7 +16527,7 @@ API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, uns
/// layer: bind layer /// layer: bind layer
/// texel_type: image texel format (RGBA8, RGBA32F, ...) /// texel_type: image texel format (RGBA8, RGBA32F, ...)
/// access: texture access policy /// access: texture access policy
/// see: ACCESS_MODE /// see: BUFFER_MODE
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access); API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
// gpu memory barriers // gpu memory barriers
@ -16544,7 +16543,7 @@ API void write_barrier();
/// `DRAW` favors CPU->GPU operations. /// `DRAW` favors CPU->GPU operations.
/// `READ` favors GPU->CPU operations. /// `READ` favors GPU->CPU operations.
/// `COPY` favors CPU->GPU->CPU operations. /// `COPY` favors CPU->GPU->CPU operations.
enum SSBO_USAGE_MODE { enum SSBO_USAGE {
STATIC_DRAW, STATIC_DRAW,
STATIC_READ, STATIC_READ,
STATIC_COPY, STATIC_COPY,
@ -16569,7 +16568,7 @@ enum SSBO_ACCESS {
/// data: optional pointer to data to upload /// data: optional pointer to data to upload
/// len: buffer size, must not be 0 /// len: buffer size, must not be 0
/// usage: buffer usage policy /// usage: buffer usage policy
/// see: USAGE_MODE /// see: SSBO_USAGE
API unsigned ssbo_create(const void *data, int len, unsigned usage); API unsigned ssbo_create(const void *data, int len, unsigned usage);
/// Destroys an SSBO resource /// Destroys an SSBO resource
@ -16591,7 +16590,7 @@ API void ssbo_bind(unsigned ssbo, unsigned unit);
/// !!! Make sure to `ssbo_unmap` the buffer once done working with it. /// !!! Make sure to `ssbo_unmap` the buffer once done working with it.
/// access: buffer access policy /// access: buffer access policy
/// return: pointer to physical memory of the buffer /// return: pointer to physical memory of the buffer
/// see: ACCESS_MODE /// see: SSBO_ACCESS
API void *ssbo_map(unsigned access); API void *ssbo_map(unsigned access);
/// Unmaps an SSBO resource /// Unmaps an SSBO resource
@ -333729,13 +333728,15 @@ void vfs_reload() {
// mount virtual filesystems later (mounting order matters: low -> to -> high priority) // mount virtual filesystems later (mounting order matters: low -> to -> high priority)
#if defined(EMSCRIPTEN) #if defined(EMSCRIPTEN)
vfs_mount("index.zip");
#else
/* // old way
for( int i = 0; i < JOBS_MAX; ++i) { for( int i = 0; i < JOBS_MAX; ++i) {
if( vfs_mount(va(".art[%02x].zip", i)) ) continue; if( vfs_mount(va(".art[%02x].zip", i)) ) continue;
if( vfs_mount(va("%s[%02x].zip", app, i)) ) continue; if( vfs_mount(va("%s[%02x].zip", app, i)) ) continue;
if( vfs_mount(va("%s%02x.zip", app, i)) ) continue; if( vfs_mount(va("%s%02x.zip", app, i)) ) continue;
// if( vfs_mount(va("%s.%02x", app, i)) ) continue; // if( vfs_mount(va("%s.%02x", app, i)) ) continue;
} } */
#else
// faster way // faster way
for( const char **file = file_list("./","*.zip"); *file; ++file) vfs_mount(*file); for( const char **file = file_list("./","*.zip"); *file; ++file) vfs_mount(*file);
#endif #endif
@ -334016,6 +334017,15 @@ if( found && *found == 0 ) {
last_size = size; last_size = size;
} }
// yet another last resort: redirect vfs_load() calls to file_load()
// (for environments without tools or cooked assets)
if(!ptr) {
static bool have_tools; do_once have_tools = file_exist(COOK_INI);
if( !have_tools ) {
ptr = file_load(pathfile, size_out);
}
}
if(!ptr) { if(!ptr) {
PRINTF("Loading %s (not found)\n", pathfile); PRINTF("Loading %s (not found)\n", pathfile);
} }

View File

@ -516,13 +516,15 @@ void vfs_reload() {
// mount virtual filesystems later (mounting order matters: low -> to -> high priority) // mount virtual filesystems later (mounting order matters: low -> to -> high priority)
#if defined(EMSCRIPTEN) #if defined(EMSCRIPTEN)
vfs_mount("index.zip");
#else
/* // old way
for( int i = 0; i < JOBS_MAX; ++i) { for( int i = 0; i < JOBS_MAX; ++i) {
if( vfs_mount(va(".art[%02x].zip", i)) ) continue; if( vfs_mount(va(".art[%02x].zip", i)) ) continue;
if( vfs_mount(va("%s[%02x].zip", app, i)) ) continue; if( vfs_mount(va("%s[%02x].zip", app, i)) ) continue;
if( vfs_mount(va("%s%02x.zip", app, i)) ) continue; if( vfs_mount(va("%s%02x.zip", app, i)) ) continue;
// if( vfs_mount(va("%s.%02x", app, i)) ) continue; // if( vfs_mount(va("%s.%02x", app, i)) ) continue;
} } */
#else
// faster way // faster way
for( const char **file = file_list("./","*.zip"); *file; ++file) vfs_mount(*file); for( const char **file = file_list("./","*.zip"); *file; ++file) vfs_mount(*file);
#endif #endif
@ -803,6 +805,15 @@ if( found && *found == 0 ) {
last_size = size; last_size = size;
} }
// yet another last resort: redirect vfs_load() calls to file_load()
// (for environments without tools or cooked assets)
if(!ptr) {
static bool have_tools; do_once have_tools = file_exist(COOK_INI);
if( !have_tools ) {
ptr = file_load(pathfile, size_out);
}
}
if(!ptr) { if(!ptr) {
PRINTF("Loading %s (not found)\n", pathfile); PRINTF("Loading %s (not found)\n", pathfile);
} }

View File

@ -335,14 +335,13 @@ API void shader_colormap(const char *name, colormap_t cm);
API unsigned shader_get_active(); API unsigned shader_get_active();
API void shader_destroy(unsigned shader); API void shader_destroy(unsigned shader);
enum BUFFER_ACCESS_MODE { // compute shaders
enum BUFFER_MODE {
BUFFER_READ, BUFFER_READ,
BUFFER_WRITE, BUFFER_WRITE,
BUFFER_READ_WRITE BUFFER_READ_WRITE
}; };
// compute shaders
/// Loads the compute shader and compiles a GL program. /// Loads the compute shader and compiles a GL program.
/// return: GL program, 0 if failed. /// return: GL program, 0 if failed.
/// cs: shader source code /// cs: shader source code
@ -361,7 +360,7 @@ API void compute_dispatch(unsigned wx, unsigned wy, unsigned wz);
/// level: texture level access (MIP0, MIP1, ...) /// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer /// layer: bind layer
/// access: texture access policy /// access: texture access policy
/// see: ACCESS_MODE /// see: BUFFER_MODE
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access); API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access);
/// Binds a texture to the program /// Binds a texture to the program
@ -372,7 +371,7 @@ API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, uns
/// layer: bind layer /// layer: bind layer
/// texel_type: image texel format (RGBA8, RGBA32F, ...) /// texel_type: image texel format (RGBA8, RGBA32F, ...)
/// access: texture access policy /// access: texture access policy
/// see: ACCESS_MODE /// see: BUFFER_MODE
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access); API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
// gpu memory barriers // gpu memory barriers
@ -388,7 +387,7 @@ API void write_barrier();
/// `DRAW` favors CPU->GPU operations. /// `DRAW` favors CPU->GPU operations.
/// `READ` favors GPU->CPU operations. /// `READ` favors GPU->CPU operations.
/// `COPY` favors CPU->GPU->CPU operations. /// `COPY` favors CPU->GPU->CPU operations.
enum SSBO_USAGE_MODE { enum SSBO_USAGE {
STATIC_DRAW, STATIC_DRAW,
STATIC_READ, STATIC_READ,
STATIC_COPY, STATIC_COPY,
@ -413,7 +412,7 @@ enum SSBO_ACCESS {
/// data: optional pointer to data to upload /// data: optional pointer to data to upload
/// len: buffer size, must not be 0 /// len: buffer size, must not be 0
/// usage: buffer usage policy /// usage: buffer usage policy
/// see: USAGE_MODE /// see: SSBO_USAGE
API unsigned ssbo_create(const void *data, int len, unsigned usage); API unsigned ssbo_create(const void *data, int len, unsigned usage);
/// Destroys an SSBO resource /// Destroys an SSBO resource
@ -435,7 +434,7 @@ API void ssbo_bind(unsigned ssbo, unsigned unit);
/// !!! Make sure to `ssbo_unmap` the buffer once done working with it. /// !!! Make sure to `ssbo_unmap` the buffer once done working with it.
/// access: buffer access policy /// access: buffer access policy
/// return: pointer to physical memory of the buffer /// return: pointer to physical memory of the buffer
/// see: ACCESS_MODE /// see: SSBO_ACCESS
API void *ssbo_map(unsigned access); API void *ssbo_map(unsigned access);
/// Unmaps an SSBO resource /// Unmaps an SSBO resource

View File

@ -4638,13 +4638,15 @@ void vfs_reload() {
// mount virtual filesystems later (mounting order matters: low -> to -> high priority) // mount virtual filesystems later (mounting order matters: low -> to -> high priority)
#if defined(EMSCRIPTEN) #if defined(EMSCRIPTEN)
vfs_mount("index.zip");
#else
/* // old way
for( int i = 0; i < JOBS_MAX; ++i) { for( int i = 0; i < JOBS_MAX; ++i) {
if( vfs_mount(va(".art[%02x].zip", i)) ) continue; if( vfs_mount(va(".art[%02x].zip", i)) ) continue;
if( vfs_mount(va("%s[%02x].zip", app, i)) ) continue; if( vfs_mount(va("%s[%02x].zip", app, i)) ) continue;
if( vfs_mount(va("%s%02x.zip", app, i)) ) continue; if( vfs_mount(va("%s%02x.zip", app, i)) ) continue;
// if( vfs_mount(va("%s.%02x", app, i)) ) continue; // if( vfs_mount(va("%s.%02x", app, i)) ) continue;
} } */
#else
// faster way // faster way
for( const char **file = file_list("./","*.zip"); *file; ++file) vfs_mount(*file); for( const char **file = file_list("./","*.zip"); *file; ++file) vfs_mount(*file);
#endif #endif
@ -4925,6 +4927,15 @@ if( found && *found == 0 ) {
last_size = size; last_size = size;
} }
// yet another last resort: redirect vfs_load() calls to file_load()
// (for environments without tools or cooked assets)
if(!ptr) {
static bool have_tools; do_once have_tools = file_exist(COOK_INI);
if( !have_tools ) {
ptr = file_load(pathfile, size_out);
}
}
if(!ptr) { if(!ptr) {
PRINTF("Loading %s (not found)\n", pathfile); PRINTF("Loading %s (not found)\n", pathfile);
} }

View File

@ -2574,14 +2574,13 @@ API void shader_colormap(const char *name, colormap_t cm);
API unsigned shader_get_active(); API unsigned shader_get_active();
API void shader_destroy(unsigned shader); API void shader_destroy(unsigned shader);
enum BUFFER_ACCESS_MODE { // compute shaders
enum BUFFER_MODE {
BUFFER_READ, BUFFER_READ,
BUFFER_WRITE, BUFFER_WRITE,
BUFFER_READ_WRITE BUFFER_READ_WRITE
}; };
// compute shaders
/// Loads the compute shader and compiles a GL program. /// Loads the compute shader and compiles a GL program.
/// return: GL program, 0 if failed. /// return: GL program, 0 if failed.
/// cs: shader source code /// cs: shader source code
@ -2600,7 +2599,7 @@ API void compute_dispatch(unsigned wx, unsigned wy, unsigned wz);
/// level: texture level access (MIP0, MIP1, ...) /// level: texture level access (MIP0, MIP1, ...)
/// layer: bind layer /// layer: bind layer
/// access: texture access policy /// access: texture access policy
/// see: ACCESS_MODE /// see: BUFFER_MODE
API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access); API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, unsigned access);
/// Binds a texture to the program /// Binds a texture to the program
@ -2611,7 +2610,7 @@ API void shader_image(texture_t t, unsigned unit, unsigned level, int layer, uns
/// layer: bind layer /// layer: bind layer
/// texel_type: image texel format (RGBA8, RGBA32F, ...) /// texel_type: image texel format (RGBA8, RGBA32F, ...)
/// access: texture access policy /// access: texture access policy
/// see: ACCESS_MODE /// see: BUFFER_MODE
API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access); API void shader_image_unit(unsigned texture, unsigned unit, unsigned level, int layer, unsigned texel_type, unsigned access);
// gpu memory barriers // gpu memory barriers
@ -2627,7 +2626,7 @@ API void write_barrier();
/// `DRAW` favors CPU->GPU operations. /// `DRAW` favors CPU->GPU operations.
/// `READ` favors GPU->CPU operations. /// `READ` favors GPU->CPU operations.
/// `COPY` favors CPU->GPU->CPU operations. /// `COPY` favors CPU->GPU->CPU operations.
enum SSBO_USAGE_MODE { enum SSBO_USAGE {
STATIC_DRAW, STATIC_DRAW,
STATIC_READ, STATIC_READ,
STATIC_COPY, STATIC_COPY,
@ -2652,7 +2651,7 @@ enum SSBO_ACCESS {
/// data: optional pointer to data to upload /// data: optional pointer to data to upload
/// len: buffer size, must not be 0 /// len: buffer size, must not be 0
/// usage: buffer usage policy /// usage: buffer usage policy
/// see: USAGE_MODE /// see: SSBO_USAGE
API unsigned ssbo_create(const void *data, int len, unsigned usage); API unsigned ssbo_create(const void *data, int len, unsigned usage);
/// Destroys an SSBO resource /// Destroys an SSBO resource
@ -2674,7 +2673,7 @@ API void ssbo_bind(unsigned ssbo, unsigned unit);
/// !!! Make sure to `ssbo_unmap` the buffer once done working with it. /// !!! Make sure to `ssbo_unmap` the buffer once done working with it.
/// access: buffer access policy /// access: buffer access policy
/// return: pointer to physical memory of the buffer /// return: pointer to physical memory of the buffer
/// see: ACCESS_MODE /// see: SSBO_ACCESS
API void *ssbo_map(unsigned access); API void *ssbo_map(unsigned access);
/// Unmaps an SSBO resource /// Unmaps an SSBO resource

View File

@ -1,4 +1,4 @@
; this is where you specify and configure the FWK pipeline. ; this is where you specify and configure the V4K pipeline.
; tweak the pipeline and add new importers just by editing this file. ; tweak the pipeline and add new importers just by editing this file.
; there is no flow control in this script file: lines are parsed and evaluated, from top to bottom. ; there is no flow control in this script file: lines are parsed and evaluated, from top to bottom.