From 8916569f7c1468f53a4385d87d5e59b2958a6901 Mon Sep 17 00:00:00 2001 From: rachytski Date: Thu, 1 Nov 2012 19:01:39 +0300 Subject: [PATCH] this fixes "GPU Wait On Buffer" issue found in Xcode Instruments - OpenGL ES Analyzer. --- yg/buffer_object.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/yg/buffer_object.cpp b/yg/buffer_object.cpp index 3a14709822..be9143fd52 100644 --- a/yg/buffer_object.cpp +++ b/yg/buffer_object.cpp @@ -46,7 +46,14 @@ namespace yg m_size = size; makeCurrent(); if (g_isBufferObjectsSupported) + { OGLCHECK(glBufferDataFn(m_target, m_size, 0, GL_DYNAMIC_DRAW)); + /// In multithreaded resource usage scenarios the suggested way to see + /// resource update made in one thread to the another thread is + /// to call the glFlush in thread, which modifies resource and then rebind + /// resource in another threads that is using this resource, if any. + OGLCHECK(glFlush()); + } } }