Commit a460a2df authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Store the gl information in a per adapter structure and initialize it only once.

parent 6089fe86
...@@ -104,7 +104,7 @@ void shader_arb_load_constants( ...@@ -104,7 +104,7 @@ void shader_arb_load_constants(
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock; IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl*)deviceImpl->wineD3D)->gl_info; WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
if (useVertexShader) { if (useVertexShader) {
IWineD3DBaseShaderImpl* vshader = (IWineD3DBaseShaderImpl*) stateBlock->vertexShader; IWineD3DBaseShaderImpl* vshader = (IWineD3DBaseShaderImpl*) stateBlock->vertexShader;
...@@ -383,7 +383,7 @@ static void shader_hw_sample(SHADER_OPCODE_ARG* arg, DWORD sampler_idx, const ch ...@@ -383,7 +383,7 @@ static void shader_hw_sample(SHADER_OPCODE_ARG* arg, DWORD sampler_idx, const ch
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *) deviceImpl->stateBlock->textures[sampler_idx]; IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *) deviceImpl->stateBlock->textures[sampler_idx];
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(((IWineD3DDeviceImpl *)(This->baseShader.device))->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info;
SHADER_BUFFER* buffer = arg->buffer; SHADER_BUFFER* buffer = arg->buffer;
DWORD sampler_type = arg->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK; DWORD sampler_type = arg->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK;
...@@ -1033,7 +1033,7 @@ static GLuint create_arb_blt_fragment_program(WineD3D_GL_Info *gl_info) { ...@@ -1033,7 +1033,7 @@ static GLuint create_arb_blt_fragment_program(WineD3D_GL_Info *gl_info) {
static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) { static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
if (useVS) { if (useVS) {
TRACE("Using vertex shader\n"); TRACE("Using vertex shader\n");
...@@ -1074,7 +1074,7 @@ static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) { ...@@ -1074,7 +1074,7 @@ static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
static void shader_arb_select_depth_blt(IWineD3DDevice *iface) { static void shader_arb_select_depth_blt(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
static GLuint vprogram_id = 0; static GLuint vprogram_id = 0;
static GLuint fprogram_id = 0; static GLuint fprogram_id = 0;
...@@ -1089,7 +1089,7 @@ static void shader_arb_select_depth_blt(IWineD3DDevice *iface) { ...@@ -1089,7 +1089,7 @@ static void shader_arb_select_depth_blt(IWineD3DDevice *iface) {
static void shader_arb_cleanup(IWineD3DDevice *iface) { static void shader_arb_cleanup(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
if (GL_SUPPORT(ARB_VERTEX_PROGRAM)) glDisable(GL_VERTEX_PROGRAM_ARB); if (GL_SUPPORT(ARB_VERTEX_PROGRAM)) glDisable(GL_VERTEX_PROGRAM_ARB);
if (GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) glDisable(GL_FRAGMENT_PROGRAM_ARB); if (GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) glDisable(GL_FRAGMENT_PROGRAM_ARB);
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
static const Wined3dTextureStateMap textureObjectSamplerStates[] = { static const Wined3dTextureStateMap textureObjectSamplerStates[] = {
{WINED3DSAMP_ADDRESSU, WINED3DSAMP_ADDRESSU}, {WINED3DSAMP_ADDRESSU, WINED3DSAMP_ADDRESSU},
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info #define GLINFO_LOCATION This->adapter->gl_info
/***************************************************************************** /*****************************************************************************
* Context_MarkStateDirty * Context_MarkStateDirty
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
static const GLenum cube_targets[6] = { static const GLenum cube_targets[6] = {
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info #define GLINFO_LOCATION This->adapter->gl_info
/* Define the default light parameters as specified by MSDN */ /* Define the default light parameters as specified by MSDN */
const WINED3DLIGHT WINED3D_default_light = { const WINED3DLIGHT WINED3D_default_light = {
...@@ -1855,12 +1855,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR ...@@ -1855,12 +1855,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
/* Set up some starting GL setup */ /* Set up some starting GL setup */
ENTER_GL(); ENTER_GL();
/*
* Initialize openGL extension related variables
* with Default values
*/
((IWineD3DImpl *) This->wineD3D)->isGLInfoValid = IWineD3DImpl_FillGLCaps(This->wineD3D, swapchain->context[0]->display);
/* Setup all the devices defaults */ /* Setup all the devices defaults */
IWineD3DStateBlock_InitStartupStateBlock((IWineD3DStateBlock *)This->stateBlock); IWineD3DStateBlock_InitStartupStateBlock((IWineD3DStateBlock *)This->stateBlock);
#if 0 #if 0
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw); WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw);
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info #define GLINFO_LOCATION This->adapter->gl_info
#include <stdio.h> #include <stdio.h>
......
...@@ -287,7 +287,7 @@ void shader_glsl_load_constants( ...@@ -287,7 +287,7 @@ void shader_glsl_load_constants(
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock; IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl*) deviceImpl->wineD3D)->gl_info; WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
GLhandleARB *constant_locations; GLhandleARB *constant_locations;
struct list *constant_list; struct list *constant_list;
...@@ -583,7 +583,7 @@ static void shader_glsl_get_register_name( ...@@ -583,7 +583,7 @@ static void shader_glsl_get_register_name(
DWORD regtype = shader_get_regtype(param); DWORD regtype = shader_get_regtype(param);
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) arg->shader; IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
WineD3D_GL_Info* gl_info = &((IWineD3DImpl*)deviceImpl->wineD3D)->gl_info; WineD3D_GL_Info* gl_info = &deviceImpl->adapter->gl_info;
char pshader = shader_is_pshader_version(This->baseShader.hex_version); char pshader = shader_is_pshader_version(This->baseShader.hex_version);
char tmpStr[50]; char tmpStr[50];
...@@ -2099,7 +2099,7 @@ static struct glsl_shader_prog_link *get_glsl_program_entry(IWineD3DDeviceImpl * ...@@ -2099,7 +2099,7 @@ static struct glsl_shader_prog_link *get_glsl_program_entry(IWineD3DDeviceImpl *
void delete_glsl_program_entry(IWineD3DDevice *iface, struct glsl_shader_prog_link *entry) { void delete_glsl_program_entry(IWineD3DDevice *iface, struct glsl_shader_prog_link *entry) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
glsl_program_key_t *key; glsl_program_key_t *key;
key = HeapAlloc(GetProcessHeap(), 0, sizeof(glsl_program_key_t)); key = HeapAlloc(GetProcessHeap(), 0, sizeof(glsl_program_key_t));
...@@ -2125,7 +2125,7 @@ void delete_glsl_program_entry(IWineD3DDevice *iface, struct glsl_shader_prog_li ...@@ -2125,7 +2125,7 @@ void delete_glsl_program_entry(IWineD3DDevice *iface, struct glsl_shader_prog_li
*/ */
static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use_vs) { static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use_vs) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
IWineD3DPixelShader *pshader = This->stateBlock->pixelShader; IWineD3DPixelShader *pshader = This->stateBlock->pixelShader;
IWineD3DVertexShader *vshader = This->stateBlock->vertexShader; IWineD3DVertexShader *vshader = This->stateBlock->vertexShader;
struct glsl_shader_prog_link *entry = NULL; struct glsl_shader_prog_link *entry = NULL;
...@@ -2250,7 +2250,7 @@ static GLhandleARB create_glsl_blt_shader(WineD3D_GL_Info *gl_info) { ...@@ -2250,7 +2250,7 @@ static GLhandleARB create_glsl_blt_shader(WineD3D_GL_Info *gl_info) {
static void shader_glsl_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) { static void shader_glsl_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
GLhandleARB program_id = 0; GLhandleARB program_id = 0;
if (useVS || usePS) set_glsl_shader_program(iface, usePS, useVS); if (useVS || usePS) set_glsl_shader_program(iface, usePS, useVS);
...@@ -2264,7 +2264,7 @@ static void shader_glsl_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) { ...@@ -2264,7 +2264,7 @@ static void shader_glsl_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
static void shader_glsl_select_depth_blt(IWineD3DDevice *iface) { static void shader_glsl_select_depth_blt(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
static GLhandleARB program_id = 0; static GLhandleARB program_id = 0;
static GLhandleARB loc = -1; static GLhandleARB loc = -1;
...@@ -2279,7 +2279,7 @@ static void shader_glsl_select_depth_blt(IWineD3DDevice *iface) { ...@@ -2279,7 +2279,7 @@ static void shader_glsl_select_depth_blt(IWineD3DDevice *iface) {
static void shader_glsl_cleanup(IWineD3DDevice *iface) { static void shader_glsl_cleanup(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(This->wineD3D))->gl_info; WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
GL_EXTCALL(glUseProgramObjectARB(0)); GL_EXTCALL(glUseProgramObjectARB(0));
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
/* ******************************************* /* *******************************************
IWineD3DIndexBuffer IUnknown parts follow IWineD3DIndexBuffer IUnknown parts follow
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->baseShader.device)->wineD3D))->gl_info #define GLINFO_LOCATION ((IWineD3DDeviceImpl *) This->baseShader.device)->adapter->gl_info
#if 0 /* Must not be 1 in cvs version */ #if 0 /* Must not be 1 in cvs version */
# define PSTRACE(A) TRACE A # define PSTRACE(A) TRACE A
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
*/ */
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
/* ******************************************* /* *******************************************
IWineD3DQuery IUnknown parts follow IWineD3DQuery IUnknown parts follow
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(d3d_shader); WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
#define GLINFO_LOCATION ((IWineD3DImpl *)(stateblock->wineD3DDevice->wineD3D))->gl_info #define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
/* Used for states which are not mapped to a gl state as-is, but used somehow different, /* Used for states which are not mapped to a gl state as-is, but used somehow different,
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
/*************************************** /***************************************
* Stateblock helper functions follow * Stateblock helper functions follow
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
typedef enum { typedef enum {
NO_CONVERSION, NO_CONVERSION,
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
/* ******************************************* /* *******************************************
IWineD3DTexture IUnknown parts follow IWineD3DTexture IUnknown parts follow
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info #define GLINFO_LOCATION This->adapter->gl_info
/***************************************************************************** /*****************************************************************************
* Pixel format array * Pixel format array
...@@ -1217,7 +1217,6 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP ...@@ -1217,7 +1217,6 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP
/* Setup the texture operations texture stage states */ /* Setup the texture operations texture stage states */
void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3) void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3)
{ {
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info
GLenum src1, src2, src3; GLenum src1, src2, src3;
GLenum opr1, opr2, opr3; GLenum opr1, opr2, opr3;
GLenum comb_target; GLenum comb_target;
...@@ -2577,7 +2576,7 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) { ...@@ -2577,7 +2576,7 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) {
* FALSE otherwise * FALSE otherwise
* *
*********************************************************************/ *********************************************************************/
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->resource.wineD3DDevice->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]) { BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]) {
int x1 = Rect->left, x2 = Rect->right; int x1 = Rect->left, x2 = Rect->right;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
#define VB_MAXDECLCHANGES 100 /* After that number we stop converting */ #define VB_MAXDECLCHANGES 100 /* After that number we stop converting */
#define VB_RESETDECLCHANGE 1000 /* Reset the changecount after that number of draws */ #define VB_RESETDECLCHANGE 1000 /* Reset the changecount after that number of draws */
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->baseShader.device)->wineD3D))->gl_info #define GLINFO_LOCATION ((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info
/* Shader debugging - Change the following line to enable debugging of software /* Shader debugging - Change the following line to enable debugging of software
vertex shaders */ vertex shaders */
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
/* ******************************************* /* *******************************************
IWineD3DVolume IUnknown parts follow IWineD3DVolume IUnknown parts follow
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
/* ******************************************* /* *******************************************
IWineD3DTexture IUnknown parts follow IWineD3DTexture IUnknown parts follow
......
...@@ -59,7 +59,14 @@ long globalChangeGlRam(long glram){ ...@@ -59,7 +59,14 @@ long globalChangeGlRam(long glram){
} }
IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *parent) { IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *parent) {
IWineD3DImpl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DImpl)); IWineD3DImpl* object;
if (!InitAdapters()) {
ERR("Failed to initialize direct3d adapters\n");
return NULL;
}
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DImpl));
object->lpVtbl = &IWineD3D_Vtbl; object->lpVtbl = &IWineD3D_Vtbl;
object->dxVersion = dxVersion; object->dxVersion = dxVersion;
object->ref = 1; object->ref = 1;
...@@ -72,7 +79,6 @@ IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *p ...@@ -72,7 +79,6 @@ IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *p
} }
TRACE("Created WineD3D object @ %p for d3d%d support\n", object, dxVersion); TRACE("Created WineD3D object @ %p for d3d%d support\n", object, dxVersion);
return (IWineD3D *)object; return (IWineD3D *)object;
......
...@@ -537,9 +537,6 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar ...@@ -537,9 +537,6 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context); void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context);
void apply_fbo_state(IWineD3DDevice *iface); void apply_fbo_state(IWineD3DDevice *iface);
/* Routine to fill gl caps for swapchains and IWineD3D */
BOOL IWineD3DImpl_FillGLCaps(IWineD3D *iface, Display* display);
/* Macros for doing basic GPU detection based on opengl capabilities */ /* Macros for doing basic GPU detection based on opengl capabilities */
#define WINE_D3D6_CAPABLE(gl_info) (gl_info->supported[ARB_MULTITEXTURE]) #define WINE_D3D6_CAPABLE(gl_info) (gl_info->supported[ARB_MULTITEXTURE])
#define WINE_D3D7_CAPABLE(gl_info) (gl_info->supported[ARB_TEXTURE_COMPRESSION] && gl_info->supported[ARB_TEXTURE_CUBE_MAP] && gl_info->supported[ARB_TEXTURE_ENV_DOT3]) #define WINE_D3D7_CAPABLE(gl_info) (gl_info->supported[ARB_TEXTURE_COMPRESSION] && gl_info->supported[ARB_TEXTURE_CUBE_MAP] && gl_info->supported[ARB_TEXTURE_ENV_DOT3])
...@@ -574,6 +571,16 @@ struct PLIGHTINFOEL { ...@@ -574,6 +571,16 @@ struct PLIGHTINFOEL {
/* The default light parameters */ /* The default light parameters */
extern const WINED3DLIGHT WINED3D_default_light; extern const WINED3DLIGHT WINED3D_default_light;
/* The adapter structure */
struct WineD3DAdapter
{
POINT monitorPoint;
Display *display;
WineD3D_GL_Info gl_info;
};
extern BOOL InitAdapters(void);
/***************************************************************************** /*****************************************************************************
* IWineD3D implementation structure * IWineD3D implementation structure
*/ */
...@@ -586,10 +593,6 @@ typedef struct IWineD3DImpl ...@@ -586,10 +593,6 @@ typedef struct IWineD3DImpl
/* WineD3D Information */ /* WineD3D Information */
IUnknown *parent; IUnknown *parent;
UINT dxVersion; UINT dxVersion;
/* GL Information */
BOOL isGLInfoValid;
WineD3D_GL_Info gl_info;
} IWineD3DImpl; } IWineD3DImpl;
extern const IWineD3DVtbl IWineD3D_Vtbl; extern const IWineD3DVtbl IWineD3D_Vtbl;
...@@ -620,6 +623,7 @@ struct IWineD3DDeviceImpl ...@@ -620,6 +623,7 @@ struct IWineD3DDeviceImpl
/* WineD3D Information */ /* WineD3D Information */
IUnknown *parent; IUnknown *parent;
IWineD3D *wineD3D; IWineD3D *wineD3D;
struct WineD3DAdapter *adapter;
/* Window styles to restore when switching fullscreen mode */ /* Window styles to restore when switching fullscreen mode */
LONG style; LONG style;
......
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