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
289562ee
Commit
289562ee
authored
Nov 23, 2004
by
Jason Edmeades
Committed by
Alexandre Julliard
Nov 23, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Implement SetStreamSource
- Ensure wined3d objects maintain a reference count of at least that of the d3dx version.
parent
7d8711e1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
148 additions
and
43 deletions
+148
-43
d3d8_main.c
dlls/d3d8/d3d8_main.c
+1
-1
directx.c
dlls/d3d8/directx.c
+1
-1
d3d9_main.c
dlls/d3d9/d3d9_main.c
+1
-1
device.c
dlls/d3d9/device.c
+9
-24
directx.c
dlls/d3d9/directx.c
+1
-1
vertexbuffer.c
dlls/d3d9/vertexbuffer.c
+1
-1
device.c
dlls/wined3d/device.c
+59
-3
directx.c
dlls/wined3d/directx.c
+12
-2
resource.c
dlls/wined3d/resource.c
+10
-0
stateblock.c
dlls/wined3d/stateblock.c
+12
-1
vertexbuffer.c
dlls/wined3d/vertexbuffer.c
+8
-0
wined3d_main.c
dlls/wined3d/wined3d_main.c
+2
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+10
-0
wined3d_interface.h
include/wine/wined3d_interface.h
+21
-7
No files found.
dlls/d3d8/d3d8_main.c
View file @
289562ee
...
...
@@ -56,7 +56,7 @@ IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
object
->
lpVtbl
=
&
Direct3D8_Vtbl
;
object
->
direct3d8
=
object
;
object
->
ref
=
1
;
object
->
WineD3D
=
WineDirect3DCreate
(
SDKVersion
,
8
);
object
->
WineD3D
=
WineDirect3DCreate
(
SDKVersion
,
8
,
(
IUnknown
*
)
object
);
TRACE
(
"SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p
\n
"
,
SDKVersion
,
object
,
object
->
WineD3D
);
...
...
dlls/d3d8/directx.c
View file @
289562ee
...
...
@@ -583,7 +583,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
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
);
IWineD3D_CreateDevice
(
This
->
WineD3D
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
&
localParameters
,
&
object
->
WineD3DDevice
,
(
IUnknown
*
)
object
);
/** use StateBlock Factory here, for creating the startup stateBlock */
object
->
StateBlock
=
NULL
;
...
...
dlls/d3d9/d3d9_main.c
View file @
289562ee
...
...
@@ -43,7 +43,7 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) {
object
->
lpVtbl
=
&
Direct3D9_Vtbl
;
object
->
ref
=
1
;
object
->
WineD3D
=
WineDirect3DCreate
(
SDKVersion
,
9
);
object
->
WineD3D
=
WineDirect3DCreate
(
SDKVersion
,
9
,
(
IUnknown
*
)
object
);
TRACE
(
"SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p
\n
"
,
SDKVersion
,
object
,
object
->
WineD3D
);
...
...
dlls/d3d9/device.c
View file @
289562ee
...
...
@@ -606,35 +606,20 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9 iface, DWORD* pFV
}
HRESULT
WINAPI
IDirect3DDevice9Impl_SetStreamSource
(
LPDIRECT3DDEVICE9
iface
,
UINT
StreamNumber
,
IDirect3DVertexBuffer9
*
pStreamData
,
UINT
OffsetInBytes
,
UINT
Stride
)
{
IDirect3DVertexBuffer9
*
oldSrc
;
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
oldSrc
=
This
->
StateBlock
->
stream_source
[
StreamNumber
];
TRACE
(
"(%p) : StreamNo: %d, OldStream (%p), NewStream (%p), NewStride %d
\n
"
,
This
,
StreamNumber
,
oldSrc
,
pStreamData
,
Stride
);
This
->
UpdateStateBlock
->
Changed
.
stream_source
[
StreamNumber
]
=
TRUE
;
This
->
UpdateStateBlock
->
Set
.
stream_source
[
StreamNumber
]
=
TRUE
;
This
->
UpdateStateBlock
->
stream_stride
[
StreamNumber
]
=
Stride
;
This
->
UpdateStateBlock
->
stream_source
[
StreamNumber
]
=
pStreamData
;
/* Handle recording of state blocks */
if
(
This
->
isRecordingState
)
{
TRACE
(
"Recording... not performing anything
\n
"
);
return
D3D_OK
;
}
if
(
oldSrc
!=
NULL
)
IDirect3DVertexBuffer9Impl_Release
(
oldSrc
);
if
(
pStreamData
!=
NULL
)
IDirect3DVertexBuffer9Impl_AddRef
(
pStreamData
);
return
D3D_OK
;
return
IWineD3DDevice_SetStreamSource
(
This
->
WineD3DDevice
,
StreamNumber
,
pStreamData
==
NULL
?
NULL
:
((
IDirect3DVertexBuffer9Impl
*
)
pStreamData
)
->
wineD3DVertexBuffer
,
OffsetInBytes
,
Stride
);
}
HRESULT
WINAPI
IDirect3DDevice9Impl_GetStreamSource
(
LPDIRECT3DDEVICE9
iface
,
UINT
StreamNumber
,
IDirect3DVertexBuffer9
**
pStream
,
UINT
*
OffsetInBytes
,
UINT
*
pStride
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
TRACE
(
"(%p) : StreamNo: %d, Stream (%p), Stride %d
\n
"
,
This
,
StreamNumber
,
This
->
StateBlock
->
stream_source
[
StreamNumber
],
This
->
StateBlock
->
stream_stride
[
StreamNumber
]);
*
pStream
=
This
->
StateBlock
->
stream_source
[
StreamNumber
];
*
pStride
=
This
->
StateBlock
->
stream_stride
[
StreamNumber
];
IDirect3DVertexBuffer9Impl_AddRef
((
LPDIRECT3DVERTEXBUFFER9
)
*
pStream
);
return
D3D_OK
;
IWineD3DVertexBuffer
*
retStream
=
NULL
;
HRESULT
rc
=
D3D_OK
;
rc
=
IWineD3DDevice_GetStreamSource
(
This
->
WineD3DDevice
,
StreamNumber
,
(
IWineD3DVertexBuffer
**
)
&
retStream
,
OffsetInBytes
,
pStride
);
if
(
rc
==
D3D_OK
&&
NULL
!=
*
pStream
)
IWineD3DVertexBuffer_GetParent
(
retStream
,
(
IUnknown
**
)
pStream
);
return
rc
;
}
HRESULT
WINAPI
IDirect3DDevice9Impl_SetStreamSourceFreq
(
LPDIRECT3DDEVICE9
iface
,
UINT
StreamNumber
,
UINT
Divider
)
{
...
...
dlls/d3d9/directx.c
View file @
289562ee
...
...
@@ -191,7 +191,7 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
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
,
(
IUnknown
*
)
object
);
FIXME
(
"(%p) : incomplete stub
\n
"
,
This
);
return
D3D_OK
;
...
...
dlls/d3d9/vertexbuffer.c
View file @
289562ee
...
...
@@ -147,7 +147,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
object
->
lpVtbl
=
&
Direct3DVertexBuffer9_Vtbl
;
object
->
ref
=
1
;
object
->
device
=
This
;
IWineD3DDevice_CreateVertexBuffer
(
This
->
WineD3DDevice
,
Size
,
Usage
,
FVF
,
Pool
,
&
(
object
->
wineD3DVertexBuffer
),
pSharedHandle
);
IWineD3DDevice_CreateVertexBuffer
(
This
->
WineD3DDevice
,
Size
,
Usage
,
FVF
,
Pool
,
&
(
object
->
wineD3DVertexBuffer
),
pSharedHandle
,
(
IUnknown
*
)
object
);
*
ppVertexBuffer
=
(
LPDIRECT3DVERTEXBUFFER9
)
object
;
return
D3D_OK
;
...
...
dlls/wined3d/device.c
View file @
289562ee
...
...
@@ -34,8 +34,16 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
/**********************************************************
* IWineD3DDevice implementation follows
**********************************************************/
HRESULT
WINAPI
IWineD3DDeviceImpl_GetParent
(
IWineD3DDevice
*
iface
,
IUnknown
**
pParent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
*
pParent
=
This
->
parent
;
IUnknown_AddRef
(
This
->
parent
);
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_CreateVertexBuffer
(
IWineD3DDevice
*
iface
,
UINT
Size
,
DWORD
Usage
,
DWORD
FVF
,
D3DPOOL
Pool
,
IWineD3DVertexBuffer
**
ppVertexBuffer
,
HANDLE
*
sharedHandle
)
{
DWORD
FVF
,
D3DPOOL
Pool
,
IWineD3DVertexBuffer
**
ppVertexBuffer
,
HANDLE
*
sharedHandle
,
IUnknown
*
parent
)
{
IWineD3DVertexBufferImpl
*
object
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
...
...
@@ -44,6 +52,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DVertexBufferImpl
));
object
->
lpVtbl
=
&
IWineD3DVertexBuffer_Vtbl
;
object
->
resource
.
wineD3DDevice
=
iface
;
IWineD3DDevice_AddRef
(
iface
);
object
->
resource
.
parent
=
parent
;
object
->
resource
.
resourceType
=
D3DRTYPE_VERTEXBUFFER
;
object
->
resource
.
ref
=
1
;
object
->
allocatedMemory
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
Size
);
...
...
@@ -58,7 +68,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_CreateStateBlock
(
IWineD3DDevice
*
iface
,
D3DSTATEBLOCKTYPE
Type
,
IWineD3DStateBlock
**
ppStateBlock
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_CreateStateBlock
(
IWineD3DDevice
*
iface
,
D3DSTATEBLOCKTYPE
Type
,
IWineD3DStateBlock
**
ppStateBlock
,
IUnknown
*
parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DStateBlockImpl
*
object
;
...
...
@@ -67,6 +77,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DStateBlockImpl
));
object
->
lpVtbl
=
&
IWineD3DStateBlock_Vtbl
;
object
->
wineD3DDevice
=
iface
;
IWineD3DDevice_AddRef
(
iface
);
object
->
parent
=
parent
;
object
->
ref
=
1
;
object
->
blockType
=
Type
;
*
ppStateBlock
=
(
IWineD3DStateBlock
*
)
object
;
...
...
@@ -109,6 +121,46 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetFVF(IWineD3DDevice *iface, DWORD *pfvf) {
return
D3D_OK
;
}
/*****
* Get / Set Stream Source
*****/
HRESULT
WINAPI
IWineD3DDeviceImpl_SetStreamSource
(
IWineD3DDevice
*
iface
,
UINT
StreamNumber
,
IWineD3DVertexBuffer
*
pStreamData
,
UINT
OffsetInBytes
,
UINT
Stride
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DVertexBuffer
*
oldSrc
;
oldSrc
=
This
->
stateBlock
->
stream_source
[
StreamNumber
];
TRACE
(
"(%p) : StreamNo: %d, OldStream (%p), NewStream (%p), NewStride %d
\n
"
,
This
,
StreamNumber
,
oldSrc
,
pStreamData
,
Stride
);
This
->
updateStateBlock
->
changed
.
stream_source
[
StreamNumber
]
=
TRUE
;
This
->
updateStateBlock
->
set
.
stream_source
[
StreamNumber
]
=
TRUE
;
This
->
updateStateBlock
->
stream_stride
[
StreamNumber
]
=
Stride
;
This
->
updateStateBlock
->
stream_source
[
StreamNumber
]
=
pStreamData
;
This
->
updateStateBlock
->
stream_offset
[
StreamNumber
]
=
OffsetInBytes
;
/* Handle recording of state blocks */
if
(
This
->
isRecordingState
)
{
TRACE
(
"Recording... not performing anything
\n
"
);
return
D3D_OK
;
}
/* Not recording... */
if
(
oldSrc
!=
NULL
)
IWineD3DVertexBuffer_Release
(
oldSrc
);
if
(
pStreamData
!=
NULL
)
IWineD3DVertexBuffer_AddRef
(
pStreamData
);
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_GetStreamSource
(
IWineD3DDevice
*
iface
,
UINT
StreamNumber
,
IWineD3DVertexBuffer
**
pStream
,
UINT
*
pOffset
,
UINT
*
pStride
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : StreamNo: %d, Stream (%p), Stride %d
\n
"
,
This
,
StreamNumber
,
This
->
stateBlock
->
stream_source
[
StreamNumber
],
This
->
stateBlock
->
stream_stride
[
StreamNumber
]);
*
pStream
=
This
->
stateBlock
->
stream_source
[
StreamNumber
];
*
pStride
=
This
->
stateBlock
->
stream_stride
[
StreamNumber
];
*
pOffset
=
This
->
stateBlock
->
stream_offset
[
StreamNumber
];
IWineD3DVertexBuffer_AddRef
(
*
pStream
);
/* We have created a new reference to the VB */
return
D3D_OK
;
}
/**********************************************************
* IUnknown parts follows
**********************************************************/
...
...
@@ -130,6 +182,7 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
TRACE
(
"(%p) : Releasing from %ld
\n
"
,
This
,
This
->
ref
);
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
{
IWineD3DStateBlock_Release
((
IWineD3DStateBlock
*
)
This
->
stateBlock
);
IWineD3D_Release
(
This
->
WineD3D
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -145,8 +198,11 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_QueryInterface
,
IWineD3DDeviceImpl_AddRef
,
IWineD3DDeviceImpl_Release
,
IWineD3DDeviceImpl_GetParent
,
IWineD3DDeviceImpl_CreateVertexBuffer
,
IWineD3DDeviceImpl_CreateStateBlock
,
IWineD3DDeviceImpl_SetFVF
,
IWineD3DDeviceImpl_GetFVF
IWineD3DDeviceImpl_GetFVF
,
IWineD3DDeviceImpl_SetStreamSource
,
IWineD3DDeviceImpl_GetStreamSource
};
dlls/wined3d/directx.c
View file @
289562ee
...
...
@@ -1310,7 +1310,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
and fields being inserted in the middle, a new structure is used in place */
HRESULT
WINAPI
IWineD3DImpl_CreateDevice
(
IWineD3D
*
iface
,
UINT
Adapter
,
D3DDEVTYPE
DeviceType
,
HWND
hFocusWindow
,
DWORD
BehaviourFlags
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
,
IWineD3DDevice
**
ppReturnedDeviceInterface
)
{
IWineD3DDevice
**
ppReturnedDeviceInterface
,
IUnknown
*
parent
)
{
HWND
whichHWND
;
HDC
hDc
;
...
...
@@ -1337,6 +1337,7 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
object
->
ref
=
1
;
object
->
WineD3D
=
iface
;
IWineD3D_AddRef
(
object
->
WineD3D
);
object
->
parent
=
parent
;
TRACE
(
"(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)
\n
"
,
This
,
Adapter
,
DeviceType
,
hFocusWindow
,
BehaviourFlags
,
pPresentationParameters
,
ppReturnedDeviceInterface
);
...
...
@@ -1468,7 +1469,8 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
/* Creating the startup stateBlock - Note Special Case: 0 => Don't fill in yet! */
IWineD3DDevice_CreateStateBlock
((
IWineD3DDevice
*
)
object
,
(
D3DSTATEBLOCKTYPE
)
0
,
(
IWineD3DStateBlock
**
)
&
object
->
stateBlock
);
(
IWineD3DStateBlock
**
)
&
object
->
stateBlock
,
NULL
);
/* Note: No parent needed for initial internal stateblock */
object
->
updateStateBlock
=
object
->
stateBlock
;
/* Setup surfaces for the backbuffer, frontbuffer and depthstencil buffer */
...
...
@@ -1581,6 +1583,13 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DImpl_GetParent
(
IWineD3D
*
iface
,
IUnknown
**
pParent
)
{
IWineD3DImpl
*
This
=
(
IWineD3DImpl
*
)
iface
;
IUnknown_AddRef
(
This
->
parent
);
*
pParent
=
This
->
parent
;
return
D3D_OK
;
}
/**********************************************************
* IUnknown parts follows
**********************************************************/
...
...
@@ -1614,6 +1623,7 @@ IWineD3DVtbl IWineD3D_Vtbl =
IWineD3DImpl_QueryInterface
,
IWineD3DImpl_AddRef
,
IWineD3DImpl_Release
,
IWineD3DImpl_GetParent
,
IWineD3DImpl_GetAdapterCount
,
IWineD3DImpl_RegisterSoftwareDevice
,
IWineD3DImpl_GetAdapterMonitor
,
...
...
dlls/wined3d/resource.c
View file @
289562ee
...
...
@@ -45,6 +45,7 @@ ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface) {
TRACE
(
"(%p) : Releasing from %ld
\n
"
,
This
,
This
->
resource
.
ref
);
ref
=
InterlockedDecrement
(
&
This
->
resource
.
ref
);
if
(
ref
==
0
)
{
IWineD3DDevice_Release
(
This
->
resource
.
wineD3DDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
...
...
@@ -97,11 +98,20 @@ D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface) {
return
This
->
resource
.
resourceType
;
}
HRESULT
WINAPI
IWineD3DResourceImpl_GetParent
(
IWineD3DResource
*
iface
,
IUnknown
**
pParent
)
{
IWineD3DResourceImpl
*
This
=
(
IWineD3DResourceImpl
*
)
iface
;
IUnknown_AddRef
(
This
->
resource
.
parent
);
*
pParent
=
This
->
resource
.
parent
;
return
D3D_OK
;
}
IWineD3DResourceVtbl
IWineD3DResource_Vtbl
=
{
IWineD3DResourceImpl_QueryInterface
,
IWineD3DResourceImpl_AddRef
,
IWineD3DResourceImpl_Release
,
IWineD3DResourceImpl_GetParent
,
IWineD3DResourceImpl_GetDevice
,
IWineD3DResourceImpl_SetPrivateData
,
IWineD3DResourceImpl_GetPrivateData
,
...
...
dlls/wined3d/stateblock.c
View file @
289562ee
...
...
@@ -24,6 +24,13 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
HRESULT
WINAPI
IWineD3DStateBlockImpl_GetParent
(
IWineD3DStateBlock
*
iface
,
IUnknown
**
pParent
)
{
IWineD3DStateBlockImpl
*
This
=
(
IWineD3DStateBlockImpl
*
)
iface
;
IUnknown_AddRef
(
This
->
parent
);
*
pParent
=
This
->
parent
;
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DStateBlockImpl_InitStartupStateBlock
(
IWineD3DStateBlock
*
iface
)
{
IWineD3DStateBlockImpl
*
This
=
(
IWineD3DStateBlockImpl
*
)
iface
;
...
...
@@ -56,7 +63,10 @@ ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
ULONG
ref
;
TRACE
(
"(%p) : Releasing from %ld
\n
"
,
This
,
This
->
ref
);
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
ref
==
0
)
{
IWineD3DDevice_Release
(
This
->
wineD3DDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
...
...
@@ -69,5 +79,6 @@ IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl =
IWineD3DStateBlockImpl_QueryInterface
,
IWineD3DStateBlockImpl_AddRef
,
IWineD3DStateBlockImpl_Release
,
IWineD3DStateBlockImpl_GetParent
,
IWineD3DStateBlockImpl_InitStartupStateBlock
};
dlls/wined3d/vertexbuffer.c
View file @
289562ee
...
...
@@ -38,6 +38,7 @@ HRESULT WINAPI IWineD3DVertexBufferImpl_QueryInterface(IWineD3DVertexBuffer *ifa
ULONG
WINAPI
IWineD3DVertexBufferImpl_AddRef
(
IWineD3DVertexBuffer
*
iface
)
{
IWineD3DVertexBufferImpl
*
This
=
(
IWineD3DVertexBufferImpl
*
)
iface
;
TRACE
(
"(%p) : AddRef increasing from %ld
\n
"
,
This
,
This
->
resource
.
ref
);
IUnknown_AddRef
(
This
->
resource
.
parent
);
return
InterlockedIncrement
(
&
This
->
resource
.
ref
);
}
...
...
@@ -48,7 +49,10 @@ ULONG WINAPI IWineD3DVertexBufferImpl_Release(IWineD3DVertexBuffer *iface) {
ref
=
InterlockedDecrement
(
&
This
->
resource
.
ref
);
if
(
ref
==
0
)
{
if
(
NULL
!=
This
->
allocatedMemory
)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
allocatedMemory
);
IWineD3DDevice_Release
(
This
->
resource
.
wineD3DDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
else
{
IUnknown_Release
(
This
->
resource
.
parent
);
/* Released the reference to the d3dx VB */
}
return
ref
;
}
...
...
@@ -88,6 +92,9 @@ D3DRESOURCETYPE WINAPI IWineD3DVertexBufferImpl_GetType(IWineD3DVertexBuffer *if
return
IWineD3DResource_GetType
((
IWineD3DResource
*
)
iface
);
}
HRESULT
WINAPI
IWineD3DVertexBufferImpl_GetParent
(
IWineD3DVertexBuffer
*
iface
,
IUnknown
**
pParent
)
{
return
IWineD3DResource_GetParent
((
IWineD3DResource
*
)
iface
,
pParent
);
}
/* ******************************************************
IWineD3DVertexBuffer IWineD3DVertexBuffer parts follow
...
...
@@ -122,6 +129,7 @@ IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl =
IWineD3DVertexBufferImpl_QueryInterface
,
IWineD3DVertexBufferImpl_AddRef
,
IWineD3DVertexBufferImpl_Release
,
IWineD3DVertexBufferImpl_GetParent
,
IWineD3DVertexBufferImpl_GetDevice
,
IWineD3DVertexBufferImpl_SetPrivateData
,
IWineD3DVertexBufferImpl_GetPrivateData
,
...
...
dlls/wined3d/wined3d_main.c
View file @
289562ee
...
...
@@ -32,11 +32,12 @@ void (*wine_tsx11_unlock_ptr)(void) = NULL;
int
vs_mode
=
VS_HW
;
/* Hardware by default */
int
ps_mode
=
PS_NONE
;
/* Disabled by default */
IWineD3D
*
WINAPI
WineDirect3DCreate
(
UINT
SDKVersion
,
UINT
dxVersion
)
{
IWineD3D
*
WINAPI
WineDirect3DCreate
(
UINT
SDKVersion
,
UINT
dxVersion
,
IUnknown
*
parent
)
{
IWineD3DImpl
*
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DImpl
));
object
->
lpVtbl
=
&
IWineD3D_Vtbl
;
object
->
dxVersion
=
dxVersion
;
object
->
ref
=
1
;
object
->
parent
=
parent
;
TRACE
(
"Created WineD3D object @ %p for d3d%d support
\n
"
,
object
,
dxVersion
);
...
...
dlls/wined3d/wined3d_private.h
View file @
289562ee
...
...
@@ -26,6 +26,7 @@
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
...
...
@@ -98,6 +99,7 @@ typedef struct IWineD3DImpl
DWORD
ref
;
/* Note: Ref counting not required */
/* WineD3D Information */
IUnknown
*
parent
;
UINT
dxVersion
;
/* GL Information */
...
...
@@ -117,6 +119,7 @@ typedef struct IWineD3DDeviceImpl
DWORD
ref
;
/* Note: Ref counting not required */
/* WineD3D Information */
IUnknown
*
parent
;
/* TODO - to be a new interface eventually */
IWineD3D
*
WineD3D
;
/* X and GL Information */
...
...
@@ -159,6 +162,7 @@ typedef struct IWineD3DResourceClass
DWORD
ref
;
/* Note: Ref counting not required */
/* WineD3DResource Information */
IUnknown
*
parent
;
IWineD3DDevice
*
wineD3DDevice
;
D3DRESOURCETYPE
resourceType
;
...
...
@@ -200,6 +204,7 @@ extern IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
/* to resolve everything we need, so doing it manually for now */
typedef
struct
SAVEDSTATES
{
BOOL
fvf
;
BOOL
stream_source
[
MAX_STREAMS
];
}
SAVEDSTATES
;
struct
IWineD3DStateBlockImpl
...
...
@@ -209,6 +214,7 @@ struct IWineD3DStateBlockImpl
DWORD
ref
;
/* Note: Ref counting not required */
/* IWineD3DStateBlock information */
IUnknown
*
parent
;
IWineD3DDevice
*
wineD3DDevice
;
D3DSTATEBLOCKTYPE
blockType
;
...
...
@@ -219,6 +225,10 @@ struct IWineD3DStateBlockImpl
/* Drawing - Vertex Shader or FVF related */
DWORD
fvf
;
/* Stream Source */
UINT
stream_stride
[
MAX_STREAMS
];
UINT
stream_offset
[
MAX_STREAMS
];
IWineD3DVertexBuffer
*
stream_source
[
MAX_STREAMS
];
};
extern
IWineD3DStateBlockVtbl
IWineD3DStateBlock_Vtbl
;
...
...
include/wine/wined3d_interface.h
View file @
289562ee
...
...
@@ -88,6 +88,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown)
STDMETHOD_
(
ULONG
,
AddRef
)(
THIS
)
PURE
;
STDMETHOD_
(
ULONG
,
Release
)(
THIS
)
PURE
;
/*** IWineD3D methods ***/
STDMETHOD
(
GetParent
)(
THIS_
IUnknown
**
pParent
)
PURE
;
STDMETHOD_
(
UINT
,
GetAdapterCount
)(
THIS
)
PURE
;
STDMETHOD
(
RegisterSoftwareDevice
)(
THIS_
void
*
pInitializeFunction
)
PURE
;
STDMETHOD_
(
HMONITOR
,
GetAdapterMonitor
)(
THIS_
UINT
Adapter
)
PURE
;
...
...
@@ -101,7 +102,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown)
STDMETHOD
(
CheckDeviceFormat
)(
THIS_
UINT
Adapter
,
D3DDEVTYPE
DeviceType
,
D3DFORMAT
AdapterFormat
,
DWORD
Usage
,
D3DRESOURCETYPE
RType
,
D3DFORMAT
CheckFormat
)
PURE
;
STDMETHOD
(
CheckDeviceFormatConversion
)(
THIS_
UINT
Adapter
,
D3DDEVTYPE
DeviceType
,
D3DFORMAT
SourceFormat
,
D3DFORMAT
TargetFormat
)
PURE
;
STDMETHOD
(
GetDeviceCaps
)(
THIS_
UINT
Adapter
,
D3DDEVTYPE
DeviceType
,
void
*
pCaps
)
PURE
;
STDMETHOD
(
CreateDevice
)(
THIS_
UINT
Adapter
,
D3DDEVTYPE
DeviceType
,
HWND
hFocusWindow
,
DWORD
BehaviorFlags
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
,
IWineD3DDevice
**
ppReturnedDeviceInterface
)
PURE
;
STDMETHOD
(
CreateDevice
)(
THIS_
UINT
Adapter
,
D3DDEVTYPE
DeviceType
,
HWND
hFocusWindow
,
DWORD
BehaviorFlags
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
,
IWineD3DDevice
**
ppReturnedDeviceInterface
,
IUnknown
*
parent
)
PURE
;
};
#undef INTERFACE
...
...
@@ -111,6 +112,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown)
#define IWineD3D_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3D_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3D methods ***/
#define IWineD3D_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3D_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p)
#define IWineD3D_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a)
#define IWineD3D_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a)
...
...
@@ -124,11 +126,11 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown)
#define IWineD3D_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f)
#define IWineD3D_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d)
#define IWineD3D_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c)
#define IWineD3D_CreateDevice(p,a,b,c,d,e,f
) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f
)
#define IWineD3D_CreateDevice(p,a,b,c,d,e,f
,g) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f,g
)
#endif
/* Define the main WineD3D entrypoint */
IWineD3D
*
WINAPI
WineDirect3DCreate
(
UINT
SDKVersion
,
UINT
dxVersion
);
IWineD3D
*
WINAPI
WineDirect3DCreate
(
UINT
SDKVersion
,
UINT
dxVersion
,
IUnknown
*
parent
);
/*****************************************************************************
* WineD3DDevice interface
...
...
@@ -141,10 +143,13 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD_
(
ULONG
,
AddRef
)(
THIS
)
PURE
;
STDMETHOD_
(
ULONG
,
Release
)(
THIS
)
PURE
;
/*** IWineD3D methods ***/
STDMETHOD
(
CreateVertexBuffer
)(
THIS_
UINT
Length
,
DWORD
Usage
,
DWORD
FVF
,
D3DPOOL
Pool
,
IWineD3DVertexBuffer
**
ppVertexBuffer
,
HANDLE
*
sharedHandle
)
PURE
;
STDMETHOD
(
CreateStateBlock
)(
THIS_
D3DSTATEBLOCKTYPE
Type
,
IWineD3DStateBlock
**
ppStateBlock
)
PURE
;
STDMETHOD
(
GetParent
)(
THIS_
IUnknown
**
pParent
)
PURE
;
STDMETHOD
(
CreateVertexBuffer
)(
THIS_
UINT
Length
,
DWORD
Usage
,
DWORD
FVF
,
D3DPOOL
Pool
,
IWineD3DVertexBuffer
**
ppVertexBuffer
,
HANDLE
*
sharedHandle
,
IUnknown
*
parent
)
PURE
;
STDMETHOD
(
CreateStateBlock
)(
THIS_
D3DSTATEBLOCKTYPE
Type
,
IWineD3DStateBlock
**
ppStateBlock
,
IUnknown
*
parent
)
PURE
;
STDMETHOD
(
SetFVF
)(
THIS_
DWORD
fvf
)
PURE
;
STDMETHOD
(
GetFVF
)(
THIS_
DWORD
*
pfvf
)
PURE
;
STDMETHOD
(
SetStreamSource
)(
THIS_
UINT
StreamNumber
,
IWineD3DVertexBuffer
*
pStreamData
,
UINT
Offset
,
UINT
Stride
)
PURE
;
STDMETHOD
(
GetStreamSource
)(
THIS_
UINT
StreamNumber
,
IWineD3DVertexBuffer
**
ppStreamData
,
UINT
*
pOffset
,
UINT
*
pStride
)
PURE
;
};
#undef INTERFACE
...
...
@@ -154,10 +159,13 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#define IWineD3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DDevice_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DDevice methods ***/
#define IWineD3DDevice_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f)
#define IWineD3DDevice_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b)
#define IWineD3DDevice_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DDevice_CreateVertexBuffer(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f,g)
#define IWineD3DDevice_CreateStateBlock(p,a,b,c) (p)->lpVtbl->CreateStateBlock(p,a,b,c)
#define IWineD3DDevice_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a)
#define IWineD3DDevice_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a)
#define IWineD3DDevice_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d)
#define IWineD3DDevice_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d)
#endif
/*****************************************************************************
...
...
@@ -171,6 +179,7 @@ DECLARE_INTERFACE_(IWineD3DResource,IUnknown)
STDMETHOD_
(
ULONG
,
AddRef
)(
THIS
)
PURE
;
STDMETHOD_
(
ULONG
,
Release
)(
THIS
)
PURE
;
/*** IWineD3DResource methods ***/
STDMETHOD
(
GetParent
)(
THIS_
IUnknown
**
pParent
)
PURE
;
STDMETHOD
(
GetDevice
)(
THIS_
IWineD3DDevice
**
ppDevice
)
PURE
;
STDMETHOD
(
SetPrivateData
)(
THIS_
REFGUID
refguid
,
CONST
void
*
pData
,
DWORD
SizeOfData
,
DWORD
Flags
)
PURE
;
STDMETHOD
(
GetPrivateData
)(
THIS_
REFGUID
refguid
,
void
*
pData
,
DWORD
*
pSizeOfData
)
PURE
;
...
...
@@ -188,6 +197,7 @@ DECLARE_INTERFACE_(IWineD3DResource,IUnknown)
#define IWineD3DResource_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DResource_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DResource methods ***/
#define IWineD3DResource_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DResource_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IWineD3DResource_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d)
#define IWineD3DResource_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c)
...
...
@@ -209,6 +219,7 @@ DECLARE_INTERFACE_(IWineD3DVertexBuffer,IDirect3DResource8)
STDMETHOD_
(
ULONG
,
AddRef
)(
THIS
)
PURE
;
STDMETHOD_
(
ULONG
,
Release
)(
THIS
)
PURE
;
/*** IWineD3DResource methods ***/
STDMETHOD
(
GetParent
)(
THIS_
IUnknown
**
pParent
)
PURE
;
STDMETHOD
(
GetDevice
)(
THIS_
IWineD3DDevice
**
ppDevice
)
PURE
;
STDMETHOD
(
SetPrivateData
)(
THIS_
REFGUID
refguid
,
CONST
void
*
pData
,
DWORD
SizeOfData
,
DWORD
Flags
)
PURE
;
STDMETHOD
(
GetPrivateData
)(
THIS_
REFGUID
refguid
,
void
*
pData
,
DWORD
*
pSizeOfData
)
PURE
;
...
...
@@ -230,6 +241,7 @@ DECLARE_INTERFACE_(IWineD3DVertexBuffer,IDirect3DResource8)
#define IWineD3DVertexBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DVertexBuffer_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DResource methods ***/
#define IWineD3DVertexBuffer_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DVertexBuffer_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IWineD3DVertexBuffer_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d)
#define IWineD3DVertexBuffer_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c)
...
...
@@ -255,6 +267,7 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown)
STDMETHOD_
(
ULONG
,
AddRef
)(
THIS
)
PURE
;
STDMETHOD_
(
ULONG
,
Release
)(
THIS
)
PURE
;
/*** IWineD3DStateBlock methods ***/
STDMETHOD
(
GetParent
)(
THIS_
IUnknown
**
pParent
)
PURE
;
STDMETHOD
(
InitStartupStateBlock
)(
THIS
)
PURE
;
};
#undef INTERFACE
...
...
@@ -265,6 +278,7 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown)
#define IWineD3DStateBlock_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DStateBlock_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DStateBlock methods ***/
#define IWineD3DStateBlock_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DStateBlock_InitStartupStateBlock(p) (p)->lpVtbl->InitStartupStateBlock(p)
#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