Skip to content

Commit 01f8951

Browse files
committed
Fix two issues
Make sure DX11 and DX12 respect the OpenContext flags Make sure OpenGL ignores non-AMD hardware
1 parent 3bee7f6 commit 01f8951

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

Src/GPUPerfAPIDX11/GPUPerfAPIDX11.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,17 @@ GPA_Status GPA_IMP_OpenContext(void* pContext)
559559

560560
getCurrentContext()->SetDX11DeviceContext(pDeviceContext);
561561

562-
return GenerateCounters(GPA_API_DIRECTX_11, vendorId, deviceId, revisionId, (GPA_ICounterAccessor**) & (g_pCurrentContext->m_pCounterAccessor), &(getCurrentContext()->m_pCounterScheduler));
562+
GPA_Status result = GenerateCounters(GPA_API_DIRECTX_11, vendorId, deviceId, revisionId, (GPA_ICounterAccessor**) & (g_pCurrentContext->m_pCounterAccessor), &(getCurrentContext()->m_pCounterScheduler));
563+
564+
if (GPA_STATUS_OK == result)
565+
{
566+
g_pCurrentContext->m_pCounterAccessor->SetAllowedCounters(g_pCurrentContext->ExposePublicCounters(),
567+
g_pCurrentContext->ExposeHardwareCounters(),
568+
g_pCurrentContext->ExposeSoftwareCounters());
569+
}
570+
571+
return result;
572+
563573
}
564574

565575
//-----------------------------------------------------------------------------

Src/GPUPerfAPIDX12/GPUPerfAPIDX12.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ GPA_Status GPA_IMP_OpenContext(void* pContext)
329329

330330
if (GPA_STATUS_OK == result)
331331
{
332+
pCounterAccessor->SetAllowedCounters(GetCurrentContext()->ExposePublicCounters(),
333+
GetCurrentContext()->ExposeHardwareCounters(),
334+
GetCurrentContext()->ExposeSoftwareCounters());
332335
GetCurrentContext()->m_pCounterAccessor =
333336
static_cast<GPA_CounterGeneratorBase*>(pCounterAccessor);
334337
GetCurrentContext()->m_pCounterScheduler = pCounterScheduler;

Src/GPUPerfAPIGL/GPUPerfAPIGL.cpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -581,17 +581,11 @@ GPA_Status GPA_IMP_GetHWInfo(void* pContext, GPA_HWInfo* pHwInfo)
581581
//TODO: should at least support GPUTime for these vendors then
582582
if (nullptr != strstr(reinterpret_cast<const char*>(pVendor), pNVIDIARenderer))
583583
{
584-
pHwInfo->SetVendorID(NVIDIA_VENDOR_ID);
585-
pHwInfo->SetDeviceName(reinterpret_cast<const char*>(pRenderer));
586-
pHwInfo->SetHWGeneration(GDT_HW_GENERATION_NVIDIA);
587-
return GPA_STATUS_OK;
584+
return GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED;
588585
}
589586
else if (nullptr != strstr(reinterpret_cast<const char*>(pVendor), pIntelRenderer))
590587
{
591-
pHwInfo->SetVendorID(INTEL_VENDOR_ID);
592-
pHwInfo->SetDeviceName(reinterpret_cast<const char*>(pRenderer));
593-
pHwInfo->SetHWGeneration(GDT_HW_GENERATION_INTEL);
594-
return GPA_STATUS_OK;
588+
return GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED;
595589
}
596590

597591
// instead of checking the vendor string to make sure it is ATI / AMD,
@@ -792,26 +786,12 @@ GPA_Status GPA_IMP_CompareHWInfo(void* pContext, GPA_HWInfo* pHwInfo)
792786

793787
if (strstr(reinterpret_cast<const char*>(pVendor), pNVIDIARenderer))
794788
{
795-
if (pHwInfo->IsNVidia())
796-
{
797-
return GPA_STATUS_OK;
798-
}
799-
else
800-
{
801-
return GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED;
802-
}
789+
return GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED;
803790
}
804791

805792
if (strstr(reinterpret_cast<const char*>(pVendor), pIntelRenderer))
806793
{
807-
if (pHwInfo->IsIntel())
808-
{
809-
return GPA_STATUS_OK;
810-
}
811-
else
812-
{
813-
return GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED;
814-
}
794+
return GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED;
815795
}
816796

817797
GPA_LogError("A unknown graphics card was identified.");

0 commit comments

Comments
 (0)