Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/GPU/Vulkan/GPU_Vulkan.h
3186 views
1
// Copyright (c) 2015- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include <string>
21
#include <vector>
22
#include <thread>
23
24
#include "Common/File/Path.h"
25
26
#include "GPU/GPUCommonHW.h"
27
#include "GPU/Vulkan/DrawEngineVulkan.h"
28
#include "GPU/Vulkan/PipelineManagerVulkan.h"
29
#include "GPU/Common/TextureShaderCommon.h"
30
31
class FramebufferManagerVulkan;
32
class ShaderManagerVulkan;
33
class LinkedShader;
34
class TextureCacheVulkan;
35
36
class GPU_Vulkan : public GPUCommonHW {
37
public:
38
GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
39
~GPU_Vulkan();
40
41
void FinishInitOnMainThread() override;
42
43
// This gets called on startup and when we get back from settings.
44
u32 CheckGPUFeatures() const override;
45
46
// These are where we can reset command buffers etc.
47
void BeginHostFrame() override;
48
void EndHostFrame() override;
49
50
void GetStats(char *buffer, size_t bufsize) override;
51
void DeviceLost() override; // Only happens on Android. Drop all textures and shaders.
52
void DeviceRestore(Draw::DrawContext *draw) override;
53
54
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
55
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
56
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
57
58
TextureCacheVulkan *GetTextureCache() {
59
return textureCacheVulkan_;
60
}
61
62
protected:
63
void FinishDeferred() override;
64
void CheckRenderResized() override;
65
66
private:
67
void BuildReportingInfo() override;
68
69
void InitDeviceObjects();
70
void DestroyDeviceObjects();
71
72
void LoadCache(const Path &filename);
73
void SaveCache(const Path &filename);
74
75
FramebufferManagerVulkan *framebufferManagerVulkan_;
76
TextureCacheVulkan *textureCacheVulkan_;
77
DrawEngineVulkan drawEngine_;
78
79
// Manages shaders and UBO data
80
ShaderManagerVulkan *shaderManagerVulkan_;
81
82
// Manages state and pipeline objects
83
PipelineManagerVulkan *pipelineManager_;
84
85
Path shaderCachePath_;
86
};
87
88