Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
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
Alchemy Viewer
Alchemy Viewer
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
Branches containing commit
No related tags found
Tags containing commit
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()
...
@@ -401,7 +401,7 @@ void LLDXHardware::cleanup()
BOOL
LLDXHardware
::
updateVRAM
()
BOOL
LLDXHardware
::
updateVRAM
()
{
{
SIZE_T
vram
=
getMBVideoMemoryViaDXGI
();
U64
vram
=
getMBVideoMemoryViaDXGI
();
if
(
vram
>
0
)
if
(
vram
>
0
)
{
{
...
@@ -411,12 +411,11 @@ BOOL LLDXHardware::updateVRAM()
...
@@ -411,12 +411,11 @@ BOOL LLDXHardware::updateVRAM()
return
FALSE
;
return
FALSE
;
}
}
S32
LLDXHardware
::
getMBVideoMemoryViaDXGI
()
U64
LLDXHardware
::
getMBVideoMemoryViaDXGI
()
{
{
HRESULT
hr
;
HRESULT
hr
;
BOOL
bGotMemory
=
FALSE
;
HRESULT
hrCoInitialize
=
S_OK
;
HRESULT
hrCoInitialize
=
S_OK
;
SIZE_T
vram
=
0
;
U64
vram
=
0
;
hrCoInitialize
=
CoInitialize
(
0
);
hrCoInitialize
=
CoInitialize
(
0
);
if
(
SUCCEEDED
(
hrCoInitialize
))
if
(
SUCCEEDED
(
hrCoInitialize
))
...
@@ -426,34 +425,35 @@ S32 LLDXHardware::getMBVideoMemoryViaDXGI()
...
@@ -426,34 +425,35 @@ S32 LLDXHardware::getMBVideoMemoryViaDXGI()
hr
=
CreateDXGIFactory1
(
IID_PPV_ARGS
(
&
pDXGIFactory
));
hr
=
CreateDXGIFactory1
(
IID_PPV_ARGS
(
&
pDXGIFactory
));
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
assert
(
pDXGIFactory
!=
0
);
llassert
(
pDXGIFactory
!=
0
);
IDXGIAdapter1
*
dxgiAdapter
=
nullptr
;
for
(
UINT
index
=
0
;
;
++
index
)
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
;
DXGI_ADAPTER_DESC1
desc
;
memset
(
&
desc
,
0
,
sizeof
(
DXGI_ADAPTER_DESC1
)
);
hr
=
tmpDxgiAdapter
->
GetDesc1
(
&
desc
);
if
(
SUCCEEDED
(
pAdapter
->
GetDesc1
(
&
desc
))
)
if
(
SUCCEEDED
(
hr
)
&&
!
dxgiAdapter
&&
desc
.
Flags
==
0
&&
tmpDxgiAdapter
)
{
{
if
(
desc
.
Flags
==
0
)
tmpDxgiAdapter
->
QueryInterface
(
IID_PPV_ARGS
(
&
dxgiAdapter
));
{
vram
=
desc
.
DedicatedVideoMemory
;
bGotMemory
=
TRUE
;
}
}
}
SAFE_RELEASE
(
pAdapter
);
SAFE_RELEASE
(
tmpDxgiAdapter
);
if
(
bGotMemory
!=
FALSE
)
++
adapterIndex
;
break
;
}
}
if
(
dxgiAdapter
!=
nullptr
)
{
DXGI_ADAPTER_DESC1
desc
;
dxgiAdapter
->
GetDesc1
(
&
desc
);
vram
=
desc
.
DedicatedVideoMemory
;
SAFE_RELEASE
(
dxgiAdapter
);
}
SAFE_RELEASE
(
pDXGIFactory
);
SAFE_RELEASE
(
pDXGIFactory
);
}
}
CoUninitialize
();
CoUninitialize
();
}
}
return
vram
/
(
1024
*
1024
)
;
return
vram
;
}
}
LLSD
LLDXHardware
::
getDisplayInfo
()
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
...
@@ -96,7 +96,7 @@ class LLDXHardware
// Will get memory of best GPU in MB, return memory on sucsess, 0 on failure
// Will get memory of best GPU in MB, return memory on sucsess, 0 on failure
// Note: WMI is not accurate in some cases
// Note: WMI is not accurate in some cases
static
S32
getMBVideoMemoryViaDXGI
();
static
U64
getMBVideoMemoryViaDXGI
();
// Find a particular device that matches the following specs.
// Find a particular device that matches the following specs.
// Empty strings indicate that you don't care.
// Empty strings indicate that you don't care.
...
@@ -109,7 +109,7 @@ class LLDXHardware
...
@@ -109,7 +109,7 @@ class LLDXHardware
typedef
std
::
map
<
std
::
string
,
LLDXDevice
*>
device_map_t
;
typedef
std
::
map
<
std
::
string
,
LLDXDevice
*>
device_map_t
;
// device_map_t mDevices;
// device_map_t mDevices;
protected
:
protected
:
S32
mVRAM
;
S32
mVRAM
;
// stored in megabytes
};
};
extern
void
(
*
gWriteDebug
)(
const
char
*
msg
);
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