diff options
author | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
commit | b235c59d60472f818a9142c0886b95a0ff4191d7 (patch) | |
tree | d323c55587584b19cc43a03f58a178823f12d3cd /linden/indra/llwindow/lldxhardware.cpp | |
parent | Second Life viewer sources 1.18.5.3 (diff) | |
download | meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.zip meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.gz meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.bz2 meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.xz |
Second Life viewer sources 1.18.6.0-RC
Diffstat (limited to 'linden/indra/llwindow/lldxhardware.cpp')
-rw-r--r-- | linden/indra/llwindow/lldxhardware.cpp | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/linden/indra/llwindow/lldxhardware.cpp b/linden/indra/llwindow/lldxhardware.cpp index 1a39e68..2aff052 100644 --- a/linden/indra/llwindow/lldxhardware.cpp +++ b/linden/indra/llwindow/lldxhardware.cpp | |||
@@ -411,6 +411,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) | |||
411 | } | 411 | } |
412 | 412 | ||
413 | std::string device_name = get_string(device_containerp, L"szDescription"); | 413 | std::string device_name = get_string(device_containerp, L"szDescription"); |
414 | |||
414 | std::string device_id = get_string(device_containerp, L"szDeviceID"); | 415 | std::string device_id = get_string(device_containerp, L"szDeviceID"); |
415 | 416 | ||
416 | LLDXDevice *dxdevicep = new LLDXDevice; | 417 | LLDXDevice *dxdevicep = new LLDXDevice; |
@@ -451,6 +452,8 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) | |||
451 | } | 452 | } |
452 | 453 | ||
453 | 454 | ||
455 | |||
456 | |||
454 | // Now, iterate through the related drivers | 457 | // Now, iterate through the related drivers |
455 | hr = device_containerp->GetChildContainer(L"Drivers", &driver_containerp); | 458 | hr = device_containerp->GetChildContainer(L"Drivers", &driver_containerp); |
456 | if (FAILED(hr) || !driver_containerp) | 459 | if (FAILED(hr) || !driver_containerp) |
@@ -468,6 +471,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) | |||
468 | S32 file_num = 0; | 471 | S32 file_num = 0; |
469 | for (file_num = 0; file_num < (S32)num_files; file_num++ ) | 472 | for (file_num = 0; file_num < (S32)num_files; file_num++ ) |
470 | { | 473 | { |
474 | |||
471 | hr = driver_containerp->EnumChildContainerNames(file_num, wszContainer, 256); | 475 | hr = driver_containerp->EnumChildContainerNames(file_num, wszContainer, 256); |
472 | if (FAILED(hr)) | 476 | if (FAILED(hr)) |
473 | { | 477 | { |
@@ -522,6 +526,104 @@ LCleanup: | |||
522 | return ok; | 526 | return ok; |
523 | } | 527 | } |
524 | 528 | ||
529 | LLSD LLDXHardware::getDisplayInfo() | ||
530 | { | ||
531 | LLTimer hw_timer; | ||
532 | HRESULT hr; | ||
533 | LLSD ret; | ||
534 | CoInitialize(NULL); | ||
535 | |||
536 | IDxDiagProvider *dx_diag_providerp = NULL; | ||
537 | IDxDiagContainer *dx_diag_rootp = NULL; | ||
538 | IDxDiagContainer *devices_containerp = NULL; | ||
539 | IDxDiagContainer *device_containerp = NULL; | ||
540 | IDxDiagContainer *file_containerp = NULL; | ||
541 | IDxDiagContainer *driver_containerp = NULL; | ||
542 | |||
543 | // CoCreate a IDxDiagProvider* | ||
544 | llinfos << "CoCreateInstance IID_IDxDiagProvider" << llendl; | ||
545 | hr = CoCreateInstance(CLSID_DxDiagProvider, | ||
546 | NULL, | ||
547 | CLSCTX_INPROC_SERVER, | ||
548 | IID_IDxDiagProvider, | ||
549 | (LPVOID*) &dx_diag_providerp); | ||
550 | |||
551 | if (FAILED(hr)) | ||
552 | { | ||
553 | llwarns << "No DXDiag provider found! DirectX 9 not installed!" << llendl; | ||
554 | gWriteDebug("No DXDiag provider found! DirectX 9 not installed!\n"); | ||
555 | goto LCleanup; | ||
556 | } | ||
557 | if (SUCCEEDED(hr)) // if FAILED(hr) then dx9 is not installed | ||
558 | { | ||
559 | // Fill out a DXDIAG_INIT_PARAMS struct and pass it to IDxDiagContainer::Initialize | ||
560 | // Passing in TRUE for bAllowWHQLChecks, allows dxdiag to check if drivers are | ||
561 | // digital signed as logo'd by WHQL which may connect via internet to update | ||
562 | // WHQL certificates. | ||
563 | DXDIAG_INIT_PARAMS dx_diag_init_params; | ||
564 | ZeroMemory(&dx_diag_init_params, sizeof(DXDIAG_INIT_PARAMS)); | ||
565 | |||
566 | dx_diag_init_params.dwSize = sizeof(DXDIAG_INIT_PARAMS); | ||
567 | dx_diag_init_params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION; | ||
568 | dx_diag_init_params.bAllowWHQLChecks = TRUE; | ||
569 | dx_diag_init_params.pReserved = NULL; | ||
570 | |||
571 | llinfos << "dx_diag_providerp->Initialize" << llendl; | ||
572 | hr = dx_diag_providerp->Initialize(&dx_diag_init_params); | ||
573 | if(FAILED(hr)) | ||
574 | { | ||
575 | goto LCleanup; | ||
576 | } | ||
577 | |||
578 | llinfos << "dx_diag_providerp->GetRootContainer" << llendl; | ||
579 | hr = dx_diag_providerp->GetRootContainer( &dx_diag_rootp ); | ||
580 | if(FAILED(hr) || !dx_diag_rootp) | ||
581 | { | ||
582 | goto LCleanup; | ||
583 | } | ||
584 | |||
585 | HRESULT hr; | ||
586 | |||
587 | // Get display driver information | ||
588 | llinfos << "dx_diag_rootp->GetChildContainer" << llendl; | ||
589 | hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp); | ||
590 | if(FAILED(hr) || !devices_containerp) | ||
591 | { | ||
592 | goto LCleanup; | ||
593 | } | ||
594 | |||
595 | // Get device 0 | ||
596 | llinfos << "devices_containerp->GetChildContainer" << llendl; | ||
597 | hr = devices_containerp->GetChildContainer(L"0", &device_containerp); | ||
598 | if(FAILED(hr) || !device_containerp) | ||
599 | { | ||
600 | goto LCleanup; | ||
601 | } | ||
602 | |||
603 | // Get the English VRAM string | ||
604 | std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish"); | ||
605 | |||
606 | |||
607 | // Dump the string as an int into the structure | ||
608 | char *stopstring; | ||
609 | ret["VRAM"] = strtol(ram_str.c_str(), &stopstring, 10); | ||
610 | std::string device_name = get_string(device_containerp, L"szDescription"); | ||
611 | ret["DeviceName"] = device_name; | ||
612 | std::string device_driver= get_string(device_containerp, L"szDriverVersion"); | ||
613 | ret["DriverVersion"] = device_driver; | ||
614 | } | ||
615 | LCleanup: | ||
616 | SAFE_RELEASE(file_containerp); | ||
617 | SAFE_RELEASE(driver_containerp); | ||
618 | SAFE_RELEASE(device_containerp); | ||
619 | SAFE_RELEASE(devices_containerp); | ||
620 | SAFE_RELEASE(dx_diag_rootp); | ||
621 | SAFE_RELEASE(dx_diag_providerp); | ||
622 | |||
623 | CoUninitialize(); | ||
624 | return ret; | ||
625 | } | ||
626 | |||
525 | void LLDXHardware::setWriteDebugFunc(void (*func)(const char*)) | 627 | void LLDXHardware::setWriteDebugFunc(void (*func)(const char*)) |
526 | { | 628 | { |
527 | gWriteDebug = func; | 629 | gWriteDebug = func; |