CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/GPU/Vulkan/GPU_Vulkan.h
Views: 1401
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
// This gets called on startup and when we get back from settings.
42
u32 CheckGPUFeatures() const override;
43
44
// These are where we can reset command buffers etc.
45
void BeginHostFrame() override;
46
void EndHostFrame() override;
47
48
void GetStats(char *buffer, size_t bufsize) override;
49
void DeviceLost() override; // Only happens on Android. Drop all textures and shaders.
50
void DeviceRestore(Draw::DrawContext *draw) override;
51
52
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
53
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
54
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
55
56
TextureCacheVulkan *GetTextureCache() {
57
return textureCacheVulkan_;
58
}
59
60
protected:
61
void FinishDeferred() override;
62
void CheckRenderResized() override;
63
64
private:
65
void BuildReportingInfo() override;
66
67
void InitDeviceObjects();
68
void DestroyDeviceObjects();
69
70
void LoadCache(const Path &filename);
71
void SaveCache(const Path &filename);
72
73
FramebufferManagerVulkan *framebufferManagerVulkan_;
74
TextureCacheVulkan *textureCacheVulkan_;
75
DrawEngineVulkan drawEngine_;
76
77
// Manages shaders and UBO data
78
ShaderManagerVulkan *shaderManagerVulkan_;
79
80
// Manages state and pipeline objects
81
PipelineManagerVulkan *pipelineManager_;
82
83
Path shaderCachePath_;
84
};
85
86