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/GPU/GLES/FramebufferManagerGLES.cpp
Views: 1401
// Copyright (c) 2012- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#include "Common/GPU/OpenGL/GLFeatures.h"18#include "Common/GPU/OpenGL/GLRenderManager.h"19#include "Common/GPU/thin3d.h"20#include "Core/System.h"21#include "GPU/Common/FramebufferManagerCommon.h"22#include "GPU/Common/PresentationCommon.h"23#include "GPU/Common/TextureDecoder.h"24#include "GPU/GLES/FramebufferManagerGLES.h"2526FramebufferManagerGLES::FramebufferManagerGLES(Draw::DrawContext *draw) :27FramebufferManagerCommon(draw)28{29needBackBufferYSwap_ = true;30presentation_->SetLanguage(draw_->GetShaderLanguageDesc().shaderLanguage);31}3233void FramebufferManagerGLES::UpdateDownloadTempBuffer(VirtualFramebuffer *nvfb) {34_assert_msg_(nvfb->fbo, "Expecting a valid nvfb in UpdateDownloadTempBuffer");3536// Discard the previous contents of this buffer where possible.37if (gl_extensions.GLES3) {38draw_->BindFramebufferAsRenderTarget(nvfb->fbo, { Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "UpdateDownloadTempBuffer");39} else if (gl_extensions.IsGLES) {40draw_->BindFramebufferAsRenderTarget(nvfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "UpdateDownloadTempBuffer");41gstate_c.Dirty(DIRTY_BLEND_STATE);42}43}4445void FramebufferManagerGLES::NotifyDisplayResized() {46FramebufferManagerCommon::NotifyDisplayResized();4748GLRenderManager *render = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);49render->Resize(PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);50}5152bool FramebufferManagerGLES::GetOutputFramebuffer(GPUDebugBuffer &buffer) {53int w, h;54draw_->GetFramebufferDimensions(nullptr, &w, &h);55buffer.Allocate(w, h, GPU_DBG_FORMAT_888_RGB, true);56draw_->CopyFramebufferToMemory(nullptr, Draw::FB_COLOR_BIT, 0, 0, w, h, Draw::DataFormat::R8G8B8_UNORM, buffer.GetData(), w, Draw::ReadbackMode::BLOCK, "GetOutputFramebuffer");57return true;58}596061