Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
e35307f8
Commit
e35307f8
authored
Mar 09, 2021
by
Roman Sedaikin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated approach to finding adapters when using DirectX.
parent
de680f76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
directXRedrawer.cc
skiko/src/jvmMain/cpp/windows/directXRedrawer.cc
+19
-19
No files found.
skiko/src/jvmMain/cpp/windows/directXRedrawer.cc
View file @
e35307f8
...
...
@@ -226,6 +226,21 @@ HRESULT D3DCompile(
return
toJavaPointer
(
renderTarget
);
}
bool
isBlacklisted
(
IDXGIAdapter1
*
hardwareAdapter
)
{
DXGI_ADAPTER_DESC1
desc
;
hardwareAdapter
->
GetDesc1
(
&
desc
);
std
::
wstring
currentAdapterName
(
desc
.
Description
);
for
(
std
::
wstring
name
:
adapterBlacklist
)
{
if
(
currentAdapterName
==
name
)
{
fwprintf
(
stderr
,
L"Graphics card: %s is blacklisted.
\n
"
,
name
.
c_str
());
return
true
;
}
}
return
false
;
}
bool
defineHardwareAdapter
(
IDXGIFactory4
*
pFactory
,
IDXGIAdapter1
**
ppAdapter
)
{
*
ppAdapter
=
nullptr
;
...
...
@@ -238,6 +253,10 @@ HRESULT D3DCompile(
}
if
(
SUCCEEDED
(
D3D12CreateDevice
(
pAdapter
,
D3D_FEATURE_LEVEL_11_0
,
_uuidof
(
ID3D12Device
),
nullptr
)))
{
if
(
isBlacklisted
(
pAdapter
))
{
continue
;
}
*
ppAdapter
=
pAdapter
;
return
true
;
}
...
...
@@ -246,21 +265,6 @@ HRESULT D3DCompile(
return
false
;
}
bool
isBlacklisted
(
IDXGIAdapter1
*
hardwareAdapter
)
{
DXGI_ADAPTER_DESC1
desc
;
hardwareAdapter
->
GetDesc1
(
&
desc
);
std
::
wstring
currentAdapterName
(
desc
.
Description
);
for
(
std
::
wstring
name
:
adapterBlacklist
)
{
if
(
currentAdapterName
==
name
)
{
fwprintf
(
stderr
,
L"Graphics card: %s is blacklisted.
\n
"
,
name
.
c_str
());
return
true
;
}
}
return
false
;
}
JNIEXPORT
jlong
JNICALL
Java_org_jetbrains_skiko_redrawer_Direct3DRedrawer_createDirectXDevice
(
JNIEnv
*
env
,
jobject
redrawer
,
jlong
windowHandle
)
{
...
...
@@ -274,10 +278,6 @@ HRESULT D3DCompile(
{
return
0
;
}
if
(
isBlacklisted
(
hardwareAdapter
.
get
()))
{
return
0
;
}
gr_cp
<
ID3D12Device
>
device
;
if
(
!
SUCCEEDED
(
D3D12CreateDevice
(
hardwareAdapter
.
get
(),
D3D_FEATURE_LEVEL_11_0
,
IID_PPV_ARGS
(
&
device
))))
{
...
...
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