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
ddbd4ab3
Commit
ddbd4ab3
authored
Nov 14, 2008
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 14, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxgi: Implement DXGID3D10CreateDevice().
parent
800fedc2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
0 deletions
+144
-0
device.c
dlls/dxgi/device.c
+9
-0
dxgi.spec
dlls/dxgi/dxgi.spec
+1
-0
dxgi_main.c
dlls/dxgi/dxgi_main.c
+133
-0
dxgi_private.h
dlls/dxgi/dxgi_private.h
+1
-0
No files found.
dlls/dxgi/device.c
View file @
ddbd4ab3
...
...
@@ -28,6 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
static
HRESULT
STDMETHODCALLTYPE
dxgi_device_QueryInterface
(
IDXGIDevice
*
iface
,
REFIID
riid
,
void
**
object
)
{
struct
dxgi_device
*
This
=
(
struct
dxgi_device
*
)
iface
;
TRACE
(
"iface %p, riid %s, object %p
\n
"
,
iface
,
debugstr_guid
(
riid
),
object
);
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
...
...
@@ -39,6 +41,12 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_QueryInterface(IDXGIDevice *iface,
return
S_OK
;
}
if
(
This
->
child_layer
)
{
TRACE
(
"forwarding to child layer %p
\n
"
,
This
->
child_layer
);
return
IUnknown_QueryInterface
(
This
->
child_layer
,
riid
,
object
);
}
WARN
(
"%s not implemented, returning E_NOINTERFACE
\n
"
,
debugstr_guid
(
riid
));
*
object
=
NULL
;
...
...
@@ -64,6 +72,7 @@ static ULONG STDMETHODCALLTYPE dxgi_device_Release(IDXGIDevice *iface)
if
(
!
refcount
)
{
if
(
This
->
child_layer
)
IUnknown_Release
(
This
->
child_layer
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
dlls/dxgi/dxgi.spec
View file @
ddbd4ab3
@ stdcall CreateDXGIFactory(ptr ptr)
@ stdcall DXGID3D10CreateDevice(ptr ptr ptr long long ptr)
@ stdcall DXGID3D10RegisterLayers(ptr long)
dlls/dxgi/dxgi_main.c
View file @
ddbd4ab3
...
...
@@ -36,6 +36,7 @@ static CRITICAL_SECTION dxgi_cs = {&dxgi_cs_debug, -1, 0, 0, 0, 0};
struct
dxgi_main
{
HMODULE
d3d10core
;
struct
dxgi_device_layer
*
device_layers
;
UINT
layer_count
;
LONG
refcount
;
...
...
@@ -50,6 +51,9 @@ static void dxgi_main_cleanup(void)
dxgi_main
.
device_layers
=
NULL
;
dxgi_main
.
layer_count
=
0
;
FreeLibrary
(
dxgi_main
.
d3d10core
);
dxgi_main
.
d3d10core
=
NULL
;
LeaveCriticalSection
(
&
dxgi_cs
);
}
...
...
@@ -97,6 +101,135 @@ HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
return
hr
;
}
static
BOOL
get_layer
(
enum
dxgi_device_layer_id
id
,
struct
dxgi_device_layer
*
layer
)
{
UINT
i
;
EnterCriticalSection
(
&
dxgi_cs
);
for
(
i
=
0
;
i
<
dxgi_main
.
layer_count
;
++
i
)
{
if
(
dxgi_main
.
device_layers
[
i
].
id
==
id
)
{
*
layer
=
dxgi_main
.
device_layers
[
i
];
LeaveCriticalSection
(
&
dxgi_cs
);
return
TRUE
;
}
}
LeaveCriticalSection
(
&
dxgi_cs
);
return
FALSE
;
}
static
HRESULT
register_d3d10core_layers
(
HMODULE
d3d10core
)
{
EnterCriticalSection
(
&
dxgi_cs
);
if
(
!
dxgi_main
.
d3d10core
)
{
HRESULT
hr
;
HRESULT
(
WINAPI
*
d3d10core_register_layers
)(
void
);
HMODULE
mod
;
BOOL
ret
;
ret
=
GetModuleHandleExA
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
(
LPCSTR
)
d3d10core
,
&
mod
);
if
(
!
ret
)
{
LeaveCriticalSection
(
&
dxgi_cs
);
return
E_FAIL
;
}
d3d10core_register_layers
=
(
HRESULT
(
WINAPI
*
)(
void
))
GetProcAddress
(
mod
,
"D3D10CoreRegisterLayers"
);
hr
=
d3d10core_register_layers
();
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to register d3d10core layers, returning %#x
\n
"
,
hr
);
LeaveCriticalSection
(
&
dxgi_cs
);
return
hr
;
}
dxgi_main
.
d3d10core
=
mod
;
}
LeaveCriticalSection
(
&
dxgi_cs
);
return
S_OK
;
}
HRESULT
WINAPI
DXGID3D10CreateDevice
(
HMODULE
d3d10core
,
IDXGIFactory
*
factory
,
IDXGIAdapter
*
adapter
,
UINT
flags
,
DWORD
unknown0
,
void
**
device
)
{
struct
layer_get_size_args
get_size_args
;
struct
dxgi_device
*
dxgi_device
;
struct
dxgi_device_layer
d3d10_layer
;
void
*
layer_base
;
UINT
device_size
;
DWORD
count
;
HRESULT
hr
;
TRACE
(
"d3d10core %p, factory %p, adapter %p, flags %#x, unknown0 %#x, device %p
\n
"
,
d3d10core
,
factory
,
adapter
,
flags
,
unknown0
,
device
);
hr
=
register_d3d10core_layers
(
d3d10core
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to register d3d10core layers, returning %#x
\n
"
,
hr
);
return
hr
;
}
if
(
!
get_layer
(
DXGI_DEVICE_LAYER_D3D10_DEVICE
,
&
d3d10_layer
))
{
ERR
(
"Failed to get D3D10 device layer
\n
"
);
return
E_FAIL
;
}
count
=
0
;
hr
=
d3d10_layer
.
init
(
d3d10_layer
.
id
,
&
count
,
NULL
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize D3D10 device layer
\n
"
);
return
E_FAIL
;
}
get_size_args
.
unknown0
=
0
;
get_size_args
.
unknown1
=
0
;
get_size_args
.
unknown2
=
NULL
;
get_size_args
.
unknown3
=
NULL
;
get_size_args
.
adapter
=
adapter
;
get_size_args
.
interface_major
=
10
;
get_size_args
.
interface_minor
=
1
;
get_size_args
.
version_build
=
4
;
get_size_args
.
version_revision
=
6000
;
device_size
=
d3d10_layer
.
get_size
(
d3d10_layer
.
id
,
&
get_size_args
,
0
);
device_size
+=
sizeof
(
*
dxgi_device
);
dxgi_device
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
device_size
);
if
(
!
dxgi_device
)
{
ERR
(
"Failed to allocate device memory
\n
"
);
return
E_OUTOFMEMORY
;
}
dxgi_device
->
vtbl
=
&
dxgi_device_vtbl
;
dxgi_device
->
refcount
=
1
;
layer_base
=
dxgi_device
+
1
;
hr
=
d3d10_layer
.
create
(
d3d10_layer
.
id
,
&
layer_base
,
0
,
dxgi_device
,
&
IID_IUnknown
,
(
void
**
)
&
dxgi_device
->
child_layer
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create device, returning %#x
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
dxgi_device
);
*
device
=
NULL
;
return
hr
;
}
*
device
=
(
IUnknown
*
)
dxgi_device
;
return
hr
;
}
HRESULT
WINAPI
DXGID3D10RegisterLayers
(
const
struct
dxgi_device_layer
*
layers
,
UINT
layer_count
)
{
UINT
i
;
...
...
dlls/dxgi/dxgi_private.h
View file @
ddbd4ab3
...
...
@@ -44,6 +44,7 @@ extern const struct IDXGIDeviceVtbl dxgi_device_vtbl;
struct
dxgi_device
{
const
struct
IDXGIDeviceVtbl
*
vtbl
;
IUnknown
*
child_layer
;
LONG
refcount
;
};
...
...
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