gs: Leave GS context and then return texture

This fixes a hang when calling GetTextureObject() on a GS::RenderTarget.
This commit is contained in:
Xaymar 2017-10-22 18:56:41 +02:00
parent 3899476a7f
commit 6a208ed215

View file

@ -44,8 +44,9 @@ GS::RenderTargetOp GS::RenderTarget::Render(uint32_t width, uint32_t height) {
gs_texture_t* GS::RenderTarget::GetTextureObject() { gs_texture_t* GS::RenderTarget::GetTextureObject() {
obs_enter_graphics(); obs_enter_graphics();
return gs_texrender_get_texture(m_renderTarget); gs_texture_t* tex = gs_texrender_get_texture(m_renderTarget);
obs_leave_graphics(); obs_leave_graphics();
return tex;
} }
GS::RenderTargetOp::RenderTargetOp(GS::RenderTarget* rt, uint32_t width, uint32_t height) : m_renderTarget(rt) { GS::RenderTargetOp::RenderTargetOp(GS::RenderTarget* rt, uint32_t width, uint32_t height) : m_renderTarget(rt) {