diff options
author | Subv <subv2112@gmail.com> | 2018-04-18 21:17:05 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-04-18 21:17:28 +0200 |
commit | 43d98ca8fee384c5aef462dd37200477e9de2013 (patch) | |
tree | 2cd2be881337d77a0da33c6db8a8bcc4007349e9 /src/video_core/renderer_opengl/gl_rasterizer_cache.h | |
parent | GLCache: Unify texture and framebuffer formats when converting to OpenGL. (diff) | |
download | yuzu-43d98ca8fee384c5aef462dd37200477e9de2013.tar yuzu-43d98ca8fee384c5aef462dd37200477e9de2013.tar.gz yuzu-43d98ca8fee384c5aef462dd37200477e9de2013.tar.bz2 yuzu-43d98ca8fee384c5aef462dd37200477e9de2013.tar.lz yuzu-43d98ca8fee384c5aef462dd37200477e9de2013.tar.xz yuzu-43d98ca8fee384c5aef462dd37200477e9de2013.tar.zst yuzu-43d98ca8fee384c5aef462dd37200477e9de2013.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer_cache.h')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 434cd2277..0ff0ce90f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -57,6 +57,15 @@ struct SurfaceParams { Invalid = 255, }; + enum class ComponentType { + Invalid = 0, + SNorm = 1, + UNorm = 2, + SInt = 3, + UInt = 4, + Float = 5, + }; + enum class SurfaceType { ColorTexture = 0, Depth = 1, @@ -126,6 +135,40 @@ struct SurfaceParams { } } + static ComponentType ComponentTypeFromTexture(Tegra::Texture::ComponentType type) { + // TODO(Subv): Implement more component types + switch (type) { + case Tegra::Texture::ComponentType::UNORM: + return ComponentType::UNorm; + default: + NGLOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); + UNREACHABLE(); + } + } + + static ComponentType ComponentTypeFromRenderTarget(Tegra::RenderTargetFormat format) { + // TODO(Subv): Implement more render targets + switch (format) { + case Tegra::RenderTargetFormat::RGBA8_UNORM: + case Tegra::RenderTargetFormat::RGB10_A2_UNORM: + return ComponentType::UNorm; + default: + NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); + UNREACHABLE(); + } + } + + static ComponentType ComponentTypeFromGPUPixelFormat( + Tegra::FramebufferConfig::PixelFormat format) { + switch (format) { + case Tegra::FramebufferConfig::PixelFormat::ABGR8: + return ComponentType::UNorm; + default: + NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); + UNREACHABLE(); + } + } + static bool CheckFormatsBlittable(PixelFormat pixel_format_a, PixelFormat pixel_format_b) { SurfaceType a_type = GetFormatType(pixel_format_a); SurfaceType b_type = GetFormatType(pixel_format_b); @@ -225,6 +268,7 @@ struct SurfaceParams { bool is_tiled = false; PixelFormat pixel_format = PixelFormat::Invalid; SurfaceType type = SurfaceType::Invalid; + ComponentType component_type = ComponentType::Invalid; }; struct CachedSurface : SurfaceParams { |