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_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 */
......@@ -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