From fb5a4927870d47a1a05110b5aa9f57c1e1109c8d Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 19 Apr 2022 22:25:45 +0000 Subject: [PATCH] Fix inclusive language presubmit The current presubmit has the filter inverted so it would only attempt to match the filtered files. The file name also has to be converted to `LocalPath` otherwise it's attempting to compare a python object to a string and always fails to match. Bug: dawn:1339 Change-Id: Ie7712dee60f6b9df2cb78c9feab11769f7ea1f02 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87080 Reviewed-by: Corentin Wallez Commit-Queue: Dan Sinclair Auto-Submit: Dan Sinclair --- CMakeLists.txt | 4 +- PRESUBMIT.py | 26 ++++- README.md | 2 +- README.md.dawn | 2 +- docs/dawn/codegen.md | 2 +- docs/dawn/fuzzing.md | 4 +- docs/dawn/infra.md | 2 +- docs/dawn/testing.md | 2 +- generator/templates/api_struct_info.json | 2 +- .../templates/library_api_enum_tables.js | 2 +- scripts/extract.py | 63 ++++++------ src/{Dummy.cpp => Placeholder.cpp} | 0 src/dawn/CMakeLists.txt | 10 +- src/dawn/common/CMakeLists.txt | 2 +- src/dawn/common/Preprocessor.h | 2 +- src/dawn/common/vulkan_platform.h | 2 +- src/dawn/native/CMakeLists.txt | 4 +- src/dawn/native/CommandAllocator.cpp | 6 +- src/dawn/native/CommandAllocator.h | 2 +- src/dawn/native/Device.cpp | 32 +++---- src/dawn/native/Device.h | 4 +- src/dawn/native/ExternalTexture.cpp | 2 +- src/dawn/native/ExternalTexture.h | 2 +- src/dawn/native/InternalPipelineStore.h | 2 +- src/dawn/native/PipelineLayout.cpp | 3 +- src/dawn/native/RenderPipeline.cpp | 16 ++-- src/dawn/native/RenderPipeline.h | 2 +- src/dawn/native/SubresourceStorage.h | 2 +- src/dawn/native/Toggles.cpp | 12 +-- src/dawn/native/Toggles.h | 2 +- src/dawn/native/metal/DeviceMTL.mm | 9 +- src/dawn/native/opengl/DeviceGL.cpp | 4 +- src/dawn/native/opengl/PipelineGL.cpp | 18 ++-- src/dawn/native/opengl/PipelineGL.h | 4 +- src/dawn/native/opengl/ShaderModuleGL.cpp | 20 ++-- src/dawn/native/opengl/ShaderModuleGL.h | 7 +- src/dawn/native/vulkan/CacheKeyVk.h | 2 +- src/dawn/native/vulkan/RenderPipelineVk.cpp | 6 +- src/dawn/native/vulkan/UtilsVulkan.h | 2 +- src/dawn/node/README.md | 4 +- src/dawn/node/tools/src/cmd/run-cts/main.go | 12 +-- src/dawn/platform/CMakeLists.txt | 2 +- src/dawn/samples/CMakeLists.txt | 2 +- src/dawn/tests/DawnTest.h | 2 +- .../end2end/GpuMemorySynchronizationTests.cpp | 8 +- .../tests/end2end/StorageTextureTests.cpp | 5 +- .../end2end/VertexOnlyRenderPipelineTests.cpp | 10 +- src/dawn/tests/end2end/WindowSurfaceTests.cpp | 2 +- src/dawn/tests/perf_tests/DawnPerfTest.cpp | 2 +- .../unittests/BuddyMemoryAllocatorTests.cpp | 36 +++---- .../tests/unittests/CommandAllocatorTests.cpp | 2 +- src/dawn/tests/unittests/ErrorTests.cpp | 82 +++++++++------- .../tests/unittests/PerThreadProcTests.cpp | 8 +- src/dawn/tests/unittests/ResultTests.cpp | 96 ++++++++++--------- .../tests/unittests/StackContainerTests.cpp | 22 ++--- .../validation/BindGroupValidationTests.cpp | 12 +-- .../CommandBufferValidationTests.cpp | 48 +++++----- .../validation/DebugMarkerValidationTests.cpp | 10 +- .../DrawIndirectValidationTests.cpp | 2 +- .../DynamicStateCommandValidationTests.cpp | 8 +- .../validation/IndexBufferValidationTests.cpp | 10 +- .../MinimumBufferSizeValidationTests.cpp | 2 +- .../validation/QueryValidationTests.cpp | 16 ++-- .../RenderBundleValidationTests.cpp | 26 ++--- .../validation/ResourceUsageTrackingTests.cpp | 94 +++++++++--------- .../validation/UnsafeAPIValidationTests.cpp | 2 +- .../unittests/validation/ValidationTest.cpp | 2 +- .../unittests/validation/ValidationTest.h | 4 +- .../VertexBufferValidationTests.cpp | 22 ++--- .../validation/VertexStateValidationTests.cpp | 76 +++++++-------- .../validation/VideoViewsValidationTests.cpp | 22 +++-- .../unittests/wire/WireArgumentTests.cpp | 12 +-- .../unittests/wire/WireDisconnectTests.cpp | 4 +- .../unittests/wire/WireInjectTextureTests.cpp | 4 +- .../unittests/wire/WireOptionalTests.cpp | 10 +- .../white_box/D3D12DescriptorHeapTests.cpp | 20 ++-- src/dawn/utils/CMakeLists.txt | 2 +- src/dawn/utils/Glfw3Fuchsia.cpp | 2 +- src/dawn/utils/ObjCUtils.h | 2 +- src/dawn/utils/ObjCUtils.mm | 2 +- src/dawn/wire/CMakeLists.txt | 2 +- .../spirv/parser_impl_module_var_test.cc | 10 +- test/tint/bug/tint/1118.wgsl | 4 +- test/tint/bug/tint/1118.wgsl.expected.glsl | 8 +- test/tint/bug/tint/1118.wgsl.expected.msl | 5 +- test/tint/bug/tint/1118.wgsl.expected.spvasm | 4 +- test/tint/bug/tint/1118.wgsl.expected.wgsl | 4 +- webgpu-cts/scripts/compile_src.py | 72 +++++++------- 88 files changed, 574 insertions(+), 534 deletions(-) rename src/{Dummy.cpp => Placeholder.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c410a97c6..183fb5e668 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 3.10.2) -# When upgrading to CMake 3.11 we can remove DAWN_DUMMY_FILE because source-less add_library +# When upgrading to CMake 3.11 we can remove DAWN_PLACEHOLDER_FILE because source-less add_library # becomes available. # When upgrading to CMake 3.12 we should add CONFIGURE_DEPENDS to DawnGenerator to rerun CMake in # case any of the generator files changes. We should also remove the CACHE "" FORCE stuff to @@ -46,7 +46,7 @@ set(DAWN_SRC_DIR "${Dawn_SOURCE_DIR}/src") set(DAWN_INCLUDE_DIR "${Dawn_SOURCE_DIR}/include") set(DAWN_TEMPLATE_DIR "${DAWN_GENERATOR_DIR}/templates") -set(DAWN_DUMMY_FILE "${DAWN_SRC_DIR}/Dummy.cpp") +set(DAWN_PLACEHOLDER_FILE "${DAWN_SRC_DIR}/Placeholder.cpp") ################################################################################ # Configuration options diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 8520b75d85..7872f7b805 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -80,7 +80,9 @@ def _CheckNonInclusiveLanguage(input_api, output_api, source_file_filter=None): matches = [] for f in input_api.AffectedFiles(include_deletes=False, file_filter=source_file_filter): - for line_num, line in f.ChangedContents(): + line_num = 0 + for line in f.NewContents(): + line_num += 1 for reg in NONINCLUSIVE_REGEX_LIST: match = reg.search(line) if match: @@ -99,11 +101,29 @@ def _CheckNonInclusiveLanguage(input_api, output_api, source_file_filter=None): def _NonInclusiveFileFilter(file): filter_list = [ + "Doxyfile", # References to main pages "PRESUBMIT.py", # Non-inclusive language check data + "PRESUBMIT.py.tint", # Non-inclusive language check data + "docs/dawn/debug_markers.md", # External URL + "docs/dawn/infra.md", # Infra settings "docs/tint/spirv-input-output-variables.md", # External URL - "test/tint/samples/compute_boids.wgsl ", # External URL + "infra/config/global/generated/cr-buildbucket.cfg", # Infra settings + "infra/config/global/main.star", # Infra settings + "infra/kokoro/windows/build.bat", # External URL + "src/dawn/common/GPUInfo.cpp", # External URL + "src/dawn/native/metal/BackendMTL.mm", # OSX Constant + "src/dawn/native/vulkan/SamplerVk.cpp", # External URL + "src/dawn/native/vulkan/TextureVk.cpp", # External URL + "src/dawn/node/tools/src/cmd/run-cts/main.go", # Terminal type name + "src/dawn/samples/ComputeBoids.cpp", # External URL + "src/dawn/tests/end2end/DepthBiasTests.cpp", # External URL + "test/tint/samples/compute_boids.wgsl", # External URL + "third_party/khronos/KHR/khrplatform.h", # Third party file + "tools/roll-all", # Branch name + "tools/src/container/key.go", # External URL + "tools/src/go.sum", # External URL ] - return file in filter_list + return file.LocalPath() not in filter_list def _DoCommonChecks(input_api, output_api): diff --git a/README.md b/README.md index 51049a8b52..cd3143d4cd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Dawn, a WebGPU implementation Dawn is an open-source and cross-platform implementation of the work-in-progress [WebGPU](https://webgpu.dev) standard. -More precisely it implements [`webgpu.h`](https://github.com/webgpu-native/webgpu-headers/blob/master/webgpu.h) that is a one-to-one mapping with the WebGPU IDL. +More precisely it implements [`webgpu.h`](https://github.com/webgpu-native/webgpu-headers/blob/main/webgpu.h) that is a one-to-one mapping with the WebGPU IDL. Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium. Dawn provides several WebGPU building blocks: diff --git a/README.md.dawn b/README.md.dawn index 18713889c2..0eba532359 100644 --- a/README.md.dawn +++ b/README.md.dawn @@ -3,7 +3,7 @@ # Dawn, a WebGPU implementation Dawn is an open-source and cross-platform implementation of the work-in-progress [WebGPU](https://webgpu.dev) standard. -More precisely it implements [`webgpu.h`](https://github.com/webgpu-native/webgpu-headers/blob/master/webgpu.h) that is a one-to-one mapping with the WebGPU IDL. +More precisely it implements [`webgpu.h`](https://github.com/webgpu-native/webgpu-headers/blob/main/webgpu.h) that is a one-to-one mapping with the WebGPU IDL. Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium. Dawn provides several WebGPU building blocks: diff --git a/docs/dawn/codegen.md b/docs/dawn/codegen.md index b62c449930..315364c07b 100644 --- a/docs/dawn/codegen.md +++ b/docs/dawn/codegen.md @@ -2,7 +2,7 @@ Dawn relies on a lot of code generation to produce boilerplate code, especially webgpu.h-related code. They start by reading some JSON files (and sometimes XML too), process the data into an in-memory representation that's then used by some [Jinja2](https://jinja.palletsprojects.com/) templates to generate the code. This is similar to the model/view separation in Web development. -Generators are based on [generator_lib.py](../generator/generator_lib.py) which provides facilities for integrating in build systems and using Jinja2. Templates can be found in [`generator/templates`](../generator/templates) and the generated files are in `out//gen/src` when building Dawn in standalone. Generated files can also be found in [Chromium's code search](https://source.chromium.org/chromium/chromium/src/+/master:out/Debug/gen/third_party/dawn/src/). +Generators are based on [generator_lib.py](../generator/generator_lib.py) which provides facilities for integrating in build systems and using Jinja2. Templates can be found in [`generator/templates`](../generator/templates) and the generated files are in `out//gen/src` when building Dawn in standalone. Generated files can also be found in [Chromium's code search](https://source.chromium.org/chromium/chromium/src/+/main:out/Debug/gen/third_party/dawn/src/). ## Dawn "JSON API" generators diff --git a/docs/dawn/fuzzing.md b/docs/dawn/fuzzing.md index 85219015a3..ffa1b30c58 100644 --- a/docs/dawn/fuzzing.md +++ b/docs/dawn/fuzzing.md @@ -13,6 +13,6 @@ The `dawn_wire_server_and_vulkan_backend_fuzzer` is like `dawn_wire_server_and_f Using a seed corpus significantly improves the efficiency of fuzzing. Dawn's fuzzers use interesting testcases discovered in previous fuzzing runs to seed future runs. Fuzzing can be further improved by using Dawn tests as a example of API usage which allows the fuzzer to quickly discover and use new API entrypoints and usage patterns. Dawn has a CI builder [cron-linux-clang-rel-x64](https://ci.chromium.org/p/dawn/builders/ci/cron-linux-clang-rel-x64) which runs on a periodic schedule. This bot runs the `dawn_end2end_tests` and `dawn_unittests` using the wire and writes out traces of the commands. This can manually be done by running: ` --use-wire --wire-trace-dir=tmp_dir`. The output directory will contain one trace for each test, where the traces are prepended with `0xFFFFFFFFFFFFFFFF`. The header is the callsite index at which the error injector should inject an error. If the fuzzer doesn't support error injection it will skip the header. [cron-linux-clang-rel-x64] then hashes the output files to produce unique names and uploads them to the fuzzer corpus directories. -Please see the `dawn.py`[https://source.chromium.org/chromium/chromium/tools/build/+/master:recipes/recipes/dawn.py] recipe for specific details. +Please see the `dawn.py`[https://source.chromium.org/chromium/chromium/tools/build/+/main:recipes/recipes/dawn.py] recipe for specific details. -Regenerating the seed corpus keeps it up to date when Dawn's API or wire protocol changes. \ No newline at end of file +Regenerating the seed corpus keeps it up to date when Dawn's API or wire protocol changes. diff --git a/docs/dawn/infra.md b/docs/dawn/infra.md index 605d9cad18..de9898ad34 100644 --- a/docs/dawn/infra.md +++ b/docs/dawn/infra.md @@ -6,7 +6,7 @@ Dawn uses Chromium's continuous integration (CI) infrastructure to continually r - [Dawn Try Builders](https://ci.chromium.org/p/dawn/g/try/builders) - [chromium.dawn Waterfall](https://ci.chromium.org/p/chromium/g/chromium.dawn/console) -For additional information on GPU testing in Chromium, please see [[chromium/src]//docs/gpu/gpu_testing_bot_details.md](https://chromium.googlesource.com/chromium/src.git/+/master/docs/gpu/gpu_testing_bot_details.md). +For additional information on GPU testing in Chromium, please see [[chromium/src]//docs/gpu/gpu_testing_bot_details.md](https://chromium.googlesource.com/chromium/src.git/+/main/docs/gpu/gpu_testing_bot_details.md). ## Dawn CI/Try Builders Dawn builders are specified in [[dawn]//infra/config/global/cr-buildbucket.cfg](../infra/config/global/cr-buildbucket.cfg). This file contains a few mixins such as `clang`, `no_clang`, `x64`, `x86`, `debug`, `release` which are used to specify the bot dimensions and build properties (builder_mixins.recipe.properties). At the time of writing, we have the following builders: diff --git a/docs/dawn/testing.md b/docs/dawn/testing.md index 749736ba26..454f9d0915 100644 --- a/docs/dawn/testing.md +++ b/docs/dawn/testing.md @@ -30,7 +30,7 @@ A Chromium checkout is required for the highest optimization flags. It is possib - `recording_time`: The time to convert Dawn commands to native commands. Metrics are reported according to the format specified at -[[chromium]//build/scripts/slave/performance_log_processor.py](https://cs.chromium.org/chromium/build/scripts/slave/performance_log_processor.py) +[[chromium]//build/recipes/performance_log_processor.py](https://cs.chromium.org/chromium/build/recipes/performance_log_processor.py) ### Dumping Trace Files diff --git a/generator/templates/api_struct_info.json b/generator/templates/api_struct_info.json index 04e56cfe95..65726081ad 100644 --- a/generator/templates/api_struct_info.json +++ b/generator/templates/api_struct_info.json @@ -16,7 +16,7 @@ //* This generator is used to produce part of Emscripten's struct_info.json, //* which is a list of struct fields that it uses to generate field offset //* information for its own code generators. -//* https://github.com/emscripten-core/emscripten/blob/master/src/struct_info.json +//* https://github.com/emscripten-core/emscripten/blob/main/src/struct_info.json //* { {% set api = metadata.api.lower() %} diff --git a/generator/templates/library_api_enum_tables.js b/generator/templates/library_api_enum_tables.js index 2ec4eb63cb..6732ebf73b 100644 --- a/generator/templates/library_api_enum_tables.js +++ b/generator/templates/library_api_enum_tables.js @@ -15,7 +15,7 @@ //* //* This generator is used to produce the number-to-string mappings for //* Emscripten's library_webgpu.js. -//* https://github.com/emscripten-core/emscripten/blob/master/src/library_webgpu.js +//* https://github.com/emscripten-core/emscripten/blob/main/src/library_webgpu.js //* {% for type in by_category["enum"] if not type.json_data.get("emscripten_no_enum_table") %} {{type.name.CamelCase()}}: {% if type.contiguousFromZero -%} diff --git a/scripts/extract.py b/scripts/extract.py index ed263f4921..ef040365a5 100644 --- a/scripts/extract.py +++ b/scripts/extract.py @@ -25,12 +25,11 @@ import zipfile def CheckedJoin(output, path): """ - CheckedJoin returns os.path.join(output, path). It does sanity checks to - ensure the resulting path is under output, but shouldn't be used on untrusted - input. - """ + CheckedJoin returns os.path.join(output, path). It checks that the resulting + path is under output, but shouldn't be used on untrusted input. + """ path = os.path.normpath(path) - if os.path.isabs(path) or path.startswith('.'): + if os.path.isabs(path) or path.startswith("."): raise ValueError(path) return os.path.join(output, path) @@ -51,22 +50,22 @@ class SymlinkEntry(object): def IterateZip(path): """ - IterateZip opens the zip file at path and returns a generator of entry objects - for each file in it. - """ - with zipfile.ZipFile(path, 'r') as zip_file: + IterateZip opens the zip file at path and returns a generator of entry objects + for each file in it. + """ + with zipfile.ZipFile(path, "r") as zip_file: for info in zip_file.infolist(): - if info.filename.endswith('/'): + if info.filename.endswith("/"): continue yield FileEntry(info.filename, None, zip_file.open(info)) def IterateTar(path, compression): """ - IterateTar opens the tar.gz or tar.bz2 file at path and returns a generator of - entry objects for each file in it. - """ - with tarfile.open(path, 'r:' + compression) as tar_file: + IterateTar opens the tar.gz or tar.bz2 file at path and returns a generator of + entry objects for each file in it. + """ + with tarfile.open(path, "r:" + compression) as tar_file: for info in tar_file: if info.isdir(): pass @@ -80,11 +79,13 @@ def IterateTar(path, compression): def main(args): - parser = optparse.OptionParser(usage='Usage: %prog ARCHIVE OUTPUT') - parser.add_option('--no-prefix', - dest='no_prefix', - action='store_true', - help='Do not remove a prefix from paths in the archive.') + parser = optparse.OptionParser(usage="Usage: %prog ARCHIVE OUTPUT") + parser.add_option( + "--no-prefix", + dest="no_prefix", + action="store_true", + help="Do not remove a prefix from paths in the archive.", + ) options, args = parser.parse_args(args) if len(args) != 2: @@ -97,7 +98,7 @@ def main(args): # Skip archives that weren't downloaded. return 0 - with open(archive, 'rb') as f: + with open(archive, "rb") as f: sha256 = hashlib.sha256() while True: chunk = f.read(1024 * 1024) @@ -113,12 +114,12 @@ def main(args): print("Already up-to-date.") return 0 - if archive.endswith('.zip'): + if archive.endswith(".zip"): entries = IterateZip(archive) - elif archive.endswith('.tar.gz'): - entries = IterateTar(archive, 'gz') - elif archive.endswith('.tar.bz2'): - entries = IterateTar(archive, 'bz2') + elif archive.endswith(".tar.gz"): + entries = IterateTar(archive, "gz") + elif archive.endswith(".tar.bz2"): + entries = IterateTar(archive, "bz2") else: raise ValueError(archive) @@ -132,11 +133,11 @@ def main(args): num_extracted = 0 for entry in entries: # Even on Windows, zip files must always use forward slashes. - if '\\' in entry.path or entry.path.startswith('/'): + if "\\" in entry.path or entry.path.startswith("/"): raise ValueError(entry.path) if not options.no_prefix: - new_prefix, rest = entry.path.split('/', 1) + new_prefix, rest = entry.path.split("/", 1) # Ensure the archive is consistent. if prefix is None: @@ -151,12 +152,12 @@ def main(args): if not os.path.isdir(os.path.dirname(fixed_path)): os.makedirs(os.path.dirname(fixed_path)) if isinstance(entry, FileEntry): - with open(fixed_path, 'wb') as out: + with open(fixed_path, "wb") as out: shutil.copyfileobj(entry.fileobj, out) elif isinstance(entry, SymlinkEntry): os.symlink(entry.target, fixed_path) else: - raise TypeError('unknown entry type') + raise TypeError("unknown entry type") # Fix up permissions if needbe. # TODO(davidben): To be extra tidy, this should only track the execute bit @@ -171,12 +172,12 @@ def main(args): finally: entries.close() - with open(stamp_path, 'w') as f: + with open(stamp_path, "w") as f: f.write(digest) print("Done. Extracted %d files." % (num_extracted, )) return 0 -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(main(sys.argv[1:])) diff --git a/src/Dummy.cpp b/src/Placeholder.cpp similarity index 100% rename from src/Dummy.cpp rename to src/Placeholder.cpp diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt index b2a3cbcaa3..f1f834eea1 100644 --- a/src/dawn/CMakeLists.txt +++ b/src/dawn/CMakeLists.txt @@ -63,13 +63,13 @@ DawnJSONGenerator( # Headers only INTERFACE library with generated headers don't work in CMake # because the GENERATED property is local to a directory. Instead we make a -# STATIC library with a Dummy cpp file. +# STATIC library with a placeholder cpp file. # # INTERFACE libraries can only have INTERFACE sources so the sources get added # to the dependant's list of sources. If these dependents are in another # directory, they don't see the GENERATED property and fail to configure # because the file doesn't exist on disk. -add_library(dawn_headers STATIC ${DAWN_DUMMY_FILE}) +add_library(dawn_headers STATIC ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_headers) target_sources(dawn_headers PRIVATE "${DAWN_INCLUDE_DIR}/dawn/dawn_wsi.h" @@ -89,7 +89,7 @@ DawnJSONGenerator( # This headers only library needs to be a STATIC library, see comment for # dawn_headers above. -add_library(dawncpp_headers STATIC ${DAWN_DUMMY_FILE}) +add_library(dawncpp_headers STATIC ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawncpp_headers) target_sources(dawncpp_headers PRIVATE "${DAWN_INCLUDE_DIR}/dawn/EnumClassBitmasks.h" @@ -107,7 +107,7 @@ DawnJSONGenerator( RESULT_VARIABLE "DAWNCPP_GEN_SOURCES" ) -add_library(dawncpp STATIC ${DAWN_DUMMY_FILE}) +add_library(dawncpp STATIC ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawncpp) target_sources(dawncpp PRIVATE ${DAWNCPP_GEN_SOURCES}) target_link_libraries(dawncpp PUBLIC dawncpp_headers) @@ -122,7 +122,7 @@ DawnJSONGenerator( RESULT_VARIABLE "DAWNPROC_GEN_SOURCES" ) -add_library(dawn_proc ${DAWN_DUMMY_FILE}) +add_library(dawn_proc ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_proc) target_compile_definitions(dawn_proc PRIVATE "WGPU_IMPLEMENTATION") if(BUILD_SHARED_LIBS) diff --git a/src/dawn/common/CMakeLists.txt b/src/dawn/common/CMakeLists.txt index 770d0840ba..f02acde21d 100644 --- a/src/dawn/common/CMakeLists.txt +++ b/src/dawn/common/CMakeLists.txt @@ -20,7 +20,7 @@ DawnGenerator( RESULT_VARIABLE "DAWN_VERSION_AUTOGEN_SOURCES" ) -add_library(dawn_common STATIC ${DAWN_DUMMY_FILE}) +add_library(dawn_common STATIC ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_common) target_sources(dawn_common PRIVATE ${DAWN_VERSION_AUTOGEN_SOURCES} diff --git a/src/dawn/common/Preprocessor.h b/src/dawn/common/Preprocessor.h index 458ccb3ba9..8860605258 100644 --- a/src/dawn/common/Preprocessor.h +++ b/src/dawn/common/Preprocessor.h @@ -18,7 +18,7 @@ // DAWN_PP_GET_HEAD: get the first element of a __VA_ARGS__ without triggering empty // __VA_ARGS__ warnings. #define DAWN_INTERNAL_PP_GET_HEAD(firstParam, ...) firstParam -#define DAWN_PP_GET_HEAD(...) DAWN_INTERNAL_PP_GET_HEAD(__VA_ARGS__, dummyArg) +#define DAWN_PP_GET_HEAD(...) DAWN_INTERNAL_PP_GET_HEAD(__VA_ARGS__, placeholderArg) // DAWN_PP_CONCATENATE: Concatenate tokens, first expanding the arguments passed in. #define DAWN_PP_CONCATENATE(arg1, arg2) DAWN_PP_CONCATENATE_1(arg1, arg2) diff --git a/src/dawn/common/vulkan_platform.h b/src/dawn/common/vulkan_platform.h index 1217e0a567..17d275f7ff 100644 --- a/src/dawn/common/vulkan_platform.h +++ b/src/dawn/common/vulkan_platform.h @@ -53,7 +53,7 @@ T NativeNonDispatachableHandleFromU64(uint64_t u64) { # error "Unsupported platform" #endif -// Define a dummy Vulkan handle for use before we include vulkan.h +// Define a placeholder Vulkan handle for use before we include vulkan.h DAWN_DEFINE_NATIVE_NON_DISPATCHABLE_HANDLE(VkSomeHandle) // Find out the alignment of native handles. Logically we would use alignof(VkSomeHandleNative) so diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt index 0acb7ba7b5..edeff36399 100644 --- a/src/dawn/native/CMakeLists.txt +++ b/src/dawn/native/CMakeLists.txt @@ -18,7 +18,7 @@ DawnJSONGenerator( RESULT_VARIABLE "DAWN_NATIVE_UTILS_GEN_SOURCES" ) -add_library(dawn_native ${DAWN_DUMMY_FILE}) +add_library(dawn_native ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_native) target_compile_definitions(dawn_native PRIVATE "DAWN_NATIVE_IMPLEMENTATION") @@ -555,7 +555,7 @@ DawnJSONGenerator( RESULT_VARIABLE "WEBGPU_DAWN_NATIVE_PROC_GEN" ) -add_library(webgpu_dawn ${DAWN_DUMMY_FILE}) +add_library(webgpu_dawn ${DAWN_PLACEHOLDER_FILE}) common_compile_options(webgpu_dawn) target_link_libraries(webgpu_dawn PRIVATE dawn_native) target_compile_definitions(webgpu_dawn PRIVATE "WGPU_IMPLEMENTATION") diff --git a/src/dawn/native/CommandAllocator.cpp b/src/dawn/native/CommandAllocator.cpp index eee4b6b188..587e1af37b 100644 --- a/src/dawn/native/CommandAllocator.cpp +++ b/src/dawn/native/CommandAllocator.cpp @@ -167,7 +167,7 @@ namespace dawn::native { } bool CommandAllocator::IsEmpty() const { - return mCurrentPtr == reinterpret_cast(&mDummyEnum[0]); + return mCurrentPtr == reinterpret_cast(&mPlaceholderEnum[0]); } CommandBlocks&& CommandAllocator::AcquireBlocks() { @@ -221,8 +221,8 @@ namespace dawn::native { } void CommandAllocator::ResetPointers() { - mCurrentPtr = reinterpret_cast(&mDummyEnum[0]); - mEndPtr = reinterpret_cast(&mDummyEnum[1]); + mCurrentPtr = reinterpret_cast(&mPlaceholderEnum[0]); + mEndPtr = reinterpret_cast(&mPlaceholderEnum[1]); } } // namespace dawn::native diff --git a/src/dawn/native/CommandAllocator.h b/src/dawn/native/CommandAllocator.h index 86c3d77fd9..8054d289b0 100644 --- a/src/dawn/native/CommandAllocator.h +++ b/src/dawn/native/CommandAllocator.h @@ -259,7 +259,7 @@ namespace dawn::native { // Data used for the block range at initialization so that the first call to Allocate sees // there is not enough space and calls GetNewBlock. This avoids having to special case the // initialization in Allocate. - uint32_t mDummyEnum[1] = {0}; + uint32_t mPlaceholderEnum[1] = {0}; // Pointers to the current range of allocation in the block. Guaranteed to allow for at // least one uint32_t if not nullptr, so that the special kEndOfBlock command id can always diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp index aad5eb93bb..d4e593daae 100644 --- a/src/dawn/native/Device.cpp +++ b/src/dawn/native/Device.cpp @@ -160,9 +160,9 @@ namespace dawn::native { if (descriptor.layout == nullptr) { // Ref will keep the pipeline layout alive until the end of the function where // the pipeline will take another reference. - DAWN_TRY_ASSIGN(layoutRef, - PipelineLayoutBase::CreateDefault( - device, GetRenderStagesAndSetDummyShader(device, &descriptor))); + DAWN_TRY_ASSIGN(layoutRef, PipelineLayoutBase::CreateDefault( + device, GetRenderStagesAndSetPlaceholderShader( + device, &descriptor))); outDescriptor->layout = layoutRef.Get(); } @@ -267,8 +267,8 @@ namespace dawn::native { DAWN_TRY_ASSIGN(mEmptyBindGroupLayout, CreateEmptyBindGroupLayout()); - // If dummy fragment shader module is needed, initialize it - if (IsToggleEnabled(Toggle::UseDummyFragmentInVertexOnlyPipeline)) { + // If placeholder fragment shader module is needed, initialize it + if (IsToggleEnabled(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline)) { // The empty fragment shader, used as a work around for vertex-only render pipeline constexpr char kEmptyFragmentShader[] = R"( @stage(fragment) fn fs_empty_main() {} @@ -278,7 +278,7 @@ namespace dawn::native { wgslDesc.source = kEmptyFragmentShader; descriptor.nextInChain = &wgslDesc; - DAWN_TRY_ASSIGN(mInternalPipelineStore->dummyFragmentShader, + DAWN_TRY_ASSIGN(mInternalPipelineStore->placeholderFragmentShader, CreateShaderModule(&descriptor)); } @@ -414,7 +414,7 @@ namespace dawn::native { mPersistentCache = nullptr; mEmptyBindGroupLayout = nullptr; mInternalPipelineStore = nullptr; - mExternalTextureDummyView = nullptr; + mExternalTexturePlaceholderView = nullptr; AssumeCommandsComplete(); @@ -811,17 +811,17 @@ namespace dawn::native { } ResultOrError> - DeviceBase::GetOrCreateDummyTextureViewForExternalTexture() { - if (!mExternalTextureDummyView.Get()) { - Ref externalTextureDummy; + DeviceBase::GetOrCreatePlaceholderTextureViewForExternalTexture() { + if (!mExternalTexturePlaceholderView.Get()) { + Ref externalTexturePlaceholder; TextureDescriptor textureDesc; textureDesc.dimension = wgpu::TextureDimension::e2D; textureDesc.format = wgpu::TextureFormat::RGBA8Unorm; - textureDesc.label = "Dawn_External_Texture_Dummy_Texture"; + textureDesc.label = "Dawn_External_Texture_Placeholder_Texture"; textureDesc.size = {1, 1, 1}; textureDesc.usage = wgpu::TextureUsage::TextureBinding; - DAWN_TRY_ASSIGN(externalTextureDummy, CreateTexture(&textureDesc)); + DAWN_TRY_ASSIGN(externalTexturePlaceholder, CreateTexture(&textureDesc)); TextureViewDescriptor textureViewDesc; textureViewDesc.arrayLayerCount = 1; @@ -829,14 +829,14 @@ namespace dawn::native { textureViewDesc.baseArrayLayer = 0; textureViewDesc.dimension = wgpu::TextureViewDimension::e2D; textureViewDesc.format = wgpu::TextureFormat::RGBA8Unorm; - textureViewDesc.label = "Dawn_External_Texture_Dummy_Texture_View"; + textureViewDesc.label = "Dawn_External_Texture_Placeholder_Texture_View"; textureViewDesc.mipLevelCount = 1; - DAWN_TRY_ASSIGN(mExternalTextureDummyView, - CreateTextureView(externalTextureDummy.Get(), &textureViewDesc)); + DAWN_TRY_ASSIGN(mExternalTexturePlaceholderView, + CreateTextureView(externalTexturePlaceholder.Get(), &textureViewDesc)); } - return mExternalTextureDummyView; + return mExternalTexturePlaceholderView; } ResultOrError> DeviceBase::GetOrCreatePipelineLayout( diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h index e2fd4513da..1f2a727091 100644 --- a/src/dawn/native/Device.h +++ b/src/dawn/native/Device.h @@ -172,7 +172,7 @@ namespace dawn::native { void UncacheComputePipeline(ComputePipelineBase* obj); - ResultOrError> GetOrCreateDummyTextureViewForExternalTexture(); + ResultOrError> GetOrCreatePlaceholderTextureViewForExternalTexture(); ResultOrError> GetOrCreatePipelineLayout( const PipelineLayoutDescriptor* descriptor); @@ -512,7 +512,7 @@ namespace dawn::native { Ref mEmptyBindGroupLayout; - Ref mExternalTextureDummyView; + Ref mExternalTexturePlaceholderView; std::unique_ptr mDynamicUploader; std::unique_ptr mAsyncTaskManager; diff --git a/src/dawn/native/ExternalTexture.cpp b/src/dawn/native/ExternalTexture.cpp index 1570825489..8d204c5fdf 100644 --- a/src/dawn/native/ExternalTexture.cpp +++ b/src/dawn/native/ExternalTexture.cpp @@ -130,7 +130,7 @@ namespace dawn::native { mTextureViews[1] = descriptor->plane1; } else { DAWN_TRY_ASSIGN(mTextureViews[1], - device->GetOrCreateDummyTextureViewForExternalTexture()); + device->GetOrCreatePlaceholderTextureViewForExternalTexture()); } // We must create a buffer to store parameters needed by a shader that operates on this diff --git a/src/dawn/native/ExternalTexture.h b/src/dawn/native/ExternalTexture.h index 17977b4b4a..694ab73bd7 100644 --- a/src/dawn/native/ExternalTexture.h +++ b/src/dawn/native/ExternalTexture.h @@ -66,7 +66,7 @@ namespace dawn::native { ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag); MaybeError Initialize(DeviceBase* device, const ExternalTextureDescriptor* descriptor); - Ref mDummyTexture; + Ref mPlaceholderTexture; Ref mParamsBuffer; std::array, kMaxPlanesPerFormat> mTextureViews; diff --git a/src/dawn/native/InternalPipelineStore.h b/src/dawn/native/InternalPipelineStore.h index 9cceaa7127..d23363e230 100644 --- a/src/dawn/native/InternalPipelineStore.h +++ b/src/dawn/native/InternalPipelineStore.h @@ -41,7 +41,7 @@ namespace dawn::native { Ref timestampComputePipeline; Ref timestampCS; - Ref dummyFragmentShader; + Ref placeholderFragmentShader; // A scratch buffer suitable for use as a copy destination and storage binding. ScratchBuffer scratchStorage; diff --git a/src/dawn/native/PipelineLayout.cpp b/src/dawn/native/PipelineLayout.cpp index 56ab100422..7faa2c0dec 100644 --- a/src/dawn/native/PipelineLayout.cpp +++ b/src/dawn/native/PipelineLayout.cpp @@ -325,8 +325,7 @@ namespace dawn::native { DAWN_TRY_ASSIGN(result, device->GetOrCreatePipelineLayout(&desc)); ASSERT(!result->IsError()); - // Sanity check in debug that the pipeline layout is compatible with the current - // pipeline. + // Check in debug that the pipeline layout is compatible with the current pipeline. for (const StageAndDescriptor& stage : stages) { const EntryPointMetadata& metadata = stage.module->GetEntryPoint(stage.entryPoint); ASSERT(ValidateCompatibilityWithPipelineLayout(device, metadata, result.Get()) diff --git a/src/dawn/native/RenderPipeline.cpp b/src/dawn/native/RenderPipeline.cpp index 95ab3128f9..79d4add164 100644 --- a/src/dawn/native/RenderPipeline.cpp +++ b/src/dawn/native/RenderPipeline.cpp @@ -473,7 +473,7 @@ namespace dawn::native { return {}; } - std::vector GetRenderStagesAndSetDummyShader( + std::vector GetRenderStagesAndSetPlaceholderShader( DeviceBase* device, const RenderPipelineDescriptor* descriptor) { std::vector stages; @@ -484,13 +484,13 @@ namespace dawn::native { stages.push_back({SingleShaderStage::Fragment, descriptor->fragment->module, descriptor->fragment->entryPoint, descriptor->fragment->constantCount, descriptor->fragment->constants}); - } else if (device->IsToggleEnabled(Toggle::UseDummyFragmentInVertexOnlyPipeline)) { + } else if (device->IsToggleEnabled(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline)) { InternalPipelineStore* store = device->GetInternalPipelineStore(); - // The dummy fragment shader module should already be initialized - DAWN_ASSERT(store->dummyFragmentShader != nullptr); - ShaderModuleBase* dummyFragmentShader = store->dummyFragmentShader.Get(); - stages.push_back( - {SingleShaderStage::Fragment, dummyFragmentShader, "fs_empty_main", 0, nullptr}); + // The placeholder fragment shader module should already be initialized + DAWN_ASSERT(store->placeholderFragmentShader != nullptr); + ShaderModuleBase* placeholderFragmentShader = store->placeholderFragmentShader.Get(); + stages.push_back({SingleShaderStage::Fragment, placeholderFragmentShader, + "fs_empty_main", 0, nullptr}); } return stages; } @@ -513,7 +513,7 @@ namespace dawn::native { : PipelineBase(device, descriptor->layout, descriptor->label, - GetRenderStagesAndSetDummyShader(device, descriptor)), + GetRenderStagesAndSetPlaceholderShader(device, descriptor)), mAttachmentState(device->GetOrCreateAttachmentState(descriptor)) { mVertexBufferCount = descriptor->vertex.bufferCount; const VertexBufferLayout* buffers = descriptor->vertex.buffers; diff --git a/src/dawn/native/RenderPipeline.h b/src/dawn/native/RenderPipeline.h index 4e3c699716..e317764d6d 100644 --- a/src/dawn/native/RenderPipeline.h +++ b/src/dawn/native/RenderPipeline.h @@ -33,7 +33,7 @@ namespace dawn::native { MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device, const RenderPipelineDescriptor* descriptor); - std::vector GetRenderStagesAndSetDummyShader( + std::vector GetRenderStagesAndSetPlaceholderShader( DeviceBase* device, const RenderPipelineDescriptor* descriptor); diff --git a/src/dawn/native/SubresourceStorage.h b/src/dawn/native/SubresourceStorage.h index bdee929af9..b2d2cbb710 100644 --- a/src/dawn/native/SubresourceStorage.h +++ b/src/dawn/native/SubresourceStorage.h @@ -91,7 +91,7 @@ namespace dawn::native { // The implementation of functions in this file can have a lot of control flow and corner cases // so each modification should come with extensive tests and ensure 100% code coverage of the // modified functions. See instructions at - // https://chromium.googlesource.com/chromium/src/+/master/docs/testing/code_coverage.md#local-coverage-script + // https://chromium.googlesource.com/chromium/src/+/main/docs/testing/code_coverage.md#local-coverage-script // to run the test with code coverage. A command line that worked in the past (with the right // GN args for the out/coverage directory in a Chromium checkout) is: // diff --git a/src/dawn/native/Toggles.cpp b/src/dawn/native/Toggles.cpp index 9b3a65517c..a807c41150 100644 --- a/src/dawn/native/Toggles.cpp +++ b/src/dawn/native/Toggles.cpp @@ -232,11 +232,11 @@ namespace dawn::native { "Disables mipmaps for r8unorm and rg8unorm textures, which are known on some drivers " "to not clear correctly.", "https://crbug.com/dawn/1071"}}, - {Toggle::UseDummyFragmentInVertexOnlyPipeline, - {"use_dummy_fragment_in_vertex_only_pipeline", - "Use a dummy empty fragment shader in vertex only render pipeline. This toggle must " - "be enabled for OpenGL ES backend, and serves as a workaround by default enabled on " - "some Metal devices with Intel GPU to ensure the depth result is correct.", + {Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, + {"use_placeholder_fragment_in_vertex_only_pipeline", + "Use a placeholder empty fragment shader in vertex only render pipeline. This toggle " + "must be enabled for OpenGL ES backend, and serves as a workaround by default " + "enabled on some Metal devices with Intel GPU to ensure the depth result is correct.", "https://crbug.com/dawn/136"}}, {Toggle::FxcOptimizations, {"fxc_optimizations", @@ -260,7 +260,7 @@ namespace dawn::native { "VK_KHR_zero_initialize_workgroup_memory is supported.", "https://crbug.com/dawn/1302"}}, - // Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle. + // Comment to separate the }} so it is clearer what to copy-paste to add a toggle. }}; } // anonymous namespace diff --git a/src/dawn/native/Toggles.h b/src/dawn/native/Toggles.h index 883d0239d5..f197a8eafe 100644 --- a/src/dawn/native/Toggles.h +++ b/src/dawn/native/Toggles.h @@ -61,7 +61,7 @@ namespace dawn::native { DisableSymbolRenaming, UseUserDefinedLabelsInBackend, DisableR8RG8Mipmaps, - UseDummyFragmentInVertexOnlyPipeline, + UsePlaceholderFragmentInVertexOnlyPipeline, FxcOptimizations, RecordDetailedTimingInTraceEvents, DisableTimestampQueryConversion, diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm index 91916123ac..375f1cbc27 100644 --- a/src/dawn/native/metal/DeviceMTL.mm +++ b/src/dawn/native/metal/DeviceMTL.mm @@ -217,13 +217,14 @@ namespace dawn::native::metal { } // On some Intel GPU vertex only render pipeline get wrong depth result if no fragment - // shader provided. Create a dummy fragment shader module to work around this issue. + // shader provided. Create a placeholder fragment shader module to work around this issue. if (gpu_info::IsIntel(vendorId)) { - bool useDummyFragmentShader = true; + bool usePlaceholderFragmentShader = true; if (gpu_info::IsSkylake(deviceId)) { - useDummyFragmentShader = false; + usePlaceholderFragmentShader = false; } - SetToggle(Toggle::UseDummyFragmentInVertexOnlyPipeline, useDummyFragmentShader); + SetToggle(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, + usePlaceholderFragmentShader); } } diff --git a/src/dawn/native/opengl/DeviceGL.cpp b/src/dawn/native/opengl/DeviceGL.cpp index 6ca733d3b4..b3a8442e01 100644 --- a/src/dawn/native/opengl/DeviceGL.cpp +++ b/src/dawn/native/opengl/DeviceGL.cpp @@ -99,8 +99,8 @@ namespace dawn::native::opengl { SetToggle(Toggle::DisableDepthStencilRead, !supportsDepthStencilRead); SetToggle(Toggle::DisableSampleVariables, !supportsSampleVariables); SetToggle(Toggle::FlushBeforeClientWaitSync, gl.GetVersion().IsES()); - // For OpenGL ES, we must use dummy fragment shader for vertex-only render pipeline. - SetToggle(Toggle::UseDummyFragmentInVertexOnlyPipeline, gl.GetVersion().IsES()); + // For OpenGL ES, we must use a placeholder fragment shader for vertex-only render pipeline. + SetToggle(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, gl.GetVersion().IsES()); } const GLFormat& Device::GetGLFormat(const Format& format) { diff --git a/src/dawn/native/opengl/PipelineGL.cpp b/src/dawn/native/opengl/PipelineGL.cpp index dff1fdb3dd..e8168599f2 100644 --- a/src/dawn/native/opengl/PipelineGL.cpp +++ b/src/dawn/native/opengl/PipelineGL.cpp @@ -87,26 +87,26 @@ namespace dawn::native::opengl { // Create an OpenGL shader for each stage and gather the list of combined samplers. PerStage combinedSamplers; - bool needsDummySampler = false; + bool needsPlaceholderSampler = false; std::vector glShaders; for (SingleShaderStage stage : IterateStages(activeStages)) { const ShaderModule* module = ToBackend(stages[stage].module.Get()); std::string glsl; DAWN_TRY_ASSIGN(glsl, module->TranslateToGLSL(stages[stage].entryPoint.c_str(), stage, &combinedSamplers[stage], layout, - &needsDummySampler)); + &needsPlaceholderSampler)); GLuint shader; DAWN_TRY_ASSIGN(shader, CreateShader(gl, GLShaderType(stage), glsl.c_str())); gl.AttachShader(mProgram, shader); glShaders.push_back(shader); } - if (needsDummySampler) { + if (needsPlaceholderSampler) { SamplerDescriptor desc = {}; ASSERT(desc.minFilter == wgpu::FilterMode::Nearest); ASSERT(desc.magFilter == wgpu::FilterMode::Nearest); ASSERT(desc.mipmapFilter == wgpu::FilterMode::Nearest); - mDummySampler = + mPlaceholderSampler = ToBackend(layout->GetDevice()->GetOrCreateSampler(&desc).AcquireSuccess()); } @@ -164,8 +164,8 @@ namespace dawn::native::opengl { wgpu::TextureSampleType::Float; } { - if (combined.useDummySampler) { - mDummySamplerUnits.push_back(textureUnit); + if (combined.usePlaceholderSampler) { + mPlaceholderSamplerUnits.push_back(textureUnit); } else { const BindGroupLayoutBase* bgl = layout->GetBindGroupLayout(combined.samplerLocation.group); @@ -209,9 +209,9 @@ namespace dawn::native::opengl { void PipelineGL::ApplyNow(const OpenGLFunctions& gl) { gl.UseProgram(mProgram); - for (GLuint unit : mDummySamplerUnits) { - ASSERT(mDummySampler.Get() != nullptr); - gl.BindSampler(unit, mDummySampler->GetNonFilteringHandle()); + for (GLuint unit : mPlaceholderSamplerUnits) { + ASSERT(mPlaceholderSampler.Get() != nullptr); + gl.BindSampler(unit, mPlaceholderSampler->GetNonFilteringHandle()); } } diff --git a/src/dawn/native/opengl/PipelineGL.h b/src/dawn/native/opengl/PipelineGL.h index 6c18fcdb9d..645bae95a3 100644 --- a/src/dawn/native/opengl/PipelineGL.h +++ b/src/dawn/native/opengl/PipelineGL.h @@ -58,10 +58,10 @@ namespace dawn::native::opengl { GLuint mProgram; std::vector> mUnitsForSamplers; std::vector> mUnitsForTextures; - std::vector mDummySamplerUnits; + std::vector mPlaceholderSamplerUnits; // TODO(enga): This could live on the Device, or elsewhere, but currently it makes Device // destruction complex as it requires the sampler to be destroyed before the sampler cache. - Ref mDummySampler; + Ref mPlaceholderSampler; }; } // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/ShaderModuleGL.cpp b/src/dawn/native/opengl/ShaderModuleGL.cpp index 6a6fd6a5d9..82adc14209 100644 --- a/src/dawn/native/opengl/ShaderModuleGL.cpp +++ b/src/dawn/native/opengl/ShaderModuleGL.cpp @@ -39,15 +39,15 @@ namespace dawn::native::opengl { } bool operator<(const CombinedSampler& a, const CombinedSampler& b) { - return std::tie(a.useDummySampler, a.samplerLocation, a.textureLocation) < - std::tie(b.useDummySampler, a.samplerLocation, b.textureLocation); + return std::tie(a.usePlaceholderSampler, a.samplerLocation, a.textureLocation) < + std::tie(b.usePlaceholderSampler, a.samplerLocation, b.textureLocation); } std::string CombinedSampler::GetName() const { std::ostringstream o; o << "dawn_combined"; - if (useDummySampler) { - o << "_dummy_sampler"; + if (usePlaceholderSampler) { + o << "_placeholder_sampler"; } else { o << "_" << static_cast(samplerLocation.group) << "_" << static_cast(samplerLocation.binding); @@ -82,7 +82,7 @@ namespace dawn::native::opengl { SingleShaderStage stage, CombinedSamplerInfo* combinedSamplers, const PipelineLayout* layout, - bool* needsDummySampler) const { + bool* needsPlaceholderSampler) const { TRACE_EVENT0(GetDevice()->GetPlatform(), General, "TranslateToGLSL"); tint::transform::Manager transformManager; tint::transform::DataMap transformInputs; @@ -111,7 +111,7 @@ namespace dawn::native::opengl { // of the original texture and sampler, and generates a unique name. The // corresponding uniforms will be retrieved by these generated names // in PipelineGL. Any texture-only references will have - // "useDummySampler" set to true, and only the texture binding point + // "usePlaceholderSampler" set to true, and only the texture binding point // will be used in naming them. In addition, Dawn will bind a // non-filtering sampler for them (see PipelineGL). auto uses = inspector.GetSamplerTextureUses(entryPointName, placeholderBindingPoint); @@ -120,10 +120,10 @@ namespace dawn::native::opengl { CombinedSampler* info = &combinedSamplers->back(); if (use.sampler_binding_point == placeholderBindingPoint) { - info->useDummySampler = true; - *needsDummySampler = true; + info->usePlaceholderSampler = true; + *needsPlaceholderSampler = true; } else { - info->useDummySampler = false; + info->usePlaceholderSampler = false; } info->samplerLocation.group = BindGroupIndex(use.sampler_binding_point.group); info->samplerLocation.binding = BindingNumber(use.sampler_binding_point.binding); @@ -131,7 +131,7 @@ namespace dawn::native::opengl { info->textureLocation.binding = BindingNumber(use.texture_binding_point.binding); tintOptions.binding_map[use] = info->GetName(); } - if (*needsDummySampler) { + if (*needsPlaceholderSampler) { tintOptions.placeholder_binding_point = placeholderBindingPoint; } diff --git a/src/dawn/native/opengl/ShaderModuleGL.h b/src/dawn/native/opengl/ShaderModuleGL.h index 89fecee919..ab8782af36 100644 --- a/src/dawn/native/opengl/ShaderModuleGL.h +++ b/src/dawn/native/opengl/ShaderModuleGL.h @@ -36,8 +36,9 @@ namespace dawn::native::opengl { BindingLocation samplerLocation; BindingLocation textureLocation; // OpenGL requires a sampler with texelFetch. If this is true, the developer did not provide - // one and Dawn should bind a dummy non-filtering sampler. |samplerLocation| is unused. - bool useDummySampler; + // one and Dawn should bind a placeholder non-filtering sampler. |samplerLocation| is + // unused. + bool usePlaceholderSampler; std::string GetName() const; }; bool operator<(const CombinedSampler& a, const CombinedSampler& b); @@ -57,7 +58,7 @@ namespace dawn::native::opengl { SingleShaderStage stage, CombinedSamplerInfo* combinedSamplers, const PipelineLayout* layout, - bool* needsDummySampler) const; + bool* needsPlaceholderSampler) const; private: ShaderModule(Device* device, const ShaderModuleDescriptor* descriptor); diff --git a/src/dawn/native/vulkan/CacheKeyVk.h b/src/dawn/native/vulkan/CacheKeyVk.h index 795d115af2..504c22f5f7 100644 --- a/src/dawn/native/vulkan/CacheKeyVk.h +++ b/src/dawn/native/vulkan/CacheKeyVk.h @@ -72,7 +72,7 @@ namespace dawn::native::vulkan { template const VkBaseOutStructure* ToVkBaseOutStructure(const VK_STRUCT_TYPE* t) { - // Sanity checks to ensure proper type safety. + // Checks to ensure proper type safety. static_assert( offsetof(VK_STRUCT_TYPE, sType) == offsetof(VkBaseOutStructure, sType) && offsetof(VK_STRUCT_TYPE, pNext) == offsetof(VkBaseOutStructure, pNext), diff --git a/src/dawn/native/vulkan/RenderPipelineVk.cpp b/src/dawn/native/vulkan/RenderPipelineVk.cpp index 9b5349dcea..3345a21359 100644 --- a/src/dawn/native/vulkan/RenderPipelineVk.cpp +++ b/src/dawn/native/vulkan/RenderPipelineVk.cpp @@ -397,8 +397,8 @@ namespace dawn::native::vulkan { inputAssembly.topology = VulkanPrimitiveTopology(GetPrimitiveTopology()); inputAssembly.primitiveRestartEnable = ShouldEnablePrimitiveRestart(GetPrimitiveTopology()); - // A dummy viewport/scissor info. The validation layers force use to provide at least one - // scissor and one viewport here, even if we choose to make them dynamic. + // A placeholder viewport/scissor info. The validation layers force use to provide at least + // one scissor and one viewport here, even if we choose to make them dynamic. VkViewport viewportDesc; viewportDesc.x = 0.0f; viewportDesc.y = 0.0f; @@ -490,7 +490,7 @@ namespace dawn::native::vulkan { colorBlend.logicOp = VK_LOGIC_OP_CLEAR; colorBlend.attachmentCount = static_cast(highestColorAttachmentIndexPlusOne); colorBlend.pAttachments = colorBlendAttachments.data(); - // The blend constant is always dynamic so we fill in a dummy value + // The blend constant is always dynamic so we fill in a placeholder value colorBlend.blendConstants[0] = 0.0f; colorBlend.blendConstants[1] = 0.0f; colorBlend.blendConstants[2] = 0.0f; diff --git a/src/dawn/native/vulkan/UtilsVulkan.h b/src/dawn/native/vulkan/UtilsVulkan.h index 650fe6fc88..4d2c0c1c85 100644 --- a/src/dawn/native/vulkan/UtilsVulkan.h +++ b/src/dawn/native/vulkan/UtilsVulkan.h @@ -68,7 +68,7 @@ namespace dawn::native::vulkan { // that is already initialized. template void Add(VK_STRUCT_TYPE* vkStruct) { - // Sanity checks to ensure proper type safety. + // Checks to ensure proper type safety. static_assert( offsetof(VK_STRUCT_TYPE, sType) == offsetof(VkBaseOutStructure, sType) && offsetof(VK_STRUCT_TYPE, pNext) == offsetof(VkBaseOutStructure, pNext), diff --git a/src/dawn/node/README.md b/src/dawn/node/README.md index 1d31764964..03c93512a7 100644 --- a/src/dawn/node/README.md +++ b/src/dawn/node/README.md @@ -101,7 +101,7 @@ Open or create the `.vscode/launch.json` file, and add: "outFiles": [ "./**/*.js" ], "args": [ "-e", "require('./src/common/tools/setup-ts-in-node.js');require('./src/common/runtime/cmdline.ts');", - "--", "dummy-arg", + "--", "placeholder-arg", "--gpu-provider", "[path-to-dawn.node]", // REPLACE: [path-to-dawn.node] "[test-query]", // REPLACE: [test-query] @@ -127,7 +127,7 @@ cd [path-to-node] \ # for example /third_party/node//node -e "require('./src/common/tools/setup-ts-in-node.js');require('./src/common/runtime/cmdline.ts');" \ -- \ - dummy-arg \ + placeholder-arg \ --gpu-provider [path to dawn.node] \ [test-query] ``` diff --git a/src/dawn/node/tools/src/cmd/run-cts/main.go b/src/dawn/node/tools/src/cmd/run-cts/main.go index 28eb60dd1d..b83824fef7 100644 --- a/src/dawn/node/tools/src/cmd/run-cts/main.go +++ b/src/dawn/node/tools/src/cmd/run-cts/main.go @@ -457,8 +457,8 @@ func (r *runner) gatherTestCases(query string, verbose bool) error { "--", // Start of arguments // src/common/runtime/helper/sys.ts expects 'node file.js ' // and slices away the first two arguments. When running with '-e', args - // start at 1, so just inject a dummy argument. - "dummy-arg", + // start at 1, so just inject a placeholder argument. + "placeholder-arg", "--list", }, query) @@ -603,8 +603,8 @@ func (r *runner) runServer(id int, caseIndices <-chan int, results chan<- result "--", // src/common/runtime/helper/sys.ts expects 'node file.js ' // and slices away the first two arguments. When running with '-e', args - // start at 1, so just inject a dummy argument. - "dummy-arg", + // start at 1, so just inject a placeholder argument. + "placeholder-arg", // Actual arguments begin here "--gpu-provider", r.dawnNode, } @@ -940,8 +940,8 @@ func (r *runner) runTestcase(query string) result { "--", // src/common/runtime/helper/sys.ts expects 'node file.js ' // and slices away the first two arguments. When running with '-e', args - // start at 1, so just inject a dummy argument. - "dummy-arg", + // start at 1, so just inject a placeholder argument. + "placeholder-arg", // Actual arguments begin here "--gpu-provider", r.dawnNode, "--verbose", diff --git a/src/dawn/platform/CMakeLists.txt b/src/dawn/platform/CMakeLists.txt index c1dfaf9c02..d9625a7411 100644 --- a/src/dawn/platform/CMakeLists.txt +++ b/src/dawn/platform/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(dawn_platform ${DAWN_DUMMY_FILE}) +add_library(dawn_platform ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_platform) target_compile_definitions(dawn_platform PRIVATE "DAWN_PLATFORM_IMPLEMENTATION") diff --git a/src/dawn/samples/CMakeLists.txt b/src/dawn/samples/CMakeLists.txt index 07d596edba..1a8e007dd9 100644 --- a/src/dawn/samples/CMakeLists.txt +++ b/src/dawn/samples/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(dawn_sample_utils STATIC ${DAWN_DUMMY_FILE}) +add_library(dawn_sample_utils STATIC ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_sample_utils) target_sources(dawn_sample_utils PRIVATE "SampleUtils.cpp" diff --git a/src/dawn/tests/DawnTest.h b/src/dawn/tests/DawnTest.h index 1bf396a708..6004762223 100644 --- a/src/dawn/tests/DawnTest.h +++ b/src/dawn/tests/DawnTest.h @@ -679,7 +679,7 @@ using DawnTest = DawnTestWithParams<>; // AdapterTestParam, and whose constructor looks like: // Param(AdapterTestParam, ABorC, 12or3, ..., otherParams... ) // You must also teach GTest how to print this struct. -// https://github.com/google/googletest/blob/master/docs/advanced.md#teaching-googletest-how-to-print-your-values +// https://github.com/google/googletest/blob/main/docs/advanced.md#teaching-googletest-how-to-print-your-values // Macro DAWN_TEST_PARAM_STRUCT can help generate this struct. #define DAWN_INSTANTIATE_TEST_P(testName, ...) \ INSTANTIATE_TEST_SUITE_P( \ diff --git a/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp index 0dd0aec84f..27f240ba40 100644 --- a/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp +++ b/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp @@ -434,9 +434,9 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { vbContents.pos[1] = vec4(1.0, 1.0, 0.0, 1.0); vbContents.pos[2] = vec4(1.0, -1.0, 0.0, 1.0); vbContents.pos[3] = vec4(-1.0, -1.0, 0.0, 1.0); - let dummy : i32 = 0; + let placeholder : i32 = 0; ibContents.indices[0] = vec4(0, 1, 2, 0); - ibContents.indices[1] = vec4(2, 3, dummy, dummy); + ibContents.indices[1] = vec4(2, 3, placeholder, placeholder); uniformContents.color = 1.0; storageContents.color = 1.0; })"); @@ -549,9 +549,9 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { contents.pos[1] = vec4(1.0, 1.0, 0.0, 1.0); contents.pos[2] = vec4(1.0, -1.0, 0.0, 1.0); contents.pos[3] = vec4(-1.0, -1.0, 0.0, 1.0); - let dummy : i32 = 0; + let placeholder : i32 = 0; contents.indices[0] = vec4(0, 1, 2, 0); - contents.indices[1] = vec4(2, 3, dummy, dummy); + contents.indices[1] = vec4(2, 3, placeholder, placeholder); contents.color0 = 1.0; contents.color1 = 1.0; })"); diff --git a/src/dawn/tests/end2end/StorageTextureTests.cpp b/src/dawn/tests/end2end/StorageTextureTests.cpp index ca29686095..bf60590fd0 100644 --- a/src/dawn/tests/end2end/StorageTextureTests.cpp +++ b/src/dawn/tests/end2end/StorageTextureTests.cpp @@ -535,10 +535,11 @@ fn IsEqualTo(pixel : vec4, expected : vec4) -> bool { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::Texture dummyOutputTexture = CreateTexture( + wgpu::Texture placeholderOutputTexture = CreateTexture( kRenderAttachmentFormat, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, {1, 1}); - utils::ComboRenderPassDescriptor renderPassDescriptor({dummyOutputTexture.CreateView()}); + utils::ComboRenderPassDescriptor renderPassDescriptor( + {placeholderOutputTexture.CreateView()}); wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor); renderPassEncoder.SetBindGroup(0, bindGroup); renderPassEncoder.SetPipeline(pipeline); diff --git a/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp b/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp index a56ebe27c7..25532773f7 100644 --- a/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp +++ b/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp @@ -308,12 +308,12 @@ TEST_P(VertexOnlyRenderPipelineTest, MultiplePass) { DAWN_INSTANTIATE_TEST(VertexOnlyRenderPipelineTest, D3D12Backend(), - D3D12Backend({"use_dummy_fragment_in_vertex_only_pipeline"}), + D3D12Backend({"use_placeholder_fragment_in_vertex_only_pipeline"}), MetalBackend(), - MetalBackend({"use_dummy_fragment_in_vertex_only_pipeline"}), + MetalBackend({"use_placeholder_fragment_in_vertex_only_pipeline"}), OpenGLBackend(), - OpenGLBackend({"use_dummy_fragment_in_vertex_only_pipeline"}), + OpenGLBackend({"use_placeholder_fragment_in_vertex_only_pipeline"}), OpenGLESBackend(), - OpenGLESBackend({"use_dummy_fragment_in_vertex_only_pipeline"}), + OpenGLESBackend({"use_placeholder_fragment_in_vertex_only_pipeline"}), VulkanBackend(), - VulkanBackend({"use_dummy_fragment_in_vertex_only_pipeline"})); + VulkanBackend({"use_placeholder_fragment_in_vertex_only_pipeline"})); diff --git a/src/dawn/tests/end2end/WindowSurfaceTests.cpp b/src/dawn/tests/end2end/WindowSurfaceTests.cpp index 8520907b45..ac5cd883c5 100644 --- a/src/dawn/tests/end2end/WindowSurfaceTests.cpp +++ b/src/dawn/tests/end2end/WindowSurfaceTests.cpp @@ -229,7 +229,7 @@ TEST_F(WindowSurfaceInstanceTests, InvalidMetalLayer) { wgpu::SurfaceDescriptorFromMetalLayer chainedDescriptor; // The CALayer is autoreleased. Releasing it causes a test failure when the Chromium GTest // autoreleasepool is emptied. - chainedDescriptor.layer = utils::CreateDummyCALayer(); + chainedDescriptor.layer = utils::CreatePlaceholderCALayer(); wgpu::SurfaceDescriptor descriptor; descriptor.nextInChain = &chainedDescriptor; diff --git a/src/dawn/tests/perf_tests/DawnPerfTest.cpp b/src/dawn/tests/perf_tests/DawnPerfTest.cpp index 75d2871176..256778bf9f 100644 --- a/src/dawn/tests/perf_tests/DawnPerfTest.cpp +++ b/src/dawn/tests/perf_tests/DawnPerfTest.cpp @@ -131,7 +131,7 @@ void DawnPerfTestEnvironment::SetUp() { std::ofstream outFile; outFile.open(mTraceFile); outFile << "{ \"traceEvents\": ["; - outFile << "{}"; // Dummy object so trace events can always prepend a comma + outFile << "{}"; // Placeholder object so trace events can always prepend a comma outFile.flush(); outFile.close(); } diff --git a/src/dawn/tests/unittests/BuddyMemoryAllocatorTests.cpp b/src/dawn/tests/unittests/BuddyMemoryAllocatorTests.cpp index d078f26837..7cf3fe230e 100644 --- a/src/dawn/tests/unittests/BuddyMemoryAllocatorTests.cpp +++ b/src/dawn/tests/unittests/BuddyMemoryAllocatorTests.cpp @@ -23,7 +23,7 @@ using namespace dawn::native; -class DummyResourceHeapAllocator : public ResourceHeapAllocator { +class PlaceholderResourceHeapAllocator : public ResourceHeapAllocator { public: ResultOrError> AllocateResourceHeap(uint64_t size) override { return std::make_unique(); @@ -32,15 +32,15 @@ class DummyResourceHeapAllocator : public ResourceHeapAllocator { } }; -class DummyBuddyResourceAllocator { +class PlaceholderBuddyResourceAllocator { public: - DummyBuddyResourceAllocator(uint64_t maxBlockSize, uint64_t memorySize) + PlaceholderBuddyResourceAllocator(uint64_t maxBlockSize, uint64_t memorySize) : mAllocator(maxBlockSize, memorySize, &mHeapAllocator) { } - DummyBuddyResourceAllocator(uint64_t maxBlockSize, - uint64_t memorySize, - ResourceHeapAllocator* heapAllocator) + PlaceholderBuddyResourceAllocator(uint64_t maxBlockSize, + uint64_t memorySize, + ResourceHeapAllocator* heapAllocator) : mAllocator(maxBlockSize, memorySize, heapAllocator) { } @@ -59,7 +59,7 @@ class DummyBuddyResourceAllocator { } private: - DummyResourceHeapAllocator mHeapAllocator; + PlaceholderResourceHeapAllocator mHeapAllocator; BuddyMemoryAllocator mAllocator; }; @@ -73,7 +73,7 @@ TEST(BuddyMemoryAllocatorTests, SingleHeap) { // constexpr uint64_t heapSize = 128; constexpr uint64_t maxBlockSize = heapSize; - DummyBuddyResourceAllocator allocator(maxBlockSize, heapSize); + PlaceholderBuddyResourceAllocator allocator(maxBlockSize, heapSize); // Cannot allocate greater than heap size. ResourceMemoryAllocation invalidAllocation = allocator.Allocate(heapSize * 2); @@ -106,7 +106,7 @@ TEST(BuddyMemoryAllocatorTests, MultipleHeaps) { // constexpr uint64_t maxBlockSize = 256; constexpr uint64_t heapSize = 128; - DummyBuddyResourceAllocator allocator(maxBlockSize, heapSize); + PlaceholderBuddyResourceAllocator allocator(maxBlockSize, heapSize); // Cannot allocate greater than heap size. ResourceMemoryAllocation invalidAllocation = allocator.Allocate(heapSize * 2); @@ -154,7 +154,7 @@ TEST(BuddyMemoryAllocatorTests, MultipleSplitHeaps) { // constexpr uint64_t maxBlockSize = 256; constexpr uint64_t heapSize = 128; - DummyBuddyResourceAllocator allocator(maxBlockSize, heapSize); + PlaceholderBuddyResourceAllocator allocator(maxBlockSize, heapSize); // Allocate two 64 byte sub-allocations. ResourceMemoryAllocation allocation1 = allocator.Allocate(heapSize / 2); @@ -208,7 +208,7 @@ TEST(BuddyMemoryAllocatorTests, MultiplSplitHeapsVariableSizes) { // constexpr uint64_t heapSize = 128; constexpr uint64_t maxBlockSize = 512; - DummyBuddyResourceAllocator allocator(maxBlockSize, heapSize); + PlaceholderBuddyResourceAllocator allocator(maxBlockSize, heapSize); // Allocate two 64-byte allocations. ResourceMemoryAllocation allocation1 = allocator.Allocate(64); @@ -284,7 +284,7 @@ TEST(BuddyMemoryAllocatorTests, SameSizeVariousAlignment) { // constexpr uint64_t heapSize = 128; constexpr uint64_t maxBlockSize = 512; - DummyBuddyResourceAllocator allocator(maxBlockSize, heapSize); + PlaceholderBuddyResourceAllocator allocator(maxBlockSize, heapSize); ResourceMemoryAllocation allocation1 = allocator.Allocate(64, 128); ASSERT_EQ(allocation1.GetInfo().mBlockOffset, 0u); @@ -334,7 +334,7 @@ TEST(BuddyMemoryAllocatorTests, VariousSizeSameAlignment) { // constexpr uint64_t heapSize = 128; constexpr uint64_t maxBlockSize = 512; - DummyBuddyResourceAllocator allocator(maxBlockSize, heapSize); + PlaceholderBuddyResourceAllocator allocator(maxBlockSize, heapSize); constexpr uint64_t alignment = 64; @@ -373,7 +373,7 @@ TEST(BuddyMemoryAllocatorTests, VariousSizeSameAlignment) { TEST(BuddyMemoryAllocatorTests, AllocationOverflow) { constexpr uint64_t heapSize = 128; constexpr uint64_t maxBlockSize = 512; - DummyBuddyResourceAllocator allocator(maxBlockSize, heapSize); + PlaceholderBuddyResourceAllocator allocator(maxBlockSize, heapSize); constexpr uint64_t largeBlock = (1ull << 63) + 1; ResourceMemoryAllocation invalidAllocation = allocator.Allocate(largeBlock); @@ -385,9 +385,9 @@ TEST(BuddyMemoryAllocatorTests, ReuseFreedHeaps) { constexpr uint64_t kHeapSize = 128; constexpr uint64_t kMaxBlockSize = 4096; - DummyResourceHeapAllocator heapAllocator; + PlaceholderResourceHeapAllocator heapAllocator; PooledResourceMemoryAllocator poolAllocator(&heapAllocator); - DummyBuddyResourceAllocator allocator(kMaxBlockSize, kHeapSize, &poolAllocator); + PlaceholderBuddyResourceAllocator allocator(kMaxBlockSize, kHeapSize, &poolAllocator); std::set heaps = {}; std::vector allocations = {}; @@ -426,9 +426,9 @@ TEST(BuddyMemoryAllocatorTests, DestroyHeaps) { constexpr uint64_t kHeapSize = 128; constexpr uint64_t kMaxBlockSize = 4096; - DummyResourceHeapAllocator heapAllocator; + PlaceholderResourceHeapAllocator heapAllocator; PooledResourceMemoryAllocator poolAllocator(&heapAllocator); - DummyBuddyResourceAllocator allocator(kMaxBlockSize, kHeapSize, &poolAllocator); + PlaceholderBuddyResourceAllocator allocator(kMaxBlockSize, kHeapSize, &poolAllocator); std::set heaps = {}; std::vector allocations = {}; diff --git a/src/dawn/tests/unittests/CommandAllocatorTests.cpp b/src/dawn/tests/unittests/CommandAllocatorTests.cpp index dae8478e9b..bb6951f2b8 100644 --- a/src/dawn/tests/unittests/CommandAllocatorTests.cpp +++ b/src/dawn/tests/unittests/CommandAllocatorTests.cpp @@ -368,7 +368,7 @@ TEST(CommandAllocator, EmptyIterator) { template struct alignas(A) AlignedStruct { - char dummy; + char placeholder; }; // Test for overflows in Allocate's computations, size 1 variant diff --git a/src/dawn/tests/unittests/ErrorTests.cpp b/src/dawn/tests/unittests/ErrorTests.cpp index 5af82a4d2b..1d6224c252 100644 --- a/src/dawn/tests/unittests/ErrorTests.cpp +++ b/src/dawn/tests/unittests/ErrorTests.cpp @@ -21,8 +21,8 @@ using namespace dawn::native; namespace { - int dummySuccess = 0xbeef; - const char* dummyErrorMessage = "I am an error message :3"; + int placeholderSuccess = 0xbeef; + const char* placeholderErrorMessage = "I am an error message :3"; // Check returning a success MaybeError with {}; TEST(ErrorTests, Error_Success) { @@ -34,35 +34,37 @@ namespace { // Check returning an error MaybeError with "return DAWN_VALIDATION_ERROR" TEST(ErrorTests, Error_Error) { - auto ReturnError = []() -> MaybeError { return DAWN_VALIDATION_ERROR(dummyErrorMessage); }; + auto ReturnError = []() -> MaybeError { + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); + }; MaybeError result = ReturnError(); ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } // Check returning a success ResultOrError with an implicit conversion TEST(ErrorTests, ResultOrError_Success) { - auto ReturnSuccess = []() -> ResultOrError { return &dummySuccess; }; + auto ReturnSuccess = []() -> ResultOrError { return &placeholderSuccess; }; ResultOrError result = ReturnSuccess(); ASSERT_TRUE(result.IsSuccess()); - ASSERT_EQ(result.AcquireSuccess(), &dummySuccess); + ASSERT_EQ(result.AcquireSuccess(), &placeholderSuccess); } // Check returning an error ResultOrError with "return DAWN_VALIDATION_ERROR" TEST(ErrorTests, ResultOrError_Error) { auto ReturnError = []() -> ResultOrError { - return DAWN_VALIDATION_ERROR(dummyErrorMessage); + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); }; ResultOrError result = ReturnError(); ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } // Check DAWN_TRY handles successes correctly. @@ -85,7 +87,9 @@ namespace { // Check DAWN_TRY handles errors correctly. TEST(ErrorTests, TRY_Error) { - auto ReturnError = []() -> MaybeError { return DAWN_VALIDATION_ERROR(dummyErrorMessage); }; + auto ReturnError = []() -> MaybeError { + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); + }; auto Try = [ReturnError]() -> MaybeError { DAWN_TRY(ReturnError()); @@ -98,12 +102,14 @@ namespace { ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } // Check DAWN_TRY adds to the backtrace. TEST(ErrorTests, TRY_AddsToBacktrace) { - auto ReturnError = []() -> MaybeError { return DAWN_VALIDATION_ERROR(dummyErrorMessage); }; + auto ReturnError = []() -> MaybeError { + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); + }; auto SingleTry = [ReturnError]() -> MaybeError { DAWN_TRY(ReturnError()); @@ -129,7 +135,7 @@ namespace { // Check DAWN_TRY_ASSIGN handles successes correctly. TEST(ErrorTests, TRY_RESULT_Success) { - auto ReturnSuccess = []() -> ResultOrError { return &dummySuccess; }; + auto ReturnSuccess = []() -> ResultOrError { return &placeholderSuccess; }; // We need to check that DAWN_TRY doesn't return on successes bool tryReturned = true; @@ -139,20 +145,20 @@ namespace { DAWN_TRY_ASSIGN(result, ReturnSuccess()); tryReturned = false; - EXPECT_EQ(result, &dummySuccess); + EXPECT_EQ(result, &placeholderSuccess); return result; }; ResultOrError result = Try(); ASSERT_TRUE(result.IsSuccess()); ASSERT_FALSE(tryReturned); - ASSERT_EQ(result.AcquireSuccess(), &dummySuccess); + ASSERT_EQ(result.AcquireSuccess(), &placeholderSuccess); } // Check DAWN_TRY_ASSIGN handles errors correctly. TEST(ErrorTests, TRY_RESULT_Error) { auto ReturnError = []() -> ResultOrError { - return DAWN_VALIDATION_ERROR(dummyErrorMessage); + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); }; auto Try = [ReturnError]() -> ResultOrError { @@ -162,30 +168,30 @@ namespace { // DAWN_TRY should return before this point EXPECT_FALSE(true); - return &dummySuccess; + return &placeholderSuccess; }; ResultOrError result = Try(); ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } // Check DAWN_TRY_ASSIGN adds to the backtrace. TEST(ErrorTests, TRY_RESULT_AddsToBacktrace) { auto ReturnError = []() -> ResultOrError { - return DAWN_VALIDATION_ERROR(dummyErrorMessage); + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); }; auto SingleTry = [ReturnError]() -> ResultOrError { DAWN_TRY(ReturnError()); - return &dummySuccess; + return &placeholderSuccess; }; auto DoubleTry = [SingleTry]() -> ResultOrError { DAWN_TRY(SingleTry()); - return &dummySuccess; + return &placeholderSuccess; }; ResultOrError singleResult = SingleTry(); @@ -203,7 +209,7 @@ namespace { // Check a ResultOrError can be DAWN_TRY_ASSIGNED in a function that returns an Error TEST(ErrorTests, TRY_RESULT_ConversionToError) { auto ReturnError = []() -> ResultOrError { - return DAWN_VALIDATION_ERROR(dummyErrorMessage); + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); }; auto Try = [ReturnError]() -> MaybeError { @@ -218,14 +224,14 @@ namespace { ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } // Check a ResultOrError can be DAWN_TRY_ASSIGNED in a function that returns an Error // Version without Result TEST(ErrorTests, TRY_RESULT_ConversionToErrorNonPointer) { auto ReturnError = []() -> ResultOrError { - return DAWN_VALIDATION_ERROR(dummyErrorMessage); + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); }; auto Try = [ReturnError]() -> MaybeError { @@ -240,12 +246,12 @@ namespace { ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } // Check DAWN_TRY_ASSIGN handles successes correctly. TEST(ErrorTests, TRY_RESULT_CLEANUP_Success) { - auto ReturnSuccess = []() -> ResultOrError { return &dummySuccess; }; + auto ReturnSuccess = []() -> ResultOrError { return &placeholderSuccess; }; // We need to check that DAWN_TRY_ASSIGN_WITH_CLEANUP doesn't return on successes and the // cleanup is not called. @@ -257,7 +263,7 @@ namespace { DAWN_TRY_ASSIGN_WITH_CLEANUP(result, ReturnSuccess(), { tryCleanup = true; }); tryReturned = false; - EXPECT_EQ(result, &dummySuccess); + EXPECT_EQ(result, &placeholderSuccess); return result; }; @@ -265,13 +271,13 @@ namespace { ASSERT_TRUE(result.IsSuccess()); ASSERT_FALSE(tryReturned); ASSERT_FALSE(tryCleanup); - ASSERT_EQ(result.AcquireSuccess(), &dummySuccess); + ASSERT_EQ(result.AcquireSuccess(), &placeholderSuccess); } // Check DAWN_TRY_ASSIGN handles cleanups. TEST(ErrorTests, TRY_RESULT_CLEANUP_Cleanup) { auto ReturnError = []() -> ResultOrError { - return DAWN_VALIDATION_ERROR(dummyErrorMessage); + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); }; // We need to check that DAWN_TRY_ASSIGN_WITH_CLEANUP calls cleanup when error. @@ -284,21 +290,21 @@ namespace { // DAWN_TRY_ASSIGN_WITH_CLEANUP should return before this point EXPECT_FALSE(true); - return &dummySuccess; + return &placeholderSuccess; }; ResultOrError result = Try(); ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); ASSERT_TRUE(tryCleanup); } // Check DAWN_TRY_ASSIGN can override return value when needed. TEST(ErrorTests, TRY_RESULT_CLEANUP_OverrideReturn) { auto ReturnError = []() -> ResultOrError { - return DAWN_VALIDATION_ERROR(dummyErrorMessage); + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); }; auto Try = [ReturnError]() -> bool { @@ -318,24 +324,28 @@ namespace { // Check a MaybeError can be DAWN_TRIED in a function that returns an ResultOrError // Check DAWN_TRY handles errors correctly. TEST(ErrorTests, TRY_ConversionToErrorOrResult) { - auto ReturnError = []() -> MaybeError { return DAWN_VALIDATION_ERROR(dummyErrorMessage); }; + auto ReturnError = []() -> MaybeError { + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); + }; auto Try = [ReturnError]() -> ResultOrError { DAWN_TRY(ReturnError()); - return &dummySuccess; + return &placeholderSuccess; }; ResultOrError result = Try(); ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } // Check a MaybeError can be DAWN_TRIED in a function that returns an ResultOrError // Check DAWN_TRY handles errors correctly. Version without Result TEST(ErrorTests, TRY_ConversionToErrorOrResultNonPointer) { - auto ReturnError = []() -> MaybeError { return DAWN_VALIDATION_ERROR(dummyErrorMessage); }; + auto ReturnError = []() -> MaybeError { + return DAWN_VALIDATION_ERROR(placeholderErrorMessage); + }; auto Try = [ReturnError]() -> ResultOrError { DAWN_TRY(ReturnError()); @@ -346,7 +356,7 @@ namespace { ASSERT_TRUE(result.IsError()); std::unique_ptr errorData = result.AcquireError(); - ASSERT_EQ(errorData->GetMessage(), dummyErrorMessage); + ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } } // anonymous namespace diff --git a/src/dawn/tests/unittests/PerThreadProcTests.cpp b/src/dawn/tests/unittests/PerThreadProcTests.cpp index f9a195b5b3..f275456e89 100644 --- a/src/dawn/tests/unittests/PerThreadProcTests.cpp +++ b/src/dawn/tests/unittests/PerThreadProcTests.cpp @@ -36,10 +36,10 @@ class PerThreadProcTests : public testing::Test { dawn::native::null::Adapter mNativeAdapter; }; -// Test that procs can be set per thread. This test overrides deviceCreateBuffer with a dummy proc -// for each thread that increments a counter. Because each thread has their own proc and counter, -// there should be no data races. The per-thread procs also check that the current thread id is -// exactly equal to the expected thread id. +// Test that procs can be set per thread. This test overrides deviceCreateBuffer with a placeholder +// proc for each thread that increments a counter. Because each thread has their own proc and +// counter, there should be no data races. The per-thread procs also check that the current thread +// id is exactly equal to the expected thread id. TEST_F(PerThreadProcTests, DispatchesPerThread) { dawnProcSetProcs(&dawnThreadDispatchProcTable); diff --git a/src/dawn/tests/unittests/ResultTests.cpp b/src/dawn/tests/unittests/ResultTests.cpp index 1775c6d75e..429ebc1664 100644 --- a/src/dawn/tests/unittests/ResultTests.cpp +++ b/src/dawn/tests/unittests/ResultTests.cpp @@ -42,9 +42,9 @@ namespace { EXPECT_FALSE(result->IsSuccess()); } - static int dummyError = 0xbeef; - static float dummySuccess = 42.0f; - static const float dummyConstSuccess = 42.0f; + static int placeholderError = 0xbeef; + static float placeholderSuccess = 42.0f; + static const float placeholderConstSuccess = 42.0f; class AClass : public RefCounted { public: @@ -52,9 +52,9 @@ namespace { }; // Tests using the following overload of TestSuccess make - // local Ref instances to dummySuccessObj. Tests should + // local Ref instances to placeholderSuccessObj. Tests should // ensure any local Ref objects made along the way continue - // to point to dummySuccessObj. + // to point to placeholderSuccessObj. template void TestSuccess(Result, E>* result, T* expectedSuccess) { EXPECT_FALSE(result->IsError()); @@ -83,25 +83,25 @@ namespace { // Test constructing an error Result TEST(ResultOnlyPointerError, ConstructingError) { - Result result(std::make_unique(dummyError)); - TestError(&result, dummyError); + Result result(std::make_unique(placeholderError)); + TestError(&result, placeholderError); } // Test moving an error Result TEST(ResultOnlyPointerError, MovingError) { - Result result(std::make_unique(dummyError)); + Result result(std::make_unique(placeholderError)); Result movedResult(std::move(result)); - TestError(&movedResult, dummyError); + TestError(&movedResult, placeholderError); } // Test returning an error Result TEST(ResultOnlyPointerError, ReturningError) { auto CreateError = []() -> Result { - return {std::make_unique(dummyError)}; + return {std::make_unique(placeholderError)}; }; Result result = CreateError(); - TestError(&result, dummyError); + TestError(&result, placeholderError); } // Test constructing a success Result @@ -132,46 +132,46 @@ namespace { // Test constructing an error Result TEST(ResultBothPointer, ConstructingError) { - Result result(std::make_unique(dummyError)); - TestError(&result, dummyError); + Result result(std::make_unique(placeholderError)); + TestError(&result, placeholderError); } // Test moving an error Result TEST(ResultBothPointer, MovingError) { - Result result(std::make_unique(dummyError)); + Result result(std::make_unique(placeholderError)); Result movedResult(std::move(result)); - TestError(&movedResult, dummyError); + TestError(&movedResult, placeholderError); } // Test returning an error Result TEST(ResultBothPointer, ReturningError) { auto CreateError = []() -> Result { - return {std::make_unique(dummyError)}; + return {std::make_unique(placeholderError)}; }; Result result = CreateError(); - TestError(&result, dummyError); + TestError(&result, placeholderError); } // Test constructing a success Result TEST(ResultBothPointer, ConstructingSuccess) { - Result result(&dummySuccess); - TestSuccess(&result, &dummySuccess); + Result result(&placeholderSuccess); + TestSuccess(&result, &placeholderSuccess); } // Test moving a success Result TEST(ResultBothPointer, MovingSuccess) { - Result result(&dummySuccess); + Result result(&placeholderSuccess); Result movedResult(std::move(result)); - TestSuccess(&movedResult, &dummySuccess); + TestSuccess(&movedResult, &placeholderSuccess); } // Test returning a success Result TEST(ResultBothPointer, ReturningSuccess) { - auto CreateSuccess = []() -> Result { return {&dummySuccess}; }; + auto CreateSuccess = []() -> Result { return {&placeholderSuccess}; }; Result result = CreateSuccess(); - TestSuccess(&result, &dummySuccess); + TestSuccess(&result, &placeholderSuccess); } // Tests converting from a Result @@ -203,71 +203,73 @@ namespace { // Test constructing an error Result TEST(ResultBothPointerWithConstResult, ConstructingError) { - Result result(std::make_unique(dummyError)); - TestError(&result, dummyError); + Result result(std::make_unique(placeholderError)); + TestError(&result, placeholderError); } // Test moving an error Result TEST(ResultBothPointerWithConstResult, MovingError) { - Result result(std::make_unique(dummyError)); + Result result(std::make_unique(placeholderError)); Result movedResult(std::move(result)); - TestError(&movedResult, dummyError); + TestError(&movedResult, placeholderError); } // Test returning an error Result TEST(ResultBothPointerWithConstResult, ReturningError) { auto CreateError = []() -> Result { - return {std::make_unique(dummyError)}; + return {std::make_unique(placeholderError)}; }; Result result = CreateError(); - TestError(&result, dummyError); + TestError(&result, placeholderError); } // Test constructing a success Result TEST(ResultBothPointerWithConstResult, ConstructingSuccess) { - Result result(&dummyConstSuccess); - TestSuccess(&result, &dummyConstSuccess); + Result result(&placeholderConstSuccess); + TestSuccess(&result, &placeholderConstSuccess); } // Test moving a success Result TEST(ResultBothPointerWithConstResult, MovingSuccess) { - Result result(&dummyConstSuccess); + Result result(&placeholderConstSuccess); Result movedResult(std::move(result)); - TestSuccess(&movedResult, &dummyConstSuccess); + TestSuccess(&movedResult, &placeholderConstSuccess); } // Test returning a success Result TEST(ResultBothPointerWithConstResult, ReturningSuccess) { - auto CreateSuccess = []() -> Result { return {&dummyConstSuccess}; }; + auto CreateSuccess = []() -> Result { + return {&placeholderConstSuccess}; + }; Result result = CreateSuccess(); - TestSuccess(&result, &dummyConstSuccess); + TestSuccess(&result, &placeholderConstSuccess); } // Result, E> // Test constructing an error Result, E> TEST(ResultRefT, ConstructingError) { - Result, int> result(std::make_unique(dummyError)); - TestError(&result, dummyError); + Result, int> result(std::make_unique(placeholderError)); + TestError(&result, placeholderError); } // Test moving an error Result, E> TEST(ResultRefT, MovingError) { - Result, int> result(std::make_unique(dummyError)); + Result, int> result(std::make_unique(placeholderError)); Result, int> movedResult(std::move(result)); - TestError(&movedResult, dummyError); + TestError(&movedResult, placeholderError); } // Test returning an error Result, E> TEST(ResultRefT, ReturningError) { auto CreateError = []() -> Result, int> { - return {std::make_unique(dummyError)}; + return {std::make_unique(placeholderError)}; }; Result, int> result = CreateError(); - TestError(&result, dummyError); + TestError(&result, placeholderError); } // Test constructing a success Result, E> @@ -340,25 +342,25 @@ namespace { // Test constructing an error Result TEST(ResultGeneric, ConstructingError) { - Result, int> result(std::make_unique(dummyError)); - TestError(&result, dummyError); + Result, int> result(std::make_unique(placeholderError)); + TestError(&result, placeholderError); } // Test moving an error Result TEST(ResultGeneric, MovingError) { - Result, int> result(std::make_unique(dummyError)); + Result, int> result(std::make_unique(placeholderError)); Result, int> movedResult(std::move(result)); - TestError(&movedResult, dummyError); + TestError(&movedResult, placeholderError); } // Test returning an error Result TEST(ResultGeneric, ReturningError) { auto CreateError = []() -> Result, int> { - return {std::make_unique(dummyError)}; + return {std::make_unique(placeholderError)}; }; Result, int> result = CreateError(); - TestError(&result, dummyError); + TestError(&result, placeholderError); } // Test constructing a success Result diff --git a/src/dawn/tests/unittests/StackContainerTests.cpp b/src/dawn/tests/unittests/StackContainerTests.cpp index 6dc62f99cc..f68ecf4cfc 100644 --- a/src/dawn/tests/unittests/StackContainerTests.cpp +++ b/src/dawn/tests/unittests/StackContainerTests.cpp @@ -14,14 +14,14 @@ namespace { - class Dummy : public RefCounted { + class Placeholder : public RefCounted { public: - explicit Dummy(int* alive) : mAlive(alive) { + explicit Placeholder(int* alive) : mAlive(alive) { ++*mAlive; } private: - ~Dummy() { + ~Placeholder() { --*mAlive; } @@ -74,22 +74,22 @@ TEST(StackContainer, Vector) { TEST(StackContainer, VectorDoubleDelete) { // Regression testing for double-delete. - typedef StackVector, 2> Vector; + typedef StackVector, 2> Vector; Vector vect; int alive = 0; - Ref dummy = AcquireRef(new Dummy(&alive)); + Ref placeholder = AcquireRef(new Placeholder(&alive)); EXPECT_EQ(alive, 1); - vect->push_back(dummy); + vect->push_back(placeholder); EXPECT_EQ(alive, 1); - Dummy* dummy_unref = dummy.Get(); - dummy = nullptr; + Placeholder* placeholder_unref = placeholder.Get(); + placeholder = nullptr; EXPECT_EQ(alive, 1); - auto itr = std::find(vect->begin(), vect->end(), dummy_unref); - EXPECT_EQ(itr->Get(), dummy_unref); + auto itr = std::find(vect->begin(), vect->end(), placeholder_unref); + EXPECT_EQ(itr->Get(), placeholder_unref); vect->erase(itr); EXPECT_EQ(alive, 0); @@ -138,7 +138,7 @@ TEST(StackContainer, BufferAlignment) { } template class StackVector; -template class StackVector, 2>; +template class StackVector, 2>; template void CheckStackVectorElements(const StackVector& vec, std::initializer_list expected) { diff --git a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp index ef60ba4b60..543c6a86bd 100644 --- a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp @@ -1499,7 +1499,7 @@ class SetBindGroupValidationTest : public ValidationTest { uint32_t count, bool expectation) { wgpu::RenderPipeline renderPipeline = CreateRenderPipeline(); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder renderPassEncoder = commandEncoder.BeginRenderPass(&renderPass); @@ -1602,7 +1602,7 @@ TEST_F(SetBindGroupValidationTest, VerifyGroupIfChangedAfterAction) { } { wgpu::RenderPipeline renderPipeline = CreateRenderPipeline(); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder renderPassEncoder = commandEncoder.BeginRenderPass(&renderPass); @@ -1966,7 +1966,7 @@ TEST_F(SetBindGroupPersistenceValidationTest, BindGroupBeforePipeline) { device, bindGroupLayouts[1], {{0, storageBuffer, 0, kBindingSize}, {1, uniformBuffer, 0, kBindingSize}}); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder renderPassEncoder = commandEncoder.BeginRenderPass(&renderPass); @@ -2020,7 +2020,7 @@ TEST_F(SetBindGroupPersistenceValidationTest, NotVulkanInheritance) { device, bindGroupLayoutsB[0], {{0, storageBuffer, 0, kBindingSize}, {1, uniformBuffer, 0, kBindingSize}}); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder renderPassEncoder = commandEncoder.BeginRenderPass(&renderPass); @@ -2270,8 +2270,8 @@ class BindingsValidationTest : public BindGroupLayoutCompatibilityTest { wgpu::RenderPipeline pipeline, bool expectation) { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder rp = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder rp = encoder.BeginRenderPass(&PlaceholderRenderPass); for (uint32_t i = 0; i < count; ++i) { rp.SetBindGroup(i, bg[i]); } diff --git a/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp index 784c8aa17d..0b74c728b8 100644 --- a/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp @@ -31,12 +31,12 @@ TEST_F(CommandBufferValidationTest, Empty) { // Test that a command buffer cannot be ended mid render pass TEST_F(CommandBufferValidationTest, EndedMidRenderPass) { - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Control case, command buffer ended after the pass is ended. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); encoder.Finish(); } @@ -44,7 +44,7 @@ TEST_F(CommandBufferValidationTest, EndedMidRenderPass) { // Error case, command buffer ended mid-pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); ASSERT_DEVICE_ERROR( encoder.Finish(), HasSubstr("Command buffer recording ended before [RenderPassEncoder] was ended.")); @@ -54,7 +54,7 @@ TEST_F(CommandBufferValidationTest, EndedMidRenderPass) { // should fail too. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); ASSERT_DEVICE_ERROR( encoder.Finish(), HasSubstr("Command buffer recording ended before [RenderPassEncoder] was ended.")); @@ -97,12 +97,12 @@ TEST_F(CommandBufferValidationTest, EndedMidComputePass) { // Test that a render pass cannot be ended twice TEST_F(CommandBufferValidationTest, RenderPassEndedTwice) { - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Control case, pass is ended once { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); encoder.Finish(); } @@ -110,7 +110,7 @@ TEST_F(CommandBufferValidationTest, RenderPassEndedTwice) { // Error case, pass ended twice { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); pass.End(); ASSERT_DEVICE_ERROR( @@ -143,12 +143,12 @@ TEST_F(CommandBufferValidationTest, ComputePassEndedTwice) { // Test that beginning a compute pass before ending the previous pass causes an error. TEST_F(CommandBufferValidationTest, BeginComputePassBeforeEndPreviousPass) { - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Beginning a compute pass before ending a render pass causes an error. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&PlaceholderRenderPass); wgpu::ComputePassEncoder computePass = encoder.BeginComputePass(); computePass.End(); renderPass.End(); @@ -168,13 +168,13 @@ TEST_F(CommandBufferValidationTest, BeginComputePassBeforeEndPreviousPass) { // Test that beginning a render pass before ending the previous pass causes an error. TEST_F(CommandBufferValidationTest, BeginRenderPassBeforeEndPreviousPass) { - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Beginning a render pass before ending the render pass causes an error. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder renderPass1 = encoder.BeginRenderPass(&dummyRenderPass); - wgpu::RenderPassEncoder renderPass2 = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder renderPass1 = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder renderPass2 = encoder.BeginRenderPass(&PlaceholderRenderPass); renderPass2.End(); renderPass1.End(); ASSERT_DEVICE_ERROR(encoder.Finish()); @@ -184,7 +184,7 @@ TEST_F(CommandBufferValidationTest, BeginRenderPassBeforeEndPreviousPass) { { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::ComputePassEncoder computePass = encoder.BeginComputePass(); - wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&PlaceholderRenderPass); renderPass.End(); computePass.End(); ASSERT_DEVICE_ERROR(encoder.Finish()); @@ -229,12 +229,12 @@ TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) { // Test that passes which are de-referenced prior to ending still allow the correct errors to be // produced. TEST_F(CommandBufferValidationTest, PassDereferenced) { - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Control case, command buffer ended after the pass is ended. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); encoder.Finish(); } @@ -242,7 +242,7 @@ TEST_F(CommandBufferValidationTest, PassDereferenced) { // Error case, no reference is kept to a render pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.BeginRenderPass(&dummyRenderPass); + encoder.BeginRenderPass(&PlaceholderRenderPass); ASSERT_DEVICE_ERROR( encoder.Finish(), HasSubstr("Command buffer recording ended before [RenderPassEncoder] was ended.")); @@ -260,7 +260,7 @@ TEST_F(CommandBufferValidationTest, PassDereferenced) { // Error case, beginning a new pass after failing to end a de-referenced pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.BeginRenderPass(&dummyRenderPass); + encoder.BeginRenderPass(&PlaceholderRenderPass); wgpu::ComputePassEncoder pass = encoder.BeginComputePass(); pass.End(); ASSERT_DEVICE_ERROR( @@ -301,12 +301,12 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { // only way to trigger the destroy call is by losing all references which means we cannot // call finish. DAWN_SKIP_TEST_IF(UsesWire()); - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Control case, command buffer ended after the pass is ended. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); encoder.Finish(); } @@ -314,7 +314,7 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { // Destroyed encoder with encoded commands should emit error on finish. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); dawn::native::FromAPI(encoder.Get())->Destroy(); ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); @@ -323,7 +323,7 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { // Destroyed encoder with encoded commands shouldn't emit an error if never finished. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); dawn::native::FromAPI(encoder.Get())->Destroy(); } @@ -332,7 +332,7 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::native::FromAPI(encoder.Get())->Destroy(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); } @@ -341,14 +341,14 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::native::FromAPI(encoder.Get())->Destroy(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); } // Destroying a finished encoder should not emit any errors. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.End(); encoder.Finish(); dawn::native::FromAPI(encoder.Get())->Destroy(); diff --git a/src/dawn/tests/unittests/validation/DebugMarkerValidationTests.cpp b/src/dawn/tests/unittests/validation/DebugMarkerValidationTests.cpp index 7fd283bddc..dfb5810fee 100644 --- a/src/dawn/tests/unittests/validation/DebugMarkerValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DebugMarkerValidationTests.cpp @@ -21,7 +21,7 @@ class DebugMarkerValidationTest : public ValidationTest {}; // Correct usage of debug markers should succeed in render pass. TEST_F(DebugMarkerValidationTest, RenderSuccess) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { @@ -39,7 +39,7 @@ TEST_F(DebugMarkerValidationTest, RenderSuccess) { // A PushDebugGroup call without a following PopDebugGroup produces an error in render pass. TEST_F(DebugMarkerValidationTest, RenderUnbalancedPush) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { @@ -56,7 +56,7 @@ TEST_F(DebugMarkerValidationTest, RenderUnbalancedPush) { // A PopDebugGroup call without a preceding PushDebugGroup produces an error in render pass. TEST_F(DebugMarkerValidationTest, RenderUnbalancedPop) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { @@ -224,7 +224,7 @@ TEST_F(DebugMarkerValidationTest, NestedComputeInCommandEncoderIndependent) { // It is possible to nested pushes in a render pass in a command encoder. TEST_F(DebugMarkerValidationTest, NestedRenderInCommandEncoder) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); encoder.PushDebugGroup("Event Start"); @@ -241,7 +241,7 @@ TEST_F(DebugMarkerValidationTest, NestedRenderInCommandEncoder) { // Command encoder and render pass pushes must be balanced independently. TEST_F(DebugMarkerValidationTest, NestedRenderInCommandEncoderIndependent) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); encoder.PushDebugGroup("Event Start"); diff --git a/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp b/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp index d004e93294..805deeeceb 100644 --- a/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp @@ -72,7 +72,7 @@ class DrawIndirectValidationTest : public ValidationTest { wgpu::Buffer indirectBuffer = utils::CreateBufferFromData(device, usage, bufferList); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetPipeline(pipeline); diff --git a/src/dawn/tests/unittests/validation/DynamicStateCommandValidationTests.cpp b/src/dawn/tests/unittests/validation/DynamicStateCommandValidationTests.cpp index 8c2826f510..4fa869e766 100644 --- a/src/dawn/tests/unittests/validation/DynamicStateCommandValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DynamicStateCommandValidationTests.cpp @@ -203,7 +203,7 @@ class SetBlendConstantTest : public ValidationTest {}; // Test to check basic use of SetBlendConstantTest TEST_F(SetBlendConstantTest, Success) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { @@ -217,7 +217,7 @@ TEST_F(SetBlendConstantTest, Success) { // Test that SetBlendConstant allows any value, large, small or negative TEST_F(SetBlendConstantTest, AnyValueAllowed) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { @@ -233,7 +233,7 @@ class SetStencilReferenceTest : public ValidationTest {}; // Test to check basic use of SetStencilReferenceTest TEST_F(SetStencilReferenceTest, Success) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { @@ -246,7 +246,7 @@ TEST_F(SetStencilReferenceTest, Success) { // Test that SetStencilReference allows any bit to be set TEST_F(SetStencilReferenceTest, AllBitsAllowed) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { diff --git a/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp index 404db884fc..1d4dbb6e63 100644 --- a/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp @@ -50,7 +50,7 @@ TEST_F(IndexBufferValidationTest, UndefinedIndexFormat) { bufferDesc.size = 256; wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Undefined); @@ -65,7 +65,7 @@ TEST_F(IndexBufferValidationTest, InvalidIndexFormat) { bufferDesc.size = 256; wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetIndexBuffer(buffer, static_cast(404)); @@ -80,7 +80,7 @@ TEST_F(IndexBufferValidationTest, IndexBufferOffsetOOBValidation) { bufferDesc.size = 256; wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Control case, using the full buffer, with or without an explicit size is valid. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -232,7 +232,7 @@ TEST_F(IndexBufferValidationTest, InvalidUsage) { wgpu::Buffer copyBuffer = utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {0, 1, 2}); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Control case: using the index buffer is valid. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -272,7 +272,7 @@ TEST_F(IndexBufferValidationTest, OffsetAlignment) { wgpu::Buffer indexBuffer = utils::CreateBufferFromData(device, wgpu::BufferUsage::Index, {0, 1, 2}); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Control cases: index buffer offset is a multiple of the index format size { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); diff --git a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp index cb7044e456..ba9de12094 100644 --- a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp @@ -300,7 +300,7 @@ class MinBufferSizeTestsBase : public ValidationTest { void TestDraw(const wgpu::RenderPipeline& renderPipeline, const std::vector& bindGroups, bool expectation) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder renderPassEncoder = commandEncoder.BeginRenderPass(&renderPass); diff --git a/src/dawn/tests/unittests/validation/QueryValidationTests.cpp b/src/dawn/tests/unittests/validation/QueryValidationTests.cpp index b1071a8edf..19e10301c3 100644 --- a/src/dawn/tests/unittests/validation/QueryValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/QueryValidationTests.cpp @@ -82,7 +82,7 @@ class OcclusionQueryValidationTest : public QuerySetValidationTest {}; // Test the occlusionQuerySet in RenderPassDescriptor TEST_F(OcclusionQueryValidationTest, InvalidOcclusionQuerySet) { wgpu::QuerySet occlusionQuerySet = CreateQuerySet(device, wgpu::QueryType::Occlusion, 2); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Success { @@ -100,7 +100,7 @@ TEST_F(OcclusionQueryValidationTest, InvalidOcclusionQuerySet) { // Fail to begin occlusion query if the occlusionQuerySet is not set in RenderPassDescriptor { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass renderPassWithoutOcclusion(device); + PlaceholderRenderPass renderPassWithoutOcclusion(device); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassWithoutOcclusion); pass.BeginOcclusionQuery(0); pass.EndOcclusionQuery(); @@ -142,7 +142,7 @@ TEST_F(OcclusionQueryValidationTest, InvalidOcclusionQuerySet) { // Test query index of occlusion query TEST_F(OcclusionQueryValidationTest, InvalidQueryIndex) { wgpu::QuerySet occlusionQuerySet = CreateQuerySet(device, wgpu::QueryType::Occlusion, 2); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); renderPass.occlusionQuerySet = occlusionQuerySet; // Fail to begin occlusion query if the query index exceeds the number of queries in query set @@ -186,7 +186,7 @@ TEST_F(OcclusionQueryValidationTest, InvalidQueryIndex) { // Test the correspondence between BeginOcclusionQuery and EndOcclusionQuery TEST_F(OcclusionQueryValidationTest, InvalidBeginAndEnd) { wgpu::QuerySet occlusionQuerySet = CreateQuerySet(device, wgpu::QueryType::Occlusion, 2); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); renderPass.occlusionQuerySet = occlusionQuerySet; // Fail to begin an occlusion query without corresponding end operation @@ -242,7 +242,7 @@ class TimestampQueryValidationTest : public QuerySetValidationTest { void EncodeRenderPassWithTimestampWrites( wgpu::CommandEncoder encoder, const std::vector& timestampWrites) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); renderPass.timestampWriteCount = timestampWrites.size(); renderPass.timestampWrites = timestampWrites.data(); @@ -290,7 +290,7 @@ TEST_F(TimestampQueryValidationTest, UnnecessaryPipelineStatistics) { TEST_F(TimestampQueryValidationTest, SetOcclusionQueryWithTimestampQuerySet) { // Fail to begin render pass if the type of occlusionQuerySet is not Occlusion wgpu::QuerySet querySet = CreateQuerySet(device, wgpu::QueryType::Timestamp, 1); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); renderPass.occlusionQuerySet = querySet; wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -558,7 +558,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnComputePassEncoder) { // Test write timestamp on render pass encoder TEST_F(TimestampQueryValidationTest, WriteTimestampOnRenderPassEncoder) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::QuerySet timestampQuerySet = CreateQuerySet(device, wgpu::QueryType::Timestamp, 2); wgpu::QuerySet occlusionQuerySet = CreateQuerySet(device, wgpu::QueryType::Occlusion, 2); @@ -707,7 +707,7 @@ TEST_F(PipelineStatisticsQueryValidationTest, BeginRenderPassWithPipelineStatist wgpu::QuerySet querySet = CreateQuerySet(device, wgpu::QueryType::PipelineStatistics, 1, {wgpu::PipelineStatisticName::VertexShaderInvocations}); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); renderPass.occlusionQuerySet = querySet; wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); diff --git a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp index 208bcb0399..db4d28fe1d 100644 --- a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp @@ -44,7 +44,7 @@ namespace { @group(1) @binding(0) var uniforms : Uniforms; struct Storage { - dummy : array + placeholder : array } @group(1) @binding(1) var ssbo : Storage; @@ -79,7 +79,7 @@ namespace { vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - // Dummy storage buffer. + // Placeholder storage buffer. wgpu::Buffer storageBuffer = utils::CreateBufferFromData( device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Storage); @@ -125,7 +125,7 @@ namespace { // Test creating and encoding an empty render bundle. TEST_F(RenderBundleValidationTest, Empty) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -145,7 +145,7 @@ TEST_F(RenderBundleValidationTest, Empty) { // This is a regression test for error render bundle encoders containing no commands would // produce non-error render bundles. TEST_F(RenderBundleValidationTest, EmptyErrorEncoderProducesErrorBundle) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; // Having 0 attachments is invalid! @@ -165,7 +165,7 @@ TEST_F(RenderBundleValidationTest, EmptyErrorEncoderProducesErrorBundle) { // Test executing zero render bundles. TEST_F(RenderBundleValidationTest, ZeroBundles) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass); @@ -176,7 +176,7 @@ TEST_F(RenderBundleValidationTest, ZeroBundles) { // Test successfully creating and encoding a render bundle into a command buffer. TEST_F(RenderBundleValidationTest, SimpleSuccess) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -199,7 +199,7 @@ TEST_F(RenderBundleValidationTest, SimpleSuccess) { // Test that render bundle debug groups must be well nested. TEST_F(RenderBundleValidationTest, DebugGroups) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -258,7 +258,7 @@ TEST_F(RenderBundleValidationTest, DebugGroups) { // Test render bundles do not inherit command buffer state TEST_F(RenderBundleValidationTest, StateInheritance) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -343,7 +343,7 @@ TEST_F(RenderBundleValidationTest, StateInheritance) { // Test render bundles do not persist command buffer state TEST_F(RenderBundleValidationTest, StatePersistence) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -428,7 +428,7 @@ TEST_F(RenderBundleValidationTest, StatePersistence) { // Test executing render bundles clears command buffer state TEST_F(RenderBundleValidationTest, ClearsState) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -520,7 +520,7 @@ TEST_F(RenderBundleValidationTest, ClearsState) { // Test creating and encoding multiple render bundles. TEST_F(RenderBundleValidationTest, MultipleBundles) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -553,7 +553,7 @@ TEST_F(RenderBundleValidationTest, MultipleBundles) { // Test that is is valid to execute a render bundle more than once. TEST_F(RenderBundleValidationTest, ExecuteMultipleTimes) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; @@ -696,7 +696,7 @@ TEST_F(RenderBundleValidationTest, DepthStencilReadOnly) { } // Test that resource usages are validated inside render bundles. TEST_F(RenderBundleValidationTest, UsageTracking) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); utils::ComboRenderBundleEncoderDescriptor desc = {}; desc.colorFormatsCount = 1; diff --git a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp index 6fb55414dd..fa8d38e20b 100644 --- a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp +++ b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp @@ -86,8 +86,8 @@ namespace { CreateBuffer(4, wgpu::BufferUsage::Vertex | wgpu::BufferUsage::Index); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32); pass.SetVertexBuffer(0, buffer); pass.End(); @@ -130,8 +130,8 @@ namespace { // It is invalid to use the buffer as both index and storage in render pass wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32); pass.SetBindGroup(0, bg); pass.End(); @@ -195,8 +195,8 @@ namespace { { // It is valid to use multiple storage usages on the same buffer in render pass wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetBindGroup(0, bg); pass.End(); encoder.Finish(); @@ -235,14 +235,14 @@ namespace { // Use these two buffers as both index and storage in different render passes wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); - wgpu::RenderPassEncoder pass0 = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass0 = encoder.BeginRenderPass(&PlaceholderRenderPass); pass0.SetIndexBuffer(buffer0, wgpu::IndexFormat::Uint32); pass0.SetBindGroup(0, bg1); pass0.End(); - wgpu::RenderPassEncoder pass1 = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass1 = encoder.BeginRenderPass(&PlaceholderRenderPass); pass1.SetIndexBuffer(buffer1, wgpu::IndexFormat::Uint32); pass1.SetBindGroup(0, bg0); pass1.End(); @@ -297,8 +297,8 @@ namespace { pass0.SetBindGroup(0, bg0); pass0.End(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass1 = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass1 = encoder.BeginRenderPass(&PlaceholderRenderPass); pass1.SetBindGroup(1, bg1); pass1.End(); @@ -325,8 +325,8 @@ namespace { // It is not allowed to use the same buffer as both readable and writable in different // draws within the same render pass. wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetPipeline(rp); pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32); @@ -392,8 +392,8 @@ namespace { // It is invalid to use the same buffer as both readable and writable usages in a single // draw wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetPipeline(rp); pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32); @@ -455,8 +455,8 @@ namespace { { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); encoder.CopyBufferToBuffer(bufferSrc, 0, bufferDst, 0, 4); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetBindGroup(0, bg0); pass.End(); encoder.Finish(); @@ -492,14 +492,14 @@ namespace { device, {{0, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Storage}}); wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, buffer0}}); - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Set index buffer twice. The second one overwrites the first one. No buffer is used as // both read and write in the same pass. But the overwritten index buffer (buffer0) still // take effect during resource tracking. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetIndexBuffer(buffer0, wgpu::IndexFormat::Uint32); pass.SetIndexBuffer(buffer1, wgpu::IndexFormat::Uint32); pass.SetBindGroup(0, bg); @@ -511,7 +511,7 @@ namespace { // read and write in the same pass { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetIndexBuffer(buffer1, wgpu::IndexFormat::Uint32); pass.SetIndexBuffer(buffer0, wgpu::IndexFormat::Uint32); pass.SetBindGroup(0, bg); @@ -524,7 +524,7 @@ namespace { // (buffer0) still take effect during resource tracking. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetVertexBuffer(0, buffer0); pass.SetVertexBuffer(0, buffer1); pass.SetBindGroup(0, bg); @@ -536,7 +536,7 @@ namespace { // buffer0 is used as both read and write in the same pass { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetVertexBuffer(0, buffer1); pass.SetVertexBuffer(0, buffer0); pass.SetBindGroup(0, bg); @@ -562,14 +562,14 @@ namespace { wgpu::BindGroup bg0 = utils::MakeBindGroup(device, bgl, {{0, buffer0}}); wgpu::BindGroup bg1 = utils::MakeBindGroup(device, bgl, {{0, buffer1}}); - DummyRenderPass dummyRenderPass(device); + PlaceholderRenderPass PlaceholderRenderPass(device); // Set bind group on the same index twice. The second one overwrites the first one. // No buffer is used as both read and write in the same pass. But the overwritten // bind group still take effect during resource tracking. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetIndexBuffer(buffer0, wgpu::IndexFormat::Uint32); pass.SetBindGroup(0, bg0); pass.SetBindGroup(0, bg1); @@ -581,7 +581,7 @@ namespace { // buffer0 is used as both read and write in the same pass { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetIndexBuffer(buffer0, wgpu::IndexFormat::Uint32); pass.SetBindGroup(0, bg1); pass.SetBindGroup(0, bg0); @@ -656,8 +656,8 @@ namespace { // These two bindings are invisible in render pass. But we still track these bindings. wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetBindGroup(0, bg); pass.End(); ASSERT_DEVICE_ERROR(encoder.Finish()); @@ -702,8 +702,8 @@ namespace { // Buffer usage in compute stage in bind group conflicts with index buffer. And binding // for compute stage is not visible in render pass. But we still track this binding. wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetIndexBuffer(buffer, wgpu::IndexFormat::Uint32); pass.SetBindGroup(0, bg); pass.End(); @@ -777,8 +777,8 @@ namespace { // Resource in bg1 conflicts with resources used in bg0. However, bindings in bg1 is // not used in pipeline. But we still track this binding. wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetBindGroup(0, bg0); pass.SetBindGroup(1, bg1); pass.SetPipeline(rp); @@ -963,8 +963,8 @@ namespace { wgpu::BindGroup bg1 = utils::MakeBindGroup(device, bgl, {{0, view}}); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetBindGroup(0, bg); pass.SetBindGroup(1, bg1); pass.End(); @@ -1155,8 +1155,8 @@ namespace { pass0.SetBindGroup(0, writeBG); pass0.End(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass1 = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass1 = encoder.BeginRenderPass(&PlaceholderRenderPass); pass1.SetBindGroup(0, readBG); pass1.End(); @@ -1190,8 +1190,8 @@ namespace { // It is not allowed to use the same texture as both readable and writable in different // draws within the same render pass. wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetPipeline(rp); pass.SetBindGroup(0, sampledBG); @@ -1262,8 +1262,8 @@ namespace { // It is invalid to use the same texture as both readable and writable usages in a // single draw wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetPipeline(rp); pass.SetBindGroup(0, sampledBG); @@ -1470,8 +1470,8 @@ namespace { // These two bindings are invisible in render pass. But we still track these bindings. wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetBindGroup(0, bg); pass.End(); ASSERT_DEVICE_ERROR(encoder.Finish()); @@ -1595,8 +1595,8 @@ namespace { // Texture binding in readBG conflicts with texture binding in writeBG. The binding // in writeBG is not used in pipeline. But we still track this binding. wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetBindGroup(0, readBG); pass.SetBindGroup(1, writeBG); pass.SetPipeline(rp); @@ -1644,8 +1644,8 @@ namespace { // Test that indirect + readonly is allowed in the same render pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetPipeline(rp); pass.SetBindGroup(0, readBG); pass.DrawIndirect(buffer, 0); @@ -1656,8 +1656,8 @@ namespace { // Test that indirect + writable is disallowed in the same render pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - DummyRenderPass dummyRenderPass(device); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); + PlaceholderRenderPass PlaceholderRenderPass(device); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); pass.SetPipeline(rp); pass.SetBindGroup(0, writeBG); pass.DrawIndirect(buffer, 0); diff --git a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp index 371f06c39d..5e277d3332 100644 --- a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp @@ -39,7 +39,7 @@ class UnsafeAPIValidationTest : public ValidationTest { // Check that pipeline overridable constants are disallowed as part of unsafe APIs. // TODO(dawn:1041) Remove when implementation for all backend is added TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { - // Create the dummy compute pipeline. + // Create the placeholder compute pipeline. wgpu::ComputePipelineDescriptor pipelineDescBase; pipelineDescBase.compute.entryPoint = "main"; diff --git a/src/dawn/tests/unittests/validation/ValidationTest.cpp b/src/dawn/tests/unittests/validation/ValidationTest.cpp index 22b7bcb544..5cf78c30d2 100644 --- a/src/dawn/tests/unittests/validation/ValidationTest.cpp +++ b/src/dawn/tests/unittests/validation/ValidationTest.cpp @@ -252,7 +252,7 @@ void ValidationTest::OnDeviceLost(WGPUDeviceLostReason reason, ASSERT(false); } -ValidationTest::DummyRenderPass::DummyRenderPass(const wgpu::Device& device) +ValidationTest::PlaceholderRenderPass::PlaceholderRenderPass(const wgpu::Device& device) : attachmentFormat(wgpu::TextureFormat::RGBA8Unorm), width(400), height(400) { wgpu::TextureDescriptor descriptor; descriptor.dimension = wgpu::TextureDimension::e2D; diff --git a/src/dawn/tests/unittests/validation/ValidationTest.h b/src/dawn/tests/unittests/validation/ValidationTest.h index 636c8b54a0..16190805c5 100644 --- a/src/dawn/tests/unittests/validation/ValidationTest.h +++ b/src/dawn/tests/unittests/validation/ValidationTest.h @@ -115,9 +115,9 @@ class ValidationTest : public testing::Test { // Helper functions to create objects to test validation. - struct DummyRenderPass : public wgpu::RenderPassDescriptor { + struct PlaceholderRenderPass : public wgpu::RenderPassDescriptor { public: - explicit DummyRenderPass(const wgpu::Device& device); + explicit PlaceholderRenderPass(const wgpu::Device& device); wgpu::Texture attachment; wgpu::TextureFormat attachmentFormat; uint32_t width; diff --git a/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp index d26b5d573a..5b79eb5a4e 100644 --- a/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp @@ -25,7 +25,7 @@ class VertexBufferValidationTest : public ValidationTest { void SetUp() override { ValidationTest::SetUp(); - // dummy vertex shader module + // Placeholder vertex shader module vsModule = utils::CreateShaderModule(device, R"( @stage(vertex) fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); @@ -106,7 +106,7 @@ class VertexBufferValidationTest : public ValidationTest { // Check that vertex buffers still count as bound if we switch the pipeline. TEST_F(VertexBufferValidationTest, VertexBuffersInheritedBetweenPipelines) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::ShaderModule vsModule2 = MakeVertexShader(2); wgpu::ShaderModule vsModule1 = MakeVertexShader(1); @@ -143,7 +143,7 @@ TEST_F(VertexBufferValidationTest, VertexBuffersInheritedBetweenPipelines) { // Check that vertex buffers that are set are reset between render passes. TEST_F(VertexBufferValidationTest, VertexBuffersNotInheritedBetweenRenderPasses) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); wgpu::ShaderModule vsModule2 = MakeVertexShader(2); wgpu::ShaderModule vsModule1 = MakeVertexShader(1); @@ -195,7 +195,7 @@ TEST_F(VertexBufferValidationTest, VertexBuffersNotInheritedBetweenRenderPasses) TEST_F(VertexBufferValidationTest, VertexBufferSlotValidation) { wgpu::Buffer buffer = MakeVertexBuffer(); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Control case: using the last vertex buffer slot in render passes is ok. { @@ -238,7 +238,7 @@ TEST_F(VertexBufferValidationTest, VertexBufferSlotValidation) { TEST_F(VertexBufferValidationTest, VertexBufferOffsetOOBValidation) { wgpu::Buffer buffer = MakeVertexBuffer(); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Control case, using the full buffer, with or without an explicit size is valid. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -312,7 +312,7 @@ TEST_F(VertexBufferValidationTest, InvalidUsage) { wgpu::Buffer indexBuffer = utils::CreateBufferFromData(device, wgpu::BufferUsage::Index, {0, 0, 0}); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Control case: using the vertex buffer is valid. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -351,7 +351,7 @@ TEST_F(VertexBufferValidationTest, InvalidUsage) { TEST_F(VertexBufferValidationTest, OffsetAlignment) { wgpu::Buffer vertexBuffer = MakeVertexBuffer(); - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Control cases: vertex buffer offset is a multiple of 4 { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -375,7 +375,7 @@ TEST_F(VertexBufferValidationTest, OffsetAlignment) { // Check vertex buffer stride requirements for draw command. TEST_F(VertexBufferValidationTest, DrawStrideLimitsVertex) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Create a buffer of size 28, containing 4 float32 elements, array stride size = 8 // The last element doesn't have the full stride size @@ -506,7 +506,7 @@ TEST_F(VertexBufferValidationTest, DrawStrideLimitsVertex) { // Check instance buffer stride requirements with instanced attributes for draw command. TEST_F(VertexBufferValidationTest, DrawStrideLimitsInstance) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Create a buffer of size 28, containing 4 float32 elements, array stride size = 8 // The last element doesn't have the full stride size @@ -637,7 +637,7 @@ TEST_F(VertexBufferValidationTest, DrawStrideLimitsInstance) { // Check vertex buffer stride requirements with instanced attributes for draw indexed command. TEST_F(VertexBufferValidationTest, DrawIndexedStrideLimitsInstance) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Create a buffer of size 28, containing 4 float32 elements, array stride size = 8 // The last element doesn't have the full stride size @@ -778,7 +778,7 @@ TEST_F(VertexBufferValidationTest, DrawIndexedStrideLimitsInstance) { // Check last stride is computed correctly for vertex buffer with multiple attributes. TEST_F(VertexBufferValidationTest, DrawStrideLimitsVertexMultipleAttributes) { - DummyRenderPass renderPass(device); + PlaceholderRenderPass renderPass(device); // Create a buffer of size 44, array stride size = 12 wgpu::BufferDescriptor descriptor; diff --git a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp index e522cb34c1..514286b5dc 100644 --- a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp @@ -43,7 +43,7 @@ class VertexStateTest : public ValidationTest { } } - const char* kDummyVertexShader = R"( + const char* kPlaceholderVertexShader = R"( @stage(vertex) fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } @@ -53,7 +53,7 @@ class VertexStateTest : public ValidationTest { // Check an empty vertex input is valid TEST_F(VertexStateTest, EmptyIsOk) { utils::ComboVertexState state; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); } // Check null buffer is valid @@ -64,7 +64,7 @@ TEST_F(VertexStateTest, NullBufferIsOk) { state.cVertexBuffers[0].arrayStride = 0; state.cVertexBuffers[0].attributeCount = 0; state.cVertexBuffers[0].attributes = nullptr; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // One null buffer (buffer[0]) followed by a buffer (buffer[1]) is OK state.vertexBufferCount = 2; @@ -72,7 +72,7 @@ TEST_F(VertexStateTest, NullBufferIsOk) { state.cVertexBuffers[1].attributeCount = 1; state.cVertexBuffers[1].attributes = &state.cAttributes[0]; state.cAttributes[0].shaderLocation = 0; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Null buffer (buffer[2]) sitting between buffers (buffer[1] and buffer[3]) is OK state.vertexBufferCount = 4; @@ -81,7 +81,7 @@ TEST_F(VertexStateTest, NullBufferIsOk) { state.cVertexBuffers[3].attributeCount = 1; state.cVertexBuffers[3].attributes = &state.cAttributes[1]; state.cAttributes[1].shaderLocation = 1; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); } // Check validation that pipeline vertex buffers are backed by attributes in the vertex input @@ -130,11 +130,11 @@ TEST_F(VertexStateTest, StrideZero) { state.vertexBufferCount = 1; state.cVertexBuffers[0].arrayStride = 0; state.cVertexBuffers[0].attributeCount = 1; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Works ok with attributes at a large-ish offset state.cAttributes[0].offset = 128; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); } // Check validation that vertex attribute offset should be within vertex buffer arrayStride, @@ -148,15 +148,15 @@ TEST_F(VertexStateTest, SetOffsetOutOfBounds) { state.cAttributes[0].shaderLocation = 0; state.cAttributes[1].shaderLocation = 1; state.cAttributes[1].offset = sizeof(float); - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test vertex attribute offset exceed vertex buffer arrayStride range state.cVertexBuffers[0].arrayStride = sizeof(float); - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); // It's OK if arrayStride is zero state.cVertexBuffers[0].arrayStride = 0; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); } // Check out of bounds condition on total number of vertex buffers @@ -169,11 +169,11 @@ TEST_F(VertexStateTest, SetVertexBuffersNumLimit) { state.cVertexBuffers[i].attributes = &state.cAttributes[i]; state.cAttributes[i].shaderLocation = i; } - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test vertex buffer number exceed the limit state.vertexBufferCount = kMaxVertexBuffers + 1; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check out of bounds condition on total number of vertex attributes @@ -185,12 +185,12 @@ TEST_F(VertexStateTest, SetVertexAttributesNumLimit) { for (uint32_t i = 0; i < kMaxVertexAttributes; ++i) { state.cAttributes[i].shaderLocation = i; } - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test vertex attribute number exceed the limit state.cVertexBuffers[1].attributeCount = 1; state.cVertexBuffers[1].attributes = &state.cAttributes[kMaxVertexAttributes - 1]; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check out of bounds condition on input arrayStride @@ -200,11 +200,11 @@ TEST_F(VertexStateTest, SetInputStrideOutOfBounds) { state.vertexBufferCount = 1; state.cVertexBuffers[0].arrayStride = kMaxVertexBufferArrayStride; state.cVertexBuffers[0].attributeCount = 1; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test input arrayStride OOB state.cVertexBuffers[0].arrayStride = kMaxVertexBufferArrayStride + 1; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check multiple of 4 bytes constraint on input arrayStride @@ -214,11 +214,11 @@ TEST_F(VertexStateTest, SetInputStrideNotAligned) { state.vertexBufferCount = 1; state.cVertexBuffers[0].arrayStride = 4; state.cVertexBuffers[0].attributeCount = 1; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test input arrayStride not multiple of 4 bytes state.cVertexBuffers[0].arrayStride = 2; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Test that we cannot set an already set attribute @@ -228,13 +228,13 @@ TEST_F(VertexStateTest, AlreadySetAttribute) { state.vertexBufferCount = 1; state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].shaderLocation = 0; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Oh no, attribute 0 is set twice state.cVertexBuffers[0].attributeCount = 2; state.cAttributes[0].shaderLocation = 0; state.cAttributes[1].shaderLocation = 0; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Test that a arrayStride of 0 is valid @@ -246,11 +246,11 @@ TEST_F(VertexStateTest, SetSameShaderLocation) { state.cAttributes[0].shaderLocation = 0; state.cAttributes[1].shaderLocation = 1; state.cAttributes[1].offset = sizeof(float); - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test same shader location in two attributes in the same buffer state.cAttributes[1].shaderLocation = 0; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); // Test same shader location in two attributes in different buffers state.vertexBufferCount = 2; @@ -259,7 +259,7 @@ TEST_F(VertexStateTest, SetSameShaderLocation) { state.cVertexBuffers[1].attributeCount = 1; state.cVertexBuffers[1].attributes = &state.cAttributes[1]; state.cAttributes[1].shaderLocation = 0; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check out of bounds condition on attribute shader location @@ -269,11 +269,11 @@ TEST_F(VertexStateTest, SetAttributeLocationOutOfBounds) { state.vertexBufferCount = 1; state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].shaderLocation = kMaxVertexAttributes - 1; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test attribute location OOB state.cAttributes[0].shaderLocation = kMaxVertexAttributes; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check attribute offset out of bounds @@ -283,11 +283,11 @@ TEST_F(VertexStateTest, SetAttributeOffsetOutOfBounds) { state.vertexBufferCount = 1; state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].offset = kMaxVertexBufferArrayStride - sizeof(wgpu::VertexFormat::Float32); - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); // Test attribute offset out of bounds state.cAttributes[0].offset = kMaxVertexBufferArrayStride - 1; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check the min(4, formatSize) alignment constraint for the offset. @@ -300,34 +300,34 @@ TEST_F(VertexStateTest, SetOffsetNotAligned) { // Test that for small formats, the offset must be aligned to the format size. state.cAttributes[0].format = wgpu::VertexFormat::Float32; state.cAttributes[0].offset = 4; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); state.cAttributes[0].offset = 2; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); state.cAttributes[0].format = wgpu::VertexFormat::Snorm16x2; state.cAttributes[0].offset = 4; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); state.cAttributes[0].offset = 2; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); state.cAttributes[0].format = wgpu::VertexFormat::Unorm8x2; state.cAttributes[0].offset = 2; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); state.cAttributes[0].offset = 1; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); // Test that for large formts the offset only needs to be aligned to 4. state.cAttributes[0].format = wgpu::VertexFormat::Snorm16x4; state.cAttributes[0].offset = 4; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); state.cAttributes[0].format = wgpu::VertexFormat::Uint32x3; state.cAttributes[0].offset = 4; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); state.cAttributes[0].format = wgpu::VertexFormat::Sint32x4; state.cAttributes[0].offset = 4; - CreatePipeline(true, state, kDummyVertexShader); + CreatePipeline(true, state, kPlaceholderVertexShader); } // Check attribute offset overflow @@ -336,7 +336,7 @@ TEST_F(VertexStateTest, SetAttributeOffsetOverflow) { state.vertexBufferCount = 1; state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].offset = std::numeric_limits::max(); - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check for some potential underflow in the vertex input validation @@ -346,7 +346,7 @@ TEST_F(VertexStateTest, VertexFormatLargerThanNonZeroStride) { state.cVertexBuffers[0].arrayStride = 4; state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].format = wgpu::VertexFormat::Float32x4; - CreatePipeline(false, state, kDummyVertexShader); + CreatePipeline(false, state, kPlaceholderVertexShader); } // Check that the vertex format base type must match the shader's variable base type. diff --git a/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp b/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp index 7c8677b361..508c86618c 100644 --- a/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp @@ -224,10 +224,10 @@ namespace { // Test copying from a buffer to a multi-planar format fails. TEST_F(VideoViewsValidation, B2TCopyAllAspectsFails) { - std::vector dummyData(4, 0); + std::vector placeholderData(4, 0); wgpu::Buffer srcBuffer = utils::CreateBufferFromData( - device, dummyData.data(), dummyData.size(), wgpu::BufferUsage::CopySrc); + device, placeholderData.data(), placeholderData.size(), wgpu::BufferUsage::CopySrc); wgpu::Texture dstTexture = CreateVideoTextureForTest( wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding); @@ -245,10 +245,10 @@ namespace { // Test copying from a buffer to a multi-planar format per plane fails. TEST_F(VideoViewsValidation, B2TCopyPlaneAspectsFails) { - std::vector dummyData(4, 0); + std::vector placeholderData(4, 0); wgpu::Buffer srcBuffer = utils::CreateBufferFromData( - device, dummyData.data(), dummyData.size(), wgpu::BufferUsage::CopySrc); + device, placeholderData.data(), placeholderData.size(), wgpu::BufferUsage::CopySrc); wgpu::Texture dstTexture = CreateVideoTextureForTest( wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding); @@ -311,13 +311,14 @@ namespace { wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0}); - std::vector dummyData(4, 0); + std::vector placeholderData(4, 0); wgpu::Extent3D writeSize = {1, 1, 1}; wgpu::Queue queue = device.GetQueue(); - ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyTexture, dummyData.data(), - dummyData.size(), &textureDataLayout, &writeSize)); + ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyTexture, placeholderData.data(), + placeholderData.size(), &textureDataLayout, + &writeSize)); } // Tests writing into a multi-planar format per plane fails. @@ -329,13 +330,14 @@ namespace { wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only); - std::vector dummmyData(4, 0); + std::vector placeholderData(4, 0); wgpu::Extent3D writeSize = {1, 1, 1}; wgpu::Queue queue = device.GetQueue(); - ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyTexture, dummmyData.data(), - dummmyData.size(), &textureDataLayout, &writeSize)); + ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyTexture, placeholderData.data(), + placeholderData.size(), &textureDataLayout, + &writeSize)); } } // anonymous namespace diff --git a/src/dawn/tests/unittests/wire/WireArgumentTests.cpp b/src/dawn/tests/unittests/wire/WireArgumentTests.cpp index 4f3da076ea..c4e00279db 100644 --- a/src/dawn/tests/unittests/wire/WireArgumentTests.cpp +++ b/src/dawn/tests/unittests/wire/WireArgumentTests.cpp @@ -166,13 +166,13 @@ TEST_F(WireArgumentTests, CStringArgument) { wgpuDeviceCreateRenderPipeline(device, &pipelineDescriptor); - WGPURenderPipeline apiDummyPipeline = api.GetNewRenderPipeline(); + WGPURenderPipeline apiPlaceholderPipeline = api.GetNewRenderPipeline(); EXPECT_CALL(api, DeviceCreateRenderPipeline( apiDevice, MatchesLambda([](const WGPURenderPipelineDescriptor* desc) -> bool { return desc->vertex.entryPoint == std::string("main"); }))) - .WillOnce(Return(apiDummyPipeline)); + .WillOnce(Return(apiPlaceholderPipeline)); FlushClient(); } @@ -248,7 +248,7 @@ TEST_F(WireArgumentTests, StructureOfValuesArgument) { wgpuDeviceCreateSampler(device, &descriptor); - WGPUSampler apiDummySampler = api.GetNewSampler(); + WGPUSampler apiPlaceholderSampler = api.GetNewSampler(); EXPECT_CALL(api, DeviceCreateSampler( apiDevice, MatchesLambda([](const WGPUSamplerDescriptor* desc) -> bool { return desc->nextInChain == nullptr && @@ -261,7 +261,7 @@ TEST_F(WireArgumentTests, StructureOfValuesArgument) { desc->compare == WGPUCompareFunction_Never && desc->lodMinClamp == kLodMin && desc->lodMaxClamp == kLodMax; }))) - .WillOnce(Return(apiDummySampler)); + .WillOnce(Return(apiPlaceholderSampler)); FlushClient(); } @@ -282,7 +282,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) { wgpuDeviceCreatePipelineLayout(device, &descriptor); - WGPUPipelineLayout apiDummyLayout = api.GetNewPipelineLayout(); + WGPUPipelineLayout apiPlaceholderLayout = api.GetNewPipelineLayout(); EXPECT_CALL(api, DeviceCreatePipelineLayout( apiDevice, MatchesLambda([apiBgl](const WGPUPipelineLayoutDescriptor* desc) -> bool { @@ -290,7 +290,7 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) { desc->bindGroupLayoutCount == 1 && desc->bindGroupLayouts[0] == apiBgl; }))) - .WillOnce(Return(apiDummyLayout)); + .WillOnce(Return(apiPlaceholderLayout)); FlushClient(); } diff --git a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp index 5ba589c023..5d449c6eb8 100644 --- a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp +++ b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp @@ -29,7 +29,7 @@ namespace { // Test that commands are not received if the client disconnects. TEST_F(WireDisconnectTests, CommandsAfterDisconnect) { - // Sanity check that commands work at all. + // Check that commands work at all. wgpuDeviceCreateCommandEncoder(device, nullptr); WGPUCommandEncoder apiCmdBufEncoder = api.GetNewCommandEncoder(); @@ -49,7 +49,7 @@ TEST_F(WireDisconnectTests, CommandsAfterDisconnect) { // Test that commands that are serialized before a disconnect but flushed // after are received. TEST_F(WireDisconnectTests, FlushAfterDisconnect) { - // Sanity check that commands work at all. + // Check that commands work at all. wgpuDeviceCreateCommandEncoder(device, nullptr); // Disconnect. diff --git a/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp b/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp index 991050b453..b7f06e45ec 100644 --- a/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp +++ b/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp @@ -38,8 +38,8 @@ TEST_F(WireInjectTextureTests, CallAfterReserveInject) { reservation.deviceId, reservation.deviceGeneration)); wgpuTextureCreateView(reservation.texture, nullptr); - WGPUTextureView apiDummyView = api.GetNewTextureView(); - EXPECT_CALL(api, TextureCreateView(apiTexture, nullptr)).WillOnce(Return(apiDummyView)); + WGPUTextureView apiPlaceholderView = api.GetNewTextureView(); + EXPECT_CALL(api, TextureCreateView(apiTexture, nullptr)).WillOnce(Return(apiPlaceholderView)); FlushClient(); } diff --git a/src/dawn/tests/unittests/wire/WireOptionalTests.cpp b/src/dawn/tests/unittests/wire/WireOptionalTests.cpp index ca68cdd505..9fafa3b996 100644 --- a/src/dawn/tests/unittests/wire/WireOptionalTests.cpp +++ b/src/dawn/tests/unittests/wire/WireOptionalTests.cpp @@ -49,7 +49,7 @@ TEST_F(WireOptionalTests, OptionalObjectValue) { wgpuDeviceCreateBindGroup(device, &bgDesc); - WGPUBindGroup apiDummyBindGroup = api.GetNewBindGroup(); + WGPUBindGroup apiPlaceholderBindGroup = api.GetNewBindGroup(); EXPECT_CALL(api, DeviceCreateBindGroup( apiDevice, MatchesLambda([](const WGPUBindGroupDescriptor* desc) -> bool { return desc->nextInChain == nullptr && desc->entryCount == 1 && @@ -58,7 +58,7 @@ TEST_F(WireOptionalTests, OptionalObjectValue) { desc->entries[0].buffer == nullptr && desc->entries[0].textureView == nullptr; }))) - .WillOnce(Return(apiDummyBindGroup)); + .WillOnce(Return(apiPlaceholderBindGroup)); FlushClient(); } @@ -138,7 +138,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) { pipelineDescriptor.depthStencil = &depthStencilState; wgpuDeviceCreateRenderPipeline(device, &pipelineDescriptor); - WGPURenderPipeline apiDummyPipeline = api.GetNewRenderPipeline(); + WGPURenderPipeline apiPlaceholderPipeline = api.GetNewRenderPipeline(); EXPECT_CALL( api, DeviceCreateRenderPipeline( @@ -161,7 +161,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) { desc->depthStencil->depthBiasSlopeScale == 0.0 && desc->depthStencil->depthBiasClamp == 0.0; }))) - .WillOnce(Return(apiDummyPipeline)); + .WillOnce(Return(apiPlaceholderPipeline)); FlushClient(); @@ -173,7 +173,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) { apiDevice, MatchesLambda([](const WGPURenderPipelineDescriptor* desc) -> bool { return desc->depthStencil == nullptr; }))) - .WillOnce(Return(apiDummyPipeline)); + .WillOnce(Return(apiPlaceholderPipeline)); FlushClient(); } diff --git a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp index 05baa9d9f6..7f97bae217 100644 --- a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp @@ -96,11 +96,11 @@ class D3D12DescriptorHeapTests : public DawnTest { wgpu::ShaderModule mSimpleFSModule; }; -class DummyStagingDescriptorAllocator { +class PlaceholderStagingDescriptorAllocator { public: - DummyStagingDescriptorAllocator(Device* device, - uint32_t descriptorCount, - uint32_t allocationsPerHeap) + PlaceholderStagingDescriptorAllocator(Device* device, + uint32_t descriptorCount, + uint32_t allocationsPerHeap) : mAllocator(device, descriptorCount, allocationsPerHeap * descriptorCount, @@ -899,7 +899,8 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { TEST_P(D3D12DescriptorHeapTests, Single) { constexpr uint32_t kDescriptorCount = 4; constexpr uint32_t kAllocationsPerHeap = 3; - DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap); + PlaceholderStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, + kAllocationsPerHeap); CPUDescriptorHeapAllocation allocation = allocator.AllocateCPUDescriptors(); EXPECT_EQ(allocation.GetHeapIndex(), 0u); @@ -914,7 +915,8 @@ TEST_P(D3D12DescriptorHeapTests, Single) { TEST_P(D3D12DescriptorHeapTests, Sequential) { constexpr uint32_t kDescriptorCount = 4; constexpr uint32_t kAllocationsPerHeap = 3; - DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap); + PlaceholderStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, + kAllocationsPerHeap); // Allocate |kNumOfHeaps| worth. constexpr uint32_t kNumOfHeaps = 2; @@ -944,7 +946,8 @@ TEST_P(D3D12DescriptorHeapTests, Sequential) { TEST_P(D3D12DescriptorHeapTests, ReuseFreedHeaps) { constexpr uint32_t kDescriptorCount = 4; constexpr uint32_t kAllocationsPerHeap = 25; - DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap); + PlaceholderStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, + kAllocationsPerHeap); constexpr uint32_t kNumofHeaps = 10; @@ -987,7 +990,8 @@ TEST_P(D3D12DescriptorHeapTests, ReuseFreedHeaps) { TEST_P(D3D12DescriptorHeapTests, AllocateDeallocateMany) { constexpr uint32_t kDescriptorCount = 4; constexpr uint32_t kAllocationsPerHeap = 25; - DummyStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, kAllocationsPerHeap); + PlaceholderStagingDescriptorAllocator allocator(mD3DDevice, kDescriptorCount, + kAllocationsPerHeap); std::list list3; std::list list5; diff --git a/src/dawn/utils/CMakeLists.txt b/src/dawn/utils/CMakeLists.txt index 6012483516..a05bcba97f 100644 --- a/src/dawn/utils/CMakeLists.txt +++ b/src/dawn/utils/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(dawn_utils STATIC ${DAWN_DUMMY_FILE}) +add_library(dawn_utils STATIC ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_utils) target_sources(dawn_utils PRIVATE "ComboRenderBundleEncoderDescriptor.cpp" diff --git a/src/dawn/utils/Glfw3Fuchsia.cpp b/src/dawn/utils/Glfw3Fuchsia.cpp index ed2a477efd..6fb13cc39a 100644 --- a/src/dawn/utils/Glfw3Fuchsia.cpp +++ b/src/dawn/utils/Glfw3Fuchsia.cpp @@ -19,7 +19,7 @@ // NOTE: This must be included before GLFW/glfw3.h because the latter will // include and "common/vulkan_platform.h" wants to be -// the first header to do so for sanity reasons (e.g. undefining weird +// the first header to do so for validity reasons (e.g. undefining weird // macros on Windows and Linux). // clang-format off #include "dawn/common/vulkan_platform.h" diff --git a/src/dawn/utils/ObjCUtils.h b/src/dawn/utils/ObjCUtils.h index 543fb6f73e..28aa1bd421 100644 --- a/src/dawn/utils/ObjCUtils.h +++ b/src/dawn/utils/ObjCUtils.h @@ -22,7 +22,7 @@ namespace utils { // The returned CALayer is autoreleased. - void* CreateDummyCALayer(); + void* CreatePlaceholderCALayer(); } // namespace utils diff --git a/src/dawn/utils/ObjCUtils.mm b/src/dawn/utils/ObjCUtils.mm index c006976409..477b0300ab 100644 --- a/src/dawn/utils/ObjCUtils.mm +++ b/src/dawn/utils/ObjCUtils.mm @@ -18,7 +18,7 @@ namespace utils { - void* CreateDummyCALayer() { + void* CreatePlaceholderCALayer() { return [CALayer layer]; } diff --git a/src/dawn/wire/CMakeLists.txt b/src/dawn/wire/CMakeLists.txt index 4afb6bd676..bce614cded 100644 --- a/src/dawn/wire/CMakeLists.txt +++ b/src/dawn/wire/CMakeLists.txt @@ -18,7 +18,7 @@ DawnJSONGenerator( RESULT_VARIABLE "DAWN_WIRE_GEN_SOURCES" ) -add_library(dawn_wire ${DAWN_DUMMY_FILE}) +add_library(dawn_wire ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_wire) target_compile_definitions(dawn_wire PRIVATE "DAWN_WIRE_IMPLEMENTATION") diff --git a/src/tint/reader/spirv/parser_impl_module_var_test.cc b/src/tint/reader/spirv/parser_impl_module_var_test.cc index c8f6935887..443e83644a 100644 --- a/src/tint/reader/spirv/parser_impl_module_var_test.cc +++ b/src/tint/reader/spirv/parser_impl_module_var_test.cc @@ -3410,8 +3410,8 @@ TEST_F(SpvModuleScopeVarParserTest, RegisterInputOutputVars) { %300 = OpFunction %void None %voidfn %entry_300 = OpLabel - %dummy_300_1 = OpFunctionCall %void %100 - %dummy_300_2 = OpFunctionCall %void %200 + %placeholder_300_1 = OpFunctionCall %void %100 + %placeholder_300_2 = OpFunctionCall %void %200 OpReturn OpFunctionEnd @@ -3424,21 +3424,21 @@ TEST_F(SpvModuleScopeVarParserTest, RegisterInputOutputVars) { ; Call %100 %1100 = OpFunction %void None %voidfn %entry_1100 = OpLabel - %dummy_1100_1 = OpFunctionCall %void %100 + %placeholder_1100_1 = OpFunctionCall %void %100 OpReturn OpFunctionEnd ; Call %200 %1200 = OpFunction %void None %voidfn %entry_1200 = OpLabel - %dummy_1200_1 = OpFunctionCall %void %200 + %placeholder_1200_1 = OpFunctionCall %void %200 OpReturn OpFunctionEnd ; Call %300 %1300 = OpFunction %void None %voidfn %entry_1300 = OpLabel - %dummy_1300_1 = OpFunctionCall %void %300 + %placeholder_1300_1 = OpFunctionCall %void %300 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1118.wgsl b/test/tint/bug/tint/1118.wgsl index c8e3d046b7..bd59a5f3f1 100644 --- a/test/tint/bug/tint/1118.wgsl +++ b/test/tint/bug/tint/1118.wgsl @@ -5,9 +5,9 @@ struct Scene { struct Material { vDiffuseColor : vec4, vAmbientColor : vec3, - dummy: f32, + placeholder: f32, vEmissiveColor : vec3, - dummy2: f32, + placeholder2: f32, }; struct Mesh { diff --git a/test/tint/bug/tint/1118.wgsl.expected.glsl b/test/tint/bug/tint/1118.wgsl.expected.glsl index a9bb0982a1..1a8acc6627 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.glsl +++ b/test/tint/bug/tint/1118.wgsl.expected.glsl @@ -11,9 +11,9 @@ struct Scene { struct Material { vec4 vDiffuseColor; vec3 vAmbientColor; - float dummy; + float placeholder; vec3 vEmissiveColor; - float dummy2; + float placeholder2; }; struct Mesh { @@ -29,9 +29,9 @@ layout(binding = 0) uniform Scene_1 { layout(binding = 1) uniform Material_1 { vec4 vDiffuseColor; vec3 vAmbientColor; - float dummy; + float placeholder; vec3 vEmissiveColor; - float dummy2; + float placeholder2; } x_49; layout(binding = 2) uniform Mesh_1 { diff --git a/test/tint/bug/tint/1118.wgsl.expected.msl b/test/tint/bug/tint/1118.wgsl.expected.msl index e1bcabfc3a..598b84b2e7 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.msl +++ b/test/tint/bug/tint/1118.wgsl.expected.msl @@ -19,9 +19,9 @@ struct Scene { struct Material { /* 0x0000 */ float4 vDiffuseColor; /* 0x0010 */ packed_float3 vAmbientColor; - /* 0x001c */ float dummy; + /* 0x001c */ float placeholder; /* 0x0020 */ packed_float3 vEmissiveColor; - /* 0x002c */ float dummy2; + /* 0x002c */ float placeholder2; }; struct Mesh { @@ -151,4 +151,3 @@ fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_24 [[buffer wrapper_result.glFragColor_1 = inner_result.glFragColor_1; return wrapper_result; } - diff --git a/test/tint/bug/tint/1118.wgsl.expected.spvasm b/test/tint/bug/tint/1118.wgsl.expected.spvasm index 30232040a9..55d6f1dfe6 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1118.wgsl.expected.spvasm @@ -19,9 +19,9 @@ OpName %Material "Material" OpMemberName %Material 0 "vDiffuseColor" OpMemberName %Material 1 "vAmbientColor" - OpMemberName %Material 2 "dummy" + OpMemberName %Material 2 "placeholder" OpMemberName %Material 3 "vEmissiveColor" - OpMemberName %Material 4 "dummy2" + OpMemberName %Material 4 "placeholder2" OpName %x_49 "x_49" OpName %Mesh "Mesh" OpMemberName %Mesh 0 "visibility" diff --git a/test/tint/bug/tint/1118.wgsl.expected.wgsl b/test/tint/bug/tint/1118.wgsl.expected.wgsl index 395ea62e17..1274782bbe 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1118.wgsl.expected.wgsl @@ -5,9 +5,9 @@ struct Scene { struct Material { vDiffuseColor : vec4, vAmbientColor : vec3, - dummy : f32, + placeholder : f32, vEmissiveColor : vec3, - dummy2 : f32, + placeholder2 : f32, } struct Mesh { diff --git a/webgpu-cts/scripts/compile_src.py b/webgpu-cts/scripts/compile_src.py index 91c0eb4325..9ebcfc429a 100755 --- a/webgpu-cts/scripts/compile_src.py +++ b/webgpu-cts/scripts/compile_src.py @@ -35,20 +35,20 @@ def compile_src(out_dir): shutil.rmtree(out_dir) run_tsc_ignore_errors([ - '--project', - os.path.join(webgpu_cts_root_dir, 'tsconfig.json'), - '--outDir', + "--project", + os.path.join(webgpu_cts_root_dir, "tsconfig.json"), + "--outDir", out_dir, - '--noEmit', - 'false', - '--noEmitOnError', - 'false', - '--declaration', - 'false', - '--sourceMap', - 'false', - '--target', - 'ES2017', + "--noEmit", + "false", + "--noEmitOnError", + "false", + "--declaration", + "false", + "--sourceMap", + "false", + "--target", + "ES2017", ]) @@ -59,43 +59,43 @@ def compile_src_for_node(out_dir, additional_args=None, clean=True): shutil.rmtree(out_dir) args = [ - '--project', - os.path.join(webgpu_cts_root_dir, 'node.tsconfig.json'), - '--outDir', + "--project", + os.path.join(webgpu_cts_root_dir, "node.tsconfig.json"), + "--outDir", out_dir, - '--noEmit', - 'false', - '--noEmitOnError', - 'false', - '--declaration', - 'false', - '--sourceMap', - 'false', - '--target', - 'ES6', + "--noEmit", + "false", + "--noEmitOnError", + "false", + "--declaration", + "false", + "--sourceMap", + "false", + "--target", + "ES6", ] args.extend(additional_args) run_tsc_ignore_errors(args) -if __name__ == '__main__': +if __name__ == "__main__": if len(sys.argv) != 2: - print('Usage: compile_src.py GEN_DIR') + print("Usage: compile_src.py GEN_DIR") sys.exit(1) gen_dir = sys.argv[1] # Compile the CTS src. - compile_src(os.path.join(gen_dir, 'src')) - compile_src_for_node(os.path.join(gen_dir, 'src-node')) + compile_src(os.path.join(gen_dir, "src")) + compile_src_for_node(os.path.join(gen_dir, "src-node")) - # Run gen_listings.js to overwrite the dummy src/webgpu/listings.js created + # Run gen_listings.js to overwrite the placeholder src/webgpu/listings.js created # from transpiling src/ RunNode([ - os.path.join(gen_dir, 'src-node', 'common', 'tools', - 'gen_listings.js'), - '--no-validate', - os.path.join(gen_dir, 'src'), - os.path.join(gen_dir, 'src-node', 'webgpu'), + os.path.join(gen_dir, "src-node", "common", "tools", + "gen_listings.js"), + "--no-validate", + os.path.join(gen_dir, "src"), + os.path.join(gen_dir, "src-node", "webgpu"), ])