#pragma once
#include <map>
#include <vector>
#include <string>
#include "Common/CommonTypes.h"
#include "Common/GPU/thin3d.h"
#include "GPU/ge_constants.h"
#include "GPU/Common/Draw2D.h"
#include "GPU/Common/ShaderCommon.h"
class ClutTexture {
public:
enum { MAX_RAMPS = 3 };
Draw::Texture *texture;
int lastFrame;
int rampLengths[MAX_RAMPS];
int rampStarts[MAX_RAMPS];
};
class TextureShaderCache {
public:
TextureShaderCache(Draw::DrawContext *draw, Draw2D *draw2D);
~TextureShaderCache();
Draw2DPipeline *GetDepalettizeShader(uint32_t clutMode, GETextureFormat texFormat, GEBufferFormat pixelFormat, bool smoothedDepal, u32 depthUpperBits);
ClutTexture GetClutTexture(GEPaletteFormat clutFormat, const u32 clutHash, const u32 *rawClut);
Draw::SamplerState *GetSampler(bool linearFilter);
void Clear();
void Decimate();
std::vector<std::string> DebugGetShaderIDs(DebugShaderType type);
std::string DebugGetShaderString(const std::string &id, DebugShaderType type, DebugShaderStringType stringType);
void DeviceLost();
void DeviceRestore(Draw::DrawContext *draw);
private:
Draw::DrawContext *draw_;
Draw::SamplerState *nearestSampler_ = nullptr;
Draw::SamplerState *linearSampler_ = nullptr;
Draw2D *draw2D_;
std::map<u64, Draw2DPipeline *> depalCache_;
std::map<u32, ClutTexture *> texCache_;
};