2013-10-12 00:05:55 +00:00
|
|
|
// Copyright (c) 2013- 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/.
|
|
|
|
|
|
|
|
|
|
|
|
// Postprocessing shader manager
|
|
|
|
// For FXAA, "Natural", bloom, B&W, cross processing and whatnot.
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-10-03 22:25:21 +00:00
|
|
|
#include "Common/Data/Format/IniFile.h"
|
2013-10-12 00:05:55 +00:00
|
|
|
|
|
|
|
struct ShaderInfo {
|
2021-05-09 13:25:12 +00:00
|
|
|
Path iniFile; // which ini file was this definition in? So we can write settings back later
|
2013-10-12 00:05:55 +00:00
|
|
|
std::string section; // ini file section. This is saved.
|
2018-03-25 09:53:11 +00:00
|
|
|
std::string name; // Fancy display name.
|
2020-05-16 07:03:39 +00:00
|
|
|
std::string parent; // Parent shader ini section name.
|
2013-10-12 00:05:55 +00:00
|
|
|
|
2021-05-09 13:25:12 +00:00
|
|
|
Path fragmentShaderFile;
|
|
|
|
Path vertexShaderFile;
|
2013-10-12 00:05:55 +00:00
|
|
|
|
2020-05-16 07:03:39 +00:00
|
|
|
// Show this shader in lists (i.e. not just for chaining.)
|
|
|
|
bool visible;
|
2013-10-22 10:17:40 +00:00
|
|
|
// Run at output instead of input resolution
|
|
|
|
bool outputResolution;
|
2015-10-14 16:32:13 +00:00
|
|
|
// Use x1 rendering res + nearest screen scaling filter
|
|
|
|
bool isUpscalingFilter;
|
2018-04-01 15:00:10 +00:00
|
|
|
// Use 2x display resolution for supersampling with blurry shaders.
|
2018-04-01 16:47:26 +00:00
|
|
|
int SSAAFilterLevel;
|
2017-03-05 13:52:27 +00:00
|
|
|
// Force constant/max refresh for animated filters
|
|
|
|
bool requires60fps;
|
2021-06-12 17:54:36 +00:00
|
|
|
// Takes previous frame as input (for blending effects.)
|
|
|
|
bool usePreviousFrame;
|
2013-10-22 10:17:40 +00:00
|
|
|
|
2020-05-16 19:25:52 +00:00
|
|
|
struct Setting {
|
|
|
|
std::string name;
|
|
|
|
float value;
|
|
|
|
float maxValue;
|
|
|
|
float minValue;
|
|
|
|
float step;
|
|
|
|
};
|
|
|
|
Setting settings[4];
|
2020-05-15 09:15:38 +00:00
|
|
|
|
2013-10-12 00:05:55 +00:00
|
|
|
// TODO: Add support for all kinds of fun options like mapping the depth buffer,
|
2020-08-10 04:20:42 +00:00
|
|
|
// SRGB texture reads, etc. prev shader?
|
2013-10-12 23:48:06 +00:00
|
|
|
|
|
|
|
bool operator == (const std::string &other) {
|
|
|
|
return name == other;
|
|
|
|
}
|
2017-04-05 03:33:22 +00:00
|
|
|
bool operator == (const ShaderInfo &other) {
|
|
|
|
return name == other.name;
|
|
|
|
}
|
2013-10-12 00:05:55 +00:00
|
|
|
};
|
|
|
|
|
2020-08-02 04:26:41 +00:00
|
|
|
struct TextureShaderInfo {
|
2021-05-09 13:25:12 +00:00
|
|
|
Path iniFile;
|
2020-08-02 04:26:41 +00:00
|
|
|
std::string section;
|
|
|
|
std::string name;
|
|
|
|
|
2021-05-09 13:25:12 +00:00
|
|
|
Path computeShaderFile;
|
2021-11-07 12:12:28 +00:00
|
|
|
|
|
|
|
// Upscaling shaders have a fixed scale factor.
|
|
|
|
int scaleFactor;
|
2020-08-02 04:26:41 +00:00
|
|
|
|
|
|
|
bool operator == (const std::string &other) {
|
|
|
|
return name == other;
|
|
|
|
}
|
|
|
|
bool operator == (const TextureShaderInfo &other) {
|
|
|
|
return name == other.name;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-09-28 21:35:57 +00:00
|
|
|
void ReloadAllPostShaderInfo(Draw::DrawContext *draw);
|
2013-10-12 00:05:55 +00:00
|
|
|
|
2020-05-16 07:03:39 +00:00
|
|
|
const ShaderInfo *GetPostShaderInfo(const std::string &name);
|
|
|
|
std::vector<const ShaderInfo *> GetPostShaderChain(const std::string &name);
|
2020-05-18 09:17:45 +00:00
|
|
|
std::vector<const ShaderInfo *> GetFullPostShadersChain(const std::vector<std::string> &names);
|
|
|
|
bool PostShaderChainRequires60FPS(const std::vector<const ShaderInfo *> &chain);
|
2017-04-05 03:33:22 +00:00
|
|
|
const std::vector<ShaderInfo> &GetAllPostShaderInfo();
|
2020-08-02 04:26:41 +00:00
|
|
|
|
|
|
|
const TextureShaderInfo *GetTextureShaderInfo(const std::string &name);
|
|
|
|
const std::vector<TextureShaderInfo> &GetAllTextureShaderInfo();
|