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 <cwallez@chromium.org> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
6a3373e419
commit
fb5a492787
|
@ -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
|
||||
|
|
26
PRESUBMIT.py
26
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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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/<Debug/Release/foo>/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/<Debug/Release/foo>/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
|
||||
|
||||
|
|
|
@ -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: `<test_binary> --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.
|
||||
Regenerating the seed corpus keeps it up to date when Dawn's API or wire protocol changes.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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() %}
|
||||
|
|
|
@ -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 -%}
|
||||
|
|
|
@ -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:]))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace dawn::native {
|
|||
}
|
||||
|
||||
bool CommandAllocator::IsEmpty() const {
|
||||
return mCurrentPtr == reinterpret_cast<const uint8_t*>(&mDummyEnum[0]);
|
||||
return mCurrentPtr == reinterpret_cast<const uint8_t*>(&mPlaceholderEnum[0]);
|
||||
}
|
||||
|
||||
CommandBlocks&& CommandAllocator::AcquireBlocks() {
|
||||
|
@ -221,8 +221,8 @@ namespace dawn::native {
|
|||
}
|
||||
|
||||
void CommandAllocator::ResetPointers() {
|
||||
mCurrentPtr = reinterpret_cast<uint8_t*>(&mDummyEnum[0]);
|
||||
mEndPtr = reinterpret_cast<uint8_t*>(&mDummyEnum[1]);
|
||||
mCurrentPtr = reinterpret_cast<uint8_t*>(&mPlaceholderEnum[0]);
|
||||
mEndPtr = reinterpret_cast<uint8_t*>(&mPlaceholderEnum[1]);
|
||||
}
|
||||
|
||||
} // namespace dawn::native
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Ref<TextureViewBase>>
|
||||
DeviceBase::GetOrCreateDummyTextureViewForExternalTexture() {
|
||||
if (!mExternalTextureDummyView.Get()) {
|
||||
Ref<TextureBase> externalTextureDummy;
|
||||
DeviceBase::GetOrCreatePlaceholderTextureViewForExternalTexture() {
|
||||
if (!mExternalTexturePlaceholderView.Get()) {
|
||||
Ref<TextureBase> 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<Ref<PipelineLayoutBase>> DeviceBase::GetOrCreatePipelineLayout(
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace dawn::native {
|
|||
|
||||
void UncacheComputePipeline(ComputePipelineBase* obj);
|
||||
|
||||
ResultOrError<Ref<TextureViewBase>> GetOrCreateDummyTextureViewForExternalTexture();
|
||||
ResultOrError<Ref<TextureViewBase>> GetOrCreatePlaceholderTextureViewForExternalTexture();
|
||||
|
||||
ResultOrError<Ref<PipelineLayoutBase>> GetOrCreatePipelineLayout(
|
||||
const PipelineLayoutDescriptor* descriptor);
|
||||
|
@ -512,7 +512,7 @@ namespace dawn::native {
|
|||
|
||||
Ref<BindGroupLayoutBase> mEmptyBindGroupLayout;
|
||||
|
||||
Ref<TextureViewBase> mExternalTextureDummyView;
|
||||
Ref<TextureViewBase> mExternalTexturePlaceholderView;
|
||||
|
||||
std::unique_ptr<DynamicUploader> mDynamicUploader;
|
||||
std::unique_ptr<AsyncTaskManager> mAsyncTaskManager;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace dawn::native {
|
|||
ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
||||
MaybeError Initialize(DeviceBase* device, const ExternalTextureDescriptor* descriptor);
|
||||
|
||||
Ref<TextureBase> mDummyTexture;
|
||||
Ref<TextureBase> mPlaceholderTexture;
|
||||
Ref<BufferBase> mParamsBuffer;
|
||||
std::array<Ref<TextureViewBase>, kMaxPlanesPerFormat> mTextureViews;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace dawn::native {
|
|||
Ref<ComputePipelineBase> timestampComputePipeline;
|
||||
Ref<ShaderModuleBase> timestampCS;
|
||||
|
||||
Ref<ShaderModuleBase> dummyFragmentShader;
|
||||
Ref<ShaderModuleBase> placeholderFragmentShader;
|
||||
|
||||
// A scratch buffer suitable for use as a copy destination and storage binding.
|
||||
ScratchBuffer scratchStorage;
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -473,7 +473,7 @@ namespace dawn::native {
|
|||
return {};
|
||||
}
|
||||
|
||||
std::vector<StageAndDescriptor> GetRenderStagesAndSetDummyShader(
|
||||
std::vector<StageAndDescriptor> GetRenderStagesAndSetPlaceholderShader(
|
||||
DeviceBase* device,
|
||||
const RenderPipelineDescriptor* descriptor) {
|
||||
std::vector<StageAndDescriptor> 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;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace dawn::native {
|
|||
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
|
||||
const RenderPipelineDescriptor* descriptor);
|
||||
|
||||
std::vector<StageAndDescriptor> GetRenderStagesAndSetDummyShader(
|
||||
std::vector<StageAndDescriptor> GetRenderStagesAndSetPlaceholderShader(
|
||||
DeviceBase* device,
|
||||
const RenderPipelineDescriptor* descriptor);
|
||||
|
||||
|
|
|
@ -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:
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace dawn::native {
|
|||
DisableSymbolRenaming,
|
||||
UseUserDefinedLabelsInBackend,
|
||||
DisableR8RG8Mipmaps,
|
||||
UseDummyFragmentInVertexOnlyPipeline,
|
||||
UsePlaceholderFragmentInVertexOnlyPipeline,
|
||||
FxcOptimizations,
|
||||
RecordDetailedTimingInTraceEvents,
|
||||
DisableTimestampQueryConversion,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -87,26 +87,26 @@ namespace dawn::native::opengl {
|
|||
|
||||
// Create an OpenGL shader for each stage and gather the list of combined samplers.
|
||||
PerStage<CombinedSamplerInfo> combinedSamplers;
|
||||
bool needsDummySampler = false;
|
||||
bool needsPlaceholderSampler = false;
|
||||
std::vector<GLuint> 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ namespace dawn::native::opengl {
|
|||
GLuint mProgram;
|
||||
std::vector<std::vector<SamplerUnit>> mUnitsForSamplers;
|
||||
std::vector<std::vector<GLuint>> mUnitsForTextures;
|
||||
std::vector<GLuint> mDummySamplerUnits;
|
||||
std::vector<GLuint> 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<Sampler> mDummySampler;
|
||||
Ref<Sampler> mPlaceholderSampler;
|
||||
};
|
||||
|
||||
} // namespace dawn::native::opengl
|
||||
|
|
|
@ -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<uint32_t>(samplerLocation.group) << "_"
|
||||
<< static_cast<uint32_t>(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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace dawn::native::vulkan {
|
|||
|
||||
template <typename VK_STRUCT_TYPE>
|
||||
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),
|
||||
|
|
|
@ -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<uint8_t>(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;
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace dawn::native::vulkan {
|
|||
// that is already initialized.
|
||||
template <typename VK_STRUCT_TYPE>
|
||||
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),
|
||||
|
|
|
@ -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 <cts-root-dir>
|
|||
[path-to-node] \ # for example <dawn-root-dir>/third_party/node/<arch>/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]
|
||||
```
|
||||
|
|
|
@ -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 <args>'
|
||||
// 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 <args>'
|
||||
// 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 <args>'
|
||||
// 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",
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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( \
|
||||
|
|
|
@ -434,9 +434,9 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
|||
vbContents.pos[1] = vec4<f32>(1.0, 1.0, 0.0, 1.0);
|
||||
vbContents.pos[2] = vec4<f32>(1.0, -1.0, 0.0, 1.0);
|
||||
vbContents.pos[3] = vec4<f32>(-1.0, -1.0, 0.0, 1.0);
|
||||
let dummy : i32 = 0;
|
||||
let placeholder : i32 = 0;
|
||||
ibContents.indices[0] = vec4<i32>(0, 1, 2, 0);
|
||||
ibContents.indices[1] = vec4<i32>(2, 3, dummy, dummy);
|
||||
ibContents.indices[1] = vec4<i32>(2, 3, placeholder, placeholder);
|
||||
uniformContents.color = 1.0;
|
||||
storageContents.color = 1.0;
|
||||
})");
|
||||
|
@ -549,9 +549,9 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
|||
contents.pos[1] = vec4<f32>(1.0, 1.0, 0.0, 1.0);
|
||||
contents.pos[2] = vec4<f32>(1.0, -1.0, 0.0, 1.0);
|
||||
contents.pos[3] = vec4<f32>(-1.0, -1.0, 0.0, 1.0);
|
||||
let dummy : i32 = 0;
|
||||
let placeholder : i32 = 0;
|
||||
contents.indices[0] = vec4<i32>(0, 1, 2, 0);
|
||||
contents.indices[1] = vec4<i32>(2, 3, dummy, dummy);
|
||||
contents.indices[1] = vec4<i32>(2, 3, placeholder, placeholder);
|
||||
contents.color0 = 1.0;
|
||||
contents.color1 = 1.0;
|
||||
})");
|
||||
|
|
|
@ -535,10 +535,11 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
|
|||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
wgpu::Texture dummyOutputTexture = CreateTexture(
|
||||
wgpu::Texture placeholderOutputTexture = CreateTexture(
|
||||
kRenderAttachmentFormat,
|
||||
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, {1, 1});
|
||||
utils |