2016-01-03 23:09:37 +01:00
|
|
|
// Copyright (c) 2015- PPSSPP Project.
|
|
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
2016-01-10 14:24:10 +01:00
|
|
|
#include <algorithm>
|
|
|
|
|
|
2020-10-04 10:04:01 +02:00
|
|
|
#include "Common/Profiler/Profiler.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
|
2020-10-04 10:10:55 +02:00
|
|
|
#include "Common/System/Display.h"
|
2020-10-04 00:25:21 +02:00
|
|
|
#include "Common/Math/lin/matrix4x4.h"
|
2021-05-01 07:15:04 -07:00
|
|
|
#include "Common/Data/Convert/ColorConv.h"
|
2020-10-04 00:25:21 +02:00
|
|
|
#include "Common/Data/Convert/SmallDataConvert.h"
|
2020-10-04 23:24:14 +02:00
|
|
|
#include "Common/GPU/thin3d.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
|
2020-10-04 23:24:14 +02:00
|
|
|
#include "Common/GPU/Vulkan/VulkanContext.h"
|
|
|
|
|
#include "Common/GPU/Vulkan/VulkanMemory.h"
|
|
|
|
|
#include "Common/GPU/Vulkan/VulkanImage.h"
|
|
|
|
|
#include "Common/GPU/Vulkan/VulkanRenderManager.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
#include "Core/MemMap.h"
|
|
|
|
|
#include "Core/Config.h"
|
2018-06-16 18:42:31 -07:00
|
|
|
#include "Core/ConfigValues.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
#include "Core/System.h"
|
|
|
|
|
#include "GPU/ge_constants.h"
|
2020-05-10 17:14:20 -07:00
|
|
|
#include "GPU/GPUInterface.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
#include "GPU/GPUState.h"
|
|
|
|
|
|
|
|
|
|
#include "GPU/Common/TextureDecoder.h"
|
2020-08-03 23:17:22 +02:00
|
|
|
#include "GPU/Common/FramebufferManagerCommon.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
#include "GPU/Debugger/Stepping.h"
|
2020-08-03 23:22:11 +02:00
|
|
|
#include "GPU/Vulkan/FramebufferManagerVulkan.h"
|
2016-01-05 22:55:47 +01:00
|
|
|
#include "GPU/Vulkan/DrawEngineVulkan.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
#include "GPU/Vulkan/TextureCacheVulkan.h"
|
|
|
|
|
#include "GPU/Vulkan/ShaderManagerVulkan.h"
|
2016-03-17 11:56:43 +01:00
|
|
|
#include "GPU/Vulkan/VulkanUtil.h"
|
2016-01-10 14:24:10 +01:00
|
|
|
|
2021-08-21 12:39:15 +02:00
|
|
|
using namespace PPSSPP_VK;
|
2021-08-20 11:22:57 +02:00
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
FramebufferManagerVulkan::FramebufferManagerVulkan(Draw::DrawContext *draw) :
|
|
|
|
|
FramebufferManagerCommon(draw) {
|
2020-05-10 16:53:15 -07:00
|
|
|
presentation_->SetLanguage(GLSL_VULKAN);
|
2016-10-09 11:09:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FramebufferManagerVulkan::~FramebufferManagerVulkan() {
|
2020-05-06 22:21:22 +02:00
|
|
|
DeviceLost();
|
2016-10-09 11:09:30 -07:00
|
|
|
}
|
|
|
|
|
|
2016-03-30 23:26:16 +02:00
|
|
|
void FramebufferManagerVulkan::NotifyClear(bool clearColor, bool clearAlpha, bool clearDepth, uint32_t color, float depth) {
|
2017-10-30 12:05:08 +01:00
|
|
|
int mask = 0;
|
|
|
|
|
// The Clear detection takes care of doing a regular draw instead if separate masking
|
|
|
|
|
// of color and alpha is needed, so we can just treat them as the same.
|
|
|
|
|
if (clearColor || clearAlpha)
|
|
|
|
|
mask |= Draw::FBChannel::FB_COLOR_BIT;
|
|
|
|
|
if (clearDepth)
|
|
|
|
|
mask |= Draw::FBChannel::FB_DEPTH_BIT;
|
|
|
|
|
if (clearAlpha)
|
|
|
|
|
mask |= Draw::FBChannel::FB_STENCIL_BIT;
|
2016-03-30 23:26:16 +02:00
|
|
|
|
2017-11-18 00:33:20 +01:00
|
|
|
// Note that since the alpha channel and the stencil channel are shared on the PSP,
|
|
|
|
|
// when we clear alpha, we also clear stencil to the same value.
|
|
|
|
|
draw_->Clear(mask, color, depth, color >> 24);
|
2017-10-30 12:05:08 +01:00
|
|
|
if (clearColor || clearAlpha) {
|
|
|
|
|
SetColorUpdated(gstate_c.skipDrawReason);
|
|
|
|
|
}
|
2016-03-22 00:12:41 +01:00
|
|
|
}
|