Fix for the hang after close caused by my previews perf queries commit.
Sorry for that. fix issue 6205
This commit is contained in:
parent
e11f5630b1
commit
d032f3fd79
|
@ -8,6 +8,16 @@ namespace DX9 {
|
||||||
PerfQuery::PerfQuery()
|
PerfQuery::PerfQuery()
|
||||||
: m_query_read_pos()
|
: m_query_read_pos()
|
||||||
, m_query_count()
|
, m_query_count()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PerfQuery::~PerfQuery()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerfQuery::CreateDeviceObjects()
|
||||||
{
|
{
|
||||||
for (int i = 0; i != ARRAYSIZE(m_query_buffer); ++i)
|
for (int i = 0; i != ARRAYSIZE(m_query_buffer); ++i)
|
||||||
{
|
{
|
||||||
|
@ -15,8 +25,7 @@ PerfQuery::PerfQuery()
|
||||||
}
|
}
|
||||||
ResetQuery();
|
ResetQuery();
|
||||||
}
|
}
|
||||||
|
void PerfQuery::DestroyDeviceObjects()
|
||||||
PerfQuery::~PerfQuery()
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i != ARRAYSIZE(m_query_buffer); ++i)
|
for (int i = 0; i != ARRAYSIZE(m_query_buffer); ++i)
|
||||||
{
|
{
|
||||||
|
@ -91,7 +100,7 @@ void PerfQuery::FlushOne()
|
||||||
{
|
{
|
||||||
auto& entry = m_query_buffer[m_query_read_pos];
|
auto& entry = m_query_buffer[m_query_read_pos];
|
||||||
|
|
||||||
UINT64 result = 0;
|
DWORD result = 0;
|
||||||
HRESULT hr = S_FALSE;
|
HRESULT hr = S_FALSE;
|
||||||
while (hr != S_OK && hr != D3DERR_DEVICELOST)
|
while (hr != S_OK && hr != D3DERR_DEVICELOST)
|
||||||
{
|
{
|
||||||
|
@ -100,7 +109,7 @@ void PerfQuery::FlushOne()
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Reported pixel metrics should be referenced to native resolution
|
// NOTE: Reported pixel metrics should be referenced to native resolution
|
||||||
m_results[entry.query_type] += (u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight();
|
m_results[entry.query_type] += (u32)((u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight());
|
||||||
|
|
||||||
m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer);
|
m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer);
|
||||||
--m_query_count;
|
--m_query_count;
|
||||||
|
@ -119,13 +128,13 @@ void PerfQuery::WeakFlush()
|
||||||
{
|
{
|
||||||
auto& entry = m_query_buffer[m_query_read_pos];
|
auto& entry = m_query_buffer[m_query_read_pos];
|
||||||
|
|
||||||
UINT64 result = 0;
|
DWORD result = 0;
|
||||||
HRESULT hr = entry.query->GetData(&result, sizeof(result), 0);
|
HRESULT hr = entry.query->GetData(&result, sizeof(result), 0);
|
||||||
|
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
// NOTE: Reported pixel metrics should be referenced to native resolution
|
// NOTE: Reported pixel metrics should be referenced to native resolution
|
||||||
m_results[entry.query_type] += (u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight();
|
m_results[entry.query_type] += (u32)((u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight());
|
||||||
|
|
||||||
m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer);
|
m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer);
|
||||||
--m_query_count;
|
--m_query_count;
|
||||||
|
|
|
@ -17,6 +17,8 @@ public:
|
||||||
u32 GetQueryResult(PerfQueryType type);
|
u32 GetQueryResult(PerfQueryType type);
|
||||||
void FlushResults();
|
void FlushResults();
|
||||||
bool IsFlushed() const;
|
bool IsFlushed() const;
|
||||||
|
void CreateDeviceObjects();
|
||||||
|
void DestroyDeviceObjects();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ActiveQuery
|
struct ActiveQuery
|
||||||
|
@ -26,7 +28,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
void WeakFlush();
|
void WeakFlush();
|
||||||
|
|
||||||
// Only use when non-empty
|
// Only use when non-empty
|
||||||
void FlushOne();
|
void FlushOne();
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ void SetupDeviceObjects()
|
||||||
VertexShaderCache::Init();
|
VertexShaderCache::Init();
|
||||||
PixelShaderCache::Init();
|
PixelShaderCache::Init();
|
||||||
g_vertex_manager->CreateDeviceObjects();
|
g_vertex_manager->CreateDeviceObjects();
|
||||||
g_perf_query = new PerfQuery;
|
((PerfQuery*)g_perf_query)->CreateDeviceObjects();
|
||||||
// Texture cache will recreate themselves over time.
|
// Texture cache will recreate themselves over time.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ void TeardownDeviceObjects()
|
||||||
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
||||||
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
||||||
delete g_framebuffer_manager;
|
delete g_framebuffer_manager;
|
||||||
delete g_perf_query;
|
((PerfQuery*)g_perf_query)->DestroyDeviceObjects();
|
||||||
D3D::font.Shutdown();
|
D3D::font.Shutdown();
|
||||||
TextureCache::Invalidate();
|
TextureCache::Invalidate();
|
||||||
VertexLoaderManager::Shutdown();
|
VertexLoaderManager::Shutdown();
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
|
|
||||||
#include "ConfigManager.h"
|
#include "ConfigManager.h"
|
||||||
#include "VideoBackend.h"
|
#include "VideoBackend.h"
|
||||||
|
#include "PerfQuery.h"
|
||||||
|
|
||||||
namespace DX9
|
namespace DX9
|
||||||
{
|
{
|
||||||
|
@ -176,6 +177,7 @@ void VideoBackend::Video_Prepare()
|
||||||
|
|
||||||
// internal interfaces
|
// internal interfaces
|
||||||
g_vertex_manager = new VertexManager;
|
g_vertex_manager = new VertexManager;
|
||||||
|
g_perf_query = new PerfQuery;
|
||||||
g_renderer = new Renderer;
|
g_renderer = new Renderer;
|
||||||
g_texture_cache = new TextureCache;
|
g_texture_cache = new TextureCache;
|
||||||
// VideoCommon
|
// VideoCommon
|
||||||
|
@ -215,9 +217,9 @@ void VideoBackend::Shutdown()
|
||||||
// internal interfaces
|
// internal interfaces
|
||||||
PixelShaderCache::Shutdown();
|
PixelShaderCache::Shutdown();
|
||||||
VertexShaderCache::Shutdown();
|
VertexShaderCache::Shutdown();
|
||||||
delete g_perf_query;
|
|
||||||
delete g_texture_cache;
|
delete g_texture_cache;
|
||||||
delete g_renderer;
|
delete g_renderer;
|
||||||
|
delete g_perf_query;
|
||||||
delete g_vertex_manager;
|
delete g_vertex_manager;
|
||||||
g_renderer = NULL;
|
g_renderer = NULL;
|
||||||
g_texture_cache = NULL;
|
g_texture_cache = NULL;
|
||||||
|
|
Loading…
Reference in New Issue