From 762c961ed3589599e085baac50c10ba671a7738b Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 14 Dec 2017 03:07:10 +0100 Subject: [PATCH] gs-vertexbuffer: Fix incorrect vertex buffer size on GPU crash --- source/gs-vertexbuffer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/gs-vertexbuffer.cpp b/source/gs-vertexbuffer.cpp index 8482da07..560713d9 100644 --- a/source/gs-vertexbuffer.cpp +++ b/source/gs-vertexbuffer.cpp @@ -109,8 +109,6 @@ gs_vertbuffer_t* GS::VertexBuffer::get(bool refreshGPU) { m_vertexbufferdata->tangents = m_data.tangents.data(); m_vertexbufferdata->colors = m_data.colors.data(); m_vertexbufferdata->num_tex = m_uvwLayers; - m_data.uvws.resize(m_uvwLayers); - m_data.uvwdata.resize(m_uvwLayers); for (uint32_t n = 0; n < m_uvwLayers; n++) { m_data.uvwdata[n].width = 4; m_data.uvwdata[n].array = m_data.uvws[n].data(); @@ -132,6 +130,11 @@ gs_vertbuffer_t* GS::VertexBuffer::get(bool refreshGPU) { obs_enter_graphics(); gs_vertexbuffer_flush(m_vertexbuffer); std::memset(m_vertexbufferdata, 0, sizeof(gs_vb_data)); + m_vertexbufferdata->num = m_maximumVertices; + m_vertexbufferdata->num_tex = m_uvwLayers; + for (uint32_t n = 0; n < m_uvwLayers; n++) { + m_data.uvwdata[n].width = 4; + } obs_leave_graphics(); } return m_vertexbuffer;