mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Fix crash in NVIDIA HasCounter() called without EnumerateCounters()
This fix avoids a NULL-pointer dereference when HasCounter() is called without a preceding call to EnumerateCounters() for NVIDIA Nsight Perf SDK counters.
This commit is contained in:
committed by
Baldur Karlsson
parent
8c97cfb7aa
commit
d03952a874
@@ -296,6 +296,10 @@ bool NVD3D11Counters::HasCounter(GPUCounter counterID) const
|
||||
{
|
||||
return counterID == GPUCounter::FirstNvidia;
|
||||
}
|
||||
if(!m_Impl->CounterEnumerator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Impl->CounterEnumerator->HasCounter(counterID);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,6 +293,12 @@ rdcarray<GPUCounter> NVD3D12Counters::EnumerateCounters(WrappedID3D12Device &dev
|
||||
{
|
||||
return {GPUCounter::FirstNvidia};
|
||||
}
|
||||
// NOTE: Nsight Perf SDK needs access to a D3D12 device handle and command
|
||||
// queue in order to determine which counters are available on a
|
||||
// particular NVIDIA device. However, since the D3D12 command queue is
|
||||
// not available at the time NVD3D12Counters::Init() is called this
|
||||
// determination must be deferred until the first time
|
||||
// NVD3D12Counters::EnumerateCounters() is called.
|
||||
if(!m_Impl->InitCounterEnumerator(device))
|
||||
{
|
||||
return {GPUCounter::FirstNvidia};
|
||||
@@ -306,6 +312,10 @@ bool NVD3D12Counters::HasCounter(GPUCounter counterID) const
|
||||
{
|
||||
return counterID == GPUCounter::FirstNvidia;
|
||||
}
|
||||
if(!m_Impl->CounterEnumerator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Impl->CounterEnumerator->HasCounter(counterID);
|
||||
}
|
||||
|
||||
|
||||
@@ -292,6 +292,10 @@ bool NVGLCounters::HasCounter(GPUCounter counterID) const
|
||||
{
|
||||
return counterID == GPUCounter::FirstNvidia;
|
||||
}
|
||||
if(!m_Impl->CounterEnumerator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Impl->CounterEnumerator->HasCounter(counterID);
|
||||
}
|
||||
|
||||
|
||||
@@ -282,6 +282,10 @@ bool NVVulkanCounters::HasCounter(GPUCounter counterID) const
|
||||
{
|
||||
return counterID == GPUCounter::FirstNvidia;
|
||||
}
|
||||
if(!m_Impl->CounterEnumerator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Impl->CounterEnumerator->HasCounter(counterID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user