summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureConversionShader.cpp
diff options
context:
space:
mode:
authorPokechu22 <pokechu022@gmail.com>2022-06-24 15:50:48 -0700
committerGitHub <noreply@github.com>2022-06-24 15:50:48 -0700
commit1faca4bfc70f808e4114d09b0e0270b2d3e23111 (patch)
tree921def1a95233881e7b252ecc8a3a46d121c4138 /Source/Core/VideoCommon/TextureConversionShader.cpp
parent76f890f6b0f6fe2f35ef029b75715f9f7b3ed305 (diff)
parentf79ac768d802f2127022f7a7f8956ee03183229b (diff)
Merge pull request #10752 from tellowkrinkle/BetterShaderNames
VideoCommon: Better shader names
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;