2012-11-01 15:19:01 +00:00
|
|
|
// Copyright (c) 2012- 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
|
2012-11-04 22:01:49 +00:00
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
// 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 21:34:00 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2012-11-19 20:23:29 +00:00
|
|
|
|
2021-05-05 23:31:38 +00:00
|
|
|
#include "Common/File/Path.h"
|
|
|
|
|
2013-08-20 20:34:47 +00:00
|
|
|
#include "GPU/GPUCommon.h"
|
2022-08-05 08:52:35 +00:00
|
|
|
#include "GPU/Common/DepalettizeCommon.h"
|
2017-01-21 21:16:30 +00:00
|
|
|
#include "GPU/GLES/FramebufferManagerGLES.h"
|
2016-04-10 08:27:28 +00:00
|
|
|
#include "GPU/GLES/DrawEngineGLES.h"
|
2017-01-21 21:16:30 +00:00
|
|
|
#include "GPU/GLES/FragmentTestCacheGLES.h"
|
2013-08-20 20:34:47 +00:00
|
|
|
|
2017-01-21 21:16:30 +00:00
|
|
|
class ShaderManagerGLES;
|
2020-09-13 21:34:00 +00:00
|
|
|
class TextureCacheGLES;
|
2012-12-21 15:49:42 +00:00
|
|
|
class LinkedShader;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2016-04-10 08:21:48 +00:00
|
|
|
class GPU_GLES : public GPUCommon {
|
2012-11-01 15:19:01 +00:00
|
|
|
public:
|
2017-01-30 15:50:35 +00:00
|
|
|
GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
|
2016-04-10 08:21:48 +00:00
|
|
|
~GPU_GLES();
|
2015-09-05 17:58:47 +00:00
|
|
|
|
2015-09-05 19:23:58 +00:00
|
|
|
// This gets called on startup and when we get back from settings.
|
2018-02-26 10:35:37 +00:00
|
|
|
void CheckGPUFeatures() override;
|
2015-09-05 17:58:47 +00:00
|
|
|
|
2017-12-03 19:30:00 +00:00
|
|
|
bool IsReady() override;
|
2018-10-31 03:32:12 +00:00
|
|
|
void CancelReady() override;
|
2017-12-03 19:30:00 +00:00
|
|
|
|
2015-07-25 12:22:43 +00:00
|
|
|
void PreExecuteOp(u32 op, u32 diff) override;
|
|
|
|
void ExecuteOp(u32 op, u32 diff) override;
|
|
|
|
|
2017-11-05 19:33:28 +00:00
|
|
|
void ReapplyGfxState() override;
|
2015-07-25 12:22:43 +00:00
|
|
|
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
|
2016-03-31 08:17:02 +00:00
|
|
|
void GetStats(char *buffer, size_t bufsize) override;
|
2016-12-21 17:33:08 +00:00
|
|
|
|
2015-07-25 12:22:43 +00:00
|
|
|
void ClearCacheNextFrame() override;
|
|
|
|
void DeviceLost() override; // Only happens on Android. Drop all textures and shaders.
|
2016-09-11 03:29:58 +00:00
|
|
|
void DeviceRestore() override;
|
2015-07-25 12:22:43 +00:00
|
|
|
|
|
|
|
void DoState(PointerWrap &p) override;
|
2013-10-09 14:08:36 +00:00
|
|
|
|
2015-07-25 12:22:43 +00:00
|
|
|
void ClearShaderCache() override;
|
|
|
|
void CleanupBeforeUI() override;
|
2013-02-17 00:06:06 +00:00
|
|
|
|
2015-10-14 15:45:21 +00: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;
|
|
|
|
|
2017-03-17 09:48:43 +00:00
|
|
|
void BeginHostFrame() override;
|
2017-11-19 11:25:57 +00:00
|
|
|
void EndHostFrame() override;
|
2017-03-17 09:48:43 +00:00
|
|
|
|
2013-04-28 21:23:30 +00:00
|
|
|
protected:
|
2015-03-15 01:11:00 +00:00
|
|
|
void FinishDeferred() override;
|
2013-04-28 21:23:30 +00:00
|
|
|
|
2012-11-06 16:05:27 +00:00
|
|
|
private:
|
2013-08-10 23:25:14 +00:00
|
|
|
void Flush() {
|
2016-04-10 08:21:48 +00:00
|
|
|
drawEngine_.Flush();
|
2013-08-10 23:25:14 +00:00
|
|
|
}
|
2013-08-06 17:08:38 +00:00
|
|
|
void CheckFlushOp(int cmd, u32 diff);
|
2013-04-29 00:49:17 +00:00
|
|
|
void BuildReportingInfo();
|
2016-12-21 18:58:10 +00:00
|
|
|
|
2017-11-05 19:33:28 +00:00
|
|
|
void InitClear() override;
|
|
|
|
void BeginFrame() override;
|
2020-03-01 21:55:28 +00:00
|
|
|
void CopyDisplayToOutput(bool reallyDirty) override;
|
2017-11-05 19:33:28 +00:00
|
|
|
void Reinitialize() override;
|
2016-12-21 18:58:10 +00:00
|
|
|
|
2017-01-21 21:16:30 +00:00
|
|
|
FramebufferManagerGLES *framebufferManagerGL_;
|
|
|
|
TextureCacheGLES *textureCacheGL_;
|
2016-04-10 08:21:48 +00:00
|
|
|
DrawEngineGLES drawEngine_;
|
2017-01-21 21:16:30 +00:00
|
|
|
FragmentTestCacheGLES fragmentTestCache_;
|
2017-01-23 19:48:23 +00:00
|
|
|
ShaderManagerGLES *shaderManagerGL_;
|
2013-01-30 19:40:26 +00:00
|
|
|
|
2021-05-05 23:31:38 +00:00
|
|
|
Path shaderCachePath_;
|
2012-11-01 15:19:01 +00:00
|
|
|
};
|