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 { ...@@ -153,12 +153,6 @@ typedef struct PSHADEROUTPUTDATA8 {
/* /*
* External prototypes
*/
/*BOOL D3DRAW_HAL_Init(HINSTANCE, DWORD, LPVOID); */
void CreateStateBlock(LPDIRECT3DDEVICE8 iface);
/*
* Macros * Macros
*/ */
#define checkGLcall(A) \ #define checkGLcall(A) \
...@@ -180,58 +174,9 @@ void CreateStateBlock(LPDIRECT3DDEVICE8 iface); ...@@ -180,58 +174,9 @@ void CreateStateBlock(LPDIRECT3DDEVICE8 iface);
} \ } \
} }
typedef enum _GL_SupportedExt { #include "d3dcore_gl.h"
/* 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;
#define USE_GL_FUNC(type, pfn) type pfn;
typedef struct _GL_Info { typedef struct _GL_Info {
/** /**
* CAPS Constants * CAPS Constants
...@@ -248,12 +193,17 @@ typedef struct _GL_Info { ...@@ -248,12 +193,17 @@ typedef struct _GL_Info {
GL_VSVersion vs_ati_version; GL_VSVersion vs_ati_version;
BOOL supported[30]; BOOL supported[30];
/** ext functions ptr */
GL_EXT_FUNCS_GEN;
/**/
} GL_Info; } GL_Info;
#undef USE_GL_FUNC
#define GL_LIMITS(ExtName) (This->direct3d8->gl_info.max_##ExtName) #define GL_LIMITS(ExtName) (This->direct3d8->gl_info.max_##ExtName)
#define GL_SUPPORT(ExtName) (TRUE == This->direct3d8->gl_info.supported[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_SUPPORT_DEV(ExtName, dev) (TRUE == (dev)->direct3d8->gl_info.supported[ExtName])
#define GLExtCall(FuncName) /*(This->direct3d8->glInfo.FuncName)*/ #define GL_EXTCALL(FuncName) (This->direct3d8->gl_info.FuncName)
#define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f) #define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
...@@ -1283,7 +1233,6 @@ void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenu ...@@ -1283,7 +1233,6 @@ void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenu
void setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage); void setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage);
void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3); void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt); SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt); GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
GLenum D3DFmt2GLFmt(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 @@ ...@@ -32,7 +32,10 @@
/** define GL_GLEXT_PROTOTYPES for having extensions prototypes defined */ /** define GL_GLEXT_PROTOTYPES for having extensions prototypes defined */
/*#define GL_GLEXT_PROTOTYPES*/ /*#define GL_GLEXT_PROTOTYPES*/
/*#undef GLX_GLXEXT_LEGACY*/
#include "d3d8_private.h" #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 */ /** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */
#undef GL_VERSION_1_4 #undef GL_VERSION_1_4
...@@ -595,13 +598,10 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface, ...@@ -595,13 +598,10 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface,
glColor4fv((float*) &vertex_shader->output.oD[0]); glColor4fv((float*) &vertex_shader->output.oD[0]);
/* Requires secondary color extensions to compile... */ /* Requires secondary color extensions to compile... */
#if defined(GL_VERSION_1_4) #if defined(GL_EXT_secondary_color)
glSecondaryColor3fv((float*) &vertex_shader->output.oD[1]);
checkGLcall("glSecondaryColor3fv");
#elif defined(GL_EXT_secondary_color)
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) { if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
/*specularColor = D3DCOLORTOCOLORVALUE(vertex_shader->output.oD[1]);*/ /*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"); checkGLcall("glSecondaryColor3fvEXT");
} }
#endif #endif
...@@ -815,34 +815,26 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface, ...@@ -815,34 +815,26 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface,
/* Requires secondary color extensions to compile... */ /* Requires secondary color extensions to compile... */
if (isSpecular) { if (isSpecular) {
#if defined(GL_VERSION_1_4) #if defined(GL_EXT_secondary_color)
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)
/* FIXME: check for GL_EXT_secondary_color */ /* FIXME: check for GL_EXT_secondary_color */
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) { if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, skip, curPos); GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE, skip, curPos);
checkGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, skip, curPos)"); vcheckGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, skip, curPos)");
glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
checkGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)"); vcheckGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
} }
#endif #endif
curPos += sizeof(DWORD); curPos += sizeof(DWORD);
} else { } else {
#if defined(GL_VERSION_1_4) #if defined(GL_EXT_secondary_color)
glDisableClientState(GL_SECONDARY_COLOR_ARRAY); if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
checkGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY)");
glSecondaryColor3f(0, 0, 0);
checkGLcall("glSecondaryColor3f(0, 0, 0)");
#else
#if 0
glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
checkGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)"); vcheckGLcall("glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
glSecondaryColor3fEXT(0, 0, 0); #if 0
checkGLcall("glSecondaryColor3fEXT(0, 0, 0)"); GL_EXTCALL(glSecondaryColor3fEXT)(0.0f, 0.0f, 0.0f);
vcheckGLcall("glSecondaryColor3fEXT(0, 0, 0)");
#endif #endif
}
#endif #endif
} }
...@@ -1256,13 +1248,23 @@ HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D ...@@ -1256,13 +1248,23 @@ HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D
return D3D_OK; return D3D_OK;
} }
void WINAPI IDirect3DDevice8Impl_SetGammaRamp(LPDIRECT3DDEVICE8 iface, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { void WINAPI IDirect3DDevice8Impl_SetGammaRamp(LPDIRECT3DDEVICE8 iface, DWORD Flags, CONST D3DGAMMARAMP* pRamp) {
HDC hDC;
ICOM_THIS(IDirect3DDevice8Impl,iface); 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; return;
} }
void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp) { void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp) {
HDC hDC;
ICOM_THIS(IDirect3DDevice8Impl,iface); 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; return;
} }
HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
...@@ -1979,7 +1981,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface) { ...@@ -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 */ /** always dirtify for now. we must find a better way to see that surface have been modified */
IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE); IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE);
IDirect3DBaseTexture8_PreLoad(cont); IDirect3DBaseTexture8_PreLoad(cont);
IDirect3DBaseTexture8_Release(cont); IDirect3DBaseTexture8Impl_Release(cont);
cont = NULL; cont = NULL;
} }
} }
...@@ -2033,10 +2035,10 @@ HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count ...@@ -2033,10 +2035,10 @@ HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count
if (Flags & D3DCLEAR_TARGET) { if (Flags & D3DCLEAR_TARGET) {
TRACE("Clearing screen with glClear to color %lx\n", Color); TRACE("Clearing screen with glClear to color %lx\n", Color);
glGetFloatv(GL_COLOR_CLEAR_VALUE, old_color_clear_value); glGetFloatv(GL_COLOR_CLEAR_VALUE, old_color_clear_value);
glClearColor(((Color >> 16) & 0xFF) / 255.0, glClearColor(((Color >> 16) & 0xFF) / 255.0f,
((Color >> 8) & 0xFF) / 255.0, ((Color >> 8) & 0xFF) / 255.0f,
((Color >> 0) & 0xFF) / 255.0, ((Color >> 0) & 0xFF) / 255.0f,
((Color >> 24) & 0xFF) / 255.0); ((Color >> 24) & 0xFF) / 255.0f);
checkGLcall("glClearColor"); checkGLcall("glClearColor");
glMask = glMask | GL_COLOR_BUFFER_BIT; glMask = glMask | GL_COLOR_BUFFER_BIT;
} }
...@@ -3094,34 +3096,26 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3 ...@@ -3094,34 +3096,26 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
if (Value) { if (Value) {
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->UpdateStateBlock->material.Specular); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->UpdateStateBlock->material.Specular);
checkGLcall("glMaterialfv"); checkGLcall("glMaterialfv");
#if defined(GL_VERSION_1_4) if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
glEnable(GL_COLOR_SUM); glEnable(GL_COLOR_SUM_EXT);
#elif defined(GL_EXT_secondary_color) } else {
glEnable(GL_COLOR_SUM_EXT); TRACE("Specular colors cannot be enabled in this version of opengl\n");
#elif defined(GL_ARB_vertex_program) }
glEnable(GL_COLOR_SUM_ARB); checkGLcall("glEnable(GL_COLOR_SUM)\n");
#else
TRACE("Specular colors cannot be enabled in this version of opengl\n");
#endif
checkGLcall("glEnable(GL_COLOR_)\n");
} else { } 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: */ /* for the case of enabled lighting: */
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
checkGLcall("glMaterialfv"); checkGLcall("glMaterialfv");
/* for the case of disabled lighting: */ /* for the case of disabled lighting: */
#if defined(GL_VERSION_1_4) if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
glDisable(GL_COLOR_SUM); glDisable(GL_COLOR_SUM_EXT);
#elif defined(GL_EXT_secondary_color) } else {
glDisable(GL_COLOR_SUM_EXT); TRACE("Specular colors cannot be disabled in this version of opengl\n");
#elif defined(GL_ARB_vertex_program) }
glDisable(GL_COLOR_SUM_ARB); checkGLcall("glDisable(GL_COLOR_SUM)\n");
#else
TRACE("Specular colors cannot be disabled in this version of opengl\n");
#endif
checkGLcall("glDisable(GL_COLOR_)\n");
} }
} }
break; break;
...@@ -3434,33 +3428,21 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3 ...@@ -3434,33 +3428,21 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
break; break;
case D3DRS_POINTSIZE_MIN : case D3DRS_POINTSIZE_MIN :
#if defined(GL_VERSION_1_4) if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
glPointParameterf(GL_POINT_SIZE_MIN, *((float*)&Value)); GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, *((float*)&Value));
checkGLcall("glPointParameterf(...);\n"); checkGLcall("glPointParameterfEXT(...);\n");
#elif defined(GL_EXT_point_parameters) } else {
glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, *((float*)&Value)); FIXME("D3DRS_POINTSIZE_MIN not supported on this opengl\n");
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
break; break;
case D3DRS_POINTSIZE_MAX : case D3DRS_POINTSIZE_MAX :
#if defined(GL_VERSION_1_4) if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
glPointParameterf(GL_POINT_SIZE_MAX, *((float*)&Value)); GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, *((float*)&Value));
checkGLcall("glPointParameterf(...);\n"); checkGLcall("glPointParameterfEXT(...);\n");
#elif defined(GL_EXT_point_parameters) } else {
glPointParameterfEXT(GL_POINT_SIZE_MAX_EXT, *((float*)&Value)); FIXME("D3DRS_POINTSIZE_MAX not supported on this opengl\n");
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
break; break;
case D3DRS_POINTSCALE_A : case D3DRS_POINTSCALE_A :
...@@ -3470,38 +3452,26 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3 ...@@ -3470,38 +3452,26 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
{ {
/* If enabled, supply the parameters, otherwise fall back to defaults */ /* If enabled, supply the parameters, otherwise fall back to defaults */
if (This->StateBlock->renderstate[D3DRS_POINTSCALEENABLE]) { 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[0] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_A]);
att[1] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_B]); att[1] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_B]);
att[2] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_C]); att[2] = *((float*)&This->StateBlock->renderstate[D3DRS_POINTSCALE_C]);
#if defined(GL_VERSION_1_4) if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, att); GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
checkGLcall("glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, ...);\n"); checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...);\n");
#elif defined(GL_EXT_point_parameters) } else {
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, att); TRACE("D3DRS_POINTSCALEENABLE not supported on this opengl\n");
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
} else { } else {
GLfloat att[3] = {1.0, 0.0, 0.0}; GLfloat att[3] = {1.0f, 0.0f, 0.0f};
#if defined(GL_VERSION_1_4) if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, att); GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
checkGLcall("glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, ...);\n"); checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...);\n");
#elif defined(GL_EXT_point_parameters) } else {
glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, att); TRACE("D3DRS_POINTSCALEENABLE not supported, but not on either\n");
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
}
break; break;
} }
...@@ -4197,12 +4167,12 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8 ...@@ -4197,12 +4167,12 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8
This->currentPalette = PaletteNumber; This->currentPalette = PaletteNumber;
#if defined(GL_EXT_paletted_texture) #if defined(GL_EXT_paletted_texture)
if (GL_SUPPORT(EXT_PALETTED_TEXTURE)) { if (GL_SUPPORT(EXT_PALETTED_TEXTURE)) {
glColorTableEXT(GL_TEXTURE_2D, /* target */ GL_EXTCALL(glColorTableEXT)(GL_TEXTURE_2D, /* target */
GL_RGBA, /* internal format */ GL_RGBA, /* internal format */
256, /* table size */ 256, /* table size */
GL_RGBA, /* table format */ GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */ GL_UNSIGNED_BYTE, /* table type */
This->palettes[PaletteNumber]); This->palettes[PaletteNumber]);
checkGLcall("glColorTableEXT"); checkGLcall("glColorTableEXT");
} else { } else {
/* Delayed palette handling ... waiting for software emulation into preload code */ /* Delayed palette handling ... waiting for software emulation into preload code */
......
...@@ -646,6 +646,10 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) { ...@@ -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_nv_version = VS_VERSION_NOT_SUPPORTED;
This->gl_info.vs_ati_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 */ /* Retrieve opengl defaults */
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max); glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
This->gl_info.max_clipplanes = min(MAX_CLIPPLANES, gl_max); This->gl_info.max_clipplanes = min(MAX_CLIPPLANES, gl_max);
...@@ -759,6 +763,10 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) { ...@@ -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)); GLX_Extensions = glXQueryExtensionsString(display, DefaultScreen(display));
FIXME("GLX_Extensions reported:\n"); 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