CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Common/GPU/OpenGL/GLFrameData.cpp
Views: 1401
#include "Common/GPU/OpenGL/GLCommon.h"1#include "Common/GPU/OpenGL/GLFrameData.h"2#include "Common/GPU/OpenGL/GLRenderManager.h"3#include "Common/Log.h"45void GLDeleter::Take(GLDeleter &other) {6_assert_msg_(IsEmpty(), "Deleter already has stuff");7shaders = std::move(other.shaders);8programs = std::move(other.programs);9buffers = std::move(other.buffers);10textures = std::move(other.textures);11inputLayouts = std::move(other.inputLayouts);12framebuffers = std::move(other.framebuffers);13pushBuffers = std::move(other.pushBuffers);14other.shaders.clear();15other.programs.clear();16other.buffers.clear();17other.textures.clear();18other.inputLayouts.clear();19other.framebuffers.clear();20other.pushBuffers.clear();21}2223// Runs on the GPU thread.24void GLDeleter::Perform(GLRenderManager *renderManager, bool skipGLCalls) {25for (auto pushBuffer : pushBuffers) {26renderManager->UnregisterPushBuffer(pushBuffer);27if (skipGLCalls) {28pushBuffer->Destroy(false);29}30delete pushBuffer;31}32pushBuffers.clear();33for (auto shader : shaders) {34if (skipGLCalls && shader)35shader->shader = 0; // prevent the glDeleteShader36delete shader;37}38shaders.clear();39for (auto program : programs) {40if (skipGLCalls && program)41program->program = 0; // prevent the glDeleteProgram42delete program;43}44programs.clear();45for (auto buffer : buffers) {46if (skipGLCalls && buffer)47buffer->buffer_ = 0;48delete buffer;49}50buffers.clear();51for (auto texture : textures) {52if (skipGLCalls && texture)53texture->texture = 0;54delete texture;55}56textures.clear();57for (auto inputLayout : inputLayouts) {58// No GL objects in an inputLayout yet59delete inputLayout;60}61inputLayouts.clear();62for (auto framebuffer : framebuffers) {63if (skipGLCalls) {64framebuffer->handle = 0;65framebuffer->color_texture.texture = 0;66framebuffer->z_stencil_buffer = 0;67framebuffer->z_stencil_texture.texture = 0;68framebuffer->z_buffer = 0;69framebuffer->stencil_buffer = 0;70}71delete framebuffer;72}73framebuffers.clear();74}757677