aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mtl/GrMtlUtil.mm
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-08-04 09:34:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-04 19:53:55 +0000
commit4a081e2475fa69dd55fcace9f8e6d3166ea25ad1 (patch)
treea42a3b82ab0697237fe66e7dda836d07af8e443d /src/gpu/mtl/GrMtlUtil.mm
parent21c3fb94deac8527719be74deff9e8fb8a490e23 (diff)
Add GrMtlTexture classes
Adds support for basic Texture creation. Bug: skia: Change-Id: I9a3f15bef1c88054c19e952e231cad94ad69f296 Reviewed-on: https://skia-review.googlesource.com/30781 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/mtl/GrMtlUtil.mm')
-rw-r--r--src/gpu/mtl/GrMtlUtil.mm20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gpu/mtl/GrMtlUtil.mm b/src/gpu/mtl/GrMtlUtil.mm
index 9c6e3f0eca..d1bbf6e6bc 100644
--- a/src/gpu/mtl/GrMtlUtil.mm
+++ b/src/gpu/mtl/GrMtlUtil.mm
@@ -101,3 +101,23 @@ GrPixelConfig GrMTLFormatToPixelConfig(MTLPixelFormat format) {
return kUnknown_GrPixelConfig;
}
}
+
+bool GrMTLFormatIsSRGB(MTLPixelFormat format, MTLPixelFormat* linearFormat) {
+ MTLPixelFormat linearFmt = format;
+ switch (format) {
+ case MTLPixelFormatRGBA8Unorm_sRGB:
+ linearFmt = MTLPixelFormatRGBA8Unorm;
+ break;
+ case MTLPixelFormatBGRA8Unorm_sRGB:
+ linearFmt = MTLPixelFormatBGRA8Unorm;
+ break;
+ default:
+ break;
+ }
+
+ if (linearFormat) {
+ *linearFormat = linearFmt;
+ }
+ return (linearFmt != format);
+}
+