Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b2f5fad4
Commit
b2f5fad4
authored
Aug 21, 2015
by
Józef Kucia
Committed by
Alexandre Julliard
Aug 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d11: Implement D3D11CreateDevice.
parent
a9cb14dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
5 deletions
+108
-5
d3d11_main.c
dlls/d3d11/d3d11_main.c
+108
-5
No files found.
dlls/d3d11/d3d11_main.c
View file @
b2f5fad4
...
...
@@ -146,12 +146,115 @@ HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte
HRESULT
WINAPI
D3D11CreateDevice
(
IDXGIAdapter
*
adapter
,
D3D_DRIVER_TYPE
driver_type
,
HMODULE
swrast
,
UINT
flags
,
const
D3D_FEATURE_LEVEL
*
feature_levels
,
UINT
levels
,
UINT
sdk_version
,
ID3D11Device
**
device
,
D3D_FEATURE_LEVEL
*
feature_level
,
ID3D11DeviceContext
**
context
)
D3D_FEATURE_LEVEL
*
obtained_feature_level
,
ID3D11DeviceContext
**
immediate_
context
)
{
FIXME
(
"adapter %p, driver_type %s, swrast %p, flags %#x, feature_levels %p, levels %#x, sdk_version %u, "
"device %p, feature_level %p, context %p stub!
\n
"
,
adapter
,
debug_d3d_driver_type
(
driver_type
),
swrast
,
flags
,
feature_levels
,
levels
,
sdk_version
,
device
,
feature_level
,
context
);
return
E_OUTOFMEMORY
;
IDXGIFactory
*
factory
;
HRESULT
hr
;
TRACE
(
"adapter %p, driver_type %s, swrast %p, flags %#x, feature_levels %p, levels %u, sdk_version %u, "
"device %p, obtained_feature_level %p, immediate_context %p.
\n
"
,
adapter
,
debug_d3d_driver_type
(
driver_type
),
swrast
,
flags
,
feature_levels
,
levels
,
sdk_version
,
device
,
obtained_feature_level
,
immediate_context
);
if
(
adapter
)
{
IDXGIAdapter_AddRef
(
adapter
);
hr
=
IDXGIAdapter_GetParent
(
adapter
,
&
IID_IDXGIFactory
,
(
void
**
)
&
factory
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to get dxgi factory, returning %#x.
\n
"
,
hr
);
return
hr
;
}
}
else
{
hr
=
CreateDXGIFactory
(
&
IID_IDXGIFactory
,
(
void
**
)
&
factory
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create dxgi factory, returning %#x.
\n
"
,
hr
);
return
hr
;
}
switch
(
driver_type
)
{
case
D3D_DRIVER_TYPE_HARDWARE
:
{
hr
=
IDXGIFactory_EnumAdapters
(
factory
,
0
,
&
adapter
);
if
(
FAILED
(
hr
))
{
WARN
(
"No adapters found, returning %#x.
\n
"
,
hr
);
IDXGIFactory_Release
(
factory
);
return
hr
;
}
break
;
}
case
D3D_DRIVER_TYPE_NULL
:
FIXME
(
"NULL device not implemented, falling back to refrast.
\n
"
);
/* fall through, for now */
case
D3D_DRIVER_TYPE_REFERENCE
:
{
HMODULE
refrast
=
LoadLibraryA
(
"d3d11ref.dll"
);
if
(
!
refrast
)
{
WARN
(
"Failed to load refrast, returning E_FAIL.
\n
"
);
IDXGIFactory_Release
(
factory
);
return
E_FAIL
;
}
hr
=
IDXGIFactory_CreateSoftwareAdapter
(
factory
,
refrast
,
&
adapter
);
FreeLibrary
(
refrast
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create a software adapter, returning %#x.
\n
"
,
hr
);
IDXGIFactory_Release
(
factory
);
return
hr
;
}
break
;
}
case
D3D_DRIVER_TYPE_SOFTWARE
:
{
if
(
!
swrast
)
{
WARN
(
"Software device requested, but NULL swrast passed, returning E_FAIL.
\n
"
);
IDXGIFactory_Release
(
factory
);
return
E_FAIL
;
}
hr
=
IDXGIFactory_CreateSoftwareAdapter
(
factory
,
swrast
,
&
adapter
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create a software adapter, returning %#x.
\n
"
,
hr
);
IDXGIFactory_Release
(
factory
);
return
hr
;
}
break
;
}
default:
FIXME
(
"Unhandled driver type %#x.
\n
"
,
driver_type
);
IDXGIFactory_Release
(
factory
);
return
E_FAIL
;
}
}
hr
=
D3D11CoreCreateDevice
(
factory
,
adapter
,
flags
,
feature_levels
,
levels
,
device
);
IDXGIAdapter_Release
(
adapter
);
IDXGIFactory_Release
(
factory
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create a device, returning %#x.
\n
"
,
hr
);
return
hr
;
}
TRACE
(
"Created ID3D11Device %p.
\n
"
,
*
device
);
if
(
obtained_feature_level
)
*
obtained_feature_level
=
ID3D11Device_GetFeatureLevel
(
*
device
);
if
(
immediate_context
)
ID3D11Device_GetImmediateContext
(
*
device
,
immediate_context
);
return
hr
;
}
HRESULT
WINAPI
D3D11CreateDeviceAndSwapChain
(
IDXGIAdapter
*
adapter
,
D3D_DRIVER_TYPE
driver_type
,
...
...
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