diff options
author | android-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com> | 2024-04-26 18:08:58 +0000 |
---|---|---|
committer | android-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com> | 2024-04-26 18:08:58 +0000 |
commit | 5d65231506de410b897a145f856a267ee24f1443 (patch) | |
tree | 61f6b2b3476435074eac2e65bbc43944b12a626d | |
parent | 9a2d2989030ec5bd4459d038b166d05e05d3f8ac (diff) | |
parent | 89caa0e1d99e45f3d6f355f6e14c147f8de3e0e5 (diff) | |
download | angle-5d65231506de410b897a145f856a267ee24f1443.tar.gz |
Roll ANGLE from 37d2277bddcc to 89caa0e1d99e (9 revisions)
https://chromium.googlesource.com/angle/angle.git/+log/37d2277bddcc..89caa0e1d99e
Please enable autosubmit on changes if possible when approving them.
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/angle-android-autoroll
Please CC angle-team@google.com,rmistry@google.com,ynovikov@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in ANGLE: https://bugs.chromium.org/p/angleproject/issues/entry
To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Test: Presubmit checks will test this change.
Exempt-From-Owner-Approval: The autoroll bot does not require owner approval.
Bug: b/334030316
Bug: b/335295728
Change-Id: I9d60ece80e5fbac6bfaab1026cbfc982ee763505
36 files changed, 719 insertions, 328 deletions
@@ -43,7 +43,7 @@ vars = { 'checkout_angle_mesa': False, # Version of Chromium our Chromium-based DEPS are mirrored from. - 'chromium_revision': '0543b5c427ca2038112d55dccdb33447f2bc6861', + 'chromium_revision': '0129806a25c3a66237e6ab2affd13344ea32723e', # We never want to checkout chromium, # but need a dummy DEPS entry for the autoroller 'dummy_checkout_chromium': False, @@ -88,7 +88,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '01d7072ad67e17b1ba7dded7955e399f29859bd6', + 'catapult_revision': '774f822ffd967e31cb9c1b3b4025bdadf5cf60af', # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. @@ -414,12 +414,12 @@ vars = { deps = { 'build': { - 'url': Var('chromium_git') + '/chromium/src/build.git@a1bcbf3070c78efa89da9037a82bb8952d346c10', + 'url': Var('chromium_git') + '/chromium/src/build.git@e797b8d487c0d4b290e78672429c20761f317e95', 'condition': 'not build_with_chromium', }, 'buildtools': { - 'url': Var('chromium_git') + '/chromium/src/buildtools.git@571c37f17dd4d1de37cc2efb6b32ff1032e47be2', + 'url': Var('chromium_git') + '/chromium/src/buildtools.git@86bf72c93ecd1a6440a827041544a04fb7db744c', 'condition': 'not build_with_chromium', }, @@ -473,7 +473,7 @@ deps = { }, 'testing': { - 'url': '{chromium_git}/chromium/src/testing@89090fdbd1996e989ef473bca492813ef541c876', + 'url': '{chromium_git}/chromium/src/testing@de15ed6974253350646dde4dca5d219ce0e80c85', 'condition': 'not build_with_chromium', }, @@ -655,7 +655,7 @@ deps = { }, 'third_party/depot_tools': { - 'url': Var('chromium_git') + '/chromium/tools/depot_tools.git@fb94001f066d0e38ab14c7413714ed17bfa34082', + 'url': Var('chromium_git') + '/chromium/tools/depot_tools.git@4246ba023a156178852f44f6a253a7199e4eaa06', 'condition': 'not build_with_chromium', }, @@ -871,7 +871,7 @@ deps = { 'packages': [ { 'package': 'chromium/third_party/r8', - 'version': 'mhSwabeiU2ueQeYkj0X1JTg-6ZdtQgiVVXM1bo0yu4IC', + 'version': 'vLf3kX0m10K0jItylIPHXJzX-Df7gLlx0EN_jDuagU0C', }, ], 'condition': 'checkout_android and not build_with_chromium', @@ -938,7 +938,7 @@ deps = { }, 'third_party/vulkan-deps': { - 'url': Var('chromium_git') + '/vulkan-deps@a4bf9c4e9ffdac1cb47ec15a75d6a8dec1f77627', + 'url': Var('chromium_git') + '/vulkan-deps@736920240f0bddbee3634f4af0dc683c0902e66a', 'condition': 'not build_with_chromium', }, @@ -958,12 +958,12 @@ deps = { }, 'tools/android': { - 'url': Var('chromium_git') + '/chromium/src/tools/android@e8280e634cded4049d109164bc61cf4963a2a810', + 'url': Var('chromium_git') + '/chromium/src/tools/android@a3f7e1c3fdc0b25c4d2ac394eb589f8d79e51fa3', 'condition': 'checkout_android and not build_with_chromium', }, 'tools/clang': { - 'url': Var('chromium_git') + '/chromium/src/tools/clang.git@0aaac4902f74d6013d56fde780c10772f34feec3', + 'url': Var('chromium_git') + '/chromium/src/tools/clang.git@9570c8ceeaa562cc08225e9ac0cb743c36bfe073', 'condition': 'not build_with_chromium', }, @@ -1009,7 +1009,7 @@ deps = { }, 'tools/perf': { - 'url': Var('chromium_git') + '/chromium/src/tools/perf@36708f2aa161039a2763a17321dd594b8efa07de', + 'url': Var('chromium_git') + '/chromium/src/tools/perf@e2665361f3c60f5412437b6e3541e5424d3659b7', 'condition': 'not build_with_chromium', }, diff --git a/build/android/apk_operations.py b/build/android/apk_operations.py index 99545f5109..b7cdf9706e 100755 --- a/build/android/apk_operations.py +++ b/build/android/apk_operations.py @@ -1440,13 +1440,17 @@ class _Command: else: fully_supported, not_supported_reasons = self._FindSupportedDevices( available_devices) - if fully_supported: + reason_string = '\n'.join( + 'The device (serial={}) is not supported because {}'.format( + serial, reason) + for serial, reason in not_supported_reasons.items()) + if args.devices: + if reason_string: + logging.warning('Devices not supported: %s', reason_string) + self.devices = available_devices + elif fully_supported: self.devices = fully_supported else: - reason_string = '\n'.join( - 'The device (serial={}) is not supported because {}'.format( - serial, reason) - for serial, reason in not_supported_reasons.items()) raise Exception('Cannot find any supported devices for this app.\n\n' f'{reason_string}') diff --git a/build/android/gyp/system_image_apks.py b/build/android/gyp/system_image_apks.py index 0b6804b9af..a44c71816c 100755 --- a/build/android/gyp/system_image_apks.py +++ b/build/android/gyp/system_image_apks.py @@ -46,16 +46,14 @@ def main(): pathlib.Path(args.output).write_bytes(z.read('system/system.apk')) return - # Rename .apk files and remove toc.pb to make it clear that system apks - # should not be installed via bundletool. - with zipfile.ZipFile(tmp_file.name) as z_input, \ - zipfile.ZipFile(args.output, 'w') as z_output: - for info in z_input.infolist(): - if info.filename.endswith('.apk'): - data = z_input.read(info) - info.filename = (info.filename.replace('splits/', - '').replace('-master', '')) - z_output.writestr(info, data) + # A single .apk file means a bundle where we take only the base split. + if args.output.endswith('.apk'): + with zipfile.ZipFile(tmp_file.name) as z: + pathlib.Path(args.output).write_bytes(z.read('splits/base-master.apk')) + return + + # Use the full .apks. + shutil.copyfile(tmp_file.name, args.output) if __name__ == '__main__': diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn index 8cbeb6e76e..cffc4ef93b 100644 --- a/build/config/clang/BUILD.gn +++ b/build/config/clang/BUILD.gn @@ -98,6 +98,8 @@ config("unsafe_buffers") { if (clang_use_chrome_plugins && clang_unsafe_buffers_paths != "" && !use_goma) { cflags = [ + "-DUNSAFE_BUFFERS_BUILD", + "-Xclang", "-add-plugin", "-Xclang", diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index f5b1d46068..78a52a0435 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -67,10 +67,6 @@ declare_args() { # Requires profiling to be set to true. enable_full_stack_frames_for_profiling = false - # When we are going to use gold we need to find it. - # This is initialized below, after use_gold might have been overridden. - gold_path = "" - # Enable fatal linker warnings. Building Chromium with certain versions # of binutils can cause linker warning. fatal_linker_warnings = true @@ -208,19 +204,9 @@ declare_args() { declare_args() { # Set to true to use icf, Identical Code Folding. - # - # icf=all is broken in older golds, see - # https://sourceware.org/bugzilla/show_bug.cgi?id=17704 - # chromeos binutils has been patched with the fix, so always use icf there. - # The bug only affects x86 and x64, so we can still use ICF when targeting - # other architectures. - # - # lld doesn't have the bug. use_icf = (is_posix || is_fuchsia) && !is_debug && !using_sanitizer && !use_clang_coverage && current_os != "zos" && - !(is_android && use_order_profiling) && - (use_lld || (use_gold && (is_chromeos || !(current_cpu == "x86" || - current_cpu == "x64")))) + !(is_android && use_order_profiling) && use_lld } if (is_android) { @@ -515,35 +501,6 @@ config("compiler") { # Linux-specific compiler flags setup. # ------------------------------------ - if (use_gold) { - ldflags += [ "-fuse-ld=gold" ] - if (!is_android) { - # On Android, this isn't needed. gcc in the NDK knows to look next to - # it with -fuse-ld=gold, and clang gets a --gcc-toolchain flag passed - # above. - if (gold_path != "") { - ldflags += [ "-B$gold_path" ] - } - - ldflags += [ - # Experimentation found that using four linking threads - # saved ~20% of link time. - # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36 - # Only apply this to the target linker, since the host - # linker might not be gold, but isn't used much anyway. - "-Wl,--threads", - "-Wl,--thread-count=4", - ] - } - - # TODO(thestig): Make this flag work with GN. - #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan || is_msan)) { - # ldflags += [ - # "-Wl,--detect-odr-violations", - # ] - #} - } - if (use_icf && (!is_apple || use_lld)) { ldflags += [ "-Wl,--icf=all" ] } @@ -2372,7 +2329,7 @@ if (is_win) { common_optimize_on_ldflags += [ # Specifically tell the linker to perform optimizations. # See http://lwn.net/Articles/192624/ . - # -O2 enables string tail merge optimization in gold and lld. + # -O2 enables string tail merge optimization in lld. "-Wl,-O2", "-Wl,--gc-sections", ] @@ -2804,7 +2761,7 @@ config("symbols") { # sections" there. Maybe just a bug in nacl_switch_32.S. _enable_gdb_index = symbol_level == 2 && !is_apple && !is_nacl && current_cpu != "x86" && - current_os != "zos" && (use_gold || use_lld) && + current_os != "zos" && use_lld && # Disable on non-fission 32-bit Android because it pushes # libcomponents_unittests over the 4gb size limit. !(is_android && !use_debug_fission && current_cpu != "x64" && diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 08bd265d24..dff295865e 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -78,6 +78,8 @@ declare_args() { # the default. This is necessary to delay the evaluation of the default # value expression until after its input values such as use_gold have # been set, e.g. by a toolchain_args() block. + # + # TODO(crbug.com/333645515): Remove the placeholder value and set directly. use_debug_fission = "default" # Enables support for ThinLTO, which links 3x-10x faster than full LTO. See @@ -236,15 +238,8 @@ enable_arm_cfi_table = is_android && !is_component_build && current_cpu == "arm" declare_args() { # Whether to use the gold linker from binutils instead of lld or bfd. - use_gold = !use_lld && !(is_castos && - (current_cpu == "arm" || current_cpu == "mipsel")) && - (((is_linux || is_chromeos_lacros) && - (current_cpu == "x64" || current_cpu == "x86" || - current_cpu == "arm" || current_cpu == "arm64" || - current_cpu == "mipsel" || current_cpu == "mips64el")) || - (is_android && (current_cpu == "x86" || current_cpu == "x64" || - current_cpu == "arm" || current_cpu == "arm64" || - current_cpu == "riscv64"))) + # TODO(crbug.com/333645515): Remove this variable. + use_gold = false } # Use relative paths for debug info. This is important to make the build @@ -276,7 +271,7 @@ assert( "Invalid use_debug_fission.") if (use_debug_fission == "default") { use_debug_fission = is_debug && !is_android && !is_fuchsia && !is_apple && - !is_win && (use_gold || use_lld) && cc_wrapper == "" + !is_win && use_lld && cc_wrapper == "" } # If it wasn't manually set, set to an appropriate default. diff --git a/build/config/siso/configure_siso.py b/build/config/siso/configure_siso.py index bcf79ca750..032fb23270 100755 --- a/build/config/siso/configure_siso.py +++ b/build/config/siso/configure_siso.py @@ -10,12 +10,39 @@ import sys THIS_DIR = os.path.abspath(os.path.dirname(__file__)) +SISO_PROJECT_CFG = "SISO_PROJECT" +SISO_ENV = os.path.join(THIS_DIR, ".sisoenv") + + +def ReadConfig(): + entries = {} + if not os.path.isfile(SISO_ENV): + print('The .sisoenv file has not been generated yet') + return entries + with open(SISO_ENV, 'r') as f: + for line in f: + parts = line.strip().split('=') + if len(parts) > 1: + entries[parts[0].strip()] = parts[1].strip() + return entries + def main(): parser = argparse.ArgumentParser(description="configure siso") parser.add_argument("--rbe_instance", help="RBE instance to use for Siso") + parser.add_argument("--get-siso-project", + help="Print the currently configured siso project to " + "stdout", + action="store_true") args = parser.parse_args() + if args.get_siso_project: + config = ReadConfig() + if not SISO_PROJECT_CFG in config: + return 1 + print(config[SISO_PROJECT_CFG]) + return 0 + project = None rbe_instance = args.rbe_instance if rbe_instance: @@ -24,10 +51,9 @@ def main(): project = elems[1] rbe_instance = elems[-1] - siso_env_path = os.path.join(THIS_DIR, ".sisoenv") - with open(siso_env_path, "w") as f: + with open(SISO_ENV, "w") as f: if project: - f.write("SISO_PROJECT=%s\n" % project) + f.write("%s=%s\n" % (SISO_PROJECT_CFG, project)) if rbe_instance: f.write("SISO_REAPI_INSTANCE=%s\n" % rbe_instance) return 0 diff --git a/build/config/unsafe_buffers_paths.txt b/build/config/unsafe_buffers_paths.txt index b7319dcb74..0c576c7e62 100644 --- a/build/config/unsafe_buffers_paths.txt +++ b/build/config/unsafe_buffers_paths.txt @@ -25,9 +25,9 @@ # the `+` line takes precedence and the file will be checked. # # To opt individual files out of checks, place `#pragma allow_unsafe_buffers` -# anywhere in the (source or header) file. These pragmas represent the -# technical debt and security risk present in the file through unsafe -# pointer usage. +# anywhere in the (source or header) file, guarded by +# `#ifdef UNSAFE_BUFFERS_BUILD`. These pragmas represent the technical debt and +# security risk present in the file through unsafe pointer usage. # # *** # Recommended process for removing a `-dir/` line from this file: @@ -37,7 +37,13 @@ # like `-dir/sub_dir/`. # 2. Add `#pragma allow_unsafe_buffers` to every file in the directory that now # has a compilation error, with a TODO to the tracking bug for the -# directory. +# directory: +# ``` +# #ifdef UNSAFE_BUFFERS_BUILD +# // TODO(crbug.com/ABC): Remove this and convert code to safer constructs. +# #pragma allow_unsafe_buffers +# #endif +# ``` # 3. Work through the files in the directory, converting pointers to spans, or # to owning containers like HeapArray and vector. Remove the pragmas from # the files when there is no unsafe pointer usage left in each one. @@ -47,14 +53,8 @@ -android_webview/ -apps/ -ash/ - --base/ -+base/containers/buffer_iterator_nocompile.nc -+base/containers/span.h -+base/strings/cstring_view -+base/unsafe_buffers_unittest.cc -+base/unsafe_buffers_nocompile.nc - +-base/allocator +-base/third_party -build/ -build_overrides/ -buildtools/ diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn index 1634e2879a..9ecf8abdcd 100644 --- a/build/config/win/BUILD.gn +++ b/build/config/win/BUILD.gn @@ -511,8 +511,9 @@ config("release_crt") { if (is_component_build) { cflags = [ "/MD" ] - # The - in front of crt-static turns the feature off. - rustflags = [ "-Ctarget-feature=-crt-static" ] + # /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release + # version. Rust needs to agree, and its default mode is dynamic+release, so + # we do nothing here. See https://github.com/rust-lang/rust/issues/39016. if (use_custom_libcxx) { # On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++ @@ -521,6 +522,10 @@ config("release_crt") { } } else { cflags = [ "/MT" ] + + # /MT specifies libcmt.lib as the CRT library, which is the static+release + # version. Rust needs to agree, so we tell it to use the static+release CRT + # as well. See https://github.com/rust-lang/rust/issues/39016. rustflags = [ "-Ctarget-feature=+crt-static" ] if (use_custom_libcxx) { @@ -534,18 +539,13 @@ config("dynamic_crt") { # This pulls in the DLL debug CRT and defines _DEBUG cflags = [ "/MDd" ] - # /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so - # we specify it explicitly. - # Once https://github.com/rust-lang/rust/issues/39016 is resolved we should - # instead tell rustc which CRT to use (static/dynamic + release/debug). We - # can't support prebuilt stdlib in this path until then. - rustflags = [ "-Clink-arg=msvcrtd.lib" ] - - # Disable libraries rustc links implicitly; - # see https://github.com/rust-lang/rust/pull/122268 - rustflags += [ - "-Clink-arg=/nodefaultlib:libcmt.lib", + # /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we + # specify it explicitly. Rust defaults to the dynamic+release library, which + # we remove here, and then replace. See + # https://github.com/rust-lang/rust/issues/39016. + rustflags = [ "-Clink-arg=/nodefaultlib:msvcrt.lib", + "-Clink-arg=msvcrtd.lib", ] if (use_custom_libcxx) { @@ -554,8 +554,9 @@ config("dynamic_crt") { } else { cflags = [ "/MD" ] - # The - in front of crt-static turns the feature off. - rustflags = [ "-Ctarget-feature=-crt-static" ] + # /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release + # version. Rust needs to agree, and its default mode is dynamic+release, so + # we do nothing here. See https://github.com/rust-lang/rust/issues/39016. if (use_custom_libcxx) { ldflags = [ "/DEFAULTLIB:msvcprt.lib" ] @@ -568,18 +569,14 @@ config("static_crt") { # This pulls in the static debug CRT and defines _DEBUG cflags = [ "/MTd" ] - # /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so - # we specify it explicitly. - # Once https://github.com/rust-lang/rust/issues/39016 is resolved we should - # instead tell rustc which CRT to use (static/dynamic + release/debug). We - # can't support prebuilt stdlib in this path until then. - rustflags = [ "-Clink-arg=libcmtd.lib" ] - - # Disable libraries rustc links implicitly; - # see https://github.com/rust-lang/rust/pull/122268 - rustflags += [ + # /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we + # specify it explicitly. We tell Rust that we're using the static CRT but + # remove the release library that it chooses, and replace with the debug + # library. See https://github.com/rust-lang/rust/issues/39016. + rustflags = [ + "-Ctarget-feature=+crt-static", "-Clink-arg=/nodefaultlib:libcmt.lib", - "-Clink-arg=/nodefaultlib:msvcrt.lib", + "-Clink-arg=libcmtd.lib", ] if (use_custom_libcxx) { @@ -587,6 +584,10 @@ config("static_crt") { } } else { cflags = [ "/MT" ] + + # /MT specifies libcmt.lib as the CRT library, which is the static+release + # version. Rust needs to agree, so we tell it to use the static+release CRT + # as well. See https://github.com/rust-lang/rust/issues/39016. rustflags = [ "-Ctarget-feature=+crt-static" ] if (use_custom_libcxx) { diff --git a/build/rust/std/gnrt_config.toml b/build/rust/std/gnrt_config.toml index 44f727a0a7..537a5feeed 100644 --- a/build/rust/std/gnrt_config.toml +++ b/build/rust/std/gnrt_config.toml @@ -64,9 +64,7 @@ remove_deps = ['allocator-api2'] [crate.libc] # This target is #[no_core] when included by std, which is incompatible with # profiling. -# -# Suppress link directives since we specify the deps in GN configs. -extra_kv = { include_coverage = false, no_link_directives = true } +extra_kv = { include_coverage = false } [crate.profiler_builtins] # The build script is used to compile a profiler-rt library, but we get diff --git a/build/rust/std/rules/BUILD.gn b/build/rust/std/rules/BUILD.gn index 88c17b68c4..caccc86328 100644 --- a/build/rust/std/rules/BUILD.gn +++ b/build/rust/std/rules/BUILD.gn @@ -1442,7 +1442,6 @@ cargo_crate("libc") { rustflags = [ "--cfg=backtrace_in_libstd", "-Zforce-unstable-if-unmarked", - "-Zlink-directives=false", ] output_dir = "$root_out_dir/local_rustc_sysroot/lib/rustlib/$rust_abi_target/lib/" diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 7b589b39e5..154369f1ff 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -875,8 +875,7 @@ template("gcc_toolchain") { # be specified by the invoker, and optionally toolprefix if it's a # cross-compile case. Note that for a cross-compile case this toolchain # requires a config to pass the appropriate -target option, or else it will -# actually just be doing a native compile. The invoker can optionally override -# use_gold too. +# actually just be doing a native compile. template("clang_toolchain") { gcc_toolchain(target_name) { _path = "$clang_base_path/bin" diff --git a/build/util/LASTCHANGE b/build/util/LASTCHANGE index 5b547e1129..dc957ae798 100644 --- a/build/util/LASTCHANGE +++ b/build/util/LASTCHANGE @@ -1,2 +1,2 @@ -LASTCHANGE=a1bcbf3070c78efa89da9037a82bb8952d346c10-refs/heads/main@{#1292285} +LASTCHANGE=e797b8d487c0d4b290e78672429c20761f317e95-refs/heads/main@{#1292661} LASTCHANGE_YEAR=2024 diff --git a/build/util/LASTCHANGE.committime b/build/util/LASTCHANGE.committime index dfd426597d..86b75240ab 100644 --- a/build/util/LASTCHANGE.committime +++ b/build/util/LASTCHANGE.committime @@ -1 +1 @@ -1714026177
\ No newline at end of file +1714076605
\ No newline at end of file diff --git a/infra/specs/angle.json b/infra/specs/angle.json index 4f5164fb8b..560f08d5a5 100644 --- a/infra/specs/angle.json +++ b/infra/specs/angle.json @@ -5947,7 +5947,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -5969,7 +5969,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -5992,7 +5992,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -6015,7 +6015,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -6038,7 +6038,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -6062,7 +6062,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -6086,7 +6086,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -6106,7 +6106,7 @@ "cpu": "x86-64", "display_attached": "1", "gpu": "8086:3e9b", - "os": "Mac-13.5" + "os": "Mac-13.5|Mac-14.4.1" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, diff --git a/infra/specs/mixins.pyl b/infra/specs/mixins.pyl index 2f922d4dcd..2b6c0c6722 100644 --- a/infra/specs/mixins.pyl +++ b/infra/specs/mixins.pyl @@ -44,7 +44,7 @@ 'mac_mini_intel_gpu_stable': { 'swarming': { 'dimensions': { 'cpu': 'x86-64', 'display_attached': '1', 'gpu': '8086:3e9b', - 'os': 'Mac-13.5'}}}, + 'os': 'Mac-13.5|Mac-14.4.1'}}}, 'mac_retina_amd_gpu_experimental': { 'swarming': { 'dimensions': { 'cpu': 'x86-64', 'display_attached': '1', 'gpu': '1002:67ef', diff --git a/scripts/code_generation_hashes/GL_EGL_entry_points.json b/scripts/code_generation_hashes/GL_EGL_entry_points.json index 9d018b3bd0..3161e4b2e0 100644 --- a/scripts/code_generation_hashes/GL_EGL_entry_points.json +++ b/scripts/code_generation_hashes/GL_EGL_entry_points.json @@ -6,7 +6,7 @@ "scripts/entry_point_packed_gl_enums.json": "57a3a729fd25032bc336f4b6a55bc238", "scripts/generate_entry_points.py": - "07f568a7df66934387bf05759110c934", + "c811134a03d12777acd1bb85da21ce92", "scripts/gl_angle_ext.xml": "197e07a917d5bba6dfa2840fb1b58e7e", "scripts/registry_xml.py": @@ -130,7 +130,7 @@ "src/libGLESv2/entry_points_cl_autogen.h": "dde2f94c3004874a7da995dae69da811", "src/libGLESv2/entry_points_egl_autogen.cpp": - "753e22c68aa2f60c02c9bda707b554e7", + "7b164c4311aba60564509540b1ed8303", "src/libGLESv2/entry_points_egl_autogen.h": "3bc7a8df9deadd7cfd615d0cfad0c6a8", "src/libGLESv2/entry_points_egl_ext_autogen.cpp": diff --git a/scripts/generate_entry_points.py b/scripts/generate_entry_points.py index 59d62d8bd8..be01613d38 100755 --- a/scripts/generate_entry_points.py +++ b/scripts/generate_entry_points.py @@ -1607,7 +1607,9 @@ def is_context_private_state_command(api, name): def is_lockless_egl_entry_point(cmd_name): - if cmd_name in ["eglGetError"]: + if cmd_name in [ + "eglGetError", "eglGetCurrentContext", "eglGetCurrentSurface", "eglGetCurrentDisplay" + ]: return True return False diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp index 1f3de17a0d..24169c0663 100644 --- a/src/libANGLE/State.cpp +++ b/src/libANGLE/State.cpp @@ -3966,6 +3966,4 @@ void State::initializeForCapture(const Context *context) initialize(mutableContext); } -constexpr State::DirtyObjectHandler State::kDirtyObjectHandlers[state::DIRTY_OBJECT_MAX]; - } // namespace gl diff --git a/src/libANGLE/State.h b/src/libANGLE/State.h index b2aa674906..fa61701b30 100644 --- a/src/libANGLE/State.h +++ b/src/libANGLE/State.h @@ -1448,13 +1448,40 @@ class State : angle::NonCopyable using DirtyObjectHandler = angle::Result (State::*)(const Context *context, Command command); - static constexpr DirtyObjectHandler kDirtyObjectHandlers[state::DIRTY_OBJECT_MAX] = { - &State::syncActiveTextures, &State::syncTexturesInit, - &State::syncImagesInit, &State::syncReadAttachments, - &State::syncDrawAttachments, &State::syncReadFramebuffer, - &State::syncDrawFramebuffer, &State::syncVertexArray, - &State::syncTextures, &State::syncImages, - &State::syncSamplers, &State::syncProgramPipelineObject}; + static constexpr std::array<DirtyObjectHandler, state::DIRTY_OBJECT_MAX> kDirtyObjectHandlers = + []() { + // Work around C++'s lack of array element support in designated initializers + std::array<DirtyObjectHandler, state::DIRTY_OBJECT_MAX> handlers{}; + + handlers[state::DIRTY_OBJECT_ACTIVE_TEXTURES] = &State::syncActiveTextures; + handlers[state::DIRTY_OBJECT_TEXTURES_INIT] = &State::syncTexturesInit; + handlers[state::DIRTY_OBJECT_IMAGES_INIT] = &State::syncImagesInit; + handlers[state::DIRTY_OBJECT_READ_ATTACHMENTS] = &State::syncReadAttachments; + handlers[state::DIRTY_OBJECT_DRAW_ATTACHMENTS] = &State::syncDrawAttachments; + handlers[state::DIRTY_OBJECT_READ_FRAMEBUFFER] = &State::syncReadFramebuffer; + handlers[state::DIRTY_OBJECT_DRAW_FRAMEBUFFER] = &State::syncDrawFramebuffer; + handlers[state::DIRTY_OBJECT_VERTEX_ARRAY] = &State::syncVertexArray; + handlers[state::DIRTY_OBJECT_TEXTURES] = &State::syncTextures; + handlers[state::DIRTY_OBJECT_IMAGES] = &State::syncImages; + handlers[state::DIRTY_OBJECT_SAMPLERS] = &State::syncSamplers; + handlers[state::DIRTY_OBJECT_PROGRAM_PIPELINE_OBJECT] = + &State::syncProgramPipelineObject; + + return handlers; + }(); + + static_assert( + []() { + for (auto handler : kDirtyObjectHandlers) + { + if (handler == nullptr) + { + return false; + } + } + return true; + }(), + "kDirtyObjectHandlers missing a handler"); // Robust init must happen before Framebuffer init for the Vulkan back-end. static_assert(state::DIRTY_OBJECT_ACTIVE_TEXTURES < state::DIRTY_OBJECT_TEXTURES_INIT, @@ -1468,25 +1495,6 @@ class State : angle::NonCopyable static_assert(state::DIRTY_OBJECT_READ_ATTACHMENTS < state::DIRTY_OBJECT_READ_FRAMEBUFFER, "init order"); - static_assert(state::DIRTY_OBJECT_ACTIVE_TEXTURES == 0, - "check DIRTY_OBJECT_ACTIVE_TEXTURES index"); - static_assert(state::DIRTY_OBJECT_TEXTURES_INIT == 1, "check DIRTY_OBJECT_TEXTURES_INIT index"); - static_assert(state::DIRTY_OBJECT_IMAGES_INIT == 2, "check DIRTY_OBJECT_IMAGES_INIT index"); - static_assert(state::DIRTY_OBJECT_READ_ATTACHMENTS == 3, - "check DIRTY_OBJECT_READ_ATTACHMENTS index"); - static_assert(state::DIRTY_OBJECT_DRAW_ATTACHMENTS == 4, - "check DIRTY_OBJECT_DRAW_ATTACHMENTS index"); - static_assert(state::DIRTY_OBJECT_READ_FRAMEBUFFER == 5, - "check DIRTY_OBJECT_READ_FRAMEBUFFER index"); - static_assert(state::DIRTY_OBJECT_DRAW_FRAMEBUFFER == 6, - "check DIRTY_OBJECT_DRAW_FRAMEBUFFER index"); - static_assert(state::DIRTY_OBJECT_VERTEX_ARRAY == 7, "check DIRTY_OBJECT_VERTEX_ARRAY index"); - static_assert(state::DIRTY_OBJECT_TEXTURES == 8, "check DIRTY_OBJECT_TEXTURES index"); - static_assert(state::DIRTY_OBJECT_IMAGES == 9, "check DIRTY_OBJECT_IMAGES index"); - static_assert(state::DIRTY_OBJECT_SAMPLERS == 10, "check DIRTY_OBJECT_SAMPLERS index"); - static_assert(state::DIRTY_OBJECT_PROGRAM_PIPELINE_OBJECT == 11, - "check DIRTY_OBJECT_PROGRAM_PIPELINE_OBJECT index"); - // Dispatch table for buffer update functions. static const angle::PackedEnumMap<BufferBinding, BufferBindingSetter> kBufferSetters; diff --git a/src/libANGLE/capture/FrameCapture.cpp b/src/libANGLE/capture/FrameCapture.cpp index 8d3bc5f394..44a46c0607 100644 --- a/src/libANGLE/capture/FrameCapture.cpp +++ b/src/libANGLE/capture/FrameCapture.cpp @@ -1554,13 +1554,13 @@ void CaptureUpdateCurrentProgram(const CallCapture &call, callsOut->emplace_back("UpdateCurrentProgram", std::move(paramBuffer)); } -bool ProgramNeedsReset(const gl::ContextID contextID, +bool ProgramNeedsReset(const gl::Context *context, ResourceTracker *resourceTracker, gl::ShaderProgramID programID) { // Check whether the program is listed in programs to regen or restore TrackedResource &trackedShaderPrograms = - resourceTracker->getTrackedResource(contextID, ResourceIDType::ShaderProgram); + resourceTracker->getTrackedResource(context->id(), ResourceIDType::ShaderProgram); ResourceSet &shaderProgramsToRegen = trackedShaderPrograms.getResourcesToRegen(); if (shaderProgramsToRegen.count(programID.value) != 0) @@ -1574,6 +1574,13 @@ bool ProgramNeedsReset(const gl::ContextID contextID, return true; } + // Deferred linked programs will also update their own uniforms + FrameCaptureShared *frameCaptureShared = context->getShareGroup()->getFrameCaptureShared(); + if (frameCaptureShared->isDeferredLinkProgram(programID)) + { + return true; + } + return false; } @@ -1593,7 +1600,7 @@ void MaybeResetDefaultUniforms(std::stringstream &out, gl::ShaderProgramID programID = uniformIter.first; const DefaultUniformLocationsSet &locations = uniformIter.second; - if (ProgramNeedsReset(context->id(), resourceTracker, programID)) + if (ProgramNeedsReset(context, resourceTracker, programID)) { // Skip programs marked for reset as they will update their own uniforms return; @@ -4649,24 +4656,34 @@ void CaptureShareGroupMidExecutionSetup( // Capture Program binary state. gl::ShaderProgramID tempShaderStartID = {resourceTracker->getMaxShaderPrograms()}; + std::map<gl::ShaderProgramID, std::vector<gl::ShaderProgramID>> deferredAttachCalls; for (const auto &programIter : programs) { gl::ShaderProgramID id = {programIter.first}; gl::Program *program = programIter.second; - // Unlinked programs don't have an executable. Thus they don't need to be captured. + // Unlinked programs don't have an executable so track in case linking is deferred // Programs are shared by contexts in the share group and only need to be captured once. if (!program->isLinked()) { - continue; + frameCaptureShared->setDeferredLinkProgram(id); + + // Deferred attachment of shaders is not yet supported + ASSERT(program->getAttachedShadersCount()); + + // AttachShader calls will be generated at shader-handling time + for (gl::ShaderType shaderType : gl::AllShaderTypes()) + { + gl::Shader *shader = program->getAttachedShader(shaderType); + if (shader != nullptr) + { + deferredAttachCalls[shader->getHandle()].push_back(id); + } + } } size_t programSetupStart = setupCalls->size(); - // Get last linked shader source. - const ProgramSources &linkedSources = - context->getShareGroup()->getFrameCaptureShared()->getProgramSources(id); - // Create two lists for program regen calls ResourceCalls &shaderProgramRegenCalls = trackedShaderPrograms.getResourceRegenCalls(); CallVector programRegenCalls({setupCalls, &shaderProgramRegenCalls[id.value]}); @@ -4677,21 +4694,29 @@ void CaptureShareGroupMidExecutionSetup( CaptureCustomShaderProgram("CreateProgram", createProgram, *calls); } - // Create two lists for program restore calls - ResourceCalls &shaderProgramRestoreCalls = trackedShaderPrograms.getResourceRestoreCalls(); - CallVector programRestoreCalls({setupCalls, &shaderProgramRestoreCalls[id.value]}); - - for (std::vector<CallCapture> *calls : programRestoreCalls) + if (program->isLinked()) { - GenerateLinkedProgram(context, replayState, resourceTracker, calls, program, id, - tempShaderStartID, linkedSources); - } + // Get last linked shader source. + const ProgramSources &linkedSources = + context->getShareGroup()->getFrameCaptureShared()->getProgramSources(id); - // Update the program in replayState - if (!replayState.getProgram() || replayState.getProgram()->id() != program->id()) - { - // Note: We don't do this in GenerateLinkedProgram because it can't modify state - (void)replayState.setProgram(context, program); + // Create two lists for program restore calls + ResourceCalls &shaderProgramRestoreCalls = + trackedShaderPrograms.getResourceRestoreCalls(); + CallVector programRestoreCalls({setupCalls, &shaderProgramRestoreCalls[id.value]}); + + for (std::vector<CallCapture> *calls : programRestoreCalls) + { + GenerateLinkedProgram(context, replayState, resourceTracker, calls, program, id, + tempShaderStartID, linkedSources); + } + + // Update the program in replayState + if (!replayState.getProgram() || replayState.getProgram()->id() != program->id()) + { + // Note: We don't do this in GenerateLinkedProgram because it can't modify state + (void)replayState.setProgram(context, program); + } } resourceTracker->getTrackedResource(context->id(), ResourceIDType::ShaderProgram) @@ -4699,12 +4724,17 @@ void CaptureShareGroupMidExecutionSetup( .insert(id.value); resourceTracker->setShaderProgramType(id, ShaderProgramType::ProgramType); - size_t programSetupEnd = setupCalls->size(); + // Mark linked programs/shaders as inactive, leaving deferred-linked programs/shaders marked + // as active + if (!frameCaptureShared->isDeferredLinkProgram(id)) + { + size_t programSetupEnd = setupCalls->size(); - // Mark the range of calls used to setup this program - frameCaptureShared->markResourceSetupCallsInactive( - setupCalls, ResourceIDType::ShaderProgram, id.value, - gl::Range<size_t>(programSetupStart, programSetupEnd)); + // Mark the range of calls used to setup this program + frameCaptureShared->markResourceSetupCallsInactive( + setupCalls, ResourceIDType::ShaderProgram, id.value, + gl::Range<size_t>(programSetupStart, programSetupEnd)); + } } // Handle shaders. @@ -4731,6 +4761,15 @@ void CaptureShareGroupMidExecutionSetup( CallCapture createShader = CaptureCreateShader(replayState, true, shader->getType(), id.value); CaptureCustomShaderProgram("CreateShader", createShader, *calls); + + // If unlinked programs have been created which reference this shader emit corresponding + // attach calls + for (const auto deferredAttachedProgramID : deferredAttachCalls[id]) + { + CallCapture attachShader = + CaptureAttachShader(replayState, true, deferredAttachedProgramID, id); + calls->emplace_back(std::move(attachShader)); + } } std::string shaderSource = shader->getSourceString(); @@ -4740,8 +4779,8 @@ void CaptureShareGroupMidExecutionSetup( ResourceCalls &shaderProgramRestoreCalls = trackedShaderPrograms.getResourceRestoreCalls(); CallVector shaderRestoreCalls({setupCalls, &shaderProgramRestoreCalls[id.value]}); - // This does not handle some more tricky situations like attaching shaders to a non-linked - // program. Or attaching uncompiled shaders. Or attaching and then deleting a shader. + // This does not handle some more tricky situations like attaching and then deleting a + // shader. // TODO(jmadill): Handle trickier program uses. http://anglebug.com/3662 if (shader->isCompiled(context)) { @@ -4771,10 +4810,14 @@ void CaptureShareGroupMidExecutionSetup( } } - // Mark the range of calls used to setup this shader - frameCaptureShared->markResourceSetupCallsInactive( - setupCalls, ResourceIDType::ShaderProgram, id.value, - gl::Range<size_t>(shaderSetupStart, setupCalls->size())); + // Deferred-linked programs/shaders must be left marked as active + if (deferredAttachCalls[id].empty()) + { + // Mark the range of calls used to setup this shader + frameCaptureShared->markResourceSetupCallsInactive( + setupCalls, ResourceIDType::ShaderProgram, id.value, + gl::Range<size_t>(shaderSetupStart, setupCalls->size())); + } resourceTracker->getTrackedResource(context->id(), ResourceIDType::ShaderProgram) .getStartingResources() diff --git a/src/libANGLE/capture/FrameCapture.h b/src/libANGLE/capture/FrameCapture.h index 74b3a17055..7f3f26b4a4 100644 --- a/src/libANGLE/capture/FrameCapture.h +++ b/src/libANGLE/capture/FrameCapture.h @@ -711,6 +711,15 @@ class FrameCaptureShared final : angle::NonCopyable std::mutex &getFrameCaptureMutex() { return mFrameCaptureMutex; } + void setDeferredLinkProgram(gl::ShaderProgramID programID) + { + mDeferredLinkPrograms.emplace(programID); + } + bool isDeferredLinkProgram(gl::ShaderProgramID programID) + { + return (mDeferredLinkPrograms.find(programID) != mDeferredLinkPrograms.end()); + } + private: void writeJSON(const gl::Context *context); void writeCppReplayIndexFiles(const gl::Context *context, bool writeResetContextCall); @@ -804,6 +813,9 @@ class FrameCaptureShared final : angle::NonCopyable ShaderSourceMap mCachedShaderSource; ProgramSourceMap mCachedProgramSources; + // Set of programs which were created but not linked before capture was started + std::set<gl::ShaderProgramID> mDeferredLinkPrograms; + gl::ContextID mWindowSurfaceContextID; std::vector<CallCapture> mShareGroupSetupCalls; diff --git a/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp b/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp index f461da52f3..a448fb2a48 100644 --- a/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp +++ b/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp @@ -111,8 +111,60 @@ angle::Result CLCommandQueueVk::enqueueReadBuffer(const cl::Buffer &buffer, const cl::EventPtrs &waitEvents, CLEventImpl::CreateFunc *eventCreateFunc) { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + std::scoped_lock<std::mutex> sl(mCommandQueueMutex); + + ANGLE_TRY(processWaitlist(waitEvents)); + + if (blocking) + { + ANGLE_TRY(finishInternal()); + auto bufferVk = &buffer.getImpl<CLBufferVk>(); + ANGLE_TRY(bufferVk->copyTo(ptr, offset, size)); + } + else + { + CLBufferVk &bufferVk = buffer.getImpl<CLBufferVk>(); + + // Reached transfer buffer creation limit/heuristic, finish this current batch + if (mHostBufferUpdateList.size() >= kMaxHostBufferUpdateListSize) + { + ANGLE_TRY(finishInternal()); + } + + // Create a transfer buffer and push it in update list + mHostBufferUpdateList.emplace_back( + cl::Buffer::Cast(this->mContext->getFrontendObject().createBuffer( + nullptr, cl::MemFlags{buffer.getFlags().get() | CL_MEM_USE_HOST_PTR}, + buffer.getSize(), ptr))); + if (mHostBufferUpdateList.back() == nullptr) + { + ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + } + CLBufferVk &transferBufferVk = mHostBufferUpdateList.back()->getImpl<CLBufferVk>(); + // Release initialization reference, lifetime controlled by RefPointer. + mHostBufferUpdateList.back()->release(); + + const VkBufferCopy copyRegion = {offset, offset, size}; + + // We need an execution barrier if buffer can be written to by kernel + if (!mComputePassCommands->getCommandBuffer().empty() && bufferVk.isWritable()) + { + VkMemoryBarrier memoryBarrier = { + VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, VK_ACCESS_SHADER_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT}; + mComputePassCommands->getCommandBuffer().pipelineBarrier( + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, + &memoryBarrier, 0, nullptr, 0, nullptr); + } + + mComputePassCommands->getCommandBuffer().copyBuffer( + bufferVk.getBuffer().getBuffer(), transferBufferVk.getBuffer().getBuffer(), 1, + ©Region); + } + + ANGLE_TRY(createEvent(eventCreateFunc)); + + return angle::Result::Continue; } angle::Result CLCommandQueueVk::enqueueWriteBuffer(const cl::Buffer &buffer, @@ -123,8 +175,20 @@ angle::Result CLCommandQueueVk::enqueueWriteBuffer(const cl::Buffer &buffer, const cl::EventPtrs &waitEvents, CLEventImpl::CreateFunc *eventCreateFunc) { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + std::scoped_lock<std::mutex> sl(mCommandQueueMutex); + + ANGLE_TRY(processWaitlist(waitEvents)); + + auto bufferVk = &buffer.getImpl<CLBufferVk>(); + ANGLE_TRY(bufferVk->copyFrom(ptr, offset, size)); + if (blocking) + { + ANGLE_TRY(finishInternal()); + } + + ANGLE_TRY(createEvent(eventCreateFunc)); + + return angle::Result::Continue; } angle::Result CLCommandQueueVk::enqueueReadBufferRect(const cl::Buffer &buffer, @@ -379,33 +443,80 @@ angle::Result CLCommandQueueVk::enqueueNativeKernel(cl::UserFunc userFunc, angle::Result CLCommandQueueVk::enqueueMarkerWithWaitList(const cl::EventPtrs &waitEvents, CLEventImpl::CreateFunc *eventCreateFunc) { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + std::scoped_lock<std::mutex> sl(mCommandQueueMutex); + + ANGLE_TRY(processWaitlist(waitEvents)); + ANGLE_TRY(createEvent(eventCreateFunc)); + + return angle::Result::Continue; } angle::Result CLCommandQueueVk::enqueueMarker(CLEventImpl::CreateFunc &eventCreateFunc) { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + std::scoped_lock<std::mutex> sl(mCommandQueueMutex); + + // This deprecated API is essentially a super-set of clEnqueueBarrier, where we also return an + // event object (i.e. marker) since clEnqueueBarrier does not provide this + VkMemoryBarrier memoryBarrier = {VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, + VK_ACCESS_SHADER_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT}; + mComputePassCommands->getCommandBuffer().pipelineBarrier( + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, + &memoryBarrier, 0, nullptr, 0, nullptr); + + ANGLE_TRY(createEvent(&eventCreateFunc)); + + return angle::Result::Continue; } angle::Result CLCommandQueueVk::enqueueWaitForEvents(const cl::EventPtrs &events) { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + std::scoped_lock<std::mutex> sl(mCommandQueueMutex); + + // Unlike clWaitForEvents, this routine is non-blocking + ANGLE_TRY(processWaitlist(events)); + + return angle::Result::Continue; } angle::Result CLCommandQueueVk::enqueueBarrierWithWaitList(const cl::EventPtrs &waitEvents, CLEventImpl::CreateFunc *eventCreateFunc) { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + std::scoped_lock<std::mutex> sl(mCommandQueueMutex); + + // The barrier command either waits for a list of events to complete, or if the list is empty it + // waits for all commands previously enqueued in command_queue to complete before it completes + if (waitEvents.empty()) + { + VkMemoryBarrier memoryBarrier = {VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, + VK_ACCESS_SHADER_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT}; + mComputePassCommands->getCommandBuffer().pipelineBarrier( + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, + &memoryBarrier, 0, nullptr, 0, nullptr); + } + else + { + ANGLE_TRY(processWaitlist(waitEvents)); + } + + ANGLE_TRY(createEvent(eventCreateFunc)); + + return angle::Result::Continue; } angle::Result CLCommandQueueVk::enqueueBarrier() { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + std::scoped_lock<std::mutex> sl(mCommandQueueMutex); + + VkMemoryBarrier memoryBarrier = {VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, + VK_ACCESS_SHADER_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT}; + mComputePassCommands->getCommandBuffer().pipelineBarrier( + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, + &memoryBarrier, 0, nullptr, 0, nullptr); + + return angle::Result::Continue; } angle::Result CLCommandQueueVk::flush() @@ -432,6 +543,20 @@ angle::Result CLCommandQueueVk::finish() return finishInternal(); } +angle::Result CLCommandQueueVk::syncHostBuffers() +{ + for (const cl::MemoryPtr &memoryPtr : mHostBufferUpdateList) + { + ASSERT(memoryPtr->getHostPtr() != nullptr); + CLBufferVk &bufferVk = memoryPtr->getImpl<CLBufferVk>(); + ANGLE_TRY( + bufferVk.copyTo(memoryPtr->getHostPtr(), memoryPtr->getOffset(), memoryPtr->getSize())); + } + mHostBufferUpdateList.clear(); + + return angle::Result::Continue; +} + angle::Result CLCommandQueueVk::processKernelResources(CLKernelVk &kernelVk, const cl::NDRange &ndrange) { @@ -704,6 +829,9 @@ angle::Result CLCommandQueueVk::finishInternal() // Submit and wait for fence ANGLE_TRY(submitCommands()); ANGLE_TRY(mContext->getRenderer()->finishQueueSerial(mContext, mLastSubmittedQueueSerial)); + + // Ensure any resources are synced back to host on GPU completion + ANGLE_TRY(syncHostBuffers()); } for (cl::EventPtr event : mAssociatedEvents) diff --git a/src/libANGLE/renderer/vulkan/CLCommandQueueVk.h b/src/libANGLE/renderer/vulkan/CLCommandQueueVk.h index 44a387b278..68191ef166 100644 --- a/src/libANGLE/renderer/vulkan/CLCommandQueueVk.h +++ b/src/libANGLE/renderer/vulkan/CLCommandQueueVk.h @@ -14,6 +14,7 @@ #include "libANGLE/renderer/vulkan/CLContextVk.h" #include "libANGLE/renderer/vulkan/CLEventVk.h" #include "libANGLE/renderer/vulkan/CLKernelVk.h" +#include "libANGLE/renderer/vulkan/CLMemoryVk.h" #include "libANGLE/renderer/vulkan/DisplayVk.h" #include "libANGLE/renderer/vulkan/ShareGroupVk.h" #include "libANGLE/renderer/vulkan/cl_types.h" @@ -225,7 +226,8 @@ class CLCommandQueueVk : public CLCommandQueueImpl CLPlatformVk *getPlatform() { return mContext->getPlatform(); } private: - static constexpr size_t kMaxDependencyTrackerSize = 64; + static constexpr size_t kMaxDependencyTrackerSize = 64; + static constexpr size_t kMaxHostBufferUpdateListSize = 16; vk::ProtectionType getProtectionType() const { return vk::ProtectionType::Unprotected; } @@ -235,6 +237,7 @@ class CLCommandQueueVk : public CLCommandQueueImpl angle::Result submitCommands(); angle::Result finishInternal(); + angle::Result syncHostBuffers(); angle::Result flushComputePassCommands(); angle::Result processWaitlist(const cl::EventPtrs &waitEvents); angle::Result createEvent(CLEventImpl::CreateFunc *createFunc); @@ -264,6 +267,9 @@ class CLCommandQueueVk : public CLCommandQueueImpl // Check to see if flush/finish can be skipped bool mHasAnyCommandsPendingSubmission; + + // List of buffer refs that need host syncing + cl::MemoryPtrs mHostBufferUpdateList; }; } // namespace rx diff --git a/src/libANGLE/renderer/vulkan/CLContextVk.cpp b/src/libANGLE/renderer/vulkan/CLContextVk.cpp index bac0ba4bb0..5acd9a1a8a 100644 --- a/src/libANGLE/renderer/vulkan/CLContextVk.cpp +++ b/src/libANGLE/renderer/vulkan/CLContextVk.cpp @@ -15,6 +15,7 @@ #include "libANGLE/CLBuffer.h" #include "libANGLE/CLContext.h" +#include "libANGLE/CLEvent.h" #include "libANGLE/CLProgram.h" #include "libANGLE/cl_utils.h" @@ -251,8 +252,23 @@ angle::Result CLContextVk::createUserEvent(const cl::Event &event, CLEventImpl:: angle::Result CLContextVk::waitForEvents(const cl::EventPtrs &events) { - UNIMPLEMENTED(); - ANGLE_CL_RETURN_ERROR(CL_OUT_OF_RESOURCES); + for (auto &event : events) + { + CLEventVk *eventVk = &event.get()->getImpl<CLEventVk>(); + if (eventVk->isUserEvent()) + { + ANGLE_TRY(eventVk->waitForUserEventStatus()); + } + else + { + // TODO rework this to instead (flush w/ ResourceUse serial wait) once we move away from + // spawning a submit-thread/Task for flush routine + // https://anglebug.com/8669 + ANGLE_TRY(event->getCommandQueue()->finish()); + } + } + + return angle::Result::Continue; } } // namespace rx diff --git a/src/libANGLE/renderer/vulkan/CLContextVk.h b/src/libANGLE/renderer/vulkan/CLContextVk.h index a4d85a775c..87e2615799 100644 --- a/src/libANGLE/renderer/vulkan/CLContextVk.h +++ b/src/libANGLE/renderer/vulkan/CLContextVk.h @@ -91,6 +91,8 @@ class CLContextVk : public CLContextImpl, public vk::Context CLPlatformVk *getPlatform() { return &mContext.getPlatform().getImpl<CLPlatformVk>(); } + cl::Context &getFrontendObject() { return const_cast<cl::Context &>(mContext); } + private: void handleDeviceLost() const; diff --git a/src/libANGLE/renderer/vulkan/CLMemoryVk.h b/src/libANGLE/renderer/vulkan/CLMemoryVk.h index 4a859b9944..4decd44b00 100644 --- a/src/libANGLE/renderer/vulkan/CLMemoryVk.h +++ b/src/libANGLE/renderer/vulkan/CLMemoryVk.h @@ -41,6 +41,13 @@ class CLMemoryVk : public CLMemoryImpl angle::Result copyTo(CLMemoryVk *dst, size_t srcOffset, size_t dstOffset, size_t size); angle::Result copyFrom(const void *ptr, size_t offset, size_t size); + bool isWritable() + { + constexpr VkBufferUsageFlags kWritableUsage = + VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; + return (getVkUsageFlags() & kWritableUsage) != 0; + } + virtual bool isCurrentlyInUse() const = 0; virtual size_t getSize() const = 0; @@ -71,6 +78,7 @@ class CLBufferVk : public CLMemoryVk CLBufferVk *getParent() { return static_cast<CLBufferVk *>(mParent); } angle::Result create(void *hostPtr); + bool isSubBuffer() const { return mParent != nullptr; } angle::Result map() override; diff --git a/src/libGLESv2/entry_points_egl_autogen.cpp b/src/libGLESv2/entry_points_egl_autogen.cpp index e4b20fd4bf..54a0591d67 100644 --- a/src/libGLESv2/entry_points_egl_autogen.cpp +++ b/src/libGLESv2/entry_points_egl_autogen.cpp @@ -355,19 +355,15 @@ EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay() Thread *thread = egl::GetCurrentThread(); EGLDisplay returnValue; - { - ANGLE_SCOPED_GLOBAL_LOCK(); - EGL_EVENT(GetCurrentDisplay, ""); - { - ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCurrentDisplay, thread); - ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay); + EGL_EVENT(GetCurrentDisplay, ""); - returnValue = GetCurrentDisplay(thread); - } + ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay); + + returnValue = GetCurrentDisplay(thread); + + ANGLE_CAPTURE_EGL(GetCurrentDisplay, true, thread, returnValue); - ANGLE_CAPTURE_EGL(GetCurrentDisplay, true, thread, returnValue); - } ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any()); return returnValue; } @@ -377,19 +373,15 @@ EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw) Thread *thread = egl::GetCurrentThread(); EGLSurface returnValue; - { - ANGLE_SCOPED_GLOBAL_LOCK(); - EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw); - { - ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCurrentSurface, thread); - ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw); + EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw); - returnValue = GetCurrentSurface(thread, readdraw); - } + ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw); + + returnValue = GetCurrentSurface(thread, readdraw); + + ANGLE_CAPTURE_EGL(GetCurrentSurface, true, thread, readdraw, returnValue); - ANGLE_CAPTURE_EGL(GetCurrentSurface, true, thread, readdraw, returnValue); - } ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any()); return returnValue; } @@ -958,19 +950,15 @@ EGLContext EGLAPIENTRY EGL_GetCurrentContext() Thread *thread = egl::GetCurrentThread(); EGLContext returnValue; - { - ANGLE_SCOPED_GLOBAL_LOCK(); - EGL_EVENT(GetCurrentContext, ""); - { - ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCurrentContext, thread); - ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext); + EGL_EVENT(GetCurrentContext, ""); - returnValue = GetCurrentContext(thread); - } + ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext); + + returnValue = GetCurrentContext(thread); + + ANGLE_CAPTURE_EGL(GetCurrentContext, true, thread, returnValue); - ANGLE_CAPTURE_EGL(GetCurrentContext, true, thread, returnValue); - } ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any()); return returnValue; } diff --git a/src/tests/capture_tests/CapturedTest.cpp b/src/tests/capture_tests/CapturedTest.cpp index bebd6ac648..9fe2cdb38b 100644 --- a/src/tests/capture_tests/CapturedTest.cpp +++ b/src/tests/capture_tests/CapturedTest.cpp @@ -44,6 +44,61 @@ void main(void) { gl_Position = vec4(0.5, 0.5, 0.5, 1.0); })"; + static constexpr char kInactiveDeferredVS[] = R"(attribute vec4 a_position; +attribute vec2 a_texCoord; +varying vec2 v_texCoord; +void main() +{ + gl_Position = a_position; + v_texCoord = a_texCoord; +})"; + + static constexpr char kInactiveDeferredFS[] = R"(precision mediump float; +varying vec2 v_texCoord; +uniform sampler2D s_texture; +void main() +{ + gl_FragColor = vec4(0.4, 0.4, 0.4, 1.0); + gl_FragColor = texture2D(s_texture, v_texCoord); +})"; + + static constexpr char kActiveDeferredVS[] = R"(attribute vec4 a_position; +attribute vec2 a_texCoord; +varying vec2 v_texCoord; +void main() +{ + gl_Position = a_position; + v_texCoord = a_texCoord; +})"; + + // Create shaders, program but defer compiling & linking, use before capture starts + // (Inactive) + lateLinkTestVertShaderInactive = glCreateShader(GL_VERTEX_SHADER); + const char *lateLinkTestVsSourceArrayInactive[1] = {kInactiveDeferredVS}; + glShaderSource(lateLinkTestVertShaderInactive, 1, lateLinkTestVsSourceArrayInactive, 0); + lateLinkTestFragShaderInactive = glCreateShader(GL_FRAGMENT_SHADER); + const char *lateLinkTestFsSourceArrayInactive[1] = {kInactiveDeferredFS}; + glShaderSource(lateLinkTestFragShaderInactive, 1, lateLinkTestFsSourceArrayInactive, 0); + lateLinkTestProgramInactive = glCreateProgram(); + glAttachShader(lateLinkTestProgramInactive, lateLinkTestVertShaderInactive); + glAttachShader(lateLinkTestProgramInactive, lateLinkTestFragShaderInactive); + + // Create inactive program having shader shared with deferred linked program + glCompileShader(lateLinkTestVertShaderInactive); + glCompileShader(lateLinkTestFragShaderInactive); + glLinkProgram(lateLinkTestProgramInactive); + ASSERT_GL_NO_ERROR(); + + // Create vertex shader and program but defer compiling & linking until capture time + // (Active) Use fragment shader attached to inactive program + lateLinkTestVertShaderActive = glCreateShader(GL_VERTEX_SHADER); + const char *lateLinkTestVsSourceArrayActive[1] = {kActiveDeferredVS}; + glShaderSource(lateLinkTestVertShaderActive, 1, lateLinkTestVsSourceArrayActive, 0); + lateLinkTestProgramActive = glCreateProgram(); + glAttachShader(lateLinkTestProgramActive, lateLinkTestVertShaderActive); + glAttachShader(lateLinkTestProgramActive, lateLinkTestFragShaderInactive); + ASSERT_GL_NO_ERROR(); + // Create shader that is unused during capture inactiveProgram = glCreateProgram(); inactiveShader = glCreateShader(GL_VERTEX_SHADER); @@ -108,6 +163,11 @@ void main(void) { glDeleteShader(inactiveShader); glDeleteShader(activeBeforeVertShader); glDeleteShader(activeBeforeFragShader); + glDeleteProgram(lateLinkTestProgramInactive); + glDeleteProgram(lateLinkTestProgramActive); + glDeleteShader(lateLinkTestVertShaderInactive); + glDeleteShader(lateLinkTestFragShaderInactive); + glDeleteShader(lateLinkTestVertShaderActive); } static constexpr char kActiveVS[] = R"(attribute vec4 a_position; @@ -130,9 +190,17 @@ void main() void frame1(); void frame2(); void frame3(); + void frame4(); std::vector<GLuint> mFBOs; + // For testing deferred compile/link + GLuint lateLinkTestVertShaderInactive; + GLuint lateLinkTestFragShaderInactive; + GLuint lateLinkTestProgramInactive; + GLuint lateLinkTestVertShaderActive; + GLuint lateLinkTestProgramActive; + GLuint inactiveProgram; GLuint inactiveShader; @@ -226,6 +294,7 @@ void CapturedTest::frame2() 0, 255, 0, // Green 255, 0, 0, // Red }; + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -297,6 +366,67 @@ void main(void) { // Note: RAII destructors called here causing additional GL calls. } +void CapturedTest::frame4() +{ + GLuint positionLoc; + GLuint texCoordLoc; + GLuint lateLinkTestTexture; + GLint samplerLoc; + + // Deferred compile/link + glCompileShader(lateLinkTestVertShaderActive); + glLinkProgram(lateLinkTestProgramActive); + ASSERT_GL_NO_ERROR(); + + // Get the attr/sampler locations + positionLoc = glGetAttribLocation(lateLinkTestProgramActive, "a_position"); + texCoordLoc = glGetAttribLocation(lateLinkTestProgramActive, "a_texCoord"); + samplerLoc = glGetUniformLocation(lateLinkTestProgramActive, "s_texture"); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + // Bind the texture object during capture + glGenTextures(1, &lateLinkTestTexture); + glBindTexture(GL_TEXTURE_2D, lateLinkTestTexture); + ASSERT_GL_NO_ERROR(); + + const size_t width = 2; + const size_t height = 2; + GLubyte pixels[width * height * 3] = { + 255, 255, 0, // Yellow + 0, 0, 255, // Blue + 0, 255, 0, // Green + 255, 0, 0, // Red + }; + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + GLfloat vertices[] = { + -0.25f, 0.75f, 0.0f, // Position 0 + 0.0f, 0.0f, // TexCoord 0 + -0.25f, -0.25f, 0.0f, // Position 1 + 0.0f, 1.0f, // TexCoord 1 + 0.75f, -0.25f, 0.0f, // Position 2 + 1.0f, 1.0f, // TexCoord 2 + 0.75f, 0.75f, 0.0f, // Position 3 + 1.0f, 0.0f // TexCoord 3 + }; + GLushort indices[] = {0, 1, 2, 0, 2, 3}; + + glClear(GL_COLOR_BUFFER_BIT); + glUseProgram(lateLinkTestProgramActive); + glVertexAttribPointer(positionLoc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices); + glVertexAttribPointer(texCoordLoc, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices + 3); + glEnableVertexAttribArray(positionLoc); + glEnableVertexAttribArray(texCoordLoc); + glUniform1i(samplerLoc, 0); + + // Draw shaders & program created before capture + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); + EXPECT_PIXEL_EQ(108, 108, 0, 0, 255, 255); +} + // Test captured by capture_tests.py TEST_P(CapturedTest, MultiFrame) { @@ -310,6 +440,9 @@ TEST_P(CapturedTest, MultiFrame) swapBuffers(); frame3(); + swapBuffers(); + frame4(); + // Empty frames to reach capture end. for (int i = 0; i < 10; i++) { diff --git a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.angledata b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.angledata Binary files differindex 7803deae6b..88493659a7 100644 --- a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.angledata +++ b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.angledata diff --git a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.cpp b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.cpp index 269c55fc71..28cd88229d 100644 --- a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.cpp +++ b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.cpp @@ -23,14 +23,14 @@ void InitReplay(void) // maxRenderbuffer = 0 // maxSampler = 0 // maxSemaphore = 0 - // maxShaderProgram = 11 + // maxShaderProgram = 16 // maxSurface = 1 // maxSync = 0 // maxTexture = 3 // maxTransformFeedback = 0 // maxVertexArray = 1 // maxegl_Sync = 0 - InitializeReplay4("CapturedTest_MultiFrame_ES3_Vulkan.angledata", 72, 32, 1, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 11, 1, 0, 3, 0, 1, 0); + InitializeReplay4("CapturedTest_MultiFrame_ES3_Vulkan.angledata", 72, 32, 1, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0, 3, 0, 1, 0); } // Public Functions diff --git a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.h b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.h index 935550145b..50d3cc61d9 100644 --- a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.h +++ b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.h @@ -25,3 +25,4 @@ extern const char *const glShaderSource_string_1[]; extern const char *const glShaderSource_string_2[]; extern const char *const glShaderSource_string_3[]; extern const char *const glShaderSource_string_4[]; +extern const char *const glShaderSource_string_5[]; diff --git a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.json b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.json index ccb5ac4508..18a6dc9792 100644 --- a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.json +++ b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan.json @@ -1,7 +1,7 @@ { "TraceMetadata": { "AreClientArraysEnabled": true, - "CaptureRevision": 22116, + "CaptureRevision": 22823, "ConfigAlphaBits": 8, "ConfigBlueBits": 8, "ConfigDepthBits": 24, diff --git a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_001.cpp b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_001.cpp index 265589c3ad..0d41659e4d 100644 --- a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_001.cpp +++ b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_001.cpp @@ -55,8 +55,8 @@ void ReplayFrame1(void) glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (void *)gReadBuffer); glGetError(); glClear(GL_COLOR_BUFFER_BIT); - glUseProgram(gShaderProgramMap[3]); - UpdateCurrentProgram(3); + glUseProgram(gShaderProgramMap[8]); + UpdateCurrentProgram(8); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 20, gClientArrays[0]); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 20, gClientArrays[1]); glEnableVertexAttribArray(0); @@ -76,20 +76,20 @@ glDeleteVertexArrays(1, gResourceIDBuffer); void ReplayFrame2(void) { eglGetError(); - CreateProgram(6); - CreateShader(GL_VERTEX_SHADER, 7); - CreateShader(GL_FRAGMENT_SHADER, 8); - glShaderSource(gShaderProgramMap[7], 1, glShaderSource_string_0, (const GLint *)&gBinaryData[176]); - glCompileShader(gShaderProgramMap[7]); - glAttachShader(gShaderProgramMap[6], gShaderProgramMap[7]); - glShaderSource(gShaderProgramMap[8], 1, glShaderSource_string_1, (const GLint *)&gBinaryData[192]); - glCompileShader(gShaderProgramMap[8]); - glAttachShader(gShaderProgramMap[6], gShaderProgramMap[8]); - glLinkProgram(gShaderProgramMap[6]); - UpdateUniformLocation(6, "s_texture", 0, 1); - glGetAttribLocation(gShaderProgramMap[6], "a_position"); - glGetAttribLocation(gShaderProgramMap[6], "a_texCoord"); - glGetUniformLocation(gShaderProgramMap[6], "s_texture"); + CreateProgram(11); + CreateShader(GL_VERTEX_SHADER, 12); + CreateShader(GL_FRAGMENT_SHADER, 13); + glShaderSource(gShaderProgramMap[12], 1, glShaderSource_string_0, (const GLint *)&gBinaryData[176]); + glCompileShader(gShaderProgramMap[12]); + glAttachShader(gShaderProgramMap[11], gShaderProgramMap[12]); + glShaderSource(gShaderProgramMap[13], 1, glShaderSource_string_1, (const GLint *)&gBinaryData[192]); + glCompileShader(gShaderProgramMap[13]); + glAttachShader(gShaderProgramMap[11], gShaderProgramMap[13]); + glLinkProgram(gShaderProgramMap[11]); + UpdateUniformLocation(11, "s_texture", 0, 1); + glGetAttribLocation(gShaderProgramMap[11], "a_position"); + glGetAttribLocation(gShaderProgramMap[11], "a_texCoord"); + glGetUniformLocation(gShaderProgramMap[11], "s_texture"); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glGenTextures(1, (GLuint *)gReadBuffer); UpdateTextureID(3, 0); @@ -99,8 +99,8 @@ void ReplayFrame2(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 9728); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 9728); glClear(GL_COLOR_BUFFER_BIT); - glUseProgram(gShaderProgramMap[6]); - UpdateCurrentProgram(6); + glUseProgram(gShaderProgramMap[11]); + UpdateCurrentProgram(11); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 20, gClientArrays[0]); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 20, gClientArrays[1]); glEnableVertexAttribArray(0); @@ -117,10 +117,10 @@ glDeleteTextures(1, gResourceIDBuffer); glDeleteVertexArrays(1, gResourceIDBuffer); UpdateResourceIDBuffer(0, gVertexArrayMap[1]); glDeleteVertexArrays(1, gResourceIDBuffer); - glDeleteProgram(gShaderProgramMap[6]); - DeleteUniformLocations(gShaderProgramMap[6]); - glDeleteShader(gShaderProgramMap[7]); - glDeleteShader(gShaderProgramMap[8]); + glDeleteProgram(gShaderProgramMap[11]); + DeleteUniformLocations(gShaderProgramMap[11]); + glDeleteShader(gShaderProgramMap[12]); + glDeleteShader(gShaderProgramMap[13]); } void ReplayFrame3(void) @@ -129,44 +129,42 @@ void ReplayFrame3(void) glGenBuffers(1, (GLuint *)gReadBuffer); UpdateBufferID(1, 0); glBindBuffer(GL_ARRAY_BUFFER, gBufferMap[1]); - CreateProgram(9); - CreateShader(GL_VERTEX_SHADER, 10); - glShaderSource(gShaderProgramMap[10], 1, glShaderSource_string_2, (const GLint *)&gBinaryData[400]); - glCompileShader(gShaderProgramMap[10]); - glGetShaderiv(gShaderProgramMap[10], GL_COMPILE_STATUS, (GLint *)gReadBuffer); - CreateShader(GL_FRAGMENT_SHADER, 11); - glShaderSource(gShaderProgramMap[11], 1, glShaderSource_string_3, (const GLint *)&gBinaryData[416]); - glCompileShader(gShaderProgramMap[11]); - glGetShaderiv(gShaderProgramMap[11], GL_COMPILE_STATUS, (GLint *)gReadBuffer); - glAttachShader(gShaderProgramMap[9], gShaderProgramMap[10]); - glDeleteShader(gShaderProgramMap[10]); - glAttachShader(gShaderProgramMap[9], gShaderProgramMap[11]); - glDeleteShader(gShaderProgramMap[11]); - glLinkProgram(gShaderProgramMap[9]); + CreateProgram(14); + CreateShader(GL_VERTEX_SHADER, 15); + glShaderSource(gShaderProgramMap[15], 1, glShaderSource_string_2, (const GLint *)&gBinaryData[400]); + glCompileShader(gShaderProgramMap[15]); + glGetShaderiv(gShaderProgramMap[15], GL_COMPILE_STATUS, (GLint *)gReadBuffer); + CreateShader(GL_FRAGMENT_SHADER, 16); + glShaderSource(gShaderProgramMap[16], 1, glShaderSource_string_3, (const GLint *)&gBinaryData[416]); + glCompileShader(gShaderProgramMap[16]); + glGetShaderiv(gShaderProgramMap[16], GL_COMPILE_STATUS, (GLint *)gReadBuffer); + glAttachShader(gShaderProgramMap[14], gShaderProgramMap[15]); + glDeleteShader(gShaderProgramMap[15]); + glAttachShader(gShaderProgramMap[14], gShaderProgramMap[16]); + glDeleteShader(gShaderProgramMap[16]); + glLinkProgram(gShaderProgramMap[14]); glGetError(); - glGetProgramiv(gShaderProgramMap[9], GL_LINK_STATUS, (GLint *)gReadBuffer); - glBindAttribLocation(gShaderProgramMap[9], 0, "attr1"); - glLinkProgram(gShaderProgramMap[9]); + glGetProgramiv(gShaderProgramMap[14], GL_LINK_STATUS, (GLint *)gReadBuffer); + glBindAttribLocation(gShaderProgramMap[14], 0, "attr1"); + glLinkProgram(gShaderProgramMap[14]); glGetError(); - glGetProgramiv(gShaderProgramMap[9], GL_LINK_STATUS, (GLint *)gReadBuffer); - glUseProgram(gShaderProgramMap[9]); - UpdateCurrentProgram(9); + glGetProgramiv(gShaderProgramMap[14], GL_LINK_STATUS, (GLint *)gReadBuffer); + glUseProgram(gShaderProgramMap[14]); + UpdateCurrentProgram(14); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 3, GL_UNSIGNED_BYTE, GL_FALSE, 1, 0); glDrawArrays(GL_TRIANGLES, 0, 3); glGetError(); - glDeleteProgram(gShaderProgramMap[9]); - DeleteUniformLocations(gShaderProgramMap[9]); + glDeleteProgram(gShaderProgramMap[14]); + DeleteUniformLocations(gShaderProgramMap[14]); UpdateResourceIDBuffer(0, gBufferMap[1]); glDeleteBuffers(1, gResourceIDBuffer); } void ResetReplayContextShared(void) { - glUseProgram(gShaderProgramMap[3]); - UpdateCurrentProgram(3); - glUniform1iv(gUniformLocations[gCurrentProgram][0], 1, (const GLint *)&gBinaryData[432]); - glUniform1iv(gUniformLocations[gCurrentProgram][0], 1, (const GLint *)&gBinaryData[448]); + UpdateResourceIDBuffer(0, gTextureMap[3]); + glDeleteTextures(1, gResourceIDBuffer); } void ResetReplayContext1(void) @@ -176,6 +174,34 @@ void ResetReplayContext1(void) void ReplayFrame4(void) { eglGetError(); + glCompileShader(gShaderProgramMap[4]); + glLinkProgram(gShaderProgramMap[5]); + UpdateUniformLocation(5, "s_texture", 0, 1); + glGetError(); + glGetAttribLocation(gShaderProgramMap[5], "a_position"); + glGetAttribLocation(gShaderProgramMap[5], "a_texCoord"); + glGetUniformLocation(gShaderProgramMap[5], "s_texture"); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glGenTextures(1, (GLuint *)gReadBuffer); + UpdateTextureID(3, 0); + glBindTexture(GL_TEXTURE_2D, gTextureMap[3]); + glGetError(); + glTexImage2D(GL_TEXTURE_2D, 0, 6407, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, (const GLubyte *)&gBinaryData[432]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 9728); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 9728); + glClear(GL_COLOR_BUFFER_BIT); + glUseProgram(gShaderProgramMap[5]); + UpdateCurrentProgram(5); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 20, gClientArrays[0]); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 20, gClientArrays[1]); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + glUniform1i(gUniformLocations[gCurrentProgram][0], 0); + UpdateClientArrayPointer(0, (const GLubyte *)&gBinaryData[448], 72); + UpdateClientArrayPointer(1, (const GLubyte *)&gBinaryData[528], 68); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (const GLubyte *)&gBinaryData[608]); + glReadPixels(108, 108, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (void *)gReadBuffer); + glGetError(); } // Public Functions diff --git a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_shared.cpp b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_shared.cpp index bc172bb746..57e666241b 100644 --- a/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_shared.cpp +++ b/src/tests/capture_tests/expected/CapturedTest_MultiFrame_ES3_Vulkan_shared.cpp @@ -2,6 +2,16 @@ #include "CapturedTest_MultiFrame_ES3_Vulkan.h" const char *const glShaderSource_string_4[] = { +"precision mediump float;\n" +"varying vec2 v_texCoord;\n" +"uniform sampler2D s_texture;\n" +"void main()\n" +"{\n" +" gl_FragColor = vec4(0.4, 0.4, 0.4, 1.0);\n" +" gl_FragColor = texture2D(s_texture, v_texCoord);\n" +"}", +}; +const char *const glShaderSource_string_5[] = { "precision highp float;\n" "void main(void) {\n" " gl_Position = vec4(0.5, 0.5, 0.5, 1.0);\n" @@ -18,38 +28,69 @@ void SetupReplayContextShared(void) glBindTexture(GL_TEXTURE_2D, gTextureMap[2]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 9728); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 9728); - glTexImage2D(GL_TEXTURE_2D, 0, 6407, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, (const GLubyte *)&gBinaryData[464]); - CreateProgram(3); - CreateShader(GL_VERTEX_SHADER, 6); - glShaderSource(gShaderProgramMap[6], 1, glShaderSource_string_0, 0); - glCompileShader(gShaderProgramMap[6]); - glAttachShader(gShaderProgramMap[3], gShaderProgramMap[6]); - CreateShader(GL_FRAGMENT_SHADER, 7); - glShaderSource(gShaderProgramMap[7], 1, glShaderSource_string_1, 0); + glTexImage2D(GL_TEXTURE_2D, 0, 6407, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, (const GLubyte *)&gBinaryData[624]); + CreateProgram(5); + CreateProgram(6); + CreateProgram(8); + CreateShader(GL_VERTEX_SHADER, 11); + glShaderSource(gShaderProgramMap[11], 1, glShaderSource_string_0, 0); + glCompileShader(gShaderProgramMap[11]); + glAttachShader(gShaderProgramMap[8], gShaderProgramMap[11]); + CreateShader(GL_FRAGMENT_SHADER, 12); + glShaderSource(gShaderProgramMap[12], 1, glShaderSource_string_1, 0); + glCompileShader(gShaderProgramMap[12]); + glAttachShader(gShaderProgramMap[8], gShaderProgramMap[12]); + glBindAttribLocation(gShaderProgramMap[8], 0, "a_position"); + glBindAttribLocation(gShaderProgramMap[8], 1, "a_texCoord"); + glLinkProgram(gShaderProgramMap[8]); + UpdateUniformLocation(8, "s_texture", 0, 1); + glUseProgram(gShaderProgramMap[8]); + UpdateCurrentProgram(8); + glUniform1iv(gUniformLocations[gCurrentProgram][0], 1, (const GLint *)&gBinaryData[640]); + glDeleteShader(gShaderProgramMap[11]); + glDeleteShader(gShaderProgramMap[12]); + CreateShader(GL_FRAGMENT_SHADER, 2); + glAttachShader(gShaderProgramMap[5], gShaderProgramMap[2]); + glShaderSource(gShaderProgramMap[2], 1, glShaderSource_string_4, 0); + glCompileShader(gShaderProgramMap[2]); + CreateShader(GL_VERTEX_SHADER, 4); + glAttachShader(gShaderProgramMap[5], gShaderProgramMap[4]); + glShaderSource(gShaderProgramMap[4], 1, glShaderSource_string_0, 0); + CreateShader(GL_VERTEX_SHADER, 7); + glAttachShader(gShaderProgramMap[6], gShaderProgramMap[7]); + glShaderSource(gShaderProgramMap[7], 1, glShaderSource_string_5, 0); glCompileShader(gShaderProgramMap[7]); - glAttachShader(gShaderProgramMap[3], gShaderProgramMap[7]); +} + +void SetupReplayContextSharedInactive(void) +{ + CreateProgram(3); + CreateShader(GL_VERTEX_SHADER, 11); + glShaderSource(gShaderProgramMap[11], 1, glShaderSource_string_0, 0); + glCompileShader(gShaderProgramMap[11]); + glAttachShader(gShaderProgramMap[3], gShaderProgramMap[11]); + CreateShader(GL_FRAGMENT_SHADER, 12); + glShaderSource(gShaderProgramMap[12], 1, glShaderSource_string_4, 0); + glCompileShader(gShaderProgramMap[12]); + glAttachShader(gShaderProgramMap[3], gShaderProgramMap[12]); glBindAttribLocation(gShaderProgramMap[3], 0, "a_position"); glBindAttribLocation(gShaderProgramMap[3], 1, "a_texCoord"); glLinkProgram(gShaderProgramMap[3]); UpdateUniformLocation(3, "s_texture", 0, 1); glUseProgram(gShaderProgramMap[3]); UpdateCurrentProgram(3); - glUniform1iv(gUniformLocations[gCurrentProgram][0], 1, (const GLint *)&gBinaryData[480]); - glDeleteShader(gShaderProgramMap[6]); - glDeleteShader(gShaderProgramMap[7]); -} - -void SetupReplayContextSharedInactive(void) -{ - CreateShader(GL_VERTEX_SHADER, 2); - glShaderSource(gShaderProgramMap[2], 1, glShaderSource_string_4, 0); - glCompileShader(gShaderProgramMap[2]); - CreateShader(GL_VERTEX_SHADER, 4); - glShaderSource(gShaderProgramMap[4], 1, glShaderSource_string_0, 0); - glCompileShader(gShaderProgramMap[4]); - CreateShader(GL_FRAGMENT_SHADER, 5); - glShaderSource(gShaderProgramMap[5], 1, glShaderSource_string_1, 0); - glCompileShader(gShaderProgramMap[5]); + glUniform1iv(gUniformLocations[gCurrentProgram][0], 1, (const GLint *)&gBinaryData[656]); + glDeleteShader(gShaderProgramMap[11]); + glDeleteShader(gShaderProgramMap[12]); + CreateShader(GL_VERTEX_SHADER, 1); + glShaderSource(gShaderProgramMap[1], 1, glShaderSource_string_0, 0); + glCompileShader(gShaderProgramMap[1]); + CreateShader(GL_VERTEX_SHADER, 9); + glShaderSource(gShaderProgramMap[9], 1, glShaderSource_string_0, 0); + glCompileShader(gShaderProgramMap[9]); + CreateShader(GL_FRAGMENT_SHADER, 10); + glShaderSource(gShaderProgramMap[10], 1, glShaderSource_string_1, 0); + glCompileShader(gShaderProgramMap[10]); } // Public Functions diff --git a/third_party/vulkan-deps/DEPS b/third_party/vulkan-deps/DEPS index 6fc63b3a97..bab7cf543a 100644 --- a/third_party/vulkan-deps/DEPS +++ b/third_party/vulkan-deps/DEPS @@ -34,7 +34,7 @@ vars = { 'vulkan_utility_libraries_revision': 'd0ffc68fe796ffd5752b7a2cba7c4f1d80ed7283', # Current revision of Khronos Vulkan-ValidationLayers. - 'vulkan_validation_revision': '17c8bcb0e86fb2a64b53f2fab70deef326f9f73b', + 'vulkan_validation_revision': '9911e85d47930883f8a0dd7aa34c035b7c468e86', } deps = { |