summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-04-25 11:06:37 +0800
committerErik Kundiman <erik@megapahit.org>2024-04-25 11:06:37 +0800
commitf7b2c0d7d95ca8609a948a7d11b44534d8ac5249 (patch)
treeb9d80bc52d207acf50ea01b465ab26749ba40f72 /indra/llwindow
parentc82295910685c54acf597277e9dac0f70eb40239 (diff)
parentfc71a9c1ed96cb1cb97124e3cceabdfa11e1cc75 (diff)
Merge tag '7.1.6-release'
source for viewer 7.1.6.8745209917
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/lldxhardware.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index 391a377280..aaa2f6aef1 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -65,13 +65,12 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam)
{
HRESULT hr;
bool bGotMemory = false;
- HRESULT hrCoInitialize = S_OK;
IWbemLocator* pIWbemLocator = nullptr;
IWbemServices* pIWbemServices = nullptr;
BSTR pNamespace = nullptr;
*pdwAdapterRam = 0;
- hrCoInitialize = CoInitialize( 0 );
+ CoInitializeEx(0, COINIT_APARTMENTTHREADED);
hr = CoCreateInstance( CLSID_WbemLocator,
nullptr,
@@ -208,8 +207,7 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam)
SAFE_RELEASE( pIWbemLocator );
- if( SUCCEEDED( hrCoInitialize ) )
- CoUninitialize();
+ CoUninitialize();
if( bGotMemory )
return S_OK;
@@ -232,9 +230,8 @@ S32 LLDXHardware::getMBVideoMemoryViaWMI()
std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor)
{
std::string mDriverVersion;
- HRESULT hrCoInitialize = S_OK;
HRESULT hres;
- hrCoInitialize = CoInitialize(0);
+ CoInitializeEx(0, COINIT_APARTMENTTHREADED);
IWbemLocator *pLoc = NULL;
hres = CoCreateInstance(
@@ -437,10 +434,10 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor)
{
pEnumerator->Release();
}
- if (SUCCEEDED(hrCoInitialize))
- {
- CoUninitialize();
- }
+
+ // supposed to always call CoUninitialize even if init returned false
+ CoUninitialize();
+
return mDriverVersion;
}
@@ -687,7 +684,8 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
BOOL ok = FALSE;
HRESULT hr;
- CoInitialize(NULL);
+ // CLSID_DxDiagProvider does not work with Multithreaded?
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
IDxDiagProvider *dx_diag_providerp = NULL;
IDxDiagContainer *dx_diag_rootp = NULL;
@@ -976,7 +974,7 @@ LLSD LLDXHardware::getDisplayInfo()
LLTimer hw_timer;
HRESULT hr;
LLSD ret;
- CoInitialize(NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
IDxDiagProvider *dx_diag_providerp = NULL;
IDxDiagContainer *dx_diag_rootp = NULL;