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
9e886423
Commit
9e886423
authored
Dec 29, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 30, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxgi: Add a separate function for factory initialization.
parent
2650885c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
68 deletions
+80
-68
dxgi_main.c
dlls/dxgi/dxgi_main.c
+6
-66
dxgi_private.h
dlls/dxgi/dxgi_private.h
+2
-1
factory.c
dlls/dxgi/factory.c
+72
-1
No files found.
dlls/dxgi/dxgi_main.c
View file @
9e886423
...
...
@@ -80,7 +80,6 @@ HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
{
struct
dxgi_factory
*
object
;
HRESULT
hr
;
UINT
i
;
TRACE
(
"riid %s, factory %p
\n
"
,
debugstr_guid
(
riid
),
factory
);
...
...
@@ -92,59 +91,13 @@ HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
return
E_OUTOFMEMORY
;
}
object
->
vtbl
=
&
dxgi_factory_vtbl
;
object
->
refcount
=
1
;
EnterCriticalSection
(
&
dxgi_cs
);
object
->
wined3d
=
WineDirect3DCreate
(
10
,
(
IUnknown
*
)
object
);
if
(
!
object
->
wined3d
)
{
hr
=
DXGI_ERROR_UNSUPPORTED
;
LeaveCriticalSection
(
&
dxgi_cs
);
goto
fail
;
}
object
->
adapter_count
=
IWineD3D_GetAdapterCount
(
object
->
wined3d
);
LeaveCriticalSection
(
&
dxgi_cs
);
object
->
adapters
=
HeapAlloc
(
GetProcessHeap
(),
0
,
object
->
adapter_count
*
sizeof
(
*
object
->
adapters
));
if
(
!
object
->
adapters
)
{
ERR
(
"Failed to allocate DXGI adapter array memory
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
fail
;
}
for
(
i
=
0
;
i
<
object
->
adapter_count
;
++
i
)
hr
=
dxgi_factory_init
(
object
);
if
(
FAILED
(
hr
))
{
struct
dxgi_adapter
*
adapter
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
adapter
));
if
(
!
adapter
)
{
UINT
j
;
ERR
(
"Failed to allocate DXGI adapter memory
\n
"
);
for
(
j
=
0
;
j
<
i
;
++
j
)
{
HeapFree
(
GetProcessHeap
(),
0
,
object
->
adapters
[
j
]);
}
hr
=
E_OUTOFMEMORY
;
goto
fail
;
}
hr
=
dxgi_adapter_init
(
adapter
,
(
IWineDXGIFactory
*
)
object
,
i
);
if
(
FAILED
(
hr
))
{
UINT
j
;
ERR
(
"Failed to initialize adapter, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
adapter
);
for
(
j
=
0
;
j
<
i
;
++
j
)
{
IDXGIAdapter_Release
(
object
->
adapters
[
j
]);
}
goto
fail
;
}
object
->
adapters
[
i
]
=
(
IDXGIAdapter
*
)
adapter
;
WARN
(
"Failed to initialize swapchain, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
factory
=
NULL
;
return
hr
;
}
TRACE
(
"Created IDXGIFactory %p
\n
"
,
object
);
...
...
@@ -153,19 +106,6 @@ HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
IDXGIFactory_Release
((
IDXGIFactory
*
)
object
);
return
hr
;
fail:
HeapFree
(
GetProcessHeap
(),
0
,
object
->
adapters
);
if
(
object
->
wined3d
)
{
EnterCriticalSection
(
&
dxgi_cs
);
IWineD3D_Release
(
object
->
wined3d
);
LeaveCriticalSection
(
&
dxgi_cs
);
}
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
factory
=
NULL
;
return
hr
;
}
static
BOOL
get_layer
(
enum
dxgi_device_layer_id
id
,
struct
dxgi_device_layer
*
layer
)
...
...
dlls/dxgi/dxgi_private.h
View file @
9e886423
...
...
@@ -75,7 +75,6 @@ const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
WINED3DFORMAT
wined3dformat_from_dxgi_format
(
DXGI_FORMAT
format
)
DECLSPEC_HIDDEN
;
/* IDXGIFactory */
extern
const
struct
IWineDXGIFactoryVtbl
dxgi_factory_vtbl
DECLSPEC_HIDDEN
;
struct
dxgi_factory
{
const
struct
IWineDXGIFactoryVtbl
*
vtbl
;
...
...
@@ -85,6 +84,8 @@ struct dxgi_factory
IDXGIAdapter
**
adapters
;
};
HRESULT
dxgi_factory_init
(
struct
dxgi_factory
*
factory
)
DECLSPEC_HIDDEN
;
/* IDXGIDevice */
struct
dxgi_device
{
...
...
dlls/dxgi/factory.c
View file @
9e886423
...
...
@@ -274,7 +274,7 @@ static IWineD3D * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *i
return
This
->
wined3d
;
}
const
struct
IWineDXGIFactoryVtbl
dxgi_factory_vtbl
=
static
const
struct
IWineDXGIFactoryVtbl
dxgi_factory_vtbl
=
{
/* IUnknown methods */
dxgi_factory_QueryInterface
,
...
...
@@ -294,3 +294,74 @@ const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl =
/* IWineDXGIFactory methods */
dxgi_factory_get_wined3d
,
};
HRESULT
dxgi_factory_init
(
struct
dxgi_factory
*
factory
)
{
HRESULT
hr
;
UINT
i
;
factory
->
vtbl
=
&
dxgi_factory_vtbl
;
factory
->
refcount
=
1
;
EnterCriticalSection
(
&
dxgi_cs
);
factory
->
wined3d
=
WineDirect3DCreate
(
10
,
(
IUnknown
*
)
factory
);
if
(
!
factory
->
wined3d
)
{
LeaveCriticalSection
(
&
dxgi_cs
);
return
DXGI_ERROR_UNSUPPORTED
;
}
factory
->
adapter_count
=
IWineD3D_GetAdapterCount
(
factory
->
wined3d
);
LeaveCriticalSection
(
&
dxgi_cs
);
factory
->
adapters
=
HeapAlloc
(
GetProcessHeap
(),
0
,
factory
->
adapter_count
*
sizeof
(
*
factory
->
adapters
));
if
(
!
factory
->
adapters
)
{
ERR
(
"Failed to allocate DXGI adapter array memory.
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
fail
;
}
for
(
i
=
0
;
i
<
factory
->
adapter_count
;
++
i
)
{
struct
dxgi_adapter
*
adapter
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
adapter
));
if
(
!
adapter
)
{
UINT
j
;
ERR
(
"Failed to allocate DXGI adapter memory.
\n
"
);
for
(
j
=
0
;
j
<
i
;
++
j
)
{
IDXGIAdapter_Release
(
factory
->
adapters
[
j
]);
}
hr
=
E_OUTOFMEMORY
;
goto
fail
;
}
hr
=
dxgi_adapter_init
(
adapter
,
(
IWineDXGIFactory
*
)
factory
,
i
);
if
(
FAILED
(
hr
))
{
UINT
j
;
ERR
(
"Failed to initialize adapter, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
adapter
);
for
(
j
=
0
;
j
<
i
;
++
j
)
{
IDXGIAdapter_Release
(
factory
->
adapters
[
j
]);
}
goto
fail
;
}
factory
->
adapters
[
i
]
=
(
IDXGIAdapter
*
)
adapter
;
}
return
S_OK
;
fail:
HeapFree
(
GetProcessHeap
(),
0
,
factory
->
adapters
);
EnterCriticalSection
(
&
dxgi_cs
);
IWineD3D_Release
(
factory
->
wined3d
);
LeaveCriticalSection
(
&
dxgi_cs
);
return
hr
;
}
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