Commit 713013a9 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- add a new private header d3dcore_gl.h that declares needed opengl

defines and the caps defines - cleanup of device.c using the caps defines (avoid the #ifdef nigthmare) - add {Set,Get}GammaRamp support
parent 24be3065
......@@ -153,12 +153,6 @@ typedef struct PSHADEROUTPUTDATA8 {
/*
* External prototypes
*/
/*BOOL D3DRAW_HAL_Init(HINSTANCE, DWORD, LPVOID); */
void CreateStateBlock(LPDIRECT3DDEVICE8 iface);
/*
* Macros
*/
#define checkGLcall(A) \
......@@ -180,58 +174,9 @@ void CreateStateBlock(LPDIRECT3DDEVICE8 iface);
} \
}
typedef enum _GL_SupportedExt {
/* ARB */
ARB_FRAGMENT_PROGRAM,
ARB_MULTISAMPLE,
ARB_MULTITEXTURE,
ARB_POINT_PARAMETERS,
ARB_TEXTURE_COMPRESSION,
ARB_TEXTURE_CUBE_MAP,
ARB_TEXTURE_ENV_DOT3,
ARB_VERTEX_PROGRAM,
ARB_VERTEX_BLEND,
/* EXT */
EXT_FOG_COORD,
EXT_PALETTED_TEXTURE,
EXT_SECONDARY_COLOR,
EXT_TEXTURE_COMPRESSION_S3TC,
EXT_TEXTURE_FILTER_ANISOTROPIC,
EXT_TEXTURE_LOD,
EXT_TEXTURE_LOD_BIAS,
EXT_VERTEX_WEIGHTING,
/* NVIDIA */
NV_FRAGMENT_PROGRAM,
NV_VERTEX_PROGRAM,
/* ATI */
EXT_VERTEX_SHADER,
OPENGL_SUPPORTED_EXT_END
} GL_SupportedExt;
typedef enum _GL_VSVersion {
VS_VERSION_NOT_SUPPORTED = 0x0,
VS_VERSION_10 = 0x10,
VS_VERSION_11 = 0x11,
VS_VERSION_20 = 0x20,
VS_VERSION_30 = 0x30,
/*Force 32-bits*/
VS_VERSION_FORCE_DWORD = 0x7FFFFFFF
} GL_VSVersion;
typedef enum _GL_PSVersion {
PS_VERSION_NOT_SUPPORTED = 0x0,
PS_VERSION_10 = 0x10,
PS_VERSION_11 = 0x11,
PS_VERSION_12 = 0x12,
PS_VERSION_13 = 0x13,
PS_VERSION_14 = 0x14,
PS_VERSION_20 = 0x20,
PS_VERSION_30 = 0x30,
/*Force 32-bits*/
PS_VERSION_FORCE_DWORD = 0x7FFFFFFF
} GL_PSVersion;
#include "d3dcore_gl.h"
#define USE_GL_FUNC(type, pfn) type pfn;
typedef struct _GL_Info {
/**
* CAPS Constants
......@@ -248,12 +193,17 @@ typedef struct _GL_Info {
GL_VSVersion vs_ati_version;
BOOL supported[30];
/** ext functions ptr */
GL_EXT_FUNCS_GEN;
/**/
} GL_Info;
#undef USE_GL_FUNC
#define GL_LIMITS(ExtName) (This->direct3d8->gl_info.max_##ExtName)
#define GL_SUPPORT(ExtName) (TRUE == This->direct3d8->gl_info.supported[ExtName])
#define GL_SUPPORT_DEV(ExtName, dev) (TRUE == (dev)->direct3d8->gl_info.supported[ExtName])
#define GLExtCall(FuncName) /*(This->direct3d8->glInfo.FuncName)*/
#define GL_LIMITS(ExtName) (This->direct3d8->gl_info.max_##ExtName)
#define GL_SUPPORT(ExtName) (TRUE == This->direct3d8->gl_info.supported[ExtName])
#define GL_SUPPORT_DEV(ExtName, dev) (TRUE == (dev)->direct3d8->gl_info.supported[ExtName])
#define GL_EXTCALL(FuncName) (This->direct3d8->gl_info.FuncName)
#define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
......@@ -1283,7 +1233,6 @@ void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenu
void setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage);
void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
......
/*
* Direct3D gl definitions
*
* Copyright 2003 Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_D3DCORE_GL_H
#define __WINE_D3DCORE_GL_H
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif
#define XMD_H /* This is to prevent the Xmd.h inclusion bug :-/ */
#include <GL/gl.h>
#include <GL/glx.h>
#ifdef HAVE_GL_GLEXT_H
# include <GL/glext.h>
#endif
#undef XMD_H
#undef APIENTRY
#undef CALLBACK
#undef WINAPI
/* Redefines the constants */
#define CALLBACK __stdcall
#define WINAPI __stdcall
#define APIENTRY WINAPI
/* GL_EXT_secondary_color */
#ifndef GL_EXT_secondary_color
#define GL_EXT_secondary_color 1
#define GL_COLOR_SUM_EXT 0x8458
#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459
#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
#endif
/* GL_EXT_paletted_texture */
#ifndef GL_EXT_paletted_texture
#define GL_EXT_paletted_texture 1
#define GL_COLOR_INDEX1_EXT 0x80E2
#define GL_COLOR_INDEX2_EXT 0x80E3
#define GL_COLOR_INDEX4_EXT 0x80E4
#define GL_COLOR_INDEX8_EXT 0x80E5
#define GL_COLOR_INDEX12_EXT 0x80E6
#define GL_COLOR_INDEX16_EXT 0x80E7
#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
#endif
/* GL_EXT_point_parameters */
#ifndef GL_EXT_point_parameters
#define GL_EXT_point_parameters 1
#define GL_POINT_SIZE_MIN_EXT 0x8126
#define GL_POINT_SIZE_MAX_EXT 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
#endif
typedef enum _GL_SupportedExt {
/* ARB */
ARB_FRAGMENT_PROGRAM,
ARB_MULTISAMPLE,
ARB_MULTITEXTURE,
ARB_POINT_PARAMETERS,
ARB_TEXTURE_COMPRESSION,
ARB_TEXTURE_CUBE_MAP,
ARB_TEXTURE_ENV_DOT3,
ARB_VERTEX_PROGRAM,
ARB_VERTEX_BLEND,
/* EXT */
EXT_FOG_COORD,
EXT_PALETTED_TEXTURE,
EXT_POINT_PARAMETERS,
EXT_SECONDARY_COLOR,
EXT_TEXTURE_COMPRESSION_S3TC,
EXT_TEXTURE_FILTER_ANISOTROPIC,
EXT_TEXTURE_LOD,
EXT_TEXTURE_LOD_BIAS,
EXT_VERTEX_WEIGHTING,
/* NVIDIA */
NV_FRAGMENT_PROGRAM,
NV_VERTEX_PROGRAM,
/* ATI */
EXT_VERTEX_SHADER,
OPENGL_SUPPORTED_EXT_END
} GL_SupportedExt;
typedef enum _GL_VSVersion {
VS_VERSION_NOT_SUPPORTED = 0x0,
VS_VERSION_10 = 0x10,
VS_VERSION_11 = 0x11,
VS_VERSION_20 = 0x20,
VS_VERSION_30 = 0x30,
/*Force 32-bits*/
VS_VERSION_FORCE_DWORD = 0x7FFFFFFF
} GL_VSVersion;
typedef enum _GL_PSVersion {
PS_VERSION_NOT_SUPPORTED = 0x0,
PS_VERSION_10 = 0x10,
PS_VERSION_11 = 0x11,
PS_VERSION_12 = 0x12,
PS_VERSION_13 = 0x13,
PS_VERSION_14 = 0x14,
PS_VERSION_20 = 0x20,
PS_VERSION_30 = 0x30,
/*Force 32-bits*/
PS_VERSION_FORCE_DWORD = 0x7FFFFFFF
} GL_PSVersion;
#define GL_EXT_FUNCS_GEN \
/** EXT Extensions **/ \
/* GL_EXT_fog_coord */ \
/* GL_EXT_paletted_texture */ \
USE_GL_FUNC(PFNGLCOLORTABLEEXTPROC, glColorTableEXT); \
/* GL_EXT_point_parameters */ \
USE_GL_FUNC(PFNGLPOINTPARAMETERFEXTPROC, glPointParameterfEXT); \
USE_GL_FUNC(PFNGLPOINTPARAMETERFVEXTPROC, glPointParameterfvEXT); \
/* GL_EXT_secondary_color */ \
USE_GL_FUNC(PFNGLSECONDARYCOLOR3UBEXTPROC, glSecondaryColor3ubEXT); \
USE_GL_FUNC(PFNGLSECONDARYCOLOR3FEXTPROC, glSecondaryColor3fEXT); \
USE_GL_FUNC(PFNGLSECONDARYCOLOR3FVEXTPROC, glSecondaryColor3fvEXT); \
USE_GL_FUNC(PFNGLSECONDARYCOLORPOINTEREXTPROC, glSecondaryColorPointerEXT); \
#endif /* __WINE_D3DCORE_GL_H */
......@@ -32,7 +32,10 @@
/** define GL_GLEXT_PROTOTYPES for having extensions prototypes defined */
/*#define GL_GLEXT_PROTOTYPES*/
/*#undef GLX_GLXEXT_LEGACY*/
#include "d3d8_private.h"
#include <GL/glext.h>
#include <GL/glxext.h>
/** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */
#undef GL_VERSION_1_4
......@@ -595,13 +598,10 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface,
glColor4fv((float*) &vertex_shader->output.oD[0]);
/* Requires secondary color extensions to compile... */
#if defined(GL_VERSION_1_4)
glSecondaryColor3fv((float*) &vertex_shader->output.oD[1]);
checkGLcall("glSecondaryColor3fv");
#elif defined(GL_EXT_secondary_color)
#if defined(GL_EXT_secondary_color)
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
/*specularColor = D3DCOLORTOCOLORVALUE(vertex_shader->output.oD[1]);*/
glSecondaryColor3fvEXT((float*) &vertex_shader->output.oD[1]);
GL_EXTCALL(glSecondaryColor3fvEXT)((float*) &vertex_shader->output.oD[1]);
checkGLcall("glSecondaryColor3fvEXT");
}
#endif
......@@ -815,34 +815,26 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface,
/* Requires secondary color extensions to compile... */
if (isSpecular) {
#if defined(GL_VERSION_1_4)
glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, skip, curPos);
checkGLcall("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, skip, curPos)");
glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
checkGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY)");
#elif defined(GL_EXT_secondary_color)
#if defined(GL_EXT_secondary_color)
/* FIXME: check for GL_EXT_secondary_color */
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, skip, curPos);
checkGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, skip, curPos)");
GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE, skip, curPos);
vcheckGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, skip, curPos)");
glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
checkGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
vcheckGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
}
#endif
curPos += sizeof(DWORD);
} else {
#if defined(GL_VERSION_1_4)
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
checkGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY)");
glSecondaryColor3f(0, 0, 0);
checkGLcall("glSecondaryColor3f(0, 0, 0)");
#else
#if 0
#if defined(GL_EXT_secondary_color)
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
checkGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
glSecondaryColor3fEXT(0, 0, 0);
checkGLcall("glSecondaryColor3fEXT(0, 0, 0)");
vcheckGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
#if 0
GL_EXTCALL(glSecondaryColor3fEXT)(0.0f, 0.0f, 0.0f);
vcheckGLcall("glSecondaryColor3fEXT(0, 0, 0)");
#endif
}
#endif
}
......@@ -1256,13 +1248,23 @@ HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D
return D3D_OK;
}
void WINAPI IDirect3DDevice8Impl_SetGammaRamp(LPDIRECT3DDEVICE8 iface, DWORD Flags, CONST D3DGAMMARAMP* pRamp) {
HDC hDC;
ICOM_THIS(IDirect3DDevice8Impl,iface);
FIXME("(%p) : stub\n", This);
FIXME("(%p) : pRamp@%p\n", This, pRamp);
hDC = GetDC(This->win_handle);
SetDeviceGammaRamp(hDC, (LPVOID) pRamp);
ReleaseDC(This->win_handle, hDC);
return;
}
void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp) {
HDC hDC;
ICOM_THIS(IDirect3DDevice8Impl,iface);
FIXME("(%p) : stub\n", This);
FIXME("(%p) : pRamp@%p\n", This, pRamp);
hDC = GetDC(This->win_handle);
GetDeviceGammaRamp(hDC, pRamp);
ReleaseDC(This->win_handle, hDC);
return;
}
HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
......@@ -1979,7 +1981,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface) {
/** always dirtify for now. we must find a better way to see that surface have been modified */
IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE);
IDirect3DBaseTexture8_PreLoad(cont);
IDirect3DBaseTexture8_Release(cont);
IDirect3DBaseTexture8Impl_Release(cont);
cont = NULL;
}
}
......@@ -2033,10 +2035,10 @@ HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count
if (Flags & D3DCLEAR_TARGET) {
TRACE("Clearing screen with glClear to color %lx\n", Color);
glGetFloatv(GL_COLOR_CLEAR_VALUE, old_color_clear_value);
glClearColor(((Color >> 16) & 0xFF) / 255.0,
((Color >> 8) & 0xFF) / 255.0,
((Color >> 0) & 0xFF) / 255.0,
((Color >> 24) & 0xFF) / 255.0);
glClearColor(((Color >> 16) & 0xFF) / 255.0f,
((Color >> 8) & 0xFF) / 255.0f,
((Color >> 0) & 0xFF) / 255.0f,
((Color >> 24) & 0xFF) / 255.0f);
checkGLcall("glClearColor");
glMask = glMask | GL_COLOR_BUFFER_BIT;
}
......@@ -3094,34 +3096,26 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
if (Value) {
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->UpdateStateBlock->material.Specular);
checkGLcall("glMaterialfv");
#if defined(GL_VERSION_1_4)
glEnable(GL_COLOR_SUM);
#elif defined(GL_EXT_secondary_color)
glEnable(GL_COLOR_SUM_EXT);
#elif defined(GL_ARB_vertex_program)
glEnable(GL_COLOR_SUM_ARB);
#else
TRACE("Specular colors cannot be enabled in this version of opengl\n");
#endif
checkGLcall("glEnable(GL_COLOR_)\n");
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
glEnable(GL_COLOR_SUM_EXT);
} else {
TRACE("Specular colors cannot be enabled in this version of opengl\n");
}
checkGLcall("glEnable(GL_COLOR_SUM)\n");
} else {
float black[4] = {0.0, 0.0, 0.0, 0.0};
float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
/* for the case of enabled lighting: */
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
checkGLcall("glMaterialfv");
/* for the case of disabled lighting: */
#if defined(GL_VERSION_1_4)
glDisable(GL_COLOR_SUM);
#elif defined(GL_EXT_secondary_color)
glDisable(GL_COLOR_SUM_EXT);
#elif defined(GL_ARB_vertex_program)
glDisable(GL_COLOR_SUM_ARB);
#else
TRACE("Specular colors cannot be disabled in this version of opengl\n");
#endif
checkGLcall("glDisable(GL_COLOR_)\n");
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
glDisable(GL_COLOR_SUM_EXT);
} else {
TRACE("Specular colors cannot be disabled in this version of opengl\n");
}
checkGLcall("glDisable(GL_COLOR_SUM)\n");
}
}
break;
......@@ -3434,33 +3428,21 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
break;
case D3DRS_POINTSIZE_MIN :
#if defined(GL_VERSION_1_4)
glPointParameterf(GL_POINT_SIZE_MIN, *((float*)&Value));
checkGLcall("glPointParameterf(...);\n");
#elif defined(GL_EXT_point_parameters)
glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, *((float*)&Value));
checkGLcall("glPointParameterfEXT(...);\n");
#elif defined(GL_ARB_point_parameters)
glPointParameterfARB(GL_POINT_SIZE_MIN_ARB, *((float*)&Value));
checkGLcall("glPointParameterfARB(...);\n");
#else
FIXME("D3DRS_POINTSIZE_MIN not supported on this opengl\n");
#endif
if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, *((float*)&Value));
checkGLcall("glPointParameterfEXT(...);\n");
} else {
FIXME("D3DRS_POINTSIZE_MIN not supported on this opengl\n");
}
break;
case D3DRS_POINTSIZE_MAX :
#if defined(GL_VERSION_1_4)
glPointParameterf(GL_POINT_SIZE_MAX, *((float*)&Value));
checkGLcall("glPointParameterf(...);\n");
#elif defined(GL_EXT_point_parameters)
glPointParameterfEXT(GL_POINT_SIZE_MAX_EXT, *((float*)&Value));
checkGLcall("glPointParameterfEXT(...);\n");
#elif defined(GL_ARB_point_parameters)
glPointParameterfARB(GL_POINT_SIZE_MAX_ARB, *((float*)&Value));
checkGLcall("glPointParameterfARB(...);\n");
#else
FIXME("D3DRS_POINTSIZE_MAX not supported on this opengl\n");
#endif
if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, *((float*)&Value));
checkGLcall("glPointParameterfEXT(...);\n");
} else {
FIXME("D3DRS_POINTSIZE_MAX not supported on this opengl\n");
}
break;
case D3DRS_POINTSCALE_A :
......@@ -3470,38 +3452,26 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
{
/* If enabled, supply the parameters, otherwise fall back to defaults */
if (This->StateBlock->renderstate[D3DRS_POINTSCALEENABLE]) {
GLfloat att[3] = {1.0, 0.0, 0.0};
GLfloat att[3] = {1.0f, 0.0f, 0.0f};
att[0] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_A]);
att[1] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_B]);
att[2] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_C]);
#if defined(GL_VERSION_1_4)
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, att);
checkGLcall("glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, ...);\n");
#elif defined(GL_EXT_point_parameters)
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, att);
checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...);\n");
#elif defined(GL_ARB_point_parameters)
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
checkGLcall("glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, ...);\n");
#else
TRACE("D3DRS_POINTSCALEENABLE not supported on this opengl\n");
#endif
if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...);\n");
} else {
TRACE("D3DRS_POINTSCALEENABLE not supported on this opengl\n");
}
} else {
GLfloat att[3] = {1.0, 0.0, 0.0};
#if defined(GL_VERSION_1_4)
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, att);
checkGLcall("glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, ...);\n");
#elif defined(GL_EXT_point_parameters)
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, att);
checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...);\n");
#elif defined(GL_ARB_point_parameters)
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
checkGLcall("glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, ...);\n");
#else
TRACE("D3DRS_POINTSCALEENABLE not supported, but not on either\n");
#endif
}
GLfloat att[3] = {1.0f, 0.0f, 0.0f};
if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...);\n");
} else {
TRACE("D3DRS_POINTSCALEENABLE not supported, but not on either\n");
}
}
break;
}
......@@ -4197,12 +4167,12 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8
This->currentPalette = PaletteNumber;
#if defined(GL_EXT_paletted_texture)
if (GL_SUPPORT(EXT_PALETTED_TEXTURE)) {
glColorTableEXT(GL_TEXTURE_2D, /* target */
GL_RGBA, /* internal format */
256, /* table size */
GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */
This->palettes[PaletteNumber]);
GL_EXTCALL(glColorTableEXT)(GL_TEXTURE_2D, /* target */
GL_RGBA, /* internal format */
256, /* table size */
GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */
This->palettes[PaletteNumber]);
checkGLcall("glColorTableEXT");
} else {
/* Delayed palette handling ... waiting for software emulation into preload code */
......
......@@ -646,6 +646,10 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
This->gl_info.vs_nv_version = VS_VERSION_NOT_SUPPORTED;
This->gl_info.vs_ati_version = VS_VERSION_NOT_SUPPORTED;
#define USE_GL_FUNC(type, pfn) This->gl_info.pfn = NULL;
GL_EXT_FUNCS_GEN;
#undef USE_GL_FUNC
/* Retrieve opengl defaults */
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
This->gl_info.max_clipplanes = min(MAX_CLIPPLANES, gl_max);
......@@ -759,6 +763,10 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
}
}
#define USE_GL_FUNC(type, pfn) This->gl_info.pfn = (type) glXGetProcAddressARB(#pfn);
GL_EXT_FUNCS_GEN;
#undef USE_GL_FUNC
GLX_Extensions = glXQueryExtensionsString(display, DefaultScreen(display));
FIXME("GLX_Extensions reported:\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment