diff options
| author | TellowKrinkle <tellowkrinkle@gmail.com> | 2022-06-11 02:51:24 -0500 |
|---|---|---|
| committer | TellowKrinkle <tellowkrinkle@gmail.com> | 2022-06-16 02:08:45 -0500 |
| commit | 23c1721fbd317a31046affcf362848bc191f4711 (patch) | |
| tree | 7e6f2698a7d0b4fab2793d0ba3b7c55a399d0433 /Source/Core/VideoCommon/TextureConversionShader.cpp | |
| parent | 70bf89fa59e3bd48633677374ca26124d36ff7e5 (diff) | |
VideoCommon: Reduce duplicates of non-palette-requiring texture decode shaders
Diffstat (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureConversionShader.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index 1b9183846f..19f2a384f0 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -950,6 +950,7 @@ uint GetTiledTexelOffset(uint2 block_size, uint2 coords) return buffer_pos; } +#if defined(HAS_PALETTE) uint4 GetPaletteColor(uint index) { // Fetch and swap BE to LE. @@ -994,6 +995,7 @@ float4 GetPaletteColorNormalized(uint index) uint4 color = GetPaletteColor(index); return float4(color) / 255.0; } +#endif // defined(HAS_PALETTE) )"; @@ -1385,7 +1387,7 @@ std::pair<u32, u32> GetDispatchCount(const DecodingShaderInfo* info, u32 width, (height + (info->group_size_y - 1)) / info->group_size_y}; } -std::string GenerateDecodingShader(TextureFormat format, TLUTFormat palette_format, +std::string GenerateDecodingShader(TextureFormat format, std::optional<TLUTFormat> palette_format, APIType api_type) { const DecodingShaderInfo* info = GetDecodingShaderInfo(format); @@ -1393,17 +1395,20 @@ std::string GenerateDecodingShader(TextureFormat format, TLUTFormat palette_form return ""; std::ostringstream ss; - switch (palette_format) + if (palette_format.has_value()) { - case TLUTFormat::IA8: - ss << "#define PALETTE_FORMAT_IA8 1\n"; - break; - case TLUTFormat::RGB565: - ss << "#define PALETTE_FORMAT_RGB565 1\n"; - break; - case TLUTFormat::RGB5A3: - ss << "#define PALETTE_FORMAT_RGB5A3 1\n"; - break; + switch (*palette_format) + { + case TLUTFormat::IA8: + ss << "#define PALETTE_FORMAT_IA8 1\n"; + break; + case TLUTFormat::RGB565: + ss << "#define PALETTE_FORMAT_RGB565 1\n"; + break; + case TLUTFormat::RGB5A3: + ss << "#define PALETTE_FORMAT_RGB5A3 1\n"; + break; + } } ss << decoding_shader_header; |
