texture_cache: Use a table instead of switch for texture formats

Use a large flat array to look up texture formats. This allows us to
properly implement formats with different component types. It should
also be faster.
This commit is contained in:
ReinUsesLisp 2019-11-09 03:26:30 -03:00
parent 48a1687f51
commit 80eacdf89b
No known key found for this signature in database
GPG key ID: 2DFC508897B39CFE
9 changed files with 290 additions and 261 deletions

View file

@ -106,7 +106,6 @@ enum class PixelFormat {
Max = MaxDepthStencilFormat,
Invalid = 255,
};
static constexpr std::size_t MaxPixelFormat = static_cast<std::size_t>(PixelFormat::Max);
enum class SurfaceType {
@ -600,10 +599,6 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format);
PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format);
PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
Tegra::Texture::ComponentType component_type,
bool is_srgb);
PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format);
SurfaceType GetFormatType(PixelFormat pixel_format);