Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b9e2beda
Commit
b9e2beda
authored
Oct 08, 2004
by
Jason Edmeades
Committed by
Alexandre Julliard
Oct 08, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy and tidy up the code from dx8 create device into wined3d. Call
from wined3d and d3d8, but short term only use the code for real from d3d9.
parent
861f6240
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
351 additions
and
27 deletions
+351
-27
d3d8_private.h
dlls/d3d8/d3d8_private.h
+1
-0
device.c
dlls/d3d8/device.c
+2
-0
directx.c
dlls/d3d8/directx.c
+18
-0
device.c
dlls/d3d9/device.c
+1
-0
directx.c
dlls/d3d9/directx.c
+14
-5
directx.c
dlls/wined3d/directx.c
+263
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+33
-1
d3d9types.h
include/d3d9types.h
+2
-1
wined3d_interface.h
include/wine/wined3d_interface.h
+17
-17
No files found.
dlls/d3d8/d3d8_private.h
View file @
b9e2beda
...
@@ -340,6 +340,7 @@ struct IDirect3DDevice8Impl
...
@@ -340,6 +340,7 @@ struct IDirect3DDevice8Impl
/* IDirect3DDevice8 fields */
/* IDirect3DDevice8 fields */
IDirect3D8Impl
*
direct3d8
;
IDirect3D8Impl
*
direct3d8
;
IWineD3DDevice
*
WineD3DDevice
;
IDirect3DSurface8Impl
*
frontBuffer
;
IDirect3DSurface8Impl
*
frontBuffer
;
IDirect3DSurface8Impl
*
backBuffer
;
IDirect3DSurface8Impl
*
backBuffer
;
...
...
dlls/d3d8/device.c
View file @
b9e2beda
...
@@ -307,6 +307,8 @@ ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
...
@@ -307,6 +307,8 @@ ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
TRACE
(
"(%p) : ReleaseRef to %ld
\n
"
,
This
,
This
->
ref
);
TRACE
(
"(%p) : ReleaseRef to %ld
\n
"
,
This
,
This
->
ref
);
if
(
ref
==
0
)
{
if
(
ref
==
0
)
{
IDirect3DDevice8Impl_CleanRender
(
iface
);
IDirect3DDevice8Impl_CleanRender
(
iface
);
IDirect3D8_Release
((
LPDIRECT3D8
)
This
->
direct3d8
);
IWineD3DDevice_Release
(
This
->
WineD3DDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
}
return
ref
;
return
ref
;
...
...
dlls/d3d8/directx.c
View file @
b9e2beda
...
@@ -547,6 +547,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
...
@@ -547,6 +547,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
int
num
;
int
num
;
XVisualInfo
template
;
XVisualInfo
template
;
HDC
hDc
;
HDC
hDc
;
WINED3DPRESENT_PARAMETERS
localParameters
;
IDirect3D8Impl
*
This
=
(
IDirect3D8Impl
*
)
iface
;
IDirect3D8Impl
*
This
=
(
IDirect3D8Impl
*
)
iface
;
TRACE
(
"(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)
\n
"
,
This
,
Adapter
,
DeviceType
,
TRACE
(
"(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)
\n
"
,
This
,
Adapter
,
DeviceType
,
...
@@ -567,6 +568,23 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
...
@@ -567,6 +568,23 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
/** The device AddRef the direct3d8 Interface else crash in propers clients codes */
/** The device AddRef the direct3d8 Interface else crash in propers clients codes */
IDirect3D8_AddRef
((
LPDIRECT3D8
)
object
->
direct3d8
);
IDirect3D8_AddRef
((
LPDIRECT3D8
)
object
->
direct3d8
);
/* Allocate an associated WineD3DDevice object */
localParameters
.
BackBufferWidth
=
&
pPresentationParameters
->
BackBufferWidth
;
localParameters
.
BackBufferHeight
=
&
pPresentationParameters
->
BackBufferHeight
;
localParameters
.
BackBufferFormat
=
&
pPresentationParameters
->
BackBufferFormat
;
localParameters
.
BackBufferCount
=
&
pPresentationParameters
->
BackBufferCount
;
localParameters
.
MultiSampleType
=
&
pPresentationParameters
->
MultiSampleType
;
localParameters
.
MultiSampleQuality
=
NULL
;
/* New at dx9 */
localParameters
.
SwapEffect
=
&
pPresentationParameters
->
SwapEffect
;
localParameters
.
hDeviceWindow
=
&
pPresentationParameters
->
hDeviceWindow
;
localParameters
.
Windowed
=
&
pPresentationParameters
->
Windowed
;
localParameters
.
EnableAutoDepthStencil
=
&
pPresentationParameters
->
EnableAutoDepthStencil
;
localParameters
.
AutoDepthStencilFormat
=
&
pPresentationParameters
->
AutoDepthStencilFormat
;
localParameters
.
Flags
=
&
pPresentationParameters
->
Flags
;
localParameters
.
FullScreen_RefreshRateInHz
=
&
pPresentationParameters
->
FullScreen_RefreshRateInHz
;
localParameters
.
PresentationInterval
=
&
pPresentationParameters
->
FullScreen_PresentationInterval
;
/* Renamed in dx9 */
IWineD3D_CreateDevice
(
This
->
WineD3D
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
&
localParameters
,
&
object
->
WineD3DDevice
);
/** use StateBlock Factory here, for creating the startup stateBlock */
/** use StateBlock Factory here, for creating the startup stateBlock */
object
->
StateBlock
=
NULL
;
object
->
StateBlock
=
NULL
;
IDirect3DDeviceImpl_CreateStateBlock
(
object
,
D3DSBT_ALL
,
NULL
);
IDirect3DDeviceImpl_CreateStateBlock
(
object
,
D3DSBT_ALL
,
NULL
);
...
...
dlls/d3d9/device.c
View file @
b9e2beda
...
@@ -68,6 +68,7 @@ ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
...
@@ -68,6 +68,7 @@ ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
TRACE
(
"(%p) : ReleaseRef to %ld
\n
"
,
This
,
This
->
ref
);
TRACE
(
"(%p) : ReleaseRef to %ld
\n
"
,
This
,
This
->
ref
);
if
(
ref
==
0
)
{
if
(
ref
==
0
)
{
IDirect3D9_Release
((
LPDIRECT3D9
)
This
->
direct3d
);
IDirect3D9_Release
((
LPDIRECT3D9
)
This
->
direct3d
);
IWineD3DDevice_Release
(
This
->
WineD3DDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
}
return
ref
;
return
ref
;
...
...
dlls/d3d9/directx.c
View file @
b9e2beda
...
@@ -172,9 +172,6 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
...
@@ -172,9 +172,6 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
IDirect3DDevice9Impl
*
object
=
NULL
;
IDirect3DDevice9Impl
*
object
=
NULL
;
WINED3DPRESENT_PARAMETERS
localParameters
;
WINED3DPRESENT_PARAMETERS
localParameters
;
TRACE
(
"(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)
\n
"
,
This
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
pPresentationParameters
,
ppReturnedDeviceInterface
);
/* Check the validity range of the adapter parameter */
/* Check the validity range of the adapter parameter */
if
(
Adapter
>=
IDirect3D9Impl_GetAdapterCount
(
iface
))
{
if
(
Adapter
>=
IDirect3D9Impl_GetAdapterCount
(
iface
))
{
return
D3DERR_INVALIDCALL
;
return
D3DERR_INVALIDCALL
;
...
@@ -192,9 +189,21 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
...
@@ -192,9 +189,21 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
*
ppReturnedDeviceInterface
=
(
IDirect3DDevice9
*
)
object
;
*
ppReturnedDeviceInterface
=
(
IDirect3DDevice9
*
)
object
;
/* Allocate an associated WineD3DDevice object */
/* Allocate an associated WineD3DDevice object */
memcpy
(
&
localParameters
,
pPresentationParameters
,
sizeof
(
D3DPRESENT_PARAMETERS
));
localParameters
.
BackBufferWidth
=
&
pPresentationParameters
->
BackBufferWidth
;
localParameters
.
BackBufferHeight
=
&
pPresentationParameters
->
BackBufferHeight
;
localParameters
.
BackBufferFormat
=
&
pPresentationParameters
->
BackBufferFormat
;
localParameters
.
BackBufferCount
=
&
pPresentationParameters
->
BackBufferCount
;
localParameters
.
MultiSampleType
=
&
pPresentationParameters
->
MultiSampleType
;
localParameters
.
MultiSampleQuality
=
&
pPresentationParameters
->
MultiSampleQuality
;
localParameters
.
SwapEffect
=
&
pPresentationParameters
->
SwapEffect
;
localParameters
.
hDeviceWindow
=
&
pPresentationParameters
->
hDeviceWindow
;
localParameters
.
Windowed
=
&
pPresentationParameters
->
Windowed
;
localParameters
.
EnableAutoDepthStencil
=
&
pPresentationParameters
->
EnableAutoDepthStencil
;
localParameters
.
AutoDepthStencilFormat
=
&
pPresentationParameters
->
AutoDepthStencilFormat
;
localParameters
.
Flags
=
&
pPresentationParameters
->
Flags
;
localParameters
.
FullScreen_RefreshRateInHz
=
&
pPresentationParameters
->
FullScreen_RefreshRateInHz
;
localParameters
.
PresentationInterval
=
&
pPresentationParameters
->
PresentationInterval
;
IWineD3D_CreateDevice
(
This
->
WineD3D
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
&
localParameters
,
&
object
->
WineD3DDevice
);
IWineD3D_CreateDevice
(
This
->
WineD3D
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
&
localParameters
,
&
object
->
WineD3DDevice
);
memcpy
(
pPresentationParameters
,
&
localParameters
,
sizeof
(
D3DPRESENT_PARAMETERS
));
FIXME
(
"(%p) : incomplete stub
\n
"
,
This
);
FIXME
(
"(%p) : incomplete stub
\n
"
,
This
);
return
D3D_OK
;
return
D3D_OK
;
...
...
dlls/wined3d/directx.c
View file @
b9e2beda
...
@@ -1312,15 +1312,275 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
...
@@ -1312,15 +1312,275 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
DWORD
BehaviourFlags
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
,
DWORD
BehaviourFlags
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
,
IWineD3DDevice
**
ppReturnedDeviceInterface
)
{
IWineD3DDevice
**
ppReturnedDeviceInterface
)
{
HWND
whichHWND
;
HDC
hDc
;
IWineD3DDeviceImpl
*
object
=
NULL
;
IWineD3DImpl
*
This
=
(
IWineD3DImpl
*
)
iface
;
int
num
;
XVisualInfo
template
;
/* Validate the adapter number */
if
(
Adapter
>=
IWineD3D_GetAdapterCount
(
iface
))
{
return
D3DERR_INVALIDCALL
;
}
/* Create a WineD3DDevice object */
/* Create a WineD3DDevice object */
IWineD3DDeviceImpl
*
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DDeviceImpl
));
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DDeviceImpl
));
*
ppReturnedDeviceInterface
=
(
IWineD3DDevice
*
)
object
;
TRACE
(
"Created WineD3DDevice object @ %p
\n
"
,
object
);
if
(
NULL
==
object
)
{
return
D3DERR_OUTOFVIDEOMEMORY
;
}
/* Set up initial COM information */
object
->
lpVtbl
=
&
IWineD3DDevice_Vtbl
;
object
->
lpVtbl
=
&
IWineD3DDevice_Vtbl
;
object
->
ref
=
1
;
object
->
ref
=
1
;
object
->
WineD3D
=
iface
;
object
->
WineD3D
=
iface
;
IWineD3D_AddRef
(
object
->
WineD3D
);
IWineD3D_AddRef
(
object
->
WineD3D
);
*
ppReturnedDeviceInterface
=
(
IWineD3DDevice
*
)
object
;
TRACE
(
"Created WineD3DDevice object @ %p
\n
"
,
object
);
TRACE
(
"(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)
\n
"
,
This
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
pPresentationParameters
,
ppReturnedDeviceInterface
);
TRACE
(
"(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))
\n
"
,
This
,
*
(
pPresentationParameters
->
AutoDepthStencilFormat
),
debug_d3dformat
(
*
(
pPresentationParameters
->
AutoDepthStencilFormat
)),
*
(
pPresentationParameters
->
BackBufferFormat
),
debug_d3dformat
(
*
(
pPresentationParameters
->
BackBufferFormat
)));
/* Save the creation parameters */
object
->
createParms
.
AdapterOrdinal
=
Adapter
;
object
->
createParms
.
DeviceType
=
DeviceType
;
object
->
createParms
.
hFocusWindow
=
hFocusWindow
;
object
->
createParms
.
BehaviorFlags
=
BehaviourFlags
;
/* Initialize other useful values */
object
->
presentParms
.
BackBufferCount
=
1
;
/* Opengl only supports one? */
object
->
adapterNo
=
Adapter
;
object
->
devType
=
DeviceType
;
/* Setup hwnd we are using, plus which display this equates to */
whichHWND
=
*
(
pPresentationParameters
->
hDeviceWindow
);
if
(
!
whichHWND
)
{
whichHWND
=
hFocusWindow
;
}
object
->
win_handle
=
whichHWND
;
object
->
win
=
(
Window
)
GetPropA
(
whichHWND
,
"__wine_x11_client_window"
);
hDc
=
GetDC
(
whichHWND
);
object
->
display
=
get_display
(
hDc
);
ReleaseDC
(
whichHWND
,
hDc
);
/* FIXME: Use for dx8 code eventually too! */
/* Deliberately no indentation here, as this if will be removed when dx8 support merged in */
if
(
This
->
dxVersion
>
8
)
{
/* Create a context based off the properties of the existing visual */
/* Note the visual is chosen as the window is created and the glcontext cannot
use different properties after that point in time. FIXME: How to handle when requested format
doesn't match actual visual? Cannot choose one here - code removed as it ONLY works if the one
it chooses is identical to the one already being used! */
/* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */
ENTER_GL
();
template
.
visualid
=
(
VisualID
)
GetPropA
(
GetDesktopWindow
(),
"__wine_x11_visual_id"
);
object
->
visInfo
=
XGetVisualInfo
(
object
->
display
,
VisualIDMask
,
&
template
,
&
num
);
if
(
NULL
==
object
->
visInfo
)
{
ERR
(
"cannot really get XVisual
\n
"
);
LEAVE_GL
();
return
D3DERR_NOTAVAILABLE
;
}
object
->
glCtx
=
glXCreateContext
(
object
->
display
,
object
->
visInfo
,
NULL
,
GL_TRUE
);
if
(
NULL
==
object
->
glCtx
)
{
ERR
(
"cannot create glxContext
\n
"
);
LEAVE_GL
();
return
D3DERR_NOTAVAILABLE
;
}
LEAVE_GL
();
if
(
object
->
glCtx
==
NULL
)
{
ERR
(
"Error in context creation !
\n
"
);
return
D3DERR_INVALIDCALL
;
}
else
{
TRACE
(
"Context created (HWND=%p, glContext=%p, Window=%ld, VisInfo=%p)
\n
"
,
whichHWND
,
object
->
glCtx
,
object
->
win
,
object
->
visInfo
);
}
/* If not windowed, need to go fullscreen, and resize the HWND to the appropriate */
/* dimensions */
if
(
!*
(
pPresentationParameters
->
Windowed
))
{
DEVMODEW
devmode
;
HDC
hdc
;
int
bpp
=
0
;
/* Get info on the current display setup */
hdc
=
CreateDCA
(
"DISPLAY"
,
NULL
,
NULL
,
NULL
);
bpp
=
GetDeviceCaps
(
hdc
,
BITSPIXEL
);
DeleteDC
(
hdc
);
/* Change the display settings */
memset
(
&
devmode
,
0
,
sizeof
(
DEVMODEW
));
devmode
.
dmFields
=
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
devmode
.
dmBitsPerPel
=
(
bpp
>=
24
)
?
32
:
bpp
;
/*Stupid XVidMode cannot change bpp D3DFmtGetBpp(object, pPresentationParameters->BackBufferFormat);*/
devmode
.
dmPelsWidth
=
*
(
pPresentationParameters
->
BackBufferWidth
);
devmode
.
dmPelsHeight
=
*
(
pPresentationParameters
->
BackBufferHeight
);
MultiByteToWideChar
(
CP_ACP
,
0
,
"Gamers CG"
,
-
1
,
devmode
.
dmDeviceName
,
CCHDEVICENAME
);
ChangeDisplaySettingsExW
(
devmode
.
dmDeviceName
,
&
devmode
,
object
->
win_handle
,
CDS_FULLSCREEN
,
NULL
);
/* Make popup window */
SetWindowLongA
(
whichHWND
,
GWL_STYLE
,
WS_POPUP
);
SetWindowPos
(
object
->
win_handle
,
HWND_TOP
,
0
,
0
,
*
(
pPresentationParameters
->
BackBufferWidth
),
*
(
pPresentationParameters
->
BackBufferHeight
),
SWP_SHOWWINDOW
|
SWP_FRAMECHANGED
);
}
/* MSDN: If Windowed is TRUE and either of the BackBufferWidth/Height values is zero,
then the corresponding dimension of the client area of the hDeviceWindow
(or the focus window, if hDeviceWindow is NULL) is taken. */
if
(
*
(
pPresentationParameters
->
Windowed
)
&&
((
*
(
pPresentationParameters
->
BackBufferWidth
)
==
0
)
||
(
*
(
pPresentationParameters
->
BackBufferHeight
)
==
0
)))
{
RECT
Rect
;
GetClientRect
(
whichHWND
,
&
Rect
);
if
(
*
(
pPresentationParameters
->
BackBufferWidth
)
==
0
)
{
*
(
pPresentationParameters
->
BackBufferWidth
)
=
Rect
.
right
;
TRACE
(
"Updating width to %d
\n
"
,
*
(
pPresentationParameters
->
BackBufferWidth
));
}
if
(
*
(
pPresentationParameters
->
BackBufferHeight
)
==
0
)
{
*
(
pPresentationParameters
->
BackBufferHeight
)
=
Rect
.
bottom
;
TRACE
(
"Updating height to %d
\n
"
,
*
(
pPresentationParameters
->
BackBufferHeight
));
}
}
/* Save the presentation parms now filled in correctly */
object
->
presentParms
.
BackBufferWidth
=
*
(
pPresentationParameters
->
BackBufferWidth
);
object
->
presentParms
.
BackBufferHeight
=
*
(
pPresentationParameters
->
BackBufferHeight
);
object
->
presentParms
.
BackBufferFormat
=
*
(
pPresentationParameters
->
BackBufferFormat
);
object
->
presentParms
.
BackBufferCount
=
*
(
pPresentationParameters
->
BackBufferCount
);
object
->
presentParms
.
MultiSampleType
=
*
(
pPresentationParameters
->
MultiSampleType
);
object
->
presentParms
.
MultiSampleQuality
=
*
(
pPresentationParameters
->
MultiSampleQuality
);
object
->
presentParms
.
SwapEffect
=
*
(
pPresentationParameters
->
SwapEffect
);
object
->
presentParms
.
hDeviceWindow
=
*
(
pPresentationParameters
->
hDeviceWindow
);
object
->
presentParms
.
Windowed
=
*
(
pPresentationParameters
->
Windowed
);
object
->
presentParms
.
EnableAutoDepthStencil
=
*
(
pPresentationParameters
->
EnableAutoDepthStencil
);
object
->
presentParms
.
AutoDepthStencilFormat
=
*
(
pPresentationParameters
->
AutoDepthStencilFormat
);
object
->
presentParms
.
Flags
=
*
(
pPresentationParameters
->
Flags
);
object
->
presentParms
.
FullScreen_RefreshRateInHz
=
*
(
pPresentationParameters
->
FullScreen_RefreshRateInHz
);
object
->
presentParms
.
PresentationInterval
=
*
(
pPresentationParameters
->
PresentationInterval
);
/* TODO:
* Creating the startup stateBlock *
object->StateBlock = NULL;
IWineD3DDevice_CreateStateBlock(object, D3DSBT_ALL, NULL);
object->UpdateStateBlock = object->StateBlock;
*/
/* Setup surfaces for the backbuffer, frontbuffer and depthstencil buffer */
TRACE
(
"Creating initial device surfaces
\n
"
);
/* TODO:
IWineD3DDevice_CreateRenderTarget((IWineD3DDevice *) object,
*(pPresentationParameters->BackBufferWidth),
*(pPresentationParameters->BackBufferHeight),
*(pPresentationParameters->BackBufferFormat),
*(pPresentationParameters->MultiSampleType),
TRUE,
(IWineD3DSurface *) &object->frontBuffer);
IWineD3DDevice_CreateRenderTarget((IWineD3DDevice *) object,
*(pPresentationParameters->BackBufferWidth),
*(pPresentationParameters->BackBufferHeight),
*(pPresentationParameters->BackBufferFormat),
*(pPresentationParameters->MultiSampleType),
TRUE,
(IWineD3DSurface *) &object->backBuffer);
if (*(pPresentationParameters->EnableAutoDepthStencil)) {
IWineD3DDevice_CreateDepthStencilSurface((IWineD3DDevice *) object,
*(pPresentationParameters->BackBufferWidth),
*(pPresentationParameters->BackBufferHeight),
*(pPresentationParameters->AutoDepthStencilFormat,
D3DMULTISAMPLE_NONE,
(IWineD3DSurface *) &object->depthStencilBuffer);
} else {
object->depthStencilBuffer = NULL;
}
TRACE("FrontBuf @ %p, BackBuf @ %p, DepthStencil @ %p\n",object->frontBuffer, object->backBuffer, object->depthStencilBuffer);
*/
/* init the default renderTarget management */
object
->
drawable
=
object
->
win
;
object
->
render_ctx
=
object
->
glCtx
;
/* TODO:
object->renderTarget = object->backBuffer;
IWineD3DSurface_AddRef((IWineD3DSurface *) object->renderTarget);
object->stencilBufferTarget = object->depthStencilBuffer;
if (NULL != object->stencilBufferTarget) {
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
}
*/
/* Set up some starting GL setup */
ENTER_GL
();
if
(
glXMakeCurrent
(
object
->
display
,
object
->
win
,
object
->
glCtx
)
==
False
)
{
ERR
(
"Error in setting current context (context %p drawable %ld)!
\n
"
,
object
->
glCtx
,
object
->
win
);
}
checkGLcall
(
"glXMakeCurrent"
);
/* Clear the screen */
glClearColor
(
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
checkGLcall
(
"glClearColor"
);
glColor3f
(
1
.
0
,
1
.
0
,
1
.
0
);
checkGLcall
(
"glColor3f"
);
glEnable
(
GL_LIGHTING
);
checkGLcall
(
"glEnable"
);
glLightModeli
(
GL_LIGHT_MODEL_LOCAL_VIEWER
,
GL_TRUE
);
checkGLcall
(
"glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);"
);
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_COMBINE_EXT
);
checkGLcall
(
"glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);"
);
glLightModeli
(
GL_LIGHT_MODEL_COLOR_CONTROL
,
GL_SEPARATE_SPECULAR_COLOR
);
checkGLcall
(
"glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);"
);
/*
* Initialize openGL extension related variables
* with Default values
*/
This
->
isGLInfoValid
=
IWineD3DImpl_FillGLCaps
(
&
This
->
gl_info
,
object
->
display
);
/* Setup all the devices defaults */
/* TODO:
IDirect3DDeviceImpl_InitStartupStateBlock(object);
*/
LEAVE_GL
();
{
/* Set a default viewport */
D3DVIEWPORT9
vp
;
vp
.
X
=
0
;
vp
.
Y
=
0
;
vp
.
Width
=
*
(
pPresentationParameters
->
BackBufferWidth
);
vp
.
Height
=
*
(
pPresentationParameters
->
BackBufferHeight
);
vp
.
MinZ
=
0
.
0
f
;
vp
.
MaxZ
=
1
.
0
f
;
/* TODO: IWineD3DDevice_SetViewport((LPDIRECT3DDEVICE9) object, &vp); */
}
/* Initialize the current view state */
object
->
modelview_valid
=
1
;
object
->
proj_valid
=
0
;
object
->
view_ident
=
1
;
object
->
last_was_rhw
=
0
;
glGetIntegerv
(
GL_MAX_LIGHTS
,
&
object
->
maxConcurrentLights
);
TRACE
(
"(%p,%d) All defaults now set up, leaving CreateDevice with %p
\n
"
,
This
,
Adapter
,
object
);
/* Clear the screen */
/* TODO: IDirect3DDevice8Impl_Clear((LPDIRECT3DDEVICE8) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0); */
}
/* End of FIXME: remove when dx8 merged in */
return
D3D_OK
;
return
D3D_OK
;
}
}
...
...
dlls/wined3d/wined3d_private.h
View file @
b9e2beda
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "wingdi.h"
#include "wingdi.h"
#include "winuser.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "d3d9.h"
#include "d3d9.h"
#include "d3d9types.h"
#include "d3d9types.h"
...
@@ -75,6 +76,16 @@ extern int num_lock;
...
@@ -75,6 +76,16 @@ extern int num_lock;
#define WINED3D_VSHADER_MAX_CONSTANTS 96
#define WINED3D_VSHADER_MAX_CONSTANTS 96
/* Maximum number of constants provided to the shaders */
/* Maximum number of constants provided to the shaders */
#define checkGLcall(A) \
{ \
GLint err = glGetError(); \
if (err != GL_NO_ERROR) { \
FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
} else { \
TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
} \
}
/*****************************************************************************
/*****************************************************************************
* IWineD3D implementation structure
* IWineD3D implementation structure
*/
*/
...
@@ -106,7 +117,28 @@ typedef struct IWineD3DDeviceImpl
...
@@ -106,7 +117,28 @@ typedef struct IWineD3DDeviceImpl
/* WineD3D Information */
/* WineD3D Information */
IWineD3D
*
WineD3D
;
IWineD3D
*
WineD3D
;
/* GL Information */
/* X and GL Information */
HWND
win_handle
;
Window
win
;
Display
*
display
;
GLXContext
glCtx
;
XVisualInfo
*
visInfo
;
GLXContext
render_ctx
;
Drawable
drawable
;
GLint
maxConcurrentLights
;
/* Optimization */
BOOL
modelview_valid
;
BOOL
proj_valid
;
BOOL
view_ident
;
/* true iff view matrix is identity */
BOOL
last_was_rhw
;
/* true iff last draw_primitive was in xyzrhw mode */
/* Internal use fields */
D3DDEVICE_CREATION_PARAMETERS
createParms
;
D3DPRESENT_PARAMETERS
presentParms
;
UINT
adapterNo
;
D3DDEVTYPE
devType
;
}
IWineD3DDeviceImpl
;
}
IWineD3DDeviceImpl
;
extern
IWineD3DDeviceVtbl
IWineD3DDevice_Vtbl
;
extern
IWineD3DDeviceVtbl
IWineD3DDevice_Vtbl
;
...
...
include/d3d9types.h
View file @
b9e2beda
...
@@ -1258,6 +1258,7 @@ typedef struct _D3DPRESENT_PARAMETERS_ {
...
@@ -1258,6 +1258,7 @@ typedef struct _D3DPRESENT_PARAMETERS_ {
UINT
BackBufferCount
;
UINT
BackBufferCount
;
D3DMULTISAMPLE_TYPE
MultiSampleType
;
D3DMULTISAMPLE_TYPE
MultiSampleType
;
DWORD
MultiSampleQuality
;
D3DSWAPEFFECT
SwapEffect
;
D3DSWAPEFFECT
SwapEffect
;
HWND
hDeviceWindow
;
HWND
hDeviceWindow
;
...
@@ -1267,7 +1268,7 @@ typedef struct _D3DPRESENT_PARAMETERS_ {
...
@@ -1267,7 +1268,7 @@ typedef struct _D3DPRESENT_PARAMETERS_ {
DWORD
Flags
;
DWORD
Flags
;
UINT
FullScreen_RefreshRateInHz
;
UINT
FullScreen_RefreshRateInHz
;
UINT
FullScreen_
PresentationInterval
;
UINT
PresentationInterval
;
}
D3DPRESENT_PARAMETERS
;
}
D3DPRESENT_PARAMETERS
;
...
...
include/wine/wined3d_interface.h
View file @
b9e2beda
...
@@ -54,20 +54,20 @@ typedef struct _WINED3DADAPTER_IDENTIFIER {
...
@@ -54,20 +54,20 @@ typedef struct _WINED3DADAPTER_IDENTIFIER {
}
WINED3DADAPTER_IDENTIFIER
;
}
WINED3DADAPTER_IDENTIFIER
;
typedef
struct
_WINED3DPRESENT_PARAMETERS
{
typedef
struct
_WINED3DPRESENT_PARAMETERS
{
UINT
BackBufferWidth
;
UINT
*
BackBufferWidth
;
UINT
BackBufferHeight
;
UINT
*
BackBufferHeight
;
D3DFORMAT
BackBufferFormat
;
D3DFORMAT
*
BackBufferFormat
;
UINT
BackBufferCount
;
UINT
*
BackBufferCount
;
D3DMULTISAMPLE_TYPE
MultiSampleType
;
D3DMULTISAMPLE_TYPE
*
MultiSampleType
;
DWORD
MultiSampleQuality
;
DWORD
*
MultiSampleQuality
;
D3DSWAPEFFECT
SwapEffect
;
D3DSWAPEFFECT
*
SwapEffect
;
HWND
hDeviceWindow
;
HWND
*
hDeviceWindow
;
BOOL
Windowed
;
BOOL
*
Windowed
;
BOOL
EnableAutoDepthStencil
;
BOOL
*
EnableAutoDepthStencil
;
D3DFORMAT
AutoDepthStencilFormat
;
D3DFORMAT
*
AutoDepthStencilFormat
;
DWORD
Flags
;
DWORD
*
Flags
;
UINT
FullScreen_RefreshRateInHz
;
UINT
*
FullScreen_RefreshRateInHz
;
UINT
PresentationInterval
;
UINT
*
PresentationInterval
;
}
WINED3DPRESENT_PARAMETERS
;
}
WINED3DPRESENT_PARAMETERS
;
typedef
struct
IWineD3D
IWineD3D
;
typedef
struct
IWineD3D
IWineD3D
;
...
@@ -143,9 +143,9 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
...
@@ -143,9 +143,9 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#if !defined(__cplusplus) || defined(CINTERFACE)
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
/*** IUnknown methods ***/
#define IWineD3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3D
Device
_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3D_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3D
Device
_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3D_Release(p) (p)->lpVtbl->Release(p)
#define IWineD3D
Device
_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3D methods ***/
/*** IWineD3D methods ***/
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment