diff --git a/quakespasm/Quake/gl_mesh.c b/quakespasm/Quake/gl_mesh.c index 98b2d7cd..e0a21d69 100644 --- a/quakespasm/Quake/gl_mesh.c +++ b/quakespasm/Quake/gl_mesh.c @@ -373,7 +373,7 @@ void GL_MakeAliasModelDisplayLists_VBO (void) unsigned short *indexes; aliasmesh_t *desc; - if (!GLAlias_SupportsShaders()) + if (!gl_glsl_alias_able) return; // first, copy the verts onto the hunk @@ -461,7 +461,7 @@ void GLMesh_LoadVertexBuffers (void) int totalindexes = 0; int totalvbosize = 0; - if (!GLAlias_SupportsShaders()) + if (!gl_glsl_alias_able) return; // pass 1 - count the sizes we need diff --git a/quakespasm/Quake/gl_vidsdl.c b/quakespasm/Quake/gl_vidsdl.c index 214bfcd3..76494690 100644 --- a/quakespasm/Quake/gl_vidsdl.c +++ b/quakespasm/Quake/gl_vidsdl.c @@ -103,6 +103,7 @@ qboolean gl_vbo_able = false; //ericw qboolean gl_glsl_able = false; //ericw GLint gl_max_texture_units = 0; //ericw qboolean gl_glsl_gamma_able = false; //ericw +qboolean gl_glsl_alias_able = false; //ericw PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz @@ -1059,7 +1060,7 @@ static void GL_CheckExtensions (void) Con_Warning ("texture_non_power_of_two disabled at command line\n"); else if (GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_non_power_of_two")) { - Con_Printf("FOUND: GL_ARB_texture_non_power_of_two\n"); + Con_Printf("FOUND: ARB_texture_non_power_of_two\n"); gl_texture_NPOT = true; } else @@ -1146,6 +1147,33 @@ static void GL_CheckExtensions (void) { Con_Warning ("GLSL gamma not available, using hardware gamma\n"); } + + // GLSL alias model rendering + // + if (COM_CheckParm("-noglslalias")) + Con_Warning ("GLSL alias model rendering disabled at command line\n"); + else if (gl_glsl_able && gl_vbo_able && gl_max_texture_units >= 3) + { + qboolean broken = false; + // Ugly hack to disable GLSL alias renderer on ATI/Win32 + // (black model bug observed by szo) +#if defined(_WIN32) + if (strstr(gl_vendor, "ATI")) + broken = true; +#endif + if (broken && !COM_CheckParm("-glslalias")) + { + Con_Warning ("Unsupported hardware, GLSL alias rendering disabled (use -glslalias to force enable)\n"); + } + else + { + gl_glsl_alias_able = true; + } + } + else + { + Con_Warning ("GLSL alias model rendering not available, using Fitz renderer\n"); + } } /* diff --git a/quakespasm/Quake/glquake.h b/quakespasm/Quake/glquake.h index b35d79c9..fcb2d3ef 100644 --- a/quakespasm/Quake/glquake.h +++ b/quakespasm/Quake/glquake.h @@ -223,6 +223,7 @@ extern QS_PFNGLUNIFORM3FPROC GL_Uniform3fFunc; extern QS_PFNGLUNIFORM4FPROC GL_Uniform4fFunc; extern qboolean gl_glsl_able; extern qboolean gl_glsl_gamma_able; +extern qboolean gl_glsl_alias_able; // ericw -- //ericw -- NPOT texture support @@ -354,7 +355,6 @@ GLint GL_GetUniformLocation (GLuint *programPtr, const char *name); GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int numbindings, const glsl_attrib_binding_t *bindings); void R_DeleteShaders (void); -qboolean GLAlias_SupportsShaders (void); void GLAlias_CreateShaders (void); void GL_DrawAliasShadow (entity_t *e); void DrawGLTriangleFan (glpoly_t *p); diff --git a/quakespasm/Quake/r_alias.c b/quakespasm/Quake/r_alias.c index 31aa31f3..9cc2883e 100644 --- a/quakespasm/Quake/r_alias.c +++ b/quakespasm/Quake/r_alias.c @@ -119,18 +119,6 @@ static void *GLARB_GetNormalOffset (aliashdr_t *hdr, int pose) return (void *)(currententity->model->vboxyzofs + (hdr->numverts_vbo * pose * sizeof (meshxyz_t)) + normaloffs); } -/* -============= -GLAlias_SupportsShaders - -Returns whether OpenGL has the capabilities we need for the shader path. -============= -*/ -qboolean GLAlias_SupportsShaders (void) -{ - return gl_glsl_able && gl_vbo_able && gl_max_texture_units >= 3; -} - /* ============= GLAlias_CreateShaders @@ -202,7 +190,7 @@ void GLAlias_CreateShaders (void) " gl_FragColor = result;\n" "}\n"; - if (!GLAlias_SupportsShaders()) + if (!gl_glsl_alias_able) return; r_alias_program = GL_CreateProgram (vertSource, fragSource, sizeof(bindings)/sizeof(bindings[0]), bindings); @@ -748,7 +736,7 @@ void R_DrawAliasModel (entity_t *e) } // call fast path if possible. if the shader compliation failed for some reason, // r_alias_program will be 0. - else if (GLAlias_SupportsShaders() && (r_alias_program != 0)) + else if (r_alias_program != 0) { GL_DrawAliasFrame_GLSL (paliashdr, lerpdata, tx, fb); }