summaryrefslogtreecommitdiff
path: root/src/video_core/surface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/surface.cpp')
-rw-r--r--src/video_core/surface.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index 64941a486..58d262446 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -306,6 +306,53 @@ bool IsPixelFormatInteger(PixelFormat format) {
306 } 306 }
307} 307}
308 308
309bool IsPixelFormatSignedInteger(PixelFormat format) {
310 switch (format) {
311 case PixelFormat::A8B8G8R8_SINT:
312 case PixelFormat::R8_SINT:
313 case PixelFormat::R16G16B16A16_SINT:
314 case PixelFormat::R32G32B32A32_SINT:
315 case PixelFormat::R32G32_SINT:
316 case PixelFormat::R16_SINT:
317 case PixelFormat::R16G16_SINT:
318 case PixelFormat::R8G8_SINT:
319 case PixelFormat::R32_SINT:
320 return true;
321 default:
322 return false;
323 }
324}
325
326size_t PixelComponentSizeBitsInteger(PixelFormat format) {
327 switch (format) {
328 case PixelFormat::A8B8G8R8_SINT:
329 case PixelFormat::A8B8G8R8_UINT:
330 case PixelFormat::R8_SINT:
331 case PixelFormat::R8_UINT:
332 case PixelFormat::R8G8_SINT:
333 case PixelFormat::R8G8_UINT:
334 return 8;
335 case PixelFormat::A2B10G10R10_UINT:
336 return 10;
337 case PixelFormat::R16G16B16A16_SINT:
338 case PixelFormat::R16G16B16A16_UINT:
339 case PixelFormat::R16_UINT:
340 case PixelFormat::R16_SINT:
341 case PixelFormat::R16G16_UINT:
342 case PixelFormat::R16G16_SINT:
343 return 16;
344 case PixelFormat::R32G32B32A32_UINT:
345 case PixelFormat::R32G32B32A32_SINT:
346 case PixelFormat::R32G32_SINT:
347 case PixelFormat::R32G32_UINT:
348 case PixelFormat::R32_UINT:
349 case PixelFormat::R32_SINT:
350 return 32;
351 default:
352 return 0;
353 }
354}
355
309std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) { 356std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
310 return {DefaultBlockWidth(format), DefaultBlockHeight(format)}; 357 return {DefaultBlockWidth(format), DefaultBlockHeight(format)};
311} 358}