diff options
| author | 2020-06-30 03:34:10 -0300 | |
|---|---|---|
| committer | 2020-07-13 01:01:08 -0300 | |
| commit | 143662118c49faf0a8bbc5df3815d095d77c15e8 (patch) | |
| tree | 010db0ae57ed159500236769f590fcae57bbfcd1 /src/video_core/surface.cpp | |
| parent | Merge pull request #4318 from lioncash/cpp20 (diff) | |
| download | yuzu-143662118c49faf0a8bbc5df3815d095d77c15e8.tar.gz yuzu-143662118c49faf0a8bbc5df3815d095d77c15e8.tar.xz yuzu-143662118c49faf0a8bbc5df3815d095d77c15e8.zip | |
video_core/surface: Reorder render target to pixel format switch
Diffstat (limited to 'src/video_core/surface.cpp')
| -rw-r--r-- | src/video_core/surface.cpp | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index bbe93903c..2392a46f4 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -85,92 +85,90 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { | |||
| 85 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: | 85 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: |
| 86 | return PixelFormat::Z32FS8; | 86 | return PixelFormat::Z32FS8; |
| 87 | default: | 87 | default: |
| 88 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 88 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); |
| 89 | UNREACHABLE(); | ||
| 90 | return PixelFormat::S8Z24; | 89 | return PixelFormat::S8Z24; |
| 91 | } | 90 | } |
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { | 93 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { |
| 95 | switch (format) { | 94 | switch (format) { |
| 96 | case Tegra::RenderTargetFormat::RGBA8_SRGB: | 95 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: |
| 97 | return PixelFormat::RGBA8_SRGB; | 96 | return PixelFormat::RGBA32F; |
| 98 | case Tegra::RenderTargetFormat::RGBA8_UNORM: | 97 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| 99 | return PixelFormat::ABGR8U; | 98 | return PixelFormat::RGBA32UI; |
| 100 | case Tegra::RenderTargetFormat::RGBA8_SNORM: | ||
| 101 | return PixelFormat::ABGR8S; | ||
| 102 | case Tegra::RenderTargetFormat::RGBA8_UINT: | ||
| 103 | return PixelFormat::ABGR8UI; | ||
| 104 | case Tegra::RenderTargetFormat::BGRA8_SRGB: | ||
| 105 | return PixelFormat::BGRA8_SRGB; | ||
| 106 | case Tegra::RenderTargetFormat::BGRA8_UNORM: | ||
| 107 | return PixelFormat::BGRA8; | ||
| 108 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | ||
| 109 | return PixelFormat::A2B10G10R10U; | ||
| 110 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | ||
| 111 | return PixelFormat::RGBA16F; | ||
| 112 | case Tegra::RenderTargetFormat::RGBA16_UNORM: | 99 | case Tegra::RenderTargetFormat::RGBA16_UNORM: |
| 113 | return PixelFormat::RGBA16U; | 100 | return PixelFormat::RGBA16U; |
| 114 | case Tegra::RenderTargetFormat::RGBA16_SNORM: | 101 | case Tegra::RenderTargetFormat::RGBA16_SNORM: |
| 115 | return PixelFormat::RGBA16S; | 102 | return PixelFormat::RGBA16S; |
| 116 | case Tegra::RenderTargetFormat::RGBA16_UINT: | 103 | case Tegra::RenderTargetFormat::RGBA16_UINT: |
| 117 | return PixelFormat::RGBA16UI; | 104 | return PixelFormat::RGBA16UI; |
| 118 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: | 105 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: |
| 119 | return PixelFormat::RGBA32F; | 106 | return PixelFormat::RGBA16F; |
| 120 | case Tegra::RenderTargetFormat::RG32_FLOAT: | 107 | case Tegra::RenderTargetFormat::RG32_FLOAT: |
| 121 | return PixelFormat::RG32F; | 108 | return PixelFormat::RG32F; |
| 109 | case Tegra::RenderTargetFormat::RG32_UINT: | ||
| 110 | return PixelFormat::RG32UI; | ||
| 111 | case Tegra::RenderTargetFormat::RGBX16_FLOAT: | ||
| 112 | return PixelFormat::RGBX16F; | ||
| 113 | case Tegra::RenderTargetFormat::BGRA8_UNORM: | ||
| 114 | return PixelFormat::BGRA8; | ||
| 115 | case Tegra::RenderTargetFormat::BGRA8_SRGB: | ||
| 116 | return PixelFormat::BGRA8_SRGB; | ||
| 117 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | ||
| 118 | return PixelFormat::A2B10G10R10U; | ||
| 119 | case Tegra::RenderTargetFormat::RGBA8_UNORM: | ||
| 120 | return PixelFormat::ABGR8U; | ||
| 121 | case Tegra::RenderTargetFormat::RGBA8_SRGB: | ||
| 122 | return PixelFormat::RGBA8_SRGB; | ||
| 123 | case Tegra::RenderTargetFormat::RGBA8_SNORM: | ||
| 124 | return PixelFormat::ABGR8S; | ||
| 125 | case Tegra::RenderTargetFormat::RGBA8_UINT: | ||
| 126 | return PixelFormat::ABGR8UI; | ||
| 127 | case Tegra::RenderTargetFormat::RG16_UNORM: | ||
| 128 | return PixelFormat::RG16; | ||
| 129 | case Tegra::RenderTargetFormat::RG16_SNORM: | ||
| 130 | return PixelFormat::RG16S; | ||
| 131 | case Tegra::RenderTargetFormat::RG16_SINT: | ||
| 132 | return PixelFormat::RG16I; | ||
| 133 | case Tegra::RenderTargetFormat::RG16_UINT: | ||
| 134 | return PixelFormat::RG16UI; | ||
| 135 | case Tegra::RenderTargetFormat::RG16_FLOAT: | ||
| 136 | return PixelFormat::RG16F; | ||
| 122 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 137 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: |
| 123 | return PixelFormat::R11FG11FB10F; | 138 | return PixelFormat::R11FG11FB10F; |
| 139 | case Tegra::RenderTargetFormat::R32_SINT: | ||
| 140 | return PixelFormat::R32I; | ||
| 141 | case Tegra::RenderTargetFormat::R32_UINT: | ||
| 142 | return PixelFormat::R32UI; | ||
| 143 | case Tegra::RenderTargetFormat::R32_FLOAT: | ||
| 144 | return PixelFormat::R32F; | ||
| 124 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: | 145 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: |
| 125 | return PixelFormat::B5G6R5U; | 146 | return PixelFormat::B5G6R5U; |
| 126 | case Tegra::RenderTargetFormat::BGR5A1_UNORM: | 147 | case Tegra::RenderTargetFormat::BGR5A1_UNORM: |
| 127 | return PixelFormat::A1B5G5R5U; | 148 | return PixelFormat::A1B5G5R5U; |
| 128 | case Tegra::RenderTargetFormat::RGBA32_UINT: | ||
| 129 | return PixelFormat::RGBA32UI; | ||
| 130 | case Tegra::RenderTargetFormat::R8_UNORM: | ||
| 131 | return PixelFormat::R8U; | ||
| 132 | case Tegra::RenderTargetFormat::R8_UINT: | ||
| 133 | return PixelFormat::R8UI; | ||
| 134 | case Tegra::RenderTargetFormat::RG16_FLOAT: | ||
| 135 | return PixelFormat::RG16F; | ||
| 136 | case Tegra::RenderTargetFormat::RG16_UINT: | ||
| 137 | return PixelFormat::RG16UI; | ||
| 138 | case Tegra::RenderTargetFormat::RG16_SINT: | ||
| 139 | return PixelFormat::RG16I; | ||
| 140 | case Tegra::RenderTargetFormat::RG16_UNORM: | ||
| 141 | return PixelFormat::RG16; | ||
| 142 | case Tegra::RenderTargetFormat::RG16_SNORM: | ||
| 143 | return PixelFormat::RG16S; | ||
| 144 | case Tegra::RenderTargetFormat::RG8_UNORM: | 149 | case Tegra::RenderTargetFormat::RG8_UNORM: |
| 145 | return PixelFormat::RG8U; | 150 | return PixelFormat::RG8U; |
| 146 | case Tegra::RenderTargetFormat::RG8_SNORM: | 151 | case Tegra::RenderTargetFormat::RG8_SNORM: |
| 147 | return PixelFormat::RG8S; | 152 | return PixelFormat::RG8S; |
| 148 | case Tegra::RenderTargetFormat::RG8_UINT: | 153 | case Tegra::RenderTargetFormat::RG8_UINT: |
| 149 | return PixelFormat::RG8UI; | 154 | return PixelFormat::RG8UI; |
| 150 | case Tegra::RenderTargetFormat::R16_FLOAT: | ||
| 151 | return PixelFormat::R16F; | ||
| 152 | case Tegra::RenderTargetFormat::R16_UNORM: | 155 | case Tegra::RenderTargetFormat::R16_UNORM: |
| 153 | return PixelFormat::R16U; | 156 | return PixelFormat::R16U; |
| 154 | case Tegra::RenderTargetFormat::R16_SNORM: | 157 | case Tegra::RenderTargetFormat::R16_SNORM: |
| 155 | return PixelFormat::R16S; | 158 | return PixelFormat::R16S; |
| 156 | case Tegra::RenderTargetFormat::R16_UINT: | ||
| 157 | return PixelFormat::R16UI; | ||
| 158 | case Tegra::RenderTargetFormat::R16_SINT: | 159 | case Tegra::RenderTargetFormat::R16_SINT: |
| 159 | return PixelFormat::R16I; | 160 | return PixelFormat::R16I; |
| 160 | case Tegra::RenderTargetFormat::R32_FLOAT: | 161 | case Tegra::RenderTargetFormat::R16_UINT: |
| 161 | return PixelFormat::R32F; | 162 | return PixelFormat::R16UI; |
| 162 | case Tegra::RenderTargetFormat::R32_SINT: | 163 | case Tegra::RenderTargetFormat::R16_FLOAT: |
| 163 | return PixelFormat::R32I; | 164 | return PixelFormat::R16F; |
| 164 | case Tegra::RenderTargetFormat::R32_UINT: | 165 | case Tegra::RenderTargetFormat::R8_UNORM: |
| 165 | return PixelFormat::R32UI; | 166 | return PixelFormat::R8U; |
| 166 | case Tegra::RenderTargetFormat::RG32_UINT: | 167 | case Tegra::RenderTargetFormat::R8_UINT: |
| 167 | return PixelFormat::RG32UI; | 168 | return PixelFormat::R8UI; |
| 168 | case Tegra::RenderTargetFormat::RGBX16_FLOAT: | ||
| 169 | return PixelFormat::RGBX16F; | ||
| 170 | default: | 169 | default: |
| 171 | LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); | 170 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<int>(format)); |
| 172 | UNREACHABLE(); | 171 | return PixelFormat::ABGR8U; |
| 173 | return PixelFormat::RGBA8_SRGB; | ||
| 174 | } | 172 | } |
| 175 | } | 173 | } |
| 176 | 174 | ||