Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
5c78f0dc
Commit
5c78f0dc
authored
3 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fix getting video memory via DXGI
parent
e59ad682
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llwindow/lldxhardware.cpp
+23
-23
23 additions, 23 deletions
indra/llwindow/lldxhardware.cpp
indra/llwindow/lldxhardware.h
+2
-2
2 additions, 2 deletions
indra/llwindow/lldxhardware.h
with
25 additions
and
25 deletions
indra/llwindow/lldxhardware.cpp
+
23
−
23
View file @
5c78f0dc
...
...
@@ -401,7 +401,7 @@ void LLDXHardware::cleanup()
BOOL
LLDXHardware
::
updateVRAM
()
{
SIZE_T
vram
=
getMBVideoMemoryViaDXGI
();
U64
vram
=
getMBVideoMemoryViaDXGI
();
if
(
vram
>
0
)
{
...
...
@@ -411,12 +411,11 @@ BOOL LLDXHardware::updateVRAM()
return
FALSE
;
}
S32
LLDXHardware
::
getMBVideoMemoryViaDXGI
()
U64
LLDXHardware
::
getMBVideoMemoryViaDXGI
()
{
HRESULT
hr
;
BOOL
bGotMemory
=
FALSE
;
HRESULT
hrCoInitialize
=
S_OK
;
SIZE_T
vram
=
0
;
U64
vram
=
0
;
hrCoInitialize
=
CoInitialize
(
0
);
if
(
SUCCEEDED
(
hrCoInitialize
))
...
...
@@ -426,34 +425,35 @@ S32 LLDXHardware::getMBVideoMemoryViaDXGI()
hr
=
CreateDXGIFactory1
(
IID_PPV_ARGS
(
&
pDXGIFactory
));
if
(
SUCCEEDED
(
hr
))
{
assert
(
pDXGIFactory
!=
0
);
for
(
UINT
index
=
0
;
;
++
index
)
llassert
(
pDXGIFactory
!=
0
);
IDXGIAdapter1
*
dxgiAdapter
=
nullptr
;
IDXGIAdapter1
*
tmpDxgiAdapter
=
nullptr
;
UINT
adapterIndex
=
0
;
while
(
pDXGIFactory
->
EnumAdapters1
(
adapterIndex
,
&
tmpDxgiAdapter
)
!=
DXGI_ERROR_NOT_FOUND
)
{
IDXGIAdapter1
*
pAdapter
=
nullptr
;
hr
=
pDXGIFactory
->
EnumAdapters1
(
index
,
&
pAdapter
);
if
(
FAILED
(
hr
))
// DXGIERR_NOT_FOUND is expected when the end of the list is hit
break
;
DXGI_ADAPTER_DESC1
desc
;
memset
(
&
desc
,
0
,
sizeof
(
DXGI_ADAPTER_DESC1
)
);
if
(
SUCCEEDED
(
pAdapter
->
GetDesc1
(
&
desc
))
)
hr
=
tmpDxgiAdapter
->
GetDesc1
(
&
desc
);
if
(
SUCCEEDED
(
hr
)
&&
!
dxgiAdapter
&&
desc
.
Flags
==
0
&&
tmpDxgiAdapter
)
{
if
(
desc
.
Flags
==
0
)
{
vram
=
desc
.
DedicatedVideoMemory
;
bGotMemory
=
TRUE
;
}
tmpDxgiAdapter
->
QueryInterface
(
IID_PPV_ARGS
(
&
dxgiAdapter
));
}
SAFE_RELEASE
(
pAdapter
);
if
(
bGotMemory
!=
FALSE
)
break
;
SAFE_RELEASE
(
tmpDxgiAdapter
);
++
adapterIndex
;
}
if
(
dxgiAdapter
!=
nullptr
)
{
DXGI_ADAPTER_DESC1
desc
;
dxgiAdapter
->
GetDesc1
(
&
desc
);
vram
=
desc
.
DedicatedVideoMemory
;
SAFE_RELEASE
(
dxgiAdapter
);
}
SAFE_RELEASE
(
pDXGIFactory
);
}
CoUninitialize
();
}
return
vram
/
(
1024
*
1024
)
;
return
vram
;
}
LLSD
LLDXHardware
::
getDisplayInfo
()
...
...
This diff is collapsed.
Click to expand it.
indra/llwindow/lldxhardware.h
+
2
−
2
View file @
5c78f0dc
...
...
@@ -96,7 +96,7 @@ class LLDXHardware
// Will get memory of best GPU in MB, return memory on sucsess, 0 on failure
// Note: WMI is not accurate in some cases
static
S32
getMBVideoMemoryViaDXGI
();
static
U64
getMBVideoMemoryViaDXGI
();
// Find a particular device that matches the following specs.
// Empty strings indicate that you don't care.
...
...
@@ -109,7 +109,7 @@ class LLDXHardware
typedef
std
::
map
<
std
::
string
,
LLDXDevice
*>
device_map_t
;
// device_map_t mDevices;
protected
:
S32
mVRAM
;
S32
mVRAM
;
// stored in megabytes
};
extern
void
(
*
gWriteDebug
)(
const
char
*
msg
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment