2015-10-10 16:41:19 +02: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/.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-09-13 23:34:00 +02:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
#include "Common/File/Path.h"
|
|
|
|
|
|
2023-02-25 14:24:59 +01:00
|
|
|
#include "GPU/GPUCommonHW.h"
|
2015-10-10 16:41:19 +02:00
|
|
|
#include "GPU/Vulkan/DrawEngineVulkan.h"
|
|
|
|
|
#include "GPU/Vulkan/PipelineManagerVulkan.h"
|
2022-08-22 12:20:21 +02:00
|
|
|
#include "GPU/Common/TextureShaderCommon.h"
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2016-01-10 14:24:10 +01:00
|
|
|
class FramebufferManagerVulkan;
|
|
|
|
|
class ShaderManagerVulkan;
|
2015-10-10 16:41:19 +02:00
|
|
|
class LinkedShader;
|
2020-09-13 23:34:00 +02:00
|
|
|
class TextureCacheVulkan;
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2023-02-25 14:24:59 +01:00
|
|
|
class GPU_Vulkan : public GPUCommonHW {
|
2015-10-10 16:41:19 +02:00
|
|
|
public:
|
2017-01-30 16:50:35 +01:00
|
|
|
GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
|
2015-10-10 16:41:19 +02:00
|
|
|
~GPU_Vulkan();
|
|
|
|
|
|
|
|
|
|
// This gets called on startup and when we get back from settings.
|
2022-09-20 10:02:15 +02:00
|
|
|
u32 CheckGPUFeatures() const override;
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2018-03-17 07:42:07 -07:00
|
|
|
bool IsReady() override;
|
2018-10-30 20:32:12 -07:00
|
|
|
void CancelReady() override;
|
2018-03-17 07:42:07 -07:00
|
|
|
|
2016-01-08 01:05:52 +01:00
|
|
|
// These are where we can reset command buffers etc.
|
2016-04-24 10:57:56 -07:00
|
|
|
void BeginHostFrame() override;
|
|
|
|
|
void EndHostFrame() override;
|
2016-01-08 01:05:52 +01:00
|
|
|
|
2016-03-31 10:17:02 +02:00
|
|
|
void GetStats(char *buffer, size_t bufsize) override;
|
2015-10-10 16:41:19 +02:00
|
|
|
void DeviceLost() override; // Only happens on Android. Drop all textures and shaders.
|
2023-02-25 23:04:27 +01:00
|
|
|
void DeviceRestore(Draw::DrawContext *draw) override;
|
2015-10-10 16:41:19 +02:00
|
|
|
|
|
|
|
|
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
|
|
|
|
|
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
|
|
|
|
|
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
|
|
|
|
|
|
2018-01-17 13:59:32 +01:00
|
|
|
TextureCacheVulkan *GetTextureCache() {
|
|
|
|
|
return textureCacheVulkan_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-10 16:41:19 +02:00
|
|
|
protected:
|
|
|
|
|
void FinishDeferred() override;
|
2022-12-01 23:41:31 +01:00
|
|
|
void CheckRenderResized() override;
|
2015-10-10 16:41:19 +02:00
|
|
|
|
|
|
|
|
private:
|
2022-11-20 12:57:32 +01:00
|
|
|
void BuildReportingInfo() override;
|
2017-10-30 12:05:08 +01:00
|
|
|
|
|
|
|
|
void InitDeviceObjects();
|
|
|
|
|
void DestroyDeviceObjects();
|
|
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
void LoadCache(const Path &filename);
|
|
|
|
|
void SaveCache(const Path &filename);
|
2018-03-13 23:22:21 +01:00
|
|
|
|
2016-12-21 18:07:17 +01:00
|
|
|
FramebufferManagerVulkan *framebufferManagerVulkan_;
|
|
|
|
|
TextureCacheVulkan *textureCacheVulkan_;
|
2016-01-05 21:18:43 +01:00
|
|
|
DrawEngineVulkan drawEngine_;
|
|
|
|
|
|
|
|
|
|
// Manages shaders and UBO data
|
2017-01-23 20:48:23 +01:00
|
|
|
ShaderManagerVulkan *shaderManagerVulkan_;
|
2016-01-05 21:18:43 +01:00
|
|
|
|
|
|
|
|
// Manages state and pipeline objects
|
2015-10-10 16:41:19 +02:00
|
|
|
PipelineManagerVulkan *pipelineManager_;
|
|
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
Path shaderCachePath_;
|
2023-01-13 10:14:29 +01:00
|
|
|
std::atomic<bool> shaderCacheLoaded_{};
|
2015-10-10 16:41:19 +02:00
|
|
|
};
|