diff options
Diffstat (limited to 'src/video_core/surface.cpp')
| -rw-r--r-- | src/video_core/surface.cpp | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 492ab6215..1688267bb 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -74,131 +74,131 @@ bool SurfaceTargetIsArray(SurfaceTarget target) { | |||
| 74 | 74 | ||
| 75 | PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { | 75 | PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { |
| 76 | switch (format) { | 76 | switch (format) { |
| 77 | case Tegra::DepthFormat::S8_Z24_UNORM: | 77 | case Tegra::DepthFormat::S8_UINT_Z24_UNORM: |
| 78 | return PixelFormat::S8Z24; | 78 | return PixelFormat::S8_UINT_D24_UNORM; |
| 79 | case Tegra::DepthFormat::Z24_S8_UNORM: | 79 | case Tegra::DepthFormat::D24S8_UNORM: |
| 80 | return PixelFormat::Z24S8; | 80 | return PixelFormat::D24_UNORM_S8_UINT; |
| 81 | case Tegra::DepthFormat::Z32_FLOAT: | 81 | case Tegra::DepthFormat::D32_FLOAT: |
| 82 | return PixelFormat::Z32F; | 82 | return PixelFormat::D32_FLOAT; |
| 83 | case Tegra::DepthFormat::Z16_UNORM: | 83 | case Tegra::DepthFormat::D16_UNORM: |
| 84 | return PixelFormat::Z16; | 84 | return PixelFormat::D16_UNORM; |
| 85 | case Tegra::DepthFormat::Z32_S8_X24_FLOAT: | 85 | case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT: |
| 86 | return PixelFormat::Z32FS8; | 86 | return PixelFormat::D32_FLOAT_S8_UINT; |
| 87 | default: | 87 | default: |
| 88 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); | 88 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); |
| 89 | return PixelFormat::S8Z24; | 89 | return PixelFormat::S8_UINT_D24_UNORM; |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { | 93 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { |
| 94 | switch (format) { | 94 | switch (format) { |
| 95 | case Tegra::RenderTargetFormat::RGBA32_FLOAT: | 95 | case Tegra::RenderTargetFormat::R32B32G32A32_FLOAT: |
| 96 | return PixelFormat::RGBA32F; | 96 | return PixelFormat::R32G32B32A32_FLOAT; |
| 97 | case Tegra::RenderTargetFormat::RGBA32_SINT: | 97 | case Tegra::RenderTargetFormat::R32G32B32A32_SINT: |
| 98 | return PixelFormat::RGBA32I; | 98 | return PixelFormat::R32G32B32A32_SINT; |
| 99 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 99 | case Tegra::RenderTargetFormat::R32G32B32A32_UINT: |
| 100 | return PixelFormat::RGBA32UI; | 100 | return PixelFormat::R32G32B32A32_UINT; |
| 101 | case Tegra::RenderTargetFormat::RGBA16_UNORM: | 101 | case Tegra::RenderTargetFormat::R16G16B16A16_UNORM: |
| 102 | return PixelFormat::RGBA16U; | 102 | return PixelFormat::R16G16B16A16_UNORM; |
| 103 | case Tegra::RenderTargetFormat::RGBA16_SNORM: | 103 | case Tegra::RenderTargetFormat::R16G16B16A16_SNORM: |
| 104 | return PixelFormat::RGBA16S; | 104 | return PixelFormat::R16G16B16A16_SNORM; |
| 105 | case Tegra::RenderTargetFormat::RGBA16_SINT: | 105 | case Tegra::RenderTargetFormat::R16G16B16A16_SINT: |
| 106 | return PixelFormat::RGBA16I; | 106 | return PixelFormat::R16G16B16A16_SINT; |
| 107 | case Tegra::RenderTargetFormat::RGBA16_UINT: | 107 | case Tegra::RenderTargetFormat::R16G16B16A16_UINT: |
| 108 | return PixelFormat::RGBA16UI; | 108 | return PixelFormat::R16G16B16A16_UINT; |
| 109 | case Tegra::RenderTargetFormat::RGBA16_FLOAT: | 109 | case Tegra::RenderTargetFormat::R16G16B16A16_FLOAT: |
| 110 | return PixelFormat::RGBA16F; | 110 | return PixelFormat::R16G16B16A16_FLOAT; |
| 111 | case Tegra::RenderTargetFormat::RG32_FLOAT: | 111 | case Tegra::RenderTargetFormat::R32G32_FLOAT: |
| 112 | return PixelFormat::RG32F; | 112 | return PixelFormat::R32G32_FLOAT; |
| 113 | case Tegra::RenderTargetFormat::RG32_SINT: | 113 | case Tegra::RenderTargetFormat::R32G32_SINT: |
| 114 | return PixelFormat::RG32I; | 114 | return PixelFormat::R32G32_SINT; |
| 115 | case Tegra::RenderTargetFormat::RG32_UINT: | 115 | case Tegra::RenderTargetFormat::R32G32_UINT: |
| 116 | return PixelFormat::RG32UI; | 116 | return PixelFormat::R32G32_UINT; |
| 117 | case Tegra::RenderTargetFormat::RGBX16_FLOAT: | 117 | case Tegra::RenderTargetFormat::R16G16B16X16_FLOAT: |
| 118 | return PixelFormat::RGBX16F; | 118 | return PixelFormat::R16G16B16X16_FLOAT; |
| 119 | case Tegra::RenderTargetFormat::BGRA8_UNORM: | 119 | case Tegra::RenderTargetFormat::B8G8R8A8_UNORM: |
| 120 | return PixelFormat::BGRA8; | 120 | return PixelFormat::B8G8R8A8_UNORM; |
| 121 | case Tegra::RenderTargetFormat::BGRA8_SRGB: | 121 | case Tegra::RenderTargetFormat::B8G8R8A8_SRGB: |
| 122 | return PixelFormat::BGRA8_SRGB; | 122 | return PixelFormat::B8G8R8A8_SRGB; |
| 123 | case Tegra::RenderTargetFormat::RGB10_A2_UNORM: | 123 | case Tegra::RenderTargetFormat::A2B10G10R10_UNORM: |
| 124 | return PixelFormat::A2B10G10R10U; | 124 | return PixelFormat::A2B10G10R10_UNORM; |
| 125 | case Tegra::RenderTargetFormat::RGB10_A2_UINT: | 125 | case Tegra::RenderTargetFormat::A2B10G10R10_UINT: |
| 126 | return PixelFormat::A2B10G10R10UI; | 126 | return PixelFormat::A2B10G10R10_UINT; |
| 127 | case Tegra::RenderTargetFormat::RGBA8_UNORM: | 127 | case Tegra::RenderTargetFormat::A8B8G8R8_UNORM: |
| 128 | return PixelFormat::ABGR8U; | 128 | return PixelFormat::A8B8G8R8_UNORM; |
| 129 | case Tegra::RenderTargetFormat::RGBA8_SRGB: | 129 | case Tegra::RenderTargetFormat::A8B8G8R8_SRGB: |
| 130 | return PixelFormat::RGBA8_SRGB; | 130 | return PixelFormat::A8B8G8R8_SRGB; |
| 131 | case Tegra::RenderTargetFormat::RGBA8_SNORM: | 131 | case Tegra::RenderTargetFormat::A8B8G8R8_SNORM: |
| 132 | return PixelFormat::ABGR8S; | 132 | return PixelFormat::A8B8G8R8_SNORM; |
| 133 | case Tegra::RenderTargetFormat::RGBA8_SINT: | 133 | case Tegra::RenderTargetFormat::A8B8G8R8_SINT: |
| 134 | return PixelFormat::ABGR8I; | 134 | return PixelFormat::A8B8G8R8_SINT; |
| 135 | case Tegra::RenderTargetFormat::RGBA8_UINT: | 135 | case Tegra::RenderTargetFormat::A8B8G8R8_UINT: |
| 136 | return PixelFormat::ABGR8UI; | 136 | return PixelFormat::A8B8G8R8_UINT; |
| 137 | case Tegra::RenderTargetFormat::RG16_UNORM: | 137 | case Tegra::RenderTargetFormat::R16G16_UNORM: |
| 138 | return PixelFormat::RG16; | 138 | return PixelFormat::R16G16_UNORM; |
| 139 | case Tegra::RenderTargetFormat::RG16_SNORM: | 139 | case Tegra::RenderTargetFormat::R16G16_SNORM: |
| 140 | return PixelFormat::RG16S; | 140 | return PixelFormat::R16G16_SNORM; |
| 141 | case Tegra::RenderTargetFormat::RG16_SINT: | 141 | case Tegra::RenderTargetFormat::R16G16_SINT: |
| 142 | return PixelFormat::RG16I; | 142 | return PixelFormat::R16G16_SINT; |
| 143 | case Tegra::RenderTargetFormat::RG16_UINT: | 143 | case Tegra::RenderTargetFormat::R16G16_UINT: |
| 144 | return PixelFormat::RG16UI; | 144 | return PixelFormat::R16G16_UINT; |
| 145 | case Tegra::RenderTargetFormat::RG16_FLOAT: | 145 | case Tegra::RenderTargetFormat::R16G16_FLOAT: |
| 146 | return PixelFormat::RG16F; | 146 | return PixelFormat::R16G16_FLOAT; |
| 147 | case Tegra::RenderTargetFormat::R11G11B10_FLOAT: | 147 | case Tegra::RenderTargetFormat::B10G11R11_FLOAT: |
| 148 | return PixelFormat::R11FG11FB10F; | 148 | return PixelFormat::B10G11R11_FLOAT; |
| 149 | case Tegra::RenderTargetFormat::R32_SINT: | 149 | case Tegra::RenderTargetFormat::R32_SINT: |
| 150 | return PixelFormat::R32I; | 150 | return PixelFormat::R32_SINT; |
| 151 | case Tegra::RenderTargetFormat::R32_UINT: | 151 | case Tegra::RenderTargetFormat::R32_UINT: |
| 152 | return PixelFormat::R32UI; | 152 | return PixelFormat::R32_UINT; |
| 153 | case Tegra::RenderTargetFormat::R32_FLOAT: | 153 | case Tegra::RenderTargetFormat::R32_FLOAT: |
| 154 | return PixelFormat::R32F; | 154 | return PixelFormat::R32_FLOAT; |
| 155 | case Tegra::RenderTargetFormat::B5G6R5_UNORM: | 155 | case Tegra::RenderTargetFormat::R5G6B5_UNORM: |
| 156 | return PixelFormat::B5G6R5U; | 156 | return PixelFormat::R5G6B5_UNORM; |
| 157 | case Tegra::RenderTargetFormat::BGR5A1_UNORM: | 157 | case Tegra::RenderTargetFormat::A1R5G5B5_UNORM: |
| 158 | return PixelFormat::B5G5R5A1U; | 158 | return PixelFormat::A1R5G5B5_UNORM; |
| 159 | case Tegra::RenderTargetFormat::RG8_UNORM: | 159 | case Tegra::RenderTargetFormat::R8G8_UNORM: |
| 160 | return PixelFormat::RG8U; | 160 | return PixelFormat::R8G8_UNORM; |
| 161 | case Tegra::RenderTargetFormat::RG8_SNORM: | 161 | case Tegra::RenderTargetFormat::R8G8_SNORM: |
| 162 | return PixelFormat::RG8S; | 162 | return PixelFormat::R8G8_SNORM; |
| 163 | case Tegra::RenderTargetFormat::RG8_SINT: | 163 | case Tegra::RenderTargetFormat::R8G8_SINT: |
| 164 | return PixelFormat::RG8I; | 164 | return PixelFormat::R8G8_SINT; |
| 165 | case Tegra::RenderTargetFormat::RG8_UINT: | 165 | case Tegra::RenderTargetFormat::R8G8_UINT: |
| 166 | return PixelFormat::RG8UI; | 166 | return PixelFormat::R8G8_UINT; |
| 167 | case Tegra::RenderTargetFormat::R16_UNORM: | 167 | case Tegra::RenderTargetFormat::R16_UNORM: |
| 168 | return PixelFormat::R16U; | 168 | return PixelFormat::R16_UNORM; |
| 169 | case Tegra::RenderTargetFormat::R16_SNORM: | 169 | case Tegra::RenderTargetFormat::R16_SNORM: |
| 170 | return PixelFormat::R16S; | 170 | return PixelFormat::R16_SNORM; |
| 171 | case Tegra::RenderTargetFormat::R16_SINT: | 171 | case Tegra::RenderTargetFormat::R16_SINT: |
| 172 | return PixelFormat::R16I; | 172 | return PixelFormat::R16_SINT; |
| 173 | case Tegra::RenderTargetFormat::R16_UINT: | 173 | case Tegra::RenderTargetFormat::R16_UINT: |
| 174 | return PixelFormat::R16UI; | 174 | return PixelFormat::R16_UINT; |
| 175 | case Tegra::RenderTargetFormat::R16_FLOAT: | 175 | case Tegra::RenderTargetFormat::R16_FLOAT: |
| 176 | return PixelFormat::R16F; | 176 | return PixelFormat::R16_FLOAT; |
| 177 | case Tegra::RenderTargetFormat::R8_UNORM: | 177 | case Tegra::RenderTargetFormat::R8_UNORM: |
| 178 | return PixelFormat::R8U; | 178 | return PixelFormat::R8_UNORM; |
| 179 | case Tegra::RenderTargetFormat::R8_SNORM: | 179 | case Tegra::RenderTargetFormat::R8_SNORM: |
| 180 | return PixelFormat::R8S; | 180 | return PixelFormat::R8_SNORM; |
| 181 | case Tegra::RenderTargetFormat::R8_SINT: | 181 | case Tegra::RenderTargetFormat::R8_SINT: |
| 182 | return PixelFormat::R8I; | 182 | return PixelFormat::R8_SINT; |
| 183 | case Tegra::RenderTargetFormat::R8_UINT: | 183 | case Tegra::RenderTargetFormat::R8_UINT: |
| 184 | return PixelFormat::R8UI; | 184 | return PixelFormat::R8_UINT; |
| 185 | default: | 185 | default: |
| 186 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<int>(format)); | 186 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<int>(format)); |
| 187 | return PixelFormat::ABGR8U; | 187 | return PixelFormat::A8B8G8R8_UNORM; |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { | 191 | PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { |
| 192 | switch (format) { | 192 | switch (format) { |
| 193 | case Tegra::FramebufferConfig::PixelFormat::ABGR8: | 193 | case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: |
| 194 | return PixelFormat::ABGR8U; | 194 | return PixelFormat::A8B8G8R8_UNORM; |
| 195 | case Tegra::FramebufferConfig::PixelFormat::RGB565: | 195 | case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: |
| 196 | return PixelFormat::B5G6R5U; | 196 | return PixelFormat::R5G6B5_UNORM; |
| 197 | case Tegra::FramebufferConfig::PixelFormat::BGRA8: | 197 | case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: |
| 198 | return PixelFormat::BGRA8; | 198 | return PixelFormat::B8G8R8A8_UNORM; |
| 199 | default: | 199 | default: |
| 200 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); | 200 | UNIMPLEMENTED_MSG("Unimplemented format={}", static_cast<u32>(format)); |
| 201 | return PixelFormat::ABGR8U; | 201 | return PixelFormat::A8B8G8R8_UNORM; |
| 202 | } | 202 | } |
| 203 | } | 203 | } |
| 204 | 204 | ||
| @@ -226,27 +226,27 @@ SurfaceType GetFormatType(PixelFormat pixel_format) { | |||
| 226 | 226 | ||
| 227 | bool IsPixelFormatASTC(PixelFormat format) { | 227 | bool IsPixelFormatASTC(PixelFormat format) { |
| 228 | switch (format) { | 228 | switch (format) { |
| 229 | case PixelFormat::ASTC_2D_4X4: | 229 | case PixelFormat::ASTC_2D_4X4_UNORM: |
| 230 | case PixelFormat::ASTC_2D_5X4: | 230 | case PixelFormat::ASTC_2D_5X4_UNORM: |
| 231 | case PixelFormat::ASTC_2D_5X5: | 231 | case PixelFormat::ASTC_2D_5X5_UNORM: |
| 232 | case PixelFormat::ASTC_2D_8X8: | 232 | case PixelFormat::ASTC_2D_8X8_UNORM: |
| 233 | case PixelFormat::ASTC_2D_8X5: | 233 | case PixelFormat::ASTC_2D_8X5_UNORM: |
| 234 | case PixelFormat::ASTC_2D_4X4_SRGB: | 234 | case PixelFormat::ASTC_2D_4X4_SRGB: |
| 235 | case PixelFormat::ASTC_2D_5X4_SRGB: | 235 | case PixelFormat::ASTC_2D_5X4_SRGB: |
| 236 | case PixelFormat::ASTC_2D_5X5_SRGB: | 236 | case PixelFormat::ASTC_2D_5X5_SRGB: |
| 237 | case PixelFormat::ASTC_2D_8X8_SRGB: | 237 | case PixelFormat::ASTC_2D_8X8_SRGB: |
| 238 | case PixelFormat::ASTC_2D_8X5_SRGB: | 238 | case PixelFormat::ASTC_2D_8X5_SRGB: |
| 239 | case PixelFormat::ASTC_2D_10X8: | 239 | case PixelFormat::ASTC_2D_10X8_UNORM: |
| 240 | case PixelFormat::ASTC_2D_10X8_SRGB: | 240 | case PixelFormat::ASTC_2D_10X8_SRGB: |
| 241 | case PixelFormat::ASTC_2D_6X6: | 241 | case PixelFormat::ASTC_2D_6X6_UNORM: |
| 242 | case PixelFormat::ASTC_2D_6X6_SRGB: | 242 | case PixelFormat::ASTC_2D_6X6_SRGB: |
| 243 | case PixelFormat::ASTC_2D_10X10: | 243 | case PixelFormat::ASTC_2D_10X10_UNORM: |
| 244 | case PixelFormat::ASTC_2D_10X10_SRGB: | 244 | case PixelFormat::ASTC_2D_10X10_SRGB: |
| 245 | case PixelFormat::ASTC_2D_12X12: | 245 | case PixelFormat::ASTC_2D_12X12_UNORM: |
| 246 | case PixelFormat::ASTC_2D_12X12_SRGB: | 246 | case PixelFormat::ASTC_2D_12X12_SRGB: |
| 247 | case PixelFormat::ASTC_2D_8X6: | 247 | case PixelFormat::ASTC_2D_8X6_UNORM: |
| 248 | case PixelFormat::ASTC_2D_8X6_SRGB: | 248 | case PixelFormat::ASTC_2D_8X6_SRGB: |
| 249 | case PixelFormat::ASTC_2D_6X5: | 249 | case PixelFormat::ASTC_2D_6X5_UNORM: |
| 250 | case PixelFormat::ASTC_2D_6X5_SRGB: | 250 | case PixelFormat::ASTC_2D_6X5_SRGB: |
| 251 | return true; | 251 | return true; |
| 252 | default: | 252 | default: |
| @@ -256,12 +256,12 @@ bool IsPixelFormatASTC(PixelFormat format) { | |||
| 256 | 256 | ||
| 257 | bool IsPixelFormatSRGB(PixelFormat format) { | 257 | bool IsPixelFormatSRGB(PixelFormat format) { |
| 258 | switch (format) { | 258 | switch (format) { |
| 259 | case PixelFormat::RGBA8_SRGB: | 259 | case PixelFormat::A8B8G8R8_SRGB: |
| 260 | case PixelFormat::BGRA8_SRGB: | 260 | case PixelFormat::B8G8R8A8_SRGB: |
| 261 | case PixelFormat::DXT1_SRGB: | 261 | case PixelFormat::BC1_RGBA_SRGB: |
| 262 | case PixelFormat::DXT23_SRGB: | 262 | case PixelFormat::BC2_SRGB: |
| 263 | case PixelFormat::DXT45_SRGB: | 263 | case PixelFormat::BC3_SRGB: |
| 264 | case PixelFormat::BC7U_SRGB: | 264 | case PixelFormat::BC7_SRGB: |
| 265 | case PixelFormat::ASTC_2D_4X4_SRGB: | 265 | case PixelFormat::ASTC_2D_4X4_SRGB: |
| 266 | case PixelFormat::ASTC_2D_8X8_SRGB: | 266 | case PixelFormat::ASTC_2D_8X8_SRGB: |
| 267 | case PixelFormat::ASTC_2D_8X5_SRGB: | 267 | case PixelFormat::ASTC_2D_8X5_SRGB: |