mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Perform OpenGL texture cleanup only on main thread.
This commit is contained in:
parent
a3d8b5d225
commit
28af5230d3
@ -21,10 +21,10 @@ void* MakeTexture()
|
|||||||
return (void*)(intptr_t)tex;
|
return (void*)(intptr_t)tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeTexture( void* _tex )
|
void FreeTexture( void* _tex, void(*runOnMainThread)(std::function<void()>) )
|
||||||
{
|
{
|
||||||
auto tex = (GLuint)(intptr_t)_tex;
|
auto tex = (GLuint)(intptr_t)_tex;
|
||||||
glDeleteTextures( 1, &tex );
|
runOnMainThread( [tex] { glDeleteTextures( 1, &tex ); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTexture( void* _tex, const char* data, int w, int h )
|
void UpdateTexture( void* _tex, const char* data, int w, int h )
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#ifndef __TRACYTEXTURE_HPP__
|
#ifndef __TRACYTEXTURE_HPP__
|
||||||
#define __TRACYTEXTURE_HPP__
|
#define __TRACYTEXTURE_HPP__
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
void* MakeTexture();
|
void* MakeTexture();
|
||||||
void FreeTexture( void* tex );
|
void FreeTexture( void* tex, void(*runOnMainThread)(std::function<void()>) );
|
||||||
void UpdateTexture( void* tex, const char* data, int w, int h );
|
void UpdateTexture( void* tex, const char* data, int w, int h );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -192,8 +192,8 @@ View::~View()
|
|||||||
if( m_compare.loadThread.joinable() ) m_compare.loadThread.join();
|
if( m_compare.loadThread.joinable() ) m_compare.loadThread.join();
|
||||||
if( m_saveThread.joinable() ) m_saveThread.join();
|
if( m_saveThread.joinable() ) m_saveThread.join();
|
||||||
|
|
||||||
if( m_frameTexture ) FreeTexture( m_frameTexture );
|
if( m_frameTexture ) FreeTexture( m_frameTexture, m_cbMainThread );
|
||||||
if( m_playback.texture ) FreeTexture( m_playback.texture );
|
if( m_playback.texture ) FreeTexture( m_playback.texture, m_cbMainThread );
|
||||||
|
|
||||||
assert( s_instance != nullptr );
|
assert( s_instance != nullptr );
|
||||||
s_instance = nullptr;
|
s_instance = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user