summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureConversionShader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureConversionShader.cpp27
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;