mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Unify CLUT texture size at 512 to reduce complexity. Worth the extra bytes.
This commit is contained in:
parent
39890f7d6f
commit
b4d0ac2e1c
3 changed files with 7 additions and 16 deletions
|
@ -132,10 +132,7 @@ void GenerateDepalShader300(ShaderWriter &writer, const DepalConfig &config) {
|
|||
break;
|
||||
}
|
||||
|
||||
float texturePixels = 256.0f;
|
||||
if (config.clutFormat != GE_CMODE_32BIT_ABGR8888) {
|
||||
texturePixels = 512.0f;
|
||||
}
|
||||
float texturePixels = 512.0f;
|
||||
|
||||
if (shift) {
|
||||
writer.F(" index = (int(uint(index) >> uint(%d)) & 0x%02x)", shift, mask);
|
||||
|
@ -278,11 +275,9 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config) {
|
|||
break;
|
||||
}
|
||||
|
||||
float texturePixels = 256.f;
|
||||
if (config.clutFormat != GE_CMODE_32BIT_ABGR8888) {
|
||||
texturePixels = 512.f;
|
||||
index_multiplier *= 0.5f;
|
||||
}
|
||||
// We always use 512-sized textures now.
|
||||
float texturePixels = 512.f;
|
||||
index_multiplier *= 0.5f;
|
||||
|
||||
// Adjust index_multiplier, similar to the use of 15.99 instead of 16 in the ES 3 path.
|
||||
// index_multiplier -= 0.01f / texturePixels;
|
||||
|
@ -326,11 +321,7 @@ void GenerateDepalSmoothed(ShaderWriter &writer, const DepalConfig &config) {
|
|||
}
|
||||
|
||||
writer.C(" float index = ").SampleTexture2D("tex", "v_texcoord").F(".%s * %0.1f;\n", sourceChannel, indexMultiplier);
|
||||
float texturePixels = 256.f;
|
||||
if (config.clutFormat != GE_CMODE_32BIT_ABGR8888) {
|
||||
texturePixels = 512.f;
|
||||
}
|
||||
|
||||
float texturePixels = 512.f;
|
||||
writer.F(" float coord = (index + 0.5) * %f;\n", 1.0 / texturePixels);
|
||||
writer.C(" vec4 outColor = ").SampleTexture2D("pal", "vec2(coord, 0.0)").C(";\n");
|
||||
}
|
||||
|
|
|
@ -640,7 +640,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
p.C(" if (depalShift == 5u) { index0 = t.g; }\n");
|
||||
p.C(" else if (depalShift == 10u) { index0 = t.b; }\n");
|
||||
p.C(" }\n");
|
||||
p.F(" t = ").SampleTexture2D("pal", "vec2(index0 * factor, 0.0)").C(";\n");
|
||||
p.F(" t = ").SampleTexture2D("pal", "vec2(index0 * factor * 0.5, 0.0)").C(";\n"); // 0.5 for 512-entry CLUT.
|
||||
break;
|
||||
case ShaderDepalMode::NORMAL:
|
||||
if (doTextureProjection) {
|
||||
|
|
|
@ -68,7 +68,7 @@ ClutTexture TextureShaderCache::GetClutTexture(GEPaletteFormat clutFormat, const
|
|||
ClutTexture *tex = new ClutTexture();
|
||||
|
||||
Draw::TextureDesc desc{};
|
||||
desc.width = maxClutEntries;
|
||||
desc.width = 512; // We always use 512-sized textures here for simplicity, though the most common is that only up to 256 entries are used.
|
||||
desc.height = 1;
|
||||
desc.depth = 1;
|
||||
desc.mipLevels = 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue