2013-10-12 02:05:55 +02: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.
|
|
|
|
|
2022-12-05 17:04:16 +01:00
|
|
|
#pragma once
|
|
|
|
|
2013-10-12 02:05:55 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct ShaderInfo {
|
2021-05-09 15:25:12 +02:00
|
|
|
Path iniFile; // which ini file was this definition in? So we can write settings back later
|
2013-10-12 02:05:55 +02:00
|
|
|
std::string section; // ini file section. This is saved.
|
2018-03-25 11:53:11 +02:00
|
|
|
std::string name; // Fancy display name.
|
2020-05-16 00:03:39 -07:00
|
|
|
std::string parent; // Parent shader ini section name.
|
2013-10-12 02:05:55 +02:00
|
|
|
|
2021-05-09 15:25:12 +02:00
|
|
|
Path fragmentShaderFile;
|
|
|
|
Path vertexShaderFile;
|
2013-10-12 02:05:55 +02:00
|
|
|
|
2020-05-16 00:03:39 -07:00
|
|
|
// Show this shader in lists (i.e. not just for chaining.)
|
|
|
|
bool visible;
|
2013-10-22 12:17:40 +02:00
|
|
|
// Run at output instead of input resolution
|
|
|
|
bool outputResolution;
|
2015-10-14 18:32:13 +02:00
|
|
|
// Use x1 rendering res + nearest screen scaling filter
|
|
|
|
bool isUpscalingFilter;
|
2022-10-20 16:16:52 +02:00
|
|
|
// Is used to post-process stereo-rendering to mono, like red/blue.
|
|
|
|
bool isStereo;
|
2018-04-01 17:00:10 +02:00
|
|
|
// Use 2x display resolution for supersampling with blurry shaders.
|
2018-04-01 18:47:26 +02:00
|
|
|
int SSAAFilterLevel;
|
2017-03-05 14:52:27 +01:00
|
|
|
// Force constant/max refresh for animated filters
|
|
|
|
bool requires60fps;
|
2021-06-12 10:54:36 -07:00
|
|
|
// Takes previous frame as input (for blending effects.)
|
|
|
|
bool usePreviousFrame;
|
2013-10-22 12:17:40 +02:00
|
|
|
|
2020-05-16 12:25:52 -07:00
|
|
|
struct Setting {
|
|
|
|
std::string name;
|
|
|
|
float value;
|
|
|
|
float maxValue;
|
|
|
|
float minValue;
|
|
|
|
float step;
|
|
|
|
};
|
|
|
|
Setting settings[4];
|
2020-05-15 11:15:38 +02:00
|
|
|
|
2013-10-12 02:05:55 +02:00
|
|
|
// TODO: Add support for all kinds of fun options like mapping the depth buffer,
|
2020-08-09 21:20:42 -07:00
|
|
|
// SRGB texture reads, etc. prev shader?
|
2013-10-12 16:48:06 -07:00
|
|
|
|
2022-12-03 19:30:50 +01:00
|
|
|
bool operator == (const std::string &other) const {
|
2013-10-12 16:48:06 -07:00
|
|
|
return name == other;
|
|
|
|
}
|
2022-12-03 19:30:50 +01:00
|
|
|
bool operator == (const ShaderInfo &other) const {
|
2017-04-04 20:33:22 -07:00
|
|
|
return name == other.name;
|
|
|
|
}
|
2022-12-03 18:58:47 +01:00
|
|
|
|
2022-12-03 19:30:50 +01:00
|
|
|
bool operator < (const ShaderInfo &other) const {
|
2022-12-03 18:58:47 +01:00
|
|
|
if (name < other.name) return true;
|
|
|
|
if (name > other.name) return false;
|
2022-12-03 19:30:50 +01:00
|
|
|
// Tie breaker
|
|
|
|
if (iniFile < other.iniFile) return true;
|
|
|
|
if (iniFile > other.iniFile) return false;
|
2022-12-03 18:58:47 +01:00
|
|
|
return false;
|
|
|
|
}
|
2013-10-12 02:05:55 +02:00
|
|
|
};
|
|
|
|
|
2020-08-01 21:26:41 -07:00
|
|
|
struct TextureShaderInfo {
|
2021-05-09 15:25:12 +02:00
|
|
|
Path iniFile;
|
2020-08-01 21:26:41 -07:00
|
|
|
std::string section;
|
|
|
|
std::string name;
|
|
|
|
|
2021-05-09 15:25:12 +02:00
|
|
|
Path computeShaderFile;
|
2021-11-07 13:12:28 +01:00
|
|
|
|
|
|
|
// Upscaling shaders have a fixed scale factor.
|
|
|
|
int scaleFactor;
|
2020-08-01 21:26:41 -07:00
|
|
|
|
2022-12-03 19:30:50 +01:00
|
|
|
bool operator == (const std::string &other) const {
|
2020-08-01 21:26:41 -07:00
|
|
|
return name == other;
|
|
|
|
}
|
2022-12-03 19:30:50 +01:00
|
|
|
bool operator == (const TextureShaderInfo &other) const {
|
2020-08-01 21:26:41 -07:00
|
|
|
return name == other.name;
|
|
|
|
}
|
2022-12-03 19:30:50 +01:00
|
|
|
|
|
|
|
bool operator < (const TextureShaderInfo &other) const {
|
|
|
|
if (name < other.name) return true;
|
|
|
|
if (name > other.name) return false;
|
|
|
|
// Tie breaker
|
|
|
|
if (iniFile < other.iniFile) return true;
|
|
|
|
if (iniFile > other.iniFile) return false;
|
|
|
|
return false;
|
|
|
|
}
|
2020-08-01 21:26:41 -07:00
|
|
|
};
|
|
|
|
|
2021-09-28 23:35:57 +02:00
|
|
|
void ReloadAllPostShaderInfo(Draw::DrawContext *draw);
|
2013-10-12 02:05:55 +02:00
|
|
|
|
2020-05-16 00:03:39 -07:00
|
|
|
const ShaderInfo *GetPostShaderInfo(const std::string &name);
|
|
|
|
std::vector<const ShaderInfo *> GetPostShaderChain(const std::string &name);
|
2020-05-18 11:17:45 +02:00
|
|
|
std::vector<const ShaderInfo *> GetFullPostShadersChain(const std::vector<std::string> &names);
|
|
|
|
bool PostShaderChainRequires60FPS(const std::vector<const ShaderInfo *> &chain);
|
2017-04-04 20:33:22 -07:00
|
|
|
const std::vector<ShaderInfo> &GetAllPostShaderInfo();
|
2020-08-01 21:26:41 -07:00
|
|
|
|
|
|
|
const TextureShaderInfo *GetTextureShaderInfo(const std::string &name);
|
|
|
|
const std::vector<TextureShaderInfo> &GetAllTextureShaderInfo();
|
2022-12-07 22:28:55 +01:00
|
|
|
void RemoveUnknownPostShaders(std::vector<std::string> *names);
|
2022-12-09 17:19:08 +01:00
|
|
|
|
|
|
|
// Call this any time you alter the postshader list. It makes sure
|
|
|
|
// that "usePrevFrame" shaders are at the end, and that there's only one.
|
|
|
|
// It'll also enforce any similar future rules.
|
|
|
|
void FixPostShaderOrder(std::vector<std::string> *names);
|