gs-vertexbuffer: Fix incorrect vertex buffer size on GPU crash

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2017-12-14 03:07:10 +01:00
parent 0d794254be
commit 762c961ed3

View file

@ -109,8 +109,6 @@ gs_vertbuffer_t* GS::VertexBuffer::get(bool refreshGPU) {
m_vertexbufferdata->tangents = m_data.tangents.data(); m_vertexbufferdata->tangents = m_data.tangents.data();
m_vertexbufferdata->colors = m_data.colors.data(); m_vertexbufferdata->colors = m_data.colors.data();
m_vertexbufferdata->num_tex = m_uvwLayers; 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++) { for (uint32_t n = 0; n < m_uvwLayers; n++) {
m_data.uvwdata[n].width = 4; m_data.uvwdata[n].width = 4;
m_data.uvwdata[n].array = m_data.uvws[n].data(); 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(); obs_enter_graphics();
gs_vertexbuffer_flush(m_vertexbuffer); gs_vertexbuffer_flush(m_vertexbuffer);
std::memset(m_vertexbufferdata, 0, sizeof(gs_vb_data)); 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(); obs_leave_graphics();
} }
return m_vertexbuffer; return m_vertexbuffer;