This commit is contained in:
Henrik Rydgård 2022-08-09 10:47:54 +02:00
parent 46342ee92d
commit 9bd4201c83
3 changed files with 10 additions and 19 deletions

View File

@ -43,7 +43,7 @@ public:
};
// Caches both shaders and palette textures.
class DepalShaderCache : public DepalShaderCacheCommon {
class DepalShaderCache {
public:
DepalShaderCache(Draw::DrawContext *draw);
~DepalShaderCache();
@ -66,6 +66,15 @@ public:
static bool GenerateVertexShader(char *buffer, const ShaderLanguageDesc &lang);
private:
static uint32_t GenerateShaderID(uint32_t clutMode, GEBufferFormat pixelFormat) {
return (clutMode & 0xFFFFFF) | (pixelFormat << 24);
}
static uint32_t GetClutID(GEPaletteFormat clutFormat, uint32_t clutHash) {
// Simplistic.
return clutHash ^ (uint32_t)clutFormat;
}
Draw::DrawContext *draw_;
Draw::ShaderModule *vertexShader_ = nullptr;
Draw::SamplerState *nearestSampler_ = nullptr;

View File

@ -343,13 +343,4 @@ void GenerateDepalShader(char *buffer, GEBufferFormat pixelFormat, ShaderLanguag
}
}
uint32_t DepalShaderCacheCommon::GenerateShaderID(uint32_t clutMode, GEBufferFormat pixelFormat) const {
return (clutMode & 0xFFFFFF) | (pixelFormat << 24);
}
uint32_t DepalShaderCacheCommon::GetClutID(GEPaletteFormat clutFormat, uint32_t clutHash) const {
// Simplistic.
return clutHash ^ (uint32_t)clutFormat;
}
#undef WRITE

View File

@ -25,12 +25,3 @@
static const int DEPAL_TEXTURE_OLD_AGE = 120;
void GenerateDepalShader(char *buffer, GEBufferFormat pixelFormat, ShaderLanguage language);
class DepalShaderCacheCommon {
public:
virtual ~DepalShaderCacheCommon() {}
protected:
uint32_t GenerateShaderID(uint32_t clutMode, GEBufferFormat pixelFormat) const;
uint32_t GetClutID(GEPaletteFormat clutFormat, uint32_t clutHash) const;
};