- Made GLSL features a compiling option...sort of
This commit is contained in:
@@ -48,6 +48,7 @@ static cvar_t *r_bloom_sky_only; // LEILEI
|
||||
extern float ScreenFrameCount;
|
||||
|
||||
static struct {
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
struct {
|
||||
image_t *texture;
|
||||
int width, height;
|
||||
@@ -129,6 +130,7 @@ static struct {
|
||||
} tveffect;
|
||||
|
||||
qboolean started;
|
||||
#endif
|
||||
} postproc;
|
||||
|
||||
|
||||
@@ -748,6 +750,7 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t
|
||||
|
||||
|
||||
static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
glslProgram_t *program;
|
||||
if (leifxmode)
|
||||
{
|
||||
@@ -871,7 +874,7 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
}
|
||||
if (vertexShaders) R_GLSL_UseProgram(0);
|
||||
GL_SelectTexture(0);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1057,6 +1060,7 @@ R_Postprocess_InitTextures
|
||||
*/
|
||||
static void R_Postprocess_InitTextures( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
byte *data;
|
||||
int vidinted = glConfig.vidHeight * 0.55f;
|
||||
int intdiv = 1;
|
||||
@@ -1174,7 +1178,7 @@ if (intdiv > 1)
|
||||
|
||||
postproc.started = qtrue;
|
||||
force32upload = 0;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1184,10 +1188,12 @@ R_InitPostprocessTextures
|
||||
*/
|
||||
void R_InitPostprocessTextures( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !postprocess )
|
||||
return;
|
||||
memset( &postproc, 0, sizeof( postproc ));
|
||||
R_Postprocess_InitTextures ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1198,14 +1204,14 @@ Backup the full original screen to a texture for downscaling and later restorati
|
||||
=================
|
||||
*/
|
||||
static void R_Postprocess_BackupScreen( void ) {
|
||||
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
GL_Bind( postproc.screen.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
|
||||
GL_Bind( postproc.depth.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1216,6 +1222,7 @@ R_PostprocessScreen
|
||||
*/
|
||||
void R_PostprocessScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !postprocess )
|
||||
return;
|
||||
if ( backEnd.donepostproc )
|
||||
@@ -1233,19 +1240,6 @@ void R_PostprocessScreen( void )
|
||||
|
||||
if ( !backEnd.projection2D )
|
||||
RB_SetGL2D();
|
||||
#if 0
|
||||
// set up full screen workspace
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglMatrixMode( GL_PROJECTION );
|
||||
qglLoadIdentity ();
|
||||
qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 );
|
||||
qglMatrixMode( GL_MODELVIEW );
|
||||
qglLoadIdentity ();
|
||||
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
#endif
|
||||
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
|
||||
@@ -1253,17 +1247,24 @@ void R_PostprocessScreen( void )
|
||||
R_Postprocess_BackupScreen();
|
||||
//Redraw texture using GLSL program
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void R_PostprocessingInit(void) {
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
memset( &postproc, 0, sizeof( postproc ));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// =================================================================
|
||||
// LEIFX FILTER EFFECTS
|
||||
//
|
||||
// Some require external GLSL scripts (placed in baseoa/glsl)
|
||||
// Some don't but are unstable on non-GL2 hardware anyway.
|
||||
//
|
||||
// =================================================================
|
||||
|
||||
|
||||
@@ -1307,6 +1308,7 @@ void R_LeiFX_Stupid_Hack (void)
|
||||
}
|
||||
void R_LeiFXPostprocessDitherScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !r_leifx->integer)
|
||||
return;
|
||||
if ( backEnd.doneleifx)
|
||||
@@ -1341,12 +1343,13 @@ void R_LeiFXPostprocessDitherScreen( void )
|
||||
}
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void R_LeiFXPostprocessFilterScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !r_leifx->integer)
|
||||
return;
|
||||
if ( backEnd.doneleifx)
|
||||
@@ -1397,19 +1400,23 @@ void R_LeiFXPostprocessFilterScreen( void )
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
// =================================================================
|
||||
// NTSC EFFECTS
|
||||
//
|
||||
// Thanks to the libretro team for their gpl ntsc shader code
|
||||
//
|
||||
// =================================================================
|
||||
|
||||
|
||||
|
||||
void R_NTSCScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !r_ntsc->integer)
|
||||
return;
|
||||
if ( backEnd.donentsc)
|
||||
@@ -1485,7 +1492,7 @@ void R_NTSCScreen( void )
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// =================================================================
|
||||
@@ -1546,6 +1553,7 @@ void R_BrightScreen( void )
|
||||
|
||||
if (r_alternateBrightness->integer == 1)
|
||||
mode = 1; // force use blend
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if (r_alternateBrightness->integer == 2)
|
||||
{
|
||||
// Automatically determine from capabilities
|
||||
@@ -1558,6 +1566,7 @@ void R_BrightScreen( void )
|
||||
// the modern pixel shader way
|
||||
if (mode == 2)
|
||||
{
|
||||
|
||||
if ( !vertexShaders )
|
||||
return; // leilei - cards without support for this should not ever activate this
|
||||
if( !postproc.started ) {
|
||||
@@ -1579,11 +1588,14 @@ void R_BrightScreen( void )
|
||||
backEnd.doneAltBrightness = qtrue;
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
}
|
||||
|
||||
// the fixed function quad blending way
|
||||
else if (mode == 1)
|
||||
#endif
|
||||
{
|
||||
|
||||
int eh, ah;
|
||||
if ((r_overBrightBits->integer))
|
||||
{
|
||||
@@ -1616,6 +1628,11 @@ void R_AltBrightnessInit( void ) {
|
||||
|
||||
// =================================================================
|
||||
// FILM POSTPROCESS
|
||||
//
|
||||
// Really a bunch of blend planes trying to really fake
|
||||
// some cinematic looks on fixed function hardware. Fillrate
|
||||
// heavy.
|
||||
//
|
||||
// =================================================================
|
||||
|
||||
void R_FilmScreen( void )
|
||||
@@ -1723,6 +1740,8 @@ void R_FilmScreen( void )
|
||||
// leilei - old 2000 console-style antialiasing/antiflickering
|
||||
void R_RetroAAScreen( void )
|
||||
{
|
||||
// this should not need glsl either, but
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !r_retroAA->integer)
|
||||
return;
|
||||
if ( backEnd.doneraa)
|
||||
@@ -1749,7 +1768,7 @@ void R_RetroAAScreen( void )
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1769,6 +1788,7 @@ void R_RetroAAScreen( void )
|
||||
|
||||
void R_AnimeScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !r_anime->integer)
|
||||
return;
|
||||
if ( backEnd.doneanime)
|
||||
@@ -1800,7 +1820,7 @@ void R_AnimeScreen( void )
|
||||
backEnd.doneanime = qtrue;
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -1819,6 +1839,7 @@ void R_AnimeScreen( void )
|
||||
|
||||
// leilei - motion blur hack
|
||||
void R_MotionBlur_BackupScreen(int which) {
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( r_motionblur->integer < 3)
|
||||
return;
|
||||
if (which == 1){ GL_Bind( postproc.motion1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // gather thee samples
|
||||
@@ -1831,13 +1852,14 @@ void R_MotionBlur_BackupScreen(int which) {
|
||||
if (which == 13){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 14){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 18){ GL_Bind( postproc.screen.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void R_MblurScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( r_motionblur->integer < 3)
|
||||
return;
|
||||
if ( backEnd.donemblur)
|
||||
@@ -1866,10 +1888,14 @@ void R_MblurScreen( void )
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
force32upload = 0;
|
||||
#else
|
||||
// NO! Use the accumulation buffer instead.
|
||||
#endif
|
||||
}
|
||||
|
||||
void R_MblurScreenPost( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( r_motionblur->integer < 3)
|
||||
return;
|
||||
if ( !backEnd.doneSurfaces )
|
||||
@@ -1895,6 +1921,9 @@ void R_MblurScreenPost( void )
|
||||
// R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
force32upload = 0;
|
||||
#else
|
||||
// NO!
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1904,7 +1933,7 @@ void R_MblurScreenPost( void )
|
||||
// =================================================================
|
||||
|
||||
static void R_Postprocess_BackupScreenTV( void ) {
|
||||
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
int intdiv;
|
||||
intdiv = 1;
|
||||
|
||||
@@ -1921,18 +1950,18 @@ static void R_Postprocess_BackupScreenTV( void ) {
|
||||
|
||||
GL_Bind( postproc.screen.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void R_Postprocess_ScaleTV( void ) {
|
||||
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglMatrixMode( GL_PROJECTION );
|
||||
qglLoadIdentity ();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1943,6 +1972,8 @@ float tvtime;
|
||||
|
||||
void R_TVScreen( void )
|
||||
{
|
||||
// leilei - this might not actually need glsl but we're doing this anyway.
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( r_tvMode->integer < 0)
|
||||
return;
|
||||
if ( backEnd.donetv)
|
||||
@@ -1995,7 +2026,9 @@ void R_TVScreen( void )
|
||||
backEnd.donetv = qtrue;
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
#else
|
||||
// NO!
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -2006,6 +2039,10 @@ void R_TVScreen( void )
|
||||
|
||||
// =================================================================
|
||||
// PALLETIZING
|
||||
//
|
||||
// Processes the screen into having a 8-bit indexed color
|
||||
// palette to suit a throwback mode better
|
||||
//
|
||||
// =================================================================
|
||||
|
||||
|
||||
@@ -2013,6 +2050,7 @@ void R_TVScreen( void )
|
||||
|
||||
void R_PaletteScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( !r_palletize->integer)
|
||||
return;
|
||||
if ( backEnd.donepalette)
|
||||
@@ -2041,7 +2079,9 @@ void R_PaletteScreen( void )
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
|
||||
#else
|
||||
// NO!
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@@ -134,6 +134,7 @@ static qboolean GLimp_HaveExtension(const char *ext)
|
||||
void GLimp_InitExtraExtensions()
|
||||
{
|
||||
vertexShaders = qfalse;
|
||||
#ifdef GLSL_BACKEND
|
||||
if ( GLimp_HaveExtension( "GL_ARB_shader_objects" )
|
||||
&& GLimp_HaveExtension( "GL_ARB_fragment_shader" )
|
||||
&& GLimp_HaveExtension( "GL_ARB_vertex_shader" )
|
||||
@@ -240,7 +241,7 @@ void GLimp_InitExtraExtensions()
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "...GL_ARB_vertex_shader not found\n" );
|
||||
}
|
||||
|
||||
#endif
|
||||
// leilei - paletted texturing
|
||||
palettedTextureSupport = qfalse;
|
||||
if ( GLimp_HaveExtension( "GL_EXT_paletted_texture" ) )
|
||||
|
@@ -1401,6 +1401,7 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
*/
|
||||
|
||||
void R_GLSL_Init(void) {
|
||||
#ifdef GLSL_BACKEND
|
||||
glslProgram_t *program;
|
||||
char programVertexObjects[MAX_PROGRAM_OBJECTS][MAX_QPATH];
|
||||
char programFragmentObjects[MAX_PROGRAM_OBJECTS][MAX_QPATH];
|
||||
@@ -1514,6 +1515,7 @@ void R_GLSL_Init(void) {
|
||||
ri.Printf( PRINT_ALL, "WARNING: Cannot locate postprocessing glsl program %s\n" ,r_postprocess->string);
|
||||
if (tr.postprocessingProgram) postprocess=qtrue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1598,8 +1600,9 @@ void R_Init( void ) {
|
||||
InitOpenGL();
|
||||
|
||||
R_InitImages();
|
||||
|
||||
#ifdef GLSL_BACKEND
|
||||
R_GLSL_Init();
|
||||
#endif
|
||||
R_InitShaders();
|
||||
|
||||
R_InitSkins();
|
||||
|
@@ -37,6 +37,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define GL_INDEX_TYPE GL_UNSIGNED_INT
|
||||
typedef unsigned int glIndex_t;
|
||||
|
||||
// Lousy hack
|
||||
#define GLSL_POSTPROCESS 1
|
||||
#define GLSL_TEXTURES 1
|
||||
#define GLSL_BACKEND 1
|
||||
|
||||
// 14 bits
|
||||
// can't be increased without changing bit packing for drawsurfs
|
||||
// see QSORT_SHADERNUM_SHIFT
|
||||
|
@@ -54,6 +54,7 @@ static glslProgram_t *R_GLSL_GetProgramByHandle(qhandle_t index) {
|
||||
* Use specified program or switch back to standard rendering pipeline
|
||||
*/
|
||||
void R_GLSL_UseProgram(qhandle_t index) {
|
||||
#ifdef GLSL_BACKEND
|
||||
glslProgram_t *program;
|
||||
|
||||
if (!vertexShaders)
|
||||
@@ -77,6 +78,7 @@ void R_GLSL_UseProgram(qhandle_t index) {
|
||||
|
||||
qglUseProgramObjectARB(program->program);
|
||||
glState.currentProgram = program->index;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1559,7 +1561,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
||||
qglEnableClientState( GL_COLOR_ARRAY );
|
||||
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors );
|
||||
}
|
||||
|
||||
#ifdef GLSL_BACKEND
|
||||
if (pStage->isGLSL && vertexShaders && pStage->program && tr.programs[pStage->program]->valid)
|
||||
{
|
||||
GLSL_Feeder(pStage, input);
|
||||
@@ -1568,6 +1570,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
||||
GLSL_Clean();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
||||
//
|
||||
@@ -1695,12 +1698,16 @@ void RB_StageIteratorGeneric( void )
|
||||
//
|
||||
// now do any dynamic lighting needed
|
||||
//
|
||||
#ifdef GLSL_BACKEND
|
||||
if (vertexShaders) qglPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
|
||||
#endif
|
||||
if ( tess.dlightBits && tess.shader->sort <= SS_OPAQUE
|
||||
&& !(tess.shader->surfaceFlags & (SURF_NODLIGHT | SURF_SKY) ) ) {
|
||||
ProjectDlightTexture();
|
||||
}
|
||||
#ifdef GLSL_BACKEND
|
||||
if (vertexShaders) qglPopClientAttrib();
|
||||
#endif
|
||||
|
||||
//
|
||||
// now do fog
|
||||
|
@@ -83,11 +83,13 @@ static glslProgram_t *R_GLSL_GetProgramByHandle(qhandle_t index) {
|
||||
return program;
|
||||
}*/
|
||||
|
||||
|
||||
/*
|
||||
* R_GLSL_AllocProgram
|
||||
* Reserve memory for program
|
||||
*/
|
||||
static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
#ifdef GLSL_BACKEND
|
||||
glslProgram_t *program;
|
||||
|
||||
if (tr.numPrograms == MAX_PROGRAMS)
|
||||
@@ -151,6 +153,7 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
tr.numPrograms++;
|
||||
|
||||
return program;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +162,7 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
* Parse program for uniform locations
|
||||
*/
|
||||
static void R_GLSL_ParseProgram(glslProgram_t *program, char *_text) {
|
||||
#ifdef GLSL_BACKEND
|
||||
char **text = &_text;
|
||||
char *token;
|
||||
|
||||
@@ -308,6 +312,7 @@ static void R_GLSL_ParseProgram(glslProgram_t *program, char *_text) {
|
||||
|
||||
token = COM_ParseExt(text, qtrue);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -315,6 +320,7 @@ static void R_GLSL_ParseProgram(glslProgram_t *program, char *_text) {
|
||||
* Load, compile and link program
|
||||
*/
|
||||
static qboolean R_GLSL_LoadProgram(glslProgram_t *program, const char *name, const char *programVertexObjects, int numVertexObjects, const char *programFragmentObjects, int numFragmentObjects) {
|
||||
#ifdef GLSL_BACKEND
|
||||
GLcharARB *buffer_vp[MAX_PROGRAM_OBJECTS];
|
||||
GLcharARB *buffer_fp[MAX_PROGRAM_OBJECTS];
|
||||
GLcharARB *buffer;
|
||||
@@ -454,6 +460,7 @@ static qboolean R_GLSL_LoadProgram(glslProgram_t *program, const char *name, con
|
||||
ri.FS_FreeFile(buffer_vp[i]);
|
||||
|
||||
return qtrue;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -461,6 +468,7 @@ static qboolean R_GLSL_LoadProgram(glslProgram_t *program, const char *name, con
|
||||
* Loads in a program of given name
|
||||
*/
|
||||
qhandle_t RE_GLSL_RegisterProgram(const char *name, const char *programVertexObjects, int numVertexObjects, const char *programFragmentObjects, int numFragmentObjects) {
|
||||
#ifdef GLSL_BACKEND
|
||||
glslProgram_t *program;
|
||||
qhandle_t hProgram;
|
||||
|
||||
@@ -509,8 +517,10 @@ qhandle_t RE_GLSL_RegisterProgram(const char *name, const char *programVertexObj
|
||||
|
||||
program->valid = qtrue;
|
||||
return program->index;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void R_RemapShader(const char *shaderName, const char *newShaderName, const char *timeOffset) {
|
||||
char strippedName[MAX_QPATH];
|
||||
int hash;
|
||||
@@ -1095,7 +1105,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
ri.Printf(PRINT_WARNING, "WARNING: no 'fragmentProgram' specified for 'program %s' in shader '%s'\n", programName, shader.name);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
#ifdef GLSL_TEXTURES
|
||||
stage->isGLSL=0;
|
||||
stage->program = RE_GLSL_RegisterProgram(programName, (const char *)programVertexObjects, numVertexObjects, (const char *)programFragmentObjects, numFragmentObjects);
|
||||
if (!stage->program) {
|
||||
@@ -1104,6 +1114,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
}
|
||||
else
|
||||
stage->isGLSL=1;
|
||||
#endif
|
||||
}
|
||||
} else if (numVertexObjects) {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: no 'program' specified for 'vertexProgram' in shader '%s'\n", shader.name);
|
||||
@@ -1148,7 +1159,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
ri.Printf(PRINT_WARNING, "WARNING: missing parameter(s) for 'vertexProgram' keyword in shader '%s'\n", shader.name);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
#ifdef GLSL_TEXTURES
|
||||
// parse up to MAX_PROGRAM_OBJECTS files
|
||||
for(;;) {
|
||||
if (numVertexObjects < MAX_PROGRAM_OBJECTS) {
|
||||
@@ -1163,6 +1174,9 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
if (!token[0])
|
||||
break;
|
||||
}
|
||||
#else
|
||||
// NO!
|
||||
#endif
|
||||
}
|
||||
//
|
||||
// fragmentProgram <path1> .... <pathN>
|
||||
@@ -2893,6 +2907,7 @@ qboolean ParseStageSimple( shaderStage_t *stage, char **text )
|
||||
|
||||
if ( token[0] == '}' )
|
||||
{
|
||||
#ifdef GLSL_TEXTURES
|
||||
if (programName[0]) {
|
||||
if (!Q_stricmp(programName, "skip")) {
|
||||
stage->program = tr.skipProgram;
|
||||
@@ -2923,7 +2938,7 @@ qboolean ParseStageSimple( shaderStage_t *stage, char **text )
|
||||
ri.Printf(PRINT_WARNING, "WARNING: no 'program' specified for 'fragmentProgram' in shader '%s'\n", shader.name);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
//
|
||||
@@ -4264,10 +4279,11 @@ otherwise set to the generic stage function
|
||||
*/
|
||||
static void ComputeStageIteratorFunc( void )
|
||||
{
|
||||
|
||||
#ifdef GLSL_TEXTURES
|
||||
if (vertexShaders)
|
||||
shader.optimalStageIteratorFunc = RB_GLSL_StageIteratorGeneric;
|
||||
else
|
||||
#endif
|
||||
shader.optimalStageIteratorFunc = RB_StageIteratorGeneric;
|
||||
|
||||
//
|
||||
@@ -4308,9 +4324,11 @@ static void ComputeStageIteratorFunc( void )
|
||||
{
|
||||
if ( !shader.numDeforms )
|
||||
{
|
||||
#ifdef GLSL_TEXTURES
|
||||
if (vertexShaders)
|
||||
shader.optimalStageIteratorFunc = RB_GLSL_StageIteratorVertexLitTexture;
|
||||
else
|
||||
#endif
|
||||
shader.optimalStageIteratorFunc = RB_StageIteratorVertexLitTexture;
|
||||
return;
|
||||
}
|
||||
@@ -4338,9 +4356,11 @@ static void ComputeStageIteratorFunc( void )
|
||||
{
|
||||
if ( shader.multitextureEnv )
|
||||
{
|
||||
#ifdef GLSL_TEXTURES
|
||||
if (vertexShaders)
|
||||
shader.optimalStageIteratorFunc = RB_GLSL_StageIteratorLightmappedMultitexture;
|
||||
else
|
||||
#endif
|
||||
shader.optimalStageIteratorFunc = RB_StageIteratorLightmappedMultitexture;
|
||||
}
|
||||
}
|
||||
@@ -4810,7 +4830,7 @@ static shader_t *FinishShader( void ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLSL_TEXTURES
|
||||
// Try to use leifx dither here instead of postprocess for more authentic overdraw artifacts
|
||||
if (r_leifx->integer > 1)
|
||||
{
|
||||
@@ -4841,6 +4861,8 @@ static shader_t *FinishShader( void ) {
|
||||
|
||||
}
|
||||
|
||||
#endif // GLSL_TEXTURES
|
||||
|
||||
// check for a missing texture
|
||||
if ( !pStage->bundle[0].image[0] ) {
|
||||
ri.Printf( PRINT_WARNING, "Shader %s has a stage with no image\n", shader.name );
|
||||
@@ -4899,16 +4921,17 @@ static shader_t *FinishShader( void ) {
|
||||
//}
|
||||
|
||||
|
||||
|
||||
#ifdef GLSL_TEXTURES
|
||||
|
||||
// leilei - force new phong on lightdiffuse and lightdiffusespecular models
|
||||
// FIXME: Intel HD doesn't like this.
|
||||
if ((r_modelshader->integer) && (pStage->isGLSL==0) && (r_ext_vertex_shader->integer) && ((pStage->rgbGen == CGEN_LIGHTING_DIFFUSE) || (pStage->rgbGen == CGEN_LIGHTING_DIFFUSE_SPECULAR)))
|
||||
{
|
||||
pStage->program = RE_GLSL_RegisterProgram("leishade", "glsl/leishade_vp.glsl", 1, "glsl/leishade_fp.glsl", 1);
|
||||
pStage->isGLSL=1;
|
||||
pStage->isLeiShade=1;
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// determine sort order and fog color adjustment
|
||||
//
|
||||
|
Reference in New Issue
Block a user