gfx: revert shader caching
parent
e74df3477c
commit
57e55fd8f6
1
MAKE.bat
1
MAKE.bat
|
@ -170,6 +170,7 @@ rem move /y 3rd_*.? engine\split\
|
||||||
git add engine/v4k.*
|
git add engine/v4k.*
|
||||||
git add MAKE.bat
|
git add MAKE.bat
|
||||||
git add bind/v4k.lua
|
git add bind/v4k.lua
|
||||||
|
git status
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
@echo off
|
||||||
|
for %%x in (*.exe) do (
|
||||||
|
echo Running %%x...
|
||||||
|
start /wait "" "%%x"
|
||||||
|
)
|
|
@ -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);
|
return shader_geom(NULL, vs, fs, attribs, fragcolor, defines);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __thread map(unsigned, unsigned) shader_instances;
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
char *shader_preprocess(const char *src, const char *defines) {
|
char *shader_preprocess(const char *src, const char *defines) {
|
||||||
if (!src) return NULL;
|
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) {
|
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");
|
PRINTF(/*"!"*/"Compiling shader\n");
|
||||||
|
|
||||||
char *glsl_defines = "";
|
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);
|
for( int i = 0; i < array_count(props); ++i ) shader_apply_param(program, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
map_insert(shader_instances, shader_hash, program);
|
|
||||||
|
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
return shader_geom(NULL, vs, fs, attribs, fragcolor, defines);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __thread map(unsigned, unsigned) shader_instances;
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
char *shader_preprocess(const char *src, const char *defines) {
|
char *shader_preprocess(const char *src, const char *defines) {
|
||||||
if (!src) return NULL;
|
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) {
|
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");
|
PRINTF(/*"!"*/"Compiling shader\n");
|
||||||
|
|
||||||
char *glsl_defines = "";
|
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);
|
for( int i = 0; i < array_count(props); ++i ) shader_apply_param(program, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
map_insert(shader_instances, shader_hash, program);
|
|
||||||
|
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
engine/v4k.c
16
engine/v4k.c
|
@ -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);
|
return shader_geom(NULL, vs, fs, attribs, fragcolor, defines);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __thread map(unsigned, unsigned) shader_instances;
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
char *shader_preprocess(const char *src, const char *defines) {
|
char *shader_preprocess(const char *src, const char *defines) {
|
||||||
if (!src) return NULL;
|
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) {
|
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");
|
PRINTF(/*"!"*/"Compiling shader\n");
|
||||||
|
|
||||||
char *glsl_defines = "";
|
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);
|
for( int i = 0; i < array_count(props); ++i ) shader_apply_param(program, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
map_insert(shader_instances, shader_hash, program);
|
|
||||||
|
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue