[Impeller] Set resourceOptions/storageMode on MTLTextures created from MTLBuffers. (flutter/engine#37073)

This commit is contained in:
Dan Field 2022-10-27 23:35:21 -07:00 committed by GitHub
parent b767b7b9a9
commit 248aca72c6
2 changed files with 16 additions and 1 deletions

View File

@ -40,6 +40,10 @@ std::shared_ptr<Texture> DeviceBufferMTL::AsTexture(
return nullptr;
}
if (@available(iOS 13.0, macos 10.15, *)) {
mtl_texture_desc.resourceOptions = buffer_.resourceOptions;
}
auto texture = [buffer_ newTextureWithDescriptor:mtl_texture_desc
offset:0
bytesPerRow:row_bytes];

View File

@ -427,7 +427,18 @@ def RunCCTests(build_dir, filter, coverage, capture_core_dump):
'impeller_unittests',
filter,
shuffle_flags,
coverage=coverage
coverage=coverage,
extra_env={
# See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc
'MTL_SHADER_VALIDATION':
'1', # Enables all shader validation tests.
'MTL_SHADER_VALIDATION_GLOBAL_MEMORY':
'1', # Validates accesses to device and constant memory.
'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY':
'1', # Validates accesses to threadgroup memory.
'MTL_SHADER_VALIDATION_TEXTURE_USAGE':
'1', # Validates that texture references are not nil.
}
)