diff options
| author | 2022-11-28 20:25:41 -0500 | |
|---|---|---|
| committer | 2022-11-28 20:25:44 -0500 | |
| commit | a9efea8ae984fee95cf10002093dcca86c1d3dab (patch) | |
| tree | 5018c664bda89557361f9d30f18002b44a234a1b | |
| parent | Merge pull request #9325 from german77/default_by_default (diff) | |
| download | yuzu-a9efea8ae984fee95cf10002093dcca86c1d3dab.tar.gz yuzu-a9efea8ae984fee95cf10002093dcca86c1d3dab.tar.xz yuzu-a9efea8ae984fee95cf10002093dcca86c1d3dab.zip | |
video_core/surface: Eliminate casts in GetFormatType()
We can just compare directly and get rid of verbose casting.
| -rw-r--r-- | src/video_core/surface.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index b618e1a25..1a76d4178 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -214,23 +214,16 @@ PixelFormat PixelFormatFromGPUPixelFormat(Service::android::PixelFormat format) | |||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | SurfaceType GetFormatType(PixelFormat pixel_format) { | 216 | SurfaceType GetFormatType(PixelFormat pixel_format) { |
| 217 | if (static_cast<std::size_t>(pixel_format) < | 217 | if (pixel_format < PixelFormat::MaxColorFormat) { |
| 218 | static_cast<std::size_t>(PixelFormat::MaxColorFormat)) { | ||
| 219 | return SurfaceType::ColorTexture; | 218 | return SurfaceType::ColorTexture; |
| 220 | } | 219 | } |
| 221 | 220 | if (pixel_format < PixelFormat::MaxDepthFormat) { | |
| 222 | if (static_cast<std::size_t>(pixel_format) < | ||
| 223 | static_cast<std::size_t>(PixelFormat::MaxDepthFormat)) { | ||
| 224 | return SurfaceType::Depth; | 221 | return SurfaceType::Depth; |
| 225 | } | 222 | } |
| 226 | 223 | if (pixel_format < PixelFormat::MaxStencilFormat) { | |
| 227 | if (static_cast<std::size_t>(pixel_format) < | ||
| 228 | static_cast<std::size_t>(PixelFormat::MaxStencilFormat)) { | ||
| 229 | return SurfaceType::Stencil; | 224 | return SurfaceType::Stencil; |
| 230 | } | 225 | } |
| 231 | 226 | if (pixel_format < PixelFormat::MaxDepthStencilFormat) { | |
| 232 | if (static_cast<std::size_t>(pixel_format) < | ||
| 233 | static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) { | ||
| 234 | return SurfaceType::DepthStencil; | 227 | return SurfaceType::DepthStencil; |
| 235 | } | 228 | } |
| 236 | 229 | ||