CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/GPU/Common/PostShader.h
Views: 1401
// Copyright (c) 2013- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.161718// Postprocessing shader manager19// For FXAA, "Natural", bloom, B&W, cross processing and whatnot.2021#pragma once2223#include <string>24#include <vector>2526struct ShaderInfo {27Path iniFile; // which ini file was this definition in? So we can write settings back later28std::string section; // ini file section. This is saved.29std::string name; // Fancy display name.30std::string parent; // Parent shader ini section name.3132Path fragmentShaderFile;33Path vertexShaderFile;3435// Show this shader in lists (i.e. not just for chaining.)36bool visible;37// Run at output instead of input resolution38bool outputResolution;39// Use x1 rendering res + nearest screen scaling filter40bool isUpscalingFilter;41// Is used to post-process stereo-rendering to mono, like red/blue.42bool isStereo;43// Use 2x display resolution for supersampling with blurry shaders.44int SSAAFilterLevel;45// Force constant/max refresh for animated filters46bool requires60fps;47// Takes previous frame as input (for blending effects.)48bool usePreviousFrame;4950struct Setting {51std::string name;52float value;53float maxValue;54float minValue;55float step;56};57Setting settings[4];5859// TODO: Add support for all kinds of fun options like mapping the depth buffer,60// SRGB texture reads, etc. prev shader?6162bool operator == (const std::string &other) const {63return name == other;64}65bool operator == (const ShaderInfo &other) const {66return name == other.name;67}6869bool operator < (const ShaderInfo &other) const {70if (name < other.name) return true;71if (name > other.name) return false;72// Tie breaker73if (iniFile < other.iniFile) return true;74if (iniFile > other.iniFile) return false;75return false;76}77};7879struct TextureShaderInfo {80Path iniFile;81std::string section;82std::string name;8384Path computeShaderFile;8586// Upscaling shaders have a fixed scale factor.87int scaleFactor;8889bool operator == (const std::string &other) const {90return name == other;91}92bool operator == (const TextureShaderInfo &other) const {93return name == other.name;94}9596bool operator < (const TextureShaderInfo &other) const {97if (name < other.name) return true;98if (name > other.name) return false;99// Tie breaker100if (iniFile < other.iniFile) return true;101if (iniFile > other.iniFile) return false;102return false;103}104};105106void ReloadAllPostShaderInfo(Draw::DrawContext *draw);107108const ShaderInfo *GetPostShaderInfo(std::string_view name);109std::vector<const ShaderInfo *> GetPostShaderChain(const std::string &name);110std::vector<const ShaderInfo *> GetFullPostShadersChain(const std::vector<std::string> &names);111bool PostShaderChainRequires60FPS(const std::vector<const ShaderInfo *> &chain);112const std::vector<ShaderInfo> &GetAllPostShaderInfo();113114const TextureShaderInfo *GetTextureShaderInfo(std::string_view name);115const std::vector<TextureShaderInfo> &GetAllTextureShaderInfo();116void RemoveUnknownPostShaders(std::vector<std::string> *names);117118// Call this any time you alter the postshader list. It makes sure119// that "usePrevFrame" shaders are at the end, and that there's only one.120// It'll also enforce any similar future rules.121void FixPostShaderOrder(std::vector<std::string> *names);122123124