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/TextureShaderCommon.h
Views: 1401
// Copyright (c) 2014- 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/.1617#pragma once1819#include <map>20#include <vector>21#include <string>2223#include "Common/CommonTypes.h"24#include "Common/GPU/thin3d.h"25#include "GPU/ge_constants.h"26#include "GPU/Common/Draw2D.h"27#include "GPU/Common/ShaderCommon.h"282930class ClutTexture {31public:32enum { MAX_RAMPS = 3 };33Draw::Texture *texture;34int lastFrame;35int rampLengths[MAX_RAMPS];36int rampStarts[MAX_RAMPS];37};3839// For CLUT depal shaders, and other pre-bind texture shaders.40// Caches both shaders and palette textures.41class TextureShaderCache {42public:43TextureShaderCache(Draw::DrawContext *draw, Draw2D *draw2D);44~TextureShaderCache();4546Draw2DPipeline *GetDepalettizeShader(uint32_t clutMode, GETextureFormat texFormat, GEBufferFormat pixelFormat, bool smoothedDepal, u32 depthUpperBits);47ClutTexture GetClutTexture(GEPaletteFormat clutFormat, const u32 clutHash, const u32 *rawClut);4849Draw::SamplerState *GetSampler(bool linearFilter);5051void Clear();52void Decimate();53std::vector<std::string> DebugGetShaderIDs(DebugShaderType type);54std::string DebugGetShaderString(const std::string &id, DebugShaderType type, DebugShaderStringType stringType);5556void DeviceLost();57void DeviceRestore(Draw::DrawContext *draw);5859private:60Draw::DrawContext *draw_;61Draw::SamplerState *nearestSampler_ = nullptr;62Draw::SamplerState *linearSampler_ = nullptr;63Draw2D *draw2D_;6465std::map<u64, Draw2DPipeline *> depalCache_;66std::map<u32, ClutTexture *> texCache_;67};686970