aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/surface.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-11-16 18:52:11 -0800
committerGitHub <noreply@github.com>2021-11-16 18:52:11 -0800
commitc2c9ca98a7f9c9d6d8b33da32ce4bdf1138b4532 (patch)
treecb1df371d288677fcede6a3409eb079e0d278163 /src/video_core/surface.cpp
parent1d8ee7341bbcedd9f3050e5cf3665f08a8e1e949 (diff)
parent88936fc84a282605ae79c74514cf9ef1a5de74cd (diff)
Merge pull request #7219 from FernandoS27/aristotles-right-testicle
Project A.R.T. Advanced Rendering Techniques
Diffstat (limited to 'src/video_core/surface.cpp')
-rw-r--r--src/video_core/surface.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index eb17462656..58d262446f 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -279,6 +279,80 @@ bool IsPixelFormatSRGB(PixelFormat format) {
}
}
+bool IsPixelFormatInteger(PixelFormat format) {
+ switch (format) {
+ case PixelFormat::A8B8G8R8_SINT:
+ case PixelFormat::A8B8G8R8_UINT:
+ case PixelFormat::A2B10G10R10_UINT:
+ case PixelFormat::R8_SINT:
+ case PixelFormat::R8_UINT:
+ case PixelFormat::R16G16B16A16_SINT:
+ case PixelFormat::R16G16B16A16_UINT:
+ case PixelFormat::R32G32B32A32_UINT:
+ case PixelFormat::R32G32B32A32_SINT:
+ case PixelFormat::R32G32_SINT:
+ case PixelFormat::R16_UINT:
+ case PixelFormat::R16_SINT:
+ case PixelFormat::R16G16_UINT:
+ case PixelFormat::R16G16_SINT:
+ case PixelFormat::R8G8_SINT:
+ case PixelFormat::R8G8_UINT:
+ case PixelFormat::R32G32_UINT:
+ case PixelFormat::R32_UINT:
+ case PixelFormat::R32_SINT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool IsPixelFormatSignedInteger(PixelFormat format) {
+ switch (format) {
+ case PixelFormat::A8B8G8R8_SINT:
+ case PixelFormat::R8_SINT:
+ case PixelFormat::R16G16B16A16_SINT:
+ case PixelFormat::R32G32B32A32_SINT:
+ case PixelFormat::R32G32_SINT:
+ case PixelFormat::R16_SINT:
+ case PixelFormat::R16G16_SINT:
+ case PixelFormat::R8G8_SINT:
+ case PixelFormat::R32_SINT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+size_t PixelComponentSizeBitsInteger(PixelFormat format) {
+ switch (format) {
+ case PixelFormat::A8B8G8R8_SINT:
+ case PixelFormat::A8B8G8R8_UINT:
+ case PixelFormat::R8_SINT:
+ case PixelFormat::R8_UINT:
+ case PixelFormat::R8G8_SINT:
+ case PixelFormat::R8G8_UINT:
+ return 8;
+ case PixelFormat::A2B10G10R10_UINT:
+ return 10;
+ case PixelFormat::R16G16B16A16_SINT:
+ case PixelFormat::R16G16B16A16_UINT:
+ case PixelFormat::R16_UINT:
+ case PixelFormat::R16_SINT:
+ case PixelFormat::R16G16_UINT:
+ case PixelFormat::R16G16_SINT:
+ return 16;
+ case PixelFormat::R32G32B32A32_UINT:
+ case PixelFormat::R32G32B32A32_SINT:
+ case PixelFormat::R32G32_SINT:
+ case PixelFormat::R32G32_UINT:
+ case PixelFormat::R32_UINT:
+ case PixelFormat::R32_SINT:
+ return 32;
+ default:
+ return 0;
+ }
+}
+
std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
return {DefaultBlockWidth(format), DefaultBlockHeight(format)};
}