summaryrefslogtreecommitdiff
path: root/chromium/components/viz/common/resources
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/components/viz/common/resources
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/viz/common/resources')
-rw-r--r--chromium/components/viz/common/resources/platform_color.h2
-rw-r--r--chromium/components/viz/common/resources/resource_format_utils.cc7
-rw-r--r--chromium/components/viz/common/resources/resource_format_utils.h5
-rw-r--r--chromium/components/viz/common/resources/resource_format_utils_mac.mm40
-rw-r--r--chromium/components/viz/common/resources/resource_sizes.h2
5 files changed, 52 insertions, 4 deletions
diff --git a/chromium/components/viz/common/resources/platform_color.h b/chromium/components/viz/common/resources/platform_color.h
index 6e8790d0a06..3d573570d8c 100644
--- a/chromium/components/viz/common/resources/platform_color.h
+++ b/chromium/components/viz/common/resources/platform_color.h
@@ -5,8 +5,8 @@
#ifndef COMPONENTS_VIZ_COMMON_RESOURCES_PLATFORM_COLOR_H_
#define COMPONENTS_VIZ_COMMON_RESOURCES_PLATFORM_COLOR_H_
-#include "base/logging.h"
#include "base/macros.h"
+#include "base/notreached.h"
#include "components/viz/common/resources/resource_format.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "third_party/skia/include/core/SkTypes.h"
diff --git a/chromium/components/viz/common/resources/resource_format_utils.cc b/chromium/components/viz/common/resources/resource_format_utils.cc
index ea1ae8de815..2bfdfd5d2e4 100644
--- a/chromium/components/viz/common/resources/resource_format_utils.cc
+++ b/chromium/components/viz/common/resources/resource_format_utils.cc
@@ -4,6 +4,8 @@
#include "components/viz/common/resources/resource_format_utils.h"
+#include <ostream>
+
#include "base/check_op.h"
#include "base/notreached.h"
#include "base/stl_util.h"
@@ -324,10 +326,11 @@ unsigned int TextureStorageFormat(ResourceFormat format) {
case RGBA_1010102:
case BGRA_1010102:
return GL_RGB10_A2_EXT;
- case BGR_565:
- case BGRX_8888:
case YVU_420:
case YUV_420_BIPLANAR:
+ return GL_RGB8_OES;
+ case BGR_565:
+ case BGRX_8888:
case P010:
break;
}
diff --git a/chromium/components/viz/common/resources/resource_format_utils.h b/chromium/components/viz/common/resources/resource_format_utils.h
index ca10863b695..ce691952e0a 100644
--- a/chromium/components/viz/common/resources/resource_format_utils.h
+++ b/chromium/components/viz/common/resources/resource_format_utils.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_VIZ_COMMON_RESOURCES_RESOURCE_FORMAT_UTILS_H_
#define COMPONENTS_VIZ_COMMON_RESOURCES_RESOURCE_FORMAT_UTILS_H_
+#include "build/build_config.h"
#include "components/viz/common/resources/resource_format.h"
#include "components/viz/common/viz_resource_format_export.h"
#include "gpu/vulkan/buildflags.h"
@@ -73,6 +74,10 @@ VIZ_RESOURCE_FORMAT_EXPORT wgpu::TextureFormat ToDawnFormat(
VIZ_RESOURCE_FORMAT_EXPORT WGPUTextureFormat
ToWGPUFormat(ResourceFormat format);
+#if defined(OS_MACOSX)
+VIZ_RESOURCE_FORMAT_EXPORT unsigned int ToMTLPixelFormat(ResourceFormat format);
+#endif
+
} // namespace viz
#endif // COMPONENTS_VIZ_COMMON_RESOURCES_RESOURCE_FORMAT_UTILS_H_
diff --git a/chromium/components/viz/common/resources/resource_format_utils_mac.mm b/chromium/components/viz/common/resources/resource_format_utils_mac.mm
new file mode 100644
index 00000000000..5a095e7f30d
--- /dev/null
+++ b/chromium/components/viz/common/resources/resource_format_utils_mac.mm
@@ -0,0 +1,40 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/viz/common/resources/resource_format_utils.h"
+
+#include <Metal/MTLPixelFormat.h>
+
+#include "base/logging.h"
+
+namespace viz {
+
+unsigned int ToMTLPixelFormat(ResourceFormat format) {
+ if (@available(macOS 10.11, *)) {
+ MTLPixelFormat mtl_pixel_format = MTLPixelFormatInvalid;
+ switch (format) {
+ case RED_8:
+ case ALPHA_8:
+ case LUMINANCE_8:
+ mtl_pixel_format = MTLPixelFormatR8Unorm;
+ break;
+ case RG_88:
+ mtl_pixel_format = MTLPixelFormatRG8Unorm;
+ break;
+ case RGBA_8888:
+ mtl_pixel_format = MTLPixelFormatRGBA8Unorm;
+ break;
+ case BGRA_8888:
+ mtl_pixel_format = MTLPixelFormatBGRA8Unorm;
+ break;
+ default:
+ DLOG(ERROR) << "Invalid Metal pixel format.";
+ break;
+ }
+ return static_cast<unsigned int>(mtl_pixel_format);
+ }
+ return 0;
+}
+
+} // namespace viz
diff --git a/chromium/components/viz/common/resources/resource_sizes.h b/chromium/components/viz/common/resources/resource_sizes.h
index 9c4d9eee7b7..f2745793207 100644
--- a/chromium/components/viz/common/resources/resource_sizes.h
+++ b/chromium/components/viz/common/resources/resource_sizes.h
@@ -9,7 +9,7 @@
#include <limits>
-#include "base/logging.h"
+#include "base/check_op.h"
#include "base/macros.h"
#include "base/numerics/safe_math.h"
#include "cc/base/math_util.h"