PR
This commit is contained in:
committed by
Chinmay Garde
parent
2866095b58
commit
51da19b944
@@ -81,12 +81,12 @@ if (current_toolchain == host_toolchain) {
|
||||
]
|
||||
}
|
||||
|
||||
# All targets on all platforms should be able to the Metal utilities. On
|
||||
# platforms where Metal in not available, the tests must be skipped or
|
||||
# All targets on all platforms should be able to use the Metal utilities. On
|
||||
# platforms where Metal is not available, the tests must be skipped or
|
||||
# implemented to use another available client rendering API. This is usually
|
||||
# either OpenGL which is portably implemented via SwiftShader or the software
|
||||
# backend. This way, all tests compile on all platforms but the Metal backend
|
||||
# exercised on platforms where Metal itself is available.
|
||||
# is exercised on platforms where Metal itself is available.
|
||||
source_set("metal") {
|
||||
testonly = true
|
||||
|
||||
@@ -107,28 +107,28 @@ if (current_toolchain == host_toolchain) {
|
||||
"$flutter_root/fml",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
test_fixtures("testing_fixtures") {
|
||||
fixtures = []
|
||||
}
|
||||
|
||||
# The //flutter/testing library provides utility methods to other test targets.
|
||||
# This test target tests the testing utilities.
|
||||
executable("testing_unittests") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"$flutter_root/testing/test_metal_surface_unittests.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":dart",
|
||||
":metal",
|
||||
":opengl",
|
||||
":skia",
|
||||
":testing",
|
||||
":testing_fixtures",
|
||||
":testing_lib",
|
||||
]
|
||||
|
||||
test_fixtures("testing_fixtures") {
|
||||
fixtures = []
|
||||
}
|
||||
|
||||
# The //flutter/testing library provides utility methods to other test targets.
|
||||
# This test target tests the testing utilities.
|
||||
executable("testing_unittests") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"$flutter_root/testing/test_metal_surface_unittests.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":dart",
|
||||
":metal",
|
||||
":opengl",
|
||||
":skia",
|
||||
":testing",
|
||||
":testing_fixtures",
|
||||
":testing_lib",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,14 +30,14 @@ TestMetalSurfaceImpl::TestMetalSurfaceImpl(SkISize surface_size) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto texture_descriptor = fml::scoped_nsobject{[[MTLTextureDescriptor
|
||||
texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
|
||||
width:surface_size.width()
|
||||
height:surface_size.height()
|
||||
mipmapped:NO] retain]};
|
||||
auto texture_descriptor = fml::scoped_nsobject{
|
||||
[[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
|
||||
width:surface_size.width()
|
||||
height:surface_size.height()
|
||||
mipmapped:NO] retain]};
|
||||
|
||||
// The most pessimistic option and disables all optimizations but allows tests
|
||||
// the most flexible access to the surface. They may read and wrote to the
|
||||
// the most flexible access to the surface. They may read and write to the
|
||||
// surface from shaders or use as a pixel view.
|
||||
texture_descriptor.get().usage = MTLTextureUsageUnknown;
|
||||
|
||||
@@ -46,8 +46,8 @@ TestMetalSurfaceImpl::TestMetalSurfaceImpl(SkISize surface_size) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto texture = fml::scoped_nsobject{
|
||||
[device.get() newTextureWithDescriptor:texture_descriptor.get()]};
|
||||
auto texture =
|
||||
fml::scoped_nsobject{[device.get() newTextureWithDescriptor:texture_descriptor.get()]};
|
||||
|
||||
if (!texture) {
|
||||
FML_LOG(ERROR) << "Could not create texture from texture descriptor.";
|
||||
@@ -85,8 +85,8 @@ TestMetalSurfaceImpl::TestMetalSurfaceImpl(SkISize surface_size) {
|
||||
kBGRA_8888_SkColorType, // color type
|
||||
nullptr, // color space
|
||||
nullptr, // surface properties
|
||||
nullptr, // release proc (texture is already ref counted in sk_cf_obj)
|
||||
nullptr // release context
|
||||
nullptr, // release proc (texture is already ref counted in sk_cf_obj)
|
||||
nullptr // release context
|
||||
);
|
||||
|
||||
if (!surface) {
|
||||
|
||||
Reference in New Issue
Block a user