Hash :
968041b5
Author :
Date :
2022-08-19T12:11:23
Metal: Optimized BufferSubData per device Adds a staging buffer path which means there are 4 paths for bufferSubData. 1. direct copy * get a pointer to the buffer * copy the new data to the buffer * if the buffer is managed, tell metal which part was updated 2. use a shadow copy * copy the data to a shadow copy * copy the entire shadow to a new buffer * start using the new buffer 3. use a new buffer * get a new buffer (or unused) * put the new data in the new buffer * blit any unchanged data from the old buffer to the new buffer * start using the new buffer 4. use a staging buffer * get a staging buffer * put the new data in the staging buffer * blit from the staging buffer to the existing buffer. Further, there are 3 types of memory storage modes. Managed, Staged, Private. Based on the GPU type different storage modes and different paths in different sitatutions are more performant. So, add feature flags to select paths by GPU. Bug: angleproject:7544 Change-Id: I741dd1874201043416374194bd2001ded8dbd9b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3842641 Reviewed-by: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This file houses the build configuration for the ANGLE Metal back-end.
import("../../../../gni/angle.gni")
assert(is_mac || is_ios)
assert(angle_enable_metal)
_metal_backend_sources = [
"BufferMtl.h",
"BufferMtl.mm",
"CompilerMtl.h",
"CompilerMtl.mm",
"ContextMtl.h",
"ContextMtl.mm",
"DeviceMtl.h",
"DeviceMtl.mm",
"DisplayMtl.h",
"DisplayMtl.mm",
"DisplayMtl_api.h",
"FrameBufferMtl.h",
"FrameBufferMtl.mm",
"IOSurfaceSurfaceMtl.h",
"IOSurfaceSurfaceMtl.mm",
"ImageMtl.h",
"ImageMtl.mm",
"ProgramMtl.h",
"ProgramMtl.mm",
"ProvokingVertexHelper.h",
"ProvokingVertexHelper.mm",
"QueryMtl.h",
"QueryMtl.mm",
"RenderBufferMtl.h",
"RenderBufferMtl.mm",
"RenderTargetMtl.h",
"RenderTargetMtl.mm",
"SamplerMtl.h",
"SamplerMtl.mm",
"ShaderMtl.h",
"ShaderMtl.mm",
"SurfaceMtl.h",
"SurfaceMtl.mm",
"SyncMtl.h",
"SyncMtl.mm",
"TextureMtl.h",
"TextureMtl.mm",
"TransformFeedbackMtl.h",
"TransformFeedbackMtl.mm",
"VertexArrayMtl.h",
"VertexArrayMtl.mm",
"mtl_buffer_manager.h",
"mtl_buffer_manager.mm",
"mtl_buffer_pool.h",
"mtl_buffer_pool.mm",
"mtl_command_buffer.h",
"mtl_command_buffer.mm",
"mtl_common.h",
"mtl_common.mm",
"mtl_context_device.h",
"mtl_context_device.mm",
"mtl_default_shaders_compiled.inc",
"mtl_format_table_autogen.mm",
"mtl_format_utils.h",
"mtl_format_utils.mm",
"mtl_glslang_mtl_utils.h",
"mtl_glslang_mtl_utils.mm",
"mtl_occlusion_query_pool.h",
"mtl_occlusion_query_pool.mm",
"mtl_render_utils.h",
"mtl_render_utils.mm",
"mtl_resource_spi.h",
"mtl_resources.h",
"mtl_resources.mm",
"mtl_state_cache.h",
"mtl_state_cache.mm",
"mtl_utils.h",
"mtl_utils.mm",
"shaders/constants.h",
"shaders/format_autogen.h",
"shaders/mtl_default_shaders_src_autogen.inc",
"shaders/rewrite_indices_shared.h",
]
config("angle_metal_spirv_backend_config") {
defines = [ "ANGLE_ENABLE_METAL_SPIRV" ]
}
config("angle_metal_backend_config") {
defines = [ "ANGLE_ENABLE_METAL" ]
ldflags = [
"-weak_framework",
"Metal",
]
}
angle_source_set("angle_metal_backend") {
public_configs = [ ":angle_metal_backend_config" ]
sources = _metal_backend_sources
cflags = []
cflags_cc = []
cflags_objc = []
cflags_objcc = []
ldflags = []
libs = []
public_deps = [
"${angle_root}:angle_common",
"${angle_root}:angle_glslang_wrapper",
"${angle_root}:angle_gpu_info_util",
"${angle_root}:angle_image_util",
"${angle_root}:libANGLE_headers",
"${angle_root}:translator",
]
if (angle_enable_msl_through_spirv) {
public_configs += [ ":angle_metal_spirv_backend_config" ]
deps = [ "${angle_spirv_cross_dir}/gn:spirv_cross_sources" ]
sources += [
"mtl_glslang_utils.h",
"mtl_glslang_utils.mm",
]
}
objc_flags = [
"-Wno-nullability-completeness",
"-Wno-unguarded-availability",
"-fno-objc-arc",
]
cflags_objc += objc_flags
cflags_objcc += objc_flags
if (is_mac) {
frameworks = [
"Cocoa.framework",
"IOSurface.framework",
"QuartzCore.framework",
]
}
# TODO(hqle): iOS support.
}