gfx: revert shader caching

main
Dominik Madarász 2024-04-15 12:07:05 +02:00
parent e74df3477c
commit 57e55fd8f6
5 changed files with 6 additions and 48 deletions

View File

@ -170,6 +170,7 @@ rem move /y 3rd_*.? engine\split\
git add engine/v4k.*
git add MAKE.bat
git add bind/v4k.lua
git status
exit /b
)

5
TEST.bat 100644
View File

@ -0,0 +1,5 @@
@echo off
for %%x in (*.exe) do (
echo Running %%x...
start /wait "" "%%x"
)

View File

@ -382874,8 +382874,6 @@ unsigned shader(const char *vs, const char *fs, const char *attribs, const char
return shader_geom(NULL, vs, fs, attribs, fragcolor, defines);
}
static __thread map(unsigned, unsigned) shader_instances;
static inline
char *shader_preprocess(const char *src, const char *defines) {
if (!src) return NULL;
@ -382893,18 +382891,6 @@ char *shader_preprocess(const char *src, const char *defines) {
}
unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char *attribs, const char *fragcolor, const char *defines) {
do_once {
map_init(shader_instances, less_int, hash_int);
}
// Hash shader input and check if we already have an instance made
unsigned shader_hash = hash_str(va("%s%s%s%s%s%s", gs, vs, fs, attribs, fragcolor, defines));
unsigned *existing = map_find(shader_instances, shader_hash);
if (existing) {
PRINTF("Shader instance reused\n");
return *existing;
}
PRINTF(/*"!"*/"Compiling shader\n");
char *glsl_defines = "";
@ -383024,8 +383010,6 @@ unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char
for( int i = 0; i < array_count(props); ++i ) shader_apply_param(program, i);
}
map_insert(shader_instances, shader_hash, program);
return program;
}

View File

@ -240,8 +240,6 @@ unsigned shader(const char *vs, const char *fs, const char *attribs, const char
return shader_geom(NULL, vs, fs, attribs, fragcolor, defines);
}
static __thread map(unsigned, unsigned) shader_instances;
static inline
char *shader_preprocess(const char *src, const char *defines) {
if (!src) return NULL;
@ -259,18 +257,6 @@ char *shader_preprocess(const char *src, const char *defines) {
}
unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char *attribs, const char *fragcolor, const char *defines) {
do_once {
map_init(shader_instances, less_int, hash_int);
}
// Hash shader input and check if we already have an instance made
unsigned shader_hash = hash_str(va("%s%s%s%s%s%s", gs, vs, fs, attribs, fragcolor, defines));
unsigned *existing = map_find(shader_instances, shader_hash);
if (existing) {
PRINTF("Shader instance reused\n");
return *existing;
}
PRINTF(/*"!"*/"Compiling shader\n");
char *glsl_defines = "";
@ -390,8 +376,6 @@ unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char
for( int i = 0; i < array_count(props); ++i ) shader_apply_param(program, i);
}
map_insert(shader_instances, shader_hash, program);
return program;
}

View File

@ -17414,8 +17414,6 @@ unsigned shader(const char *vs, const char *fs, const char *attribs, const char
return shader_geom(NULL, vs, fs, attribs, fragcolor, defines);
}
static __thread map(unsigned, unsigned) shader_instances;
static inline
char *shader_preprocess(const char *src, const char *defines) {
if (!src) return NULL;
@ -17433,18 +17431,6 @@ char *shader_preprocess(const char *src, const char *defines) {
}
unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char *attribs, const char *fragcolor, const char *defines) {
do_once {
map_init(shader_instances, less_int, hash_int);
}
// Hash shader input and check if we already have an instance made
unsigned shader_hash = hash_str(va("%s%s%s%s%s%s", gs, vs, fs, attribs, fragcolor, defines));
unsigned *existing = map_find(shader_instances, shader_hash);
if (existing) {
PRINTF("Shader instance reused\n");
return *existing;
}
PRINTF(/*"!"*/"Compiling shader\n");
char *glsl_defines = "";
@ -17564,8 +17550,6 @@ unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char
for( int i = 0; i < array_count(props); ++i ) shader_apply_param(program, i);
}
map_insert(shader_instances, shader_hash, program);
return program;
}