thin3d gles: Unbind buffers after drawing. Fixes #9715

This commit is contained in:
Henrik Rydgård 2017-05-24 12:06:02 +02:00
parent 14900d4c1b
commit 7d0cfbabe7
4 changed files with 9 additions and 5 deletions

View File

@ -50,7 +50,9 @@ void unregister_gl_resource_holder(GfxResourceHolder *holder) {
erased = true;
}
}
WLOG("unregister_gl_resource_holder: Resource not registered");
if (!erased) {
WLOG("unregister_gl_resource_holder: Resource not registered");
}
} else {
WLOG("GL resource holder not initialized or already shutdown, cannot unregister resource");
}

View File

@ -92,7 +92,6 @@ void DrawBuffer::Flush(bool set_blend_state) {
VsTexColUB ub{};
memcpy(ub.WorldViewProj, drawMatrix_.getReadPtr(), sizeof(Matrix4x4));
// pipeline_->SetMatrix4x4("WorldViewProj", drawMatrix_.getReadPtr());
draw_->UpdateDynamicUniformBuffer(&ub, sizeof(ub));
if (vbuf_) {
draw_->UpdateBuffer(vbuf_, (const uint8_t *)verts_, 0, sizeof(Vertex) * count_, Draw::UPDATE_DISCARD);

View File

@ -1129,6 +1129,7 @@ void OpenGLContext::Draw(int vertexCount, int offset) {
glDrawArrays(curPipeline_->prim, offset, vertexCount);
curPipeline_->inputLayout->Unapply();
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void OpenGLContext::DrawIndexed(int vertexCount, int offset) {
@ -1141,6 +1142,8 @@ void OpenGLContext::DrawIndexed(int vertexCount, int offset) {
glDrawElements(curPipeline_->prim, vertexCount, GL_UNSIGNED_INT, (const void *)(size_t)offset);
curPipeline_->inputLayout->Unapply();
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
void OpenGLContext::DrawUP(const void *vdata, int vertexCount) {

View File

@ -79,11 +79,11 @@ void UIScreen::preRender() {
}
void UIScreen::postRender() {
auto thin3d = screenManager()->getDrawContext();
if (!thin3d) {
Draw::DrawContext *draw = screenManager()->getDrawContext();
if (!draw) {
return;
}
thin3d->End();
draw->End();
}
void UIScreen::render() {