gl_compat.c revision 114410893548b9522c46fdcbd8f63385eb8bfb68
/*
* Compatibility functions for older GL implementations
*
* Copyright 2008 Stefan Dösinger for CodeWeavers
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "config.h"
#include <stdio.h>
#ifdef HAVE_FLOAT_H
# include <float.h>
#endif
#include "wined3d_private.h"
/* Start GL_ARB_multitexture emulation */
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord1f(s);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord1fv(v);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord2f(s, t);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord2fv(v);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord3f(s, t, r);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord3fv(v);
}
static void WINE_GLAPI wine_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord4f(s, t, r, q);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord4fv(v);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord2sv(v);
}
if(target != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
glTexCoord4sv(v);
}
if(texture != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
}
if(texture != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
}
}
switch(pname) {
case GL_ACTIVE_TEXTURE: *params = 0; break;
}
}
}
}
/* Start GL_EXT_fogcoord emulation */
}
}
ctx->fog_enabled = 0;
}
}
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
if(param == GL_FRAGMENT_DEPTH_EXT) {
} else {
WARN("Fog coords activated, but not supported. Using slow emulation\n");
}
} else {
if(pname == GL_FOG_START) {
} else if(pname == GL_FOG_END) {
}
}
}
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
if(*param == GL_FRAGMENT_DEPTH_EXT) {
} else {
WARN("Fog coords activated, but not supported. Using slow emulation\n");
}
} else {
if(pname == GL_FOG_START) {
} else if(pname == GL_FOG_END) {
}
}
}
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
if(param == GL_FRAGMENT_DEPTH_EXT) {
} else {
WARN("Fog coords activated, but not supported. Using slow emulation\n");
}
} else {
if(pname == GL_FOG_START) {
} else if(pname == GL_FOG_END) {
}
}
}
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
if(*param == GL_FRAGMENT_DEPTH_EXT) {
} else {
WARN("Fog coords activated, but not supported. Using slow emulation\n");
}
} else {
if(pname == GL_FOG_COLOR) {
} else if(pname == GL_FOG_START) {
} else if(pname == GL_FOG_END) {
}
}
}
static void (WINE_GLAPI *old_fogcoord_glVertex4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w) = NULL;
static void (WINE_GLAPI *old_fogcoord_glColor4f) (GLfloat r, GLfloat g, GLfloat b, GLfloat a) = NULL;
static void (WINE_GLAPI *old_fogcoord_glColor4ub) (GLubyte r, GLubyte g, GLubyte b, GLubyte a) = NULL;
GLfloat i;
old_fogcoord_glVertex4f(x, y, z, w);
} else {
old_fogcoord_glVertex4f(x, y, z, w);
}
}
}
wine_glVertex4f(x, y, z, 1.0f);
}
}
old_fogcoord_glColor4f(r, g, b, a);
}
}
wine_glColor4f(r, g, b, 1.0f);
}
}
}
/* In D3D the fog coord is a UBYTE, so there's no problem with using the single
* precision function
*/
ctx->fog_coord_value = f;
}
}
wine_glFogCoordfEXT(*f);
}
wine_glFogCoordfEXT(*f);
}
/* End GL_EXT_fog_coord emulation */
#define GLINFO_LOCATION (*gl_info)
{
if(!GL_SUPPORT(ARB_MULTITEXTURE)) {
TRACE("Applying GL_ARB_multitexture emulation hooks\n");
FIXME("GL_ARB_multitexture glGetIntegerv hook already applied\n");
} else {
}
if(old_multitex_glGetFloatv) {
FIXME("GL_ARB_multitexture glGetGloatv hook already applied\n");
} else {
}
FIXME("GL_ARB_multitexture glGetDoublev hook already applied\n");
} else {
}
}
if(!GL_SUPPORT(EXT_FOG_COORD)) {
/* This emulation isn't perfect. There are a number of potential problems, but they should
* not matter in practise:
*
* Fog vs fragment shader: If we are using GL_ARB_fragment_program with the fog option, the
* glDisable(GL_FOG) here won't matter. However, if we have GL_ARB_fragment_program, it is pretty
* unlikely that we don't have GL_EXT_fog_coord. Besides, we probably have GL_ARB_vertex_program
* too, which would allow fog coord emulation in a fixed function vertex pipeline replacement.
*
* Fog vs texture: We apply the fog in the vertex color. An app could set up texturing settings which
* ignore the vertex color, thus effectively disabing our fog. However, in D3D this type of fog is
* a per-vertex fog too, so the apps shouldn't do that.
*
* Fog vs lighting: The app could in theory use D3DFOG_NONE table and D3DFOG_NONE vertex fog with
* untransformed vertices. That enables lighting and fog coords at the same time, and the lighting
* calculations could affect the already blended in fog color. There's nothing we can do against that,
* but most apps using fog color do their own lighting too and often even use RHW vertices. So live
* with it.
*/
TRACE("Applying GL_ARB_fog_coord emulation hooks\n");
/* This probably means that the implementation doesn't advertise the extension, but implicitly supports
* it via the GL core version, or someone messed around in the extension table in directx.c. Add version-
* dependent loading for this extension if we ever hit this situation
*/
if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {
FIXME("GL implementation supports GL_ARB_fragment_program but not GL_EXT_fog_coord\n");
FIXME("The fog coord emulation will most likely fail\n");
} else if(GL_SUPPORT(ARB_FRAGMENT_SHADER)) {
FIXME("GL implementation supports GL_ARB_fragment_shader but not GL_EXT_fog_coord\n");
FIXME("The fog coord emulation will most likely fail\n");
}
if(old_fogcoord_glFogi) {
FIXME("GL_EXT_fogcoord glFogi hook already applied\n");
} else {
}
if(old_fogcoord_glFogiv) {
FIXME("GL_EXT_fogcoord glFogiv hook already applied\n");
} else {
}
if(old_fogcoord_glFogf) {
FIXME("GL_EXT_fogcoord glFogf hook already applied\n");
} else {
}
if(old_fogcoord_glFogfv) {
FIXME("GL_EXT_fogcoord glFogfv hook already applied\n");
} else {
}
if(old_fogcoord_glEnable) {
FIXME("GL_EXT_fogcoord glEnable hook already applied\n");
} else {
}
if(old_fogcoord_glDisable) {
FIXME("GL_EXT_fogcoord glDisable hook already applied\n");
} else {
}
if(old_fogcoord_glVertex4f) {
FIXME("GL_EXT_fogcoord glVertex4f hook already applied\n");
} else {
}
if(old_fogcoord_glVertex4fv) {
FIXME("GL_EXT_fogcoord glVertex4fv hook already applied\n");
} else {
}
if(old_fogcoord_glVertex3f) {
FIXME("GL_EXT_fogcoord glVertex3f hook already applied\n");
} else {
}
if(old_fogcoord_glVertex3fv) {
FIXME("GL_EXT_fogcoord glVertex3fv hook already applied\n");
} else {
}
if(old_fogcoord_glColor4f) {
FIXME("GL_EXT_fogcoord glColor4f hook already applied\n");
} else {
}
if(old_fogcoord_glColor4fv) {
FIXME("GL_EXT_fogcoord glColor4fv hook already applied\n");
} else {
}
if(old_fogcoord_glColor3f) {
FIXME("GL_EXT_fogcoord glColor3f hook already applied\n");
} else {
}
if(old_fogcoord_glColor3fv) {
FIXME("GL_EXT_fogcoord glColor3fv hook already applied\n");
} else {
}
if(old_fogcoord_glColor4ub) {
FIXME("GL_EXT_fogcoord glColor4ub hook already applied\n");
} else {
}
FIXME("GL_EXT_fogcoord glFogCoordfEXT hook already applied\n");
} else {
}
FIXME("GL_EXT_fogcoord glFogCoordfvEXT hook already applied\n");
} else {
}
FIXME("GL_EXT_fogcoord glFogCoorddEXT hook already applied\n");
} else {
}
FIXME("GL_EXT_fogcoord glFogCoorddvEXT hook already applied\n");
} else {
}
}
}