From: divverent Date: Fri, 29 Jun 2007 07:46:15 +0000 (+0000) Subject: fix shader name in "permutation%s failed for shader %s, some features may not work... X-Git-Tag: xonotic-v0.1.0preview~3008 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=e0b75592f84fcc8051d5f6b248fa256579ea79eb fix shader name in "permutation%s failed for shader %s, some features may not work properly!" message (previously was hardcoded to glsl/default.glsl); new command r_glsl_dumpshader that dumps the engine builtin default.glsl file to glsl/default.glsl for editing and trying out stuff git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7456 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index c0bc61c3..d0f51bf0 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -807,7 +807,7 @@ void R_GLSL_CompilePermutation(const char *filename, int permutation) qglUseProgramObjectARB(0);CHECKGLERROR } else - Con_Printf("permutation%s failed for shader %s, some features may not work properly!\n", permutationname, "glsl/default.glsl"); + Con_Printf("permutation%s failed for shader %s, some features may not work properly!\n", permutationname, filename); if (shaderstring) Mem_Free(shaderstring); } @@ -821,6 +821,27 @@ void R_GLSL_Restart_f(void) memset(r_glsl_permutations, 0, sizeof(r_glsl_permutations)); } +void R_GLSL_DumpShader_f(void) +{ + int i; + + qfile_t *file = FS_Open("glsl/default.glsl", "w", false, false); + if(!file) + { + Con_Printf("failed to write to glsl/default.glsl\n"); + return; + } + + FS_Print(file, "// #define VERTEX_SHADER GEOMETRY_SHADER FRAGMENT_SHADER\n"); + for (i = 0;permutationinfo[i][0];i++) + FS_Printf(file, "// %s", permutationinfo[i][0]); + FS_Print(file, "\n"); + FS_Print(file, builtinshaderstring); + FS_Close(file); + + Con_Printf("data/default.glsl written"); +} + extern rtexture_t *r_shadow_attenuationgradienttexture; extern rtexture_t *r_shadow_attenuation2dtexture; extern rtexture_t *r_shadow_attenuation3dtexture; @@ -1490,6 +1511,7 @@ void GL_Main_Init(void) r_main_mempool = Mem_AllocPool("Renderer", 0, NULL); Cmd_AddCommand("r_glsl_restart", R_GLSL_Restart_f, "unloads GLSL shaders, they will then be reloaded as needed"); + Cmd_AddCommand("r_glsl_dumpshader", R_GLSL_DumpShader_f, "dumps the engine internal default.glsl shader into glsl/default.glsl"); // FIXME: the client should set up r_refdef.fog stuff including the fogmasktable if (gamemode == GAME_NEHAHRA) {