Batch optimizations
Showing the changes to interface/src/Application.cpp (1 of 14 files). Show all
Unified · Split
| @@ -1035,13 +1035,6 @@ void Application::initializeUi() { · 1034 unmodified lines | |||
| 1035 | updateInputModes(); | 1035 | updateInputModes(); |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | template<typename F> | ||
| 1039 | void doInBatch(RenderArgs* args, F f) { | ||
| 1040 | gpu::Batch batch; | ||
| 1041 | f(batch); | ||
| 1042 | args->_context->render(batch); | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | void Application::paintGL() { | 1038 | void Application::paintGL() { |
| 1046 | PROFILE_RANGE(__FUNCTION__); | 1039 | PROFILE_RANGE(__FUNCTION__); |
| 1047 | if (nullptr == _displayPlugin) { | 1040 | if (nullptr == _displayPlugin) { |
| @@ -1095,12 +1088,12 @@ void Application::paintGL() { · 47 unmodified lines | |||
| 1095 | auto mirrorRectDest = glm::ivec4(mirrorRect.z, mirrorRect.y, mirrorRect.x, mirrorRect.w); | 1088 | auto mirrorRectDest = glm::ivec4(mirrorRect.z, mirrorRect.y, mirrorRect.x, mirrorRect.w); |
| 1096 | 1089 | ||
| 1097 | auto selfieFbo = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer(); | 1090 | auto selfieFbo = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer(); |
| 1098 | gpu::Batch batch; | 1091 | doInBatch(renderArgs._context, [=](gpu::Batch& batch) { |
| 1099 | batch.setFramebuffer(selfieFbo); | 1092 | batch.setFramebuffer(selfieFbo); |
| 1100 | batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); | 1093 | batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); |
| 1101 | batch.blit(primaryFbo, mirrorRect, selfieFbo, mirrorRectDest); | 1094 | batch.blit(primaryFbo, mirrorRect, selfieFbo, mirrorRectDest); |
| 1102 | batch.setFramebuffer(nullptr); | 1095 | batch.setFramebuffer(nullptr); |
| 1103 | renderArgs._context->render(batch); | 1096 | }); |
| 1104 | } | 1097 | } |
| 1105 | } | 1098 | } |
| 1106 | 1099 | ||
| @@ -1224,7 +1217,7 @@ void Application::paintGL() { · 117 unmodified lines | |||
| 1224 | } | 1217 | } |
| 1225 | displaySide(&renderArgs, _myCamera); | 1218 | displaySide(&renderArgs, _myCamera); |
| 1226 | renderArgs._context->enableStereo(false); | 1219 | renderArgs._context->enableStereo(false); |
| 1227 | doInBatch(&renderArgs, [](gpu::Batch& batch) { | 1220 | doInBatch(renderArgs._context, [](gpu::Batch& batch) { |
| 1228 | batch.setFramebuffer(nullptr); | 1221 | batch.setFramebuffer(nullptr); |
| 1229 | }); | 1222 | }); |
| 1230 | } | 1223 | } |
| @@ -1288,9 +1281,9 @@ void Application::paintGL() { · 57 unmodified lines | |||
| 1288 | 1281 | ||
| 1289 | // Reset the gpu::Context Stages | 1282 | // Reset the gpu::Context Stages |
| 1290 | // Back to the default framebuffer; | 1283 | // Back to the default framebuffer; |
| 1291 | gpu::Batch batch; | 1284 | doInBatch(renderArgs._context, [=](gpu::Batch& batch) { |
| 1292 | batch.resetStages(); | 1285 | batch.resetStages(); |
| 1293 | renderArgs._context->render(batch); | 1286 | }); |
| 1294 | } | 1287 | } |
| 1295 | 1288 | ||
| 1296 | void Application::runTests() { | 1289 | void Application::runTests() { |