These tests draw a simple triangle with many ways of encoding commands,
binding, and uploading data to the GPU. This tests the performance of Dawn's
validation, command recording, and submission by switching buffer
bindings, bind groups, and pipelines. Some test instantiations upload
per-draw data to test efficiency of resource transitions or pre-record
commands in a render bundle.
Change-Id: I9994cd96ef5988cca410462418792f28161c0526
Bug: dawn:208
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12460
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This fixes bugs where we try to uncache objects that fail creation.
Bug: dawn:249
Change-Id: Ic60b3ce702dfdda18baa6d263911885a43d3cda7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12820
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This mostly makes the MemoryAllocator not owned by the
BuddyResourceAllocator so that we don't need an extra class for the
dependency injection in the Vulkan backend. (the container for the
BuddyMemoryAllocator can be it's MemoryAllocator at the same time).
Also renames methods of MemoryAllocator to be more explicit.
Also renames the constructor parameter of BuddyMemoryAllocator to be
(subjectively) closer to what the represent.
BUG=dawn:27
Change-Id: I37355ad5b3cded143956f0adc4742fa1b717e9bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12661
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This removes the duplication of the memory allocators in preparation for
using sub-allocation in the Vulkan backend too.
Also renames ResourceMemory to ResourceHeap and MemoryResourceAllocator
to ResourceMemoryAllocator, and fixes a number of unused includes.
BUG=dawn:27
Change-Id: I1a9e7d41e5efafa5192bda1d89dc06455fa2af40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12660
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Updates TextureD3D to use the allocation handle and
defaults to using MSAA heaps.
BUG=dawn:27
Change-Id: I2318bb8d068df86364cb2ebc433f4737e9e121aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This patch extends the BindGroupTracker in the D3D12 and Vulkan backends to
track bound storage buffers. We insert barriers between dispatches to properly
synchronize writes to storage buffers.
Bug: dawn:236
Change-Id: Iab3f964c345b64755557ab206e05a2ff7b0a3a1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12301
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch implements the serialization and deserialization of
DawnDeviceProperties in dawn_wire for the use of serializing this type
of object in Chromium.
BUG=chromium:996713
TEST=dawn_unittests
Change-Id: I1678627a017079540689d8529a1a7e1c975aae61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12240
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Trace data can be used to build additional metrics which measure
validation costs, GPU time, etc. It will also be helpful to store in
the test output for later analysis.
This CL also adds jsoncpp as a DEP so we can dump trace file json
output.
Bug: dawn:208
Change-Id: Ia6c05ca90aecae308ee6a4fd11e5f43bb03b1dc9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12080
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
libdawn_native also requires the dawncpp headers. When we separated
libdawn_cpp from the dawn_headers, libdawn_native lost the cpp headers
and caused a compile failure. This patch separates the dawncpp headers
as a separate target so both libdawncpp and libdawn_native can depend
on them.
Bug: dawn:22
Change-Id: I4172f1654377afac8c4314123ee8b5b81dc7c928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12300
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Added D3D12Error to check HRESULTS and return error messages
with the correct error names.
Remove ASSERT_SUCCESS from D3D12 backend and use
MaybeError and ResultError instead to handle errors.
Bug: dawn:19
Change-Id: Idf2f1987725e7e658bd29a9b13653125ab43c564
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12000
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This will become wgpuGetProcAddress that is part of the webgpu.h and the
last gap in functionality for dawn.h to match webgpu.h.
BUG=dawn:22
Change-Id: I0dcb3b5e6bd99cb10db273fc101d3ec0161b7da0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
The functionality of the dawn_headers and libdawn targets are split into
the following targets:
- dawn_headers: the new version only exposes the "dawn.h" C API and no
longer includes the C++ API.
- dawncpp: the header and implementation of the C++ API that wraps the
C API. This is unbundled from the rest so the C++ API can be used
with libdawn_proc or other libraries implementing the C API.
- libdawn_proc: A DawnProcTable-backend implementation of the C API.
This is needed because in follow-up commit there will be three libraries
implementing the C API: libdawn_proc that trampolines where we want, and
libdawn_native/wire that don't have trampolines for better perf.
BUG=dawn:22
Change-Id: I5d941f0d98e5a4b633e14d67eb5269f7924f0647
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12160
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This change refactors D3D12 backend to have CommandRecordingContext
CommandRecordingContext allows us to, in a future, add additional
data to the context such as textures that need to be acquired and
released before command lists are executed.
The Device's pending command list and the command list which resides
in the Queue object were converted to use CommandRecordingContext.
Bug=dawn:234
Change-Id: Ic13a229fc1f15895ef71117ce638c942de224743
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11940
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Allows buffer/texture direct access to underlying resource rather than indirectly with a opaque memory type.
BUG=dawn:27
Change-Id: I2eb69f4e30c96c431dbc96094d671be1e0a29869
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Previously dawn_native files were in src/dawn_native/ while generated
files were in dawn_native/. This makes some things complicated when
integrating in other source trees so normalize all generated files to be
in paths that match the main tree.
BUG=dawn:225
Change-Id: I5b3e04d37a16251143578dfb7a31445b229fe4ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11300
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This is to match WebGPU semantics.
Bug: dawn:201
Change-Id: I2aab671fc389edf1d2765395814a9c831afc653e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11080
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This changes updates ErrorScopes so that scopes enclosing a
Queue::Submit or Queue::Signal resolve their callbacks asynchronously
after GPU execution is complete.
Bug: dawn:153
Change-Id: I0e0b8a9f19f3f29d1b6a3683938154b87f190a07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10701
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
ChromeOS has is_linux = true so the code to skip compiling GLFW on
ChromeOS didn't work correctly.
BUG=dawn:221
BUG=chromium:1002895
Change-Id: Ifbf8527407ad20b4368531da1d7653ce620d37be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11200
Reviewed-by: Mitsuru Oshima <oshima@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
A previous CL broke the build because a GLFW-related config
is no longer exposed. This fixes the issue.
Bug=dawn:221
Change-Id: I83d43b55d58d18e04ea20f732c76830a798f2487
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11181
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: David Turner <digit@google.com>
Due to the way GN target discovery works, glfw would get discovered in
Fuchsia / Android / ChromeOS builds when it isn't supported causing
compilation failures. This changes third_party/BUILD.gn so that glfw
targets are only created on supported platforms. It also changes
dawn_glfw in BUILD.gn to be more robust to building on all platforms.
Bug=dawn:221
BUG=chromium:1002895
Change-Id: I8f40b06f680094406d24e9a6dea44b128e59b854
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11160
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch implements Push/PopErrorScope except for asynchronous
or GPU commands. These commands, such as Queue::Submit will need
to hold onto the ErrorScope until GPU execution is complete.
Bug: dawn:153
Change-Id: I2d340b8b391d117a59497f35690993a9cd7503e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10700
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This CL adds Fuchsia-specific implementations to the following
classes:
dawn_native::vulkan::external_memory::Service
dawn_native::vulkan::external_semaphore::Service
The implementation is based on two Fuchsia Vulkan extensions
that are provides by the vulkan_fuchsia_extras.h header (i.e.
are not upstreamed to Khronos yet, but used/provided by the
Fuchsia platform):
VK_FUCHSIA_external_memory
VK_FUCHSIA_external_semaphore
Their details are similar to VK_KHR_external_XXXX_fd, but
uses Zircon handles instead of file decriptors.
BUG=dawn:221
Change-Id: I48238bcf3193433970cbe200a84b86a67103a2f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10963
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: David Turner <digit@google.com>
Enable the Vulkan backend when building Dawn with
the Chromium build system for Fuchsia. To make this
work properly the following is required:
- Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe
the Fuchsia swapchain layer and its layer extension, as well
as enabling them when creating a new VkInstance.
- Modify VulkanFunctions.cpp to load the Fuchsia swapchain
related extension for this platform only.
- Provide a small mock GLFW library for Fuchsia under
src/utils/Glfw3Fuchsia.cpp, since the upstream project
does not support this platform at all. Its purpose is
only to allow the creation of the right VulkanBinding
instance, which depends on the creation of a display
surface for latter swapchain creation.
- Add //third_party/fuchsia-sdk:vulkan_base and
//third_party/fuchsia-sdk:vulkan_validation as
data_deps of the libdawn_native_sources target in
order to ensure that the Fuchsia package created by
the build system will include the correct Vulkan
libraries (loader and validation layers).
This builds correctly, and both dawn_unittests and
dawn_end2end_tests will run on a real Fuchsia device
or inside the Fuchsia emulator, using either GPU
virtualization or a software-based renderer.
Note: dawn_unittests will also run inside QEMU, but
not dawn_end2end_tests, since the latter requires
proper GPU emulation which is not available in this
environment.
NOTE: All end2end tests pass using a device with
an "Intel HD Graphics 615 (Kaby Lake GT2)"
adapter. However:
- For some reason, a single test takes up
to 129 seconds to pass
(BufferSetSubDataTests.ManySetSubData/Vulkan).
- The test process crashes inside VkDestroyInstance(),
apparently inside the Fuchsia-specific imagepipe
layer (which implements swapchain support).
This is likely a bug in the layer itself, and
not Dawn.
Also, may end2end tests will crash when run inside
the Fuchsia emulator (which uses GPU virtualization
to talk to the host GPU). The crashes happen inside
libvulkan-goldfish.so, the emulator-specific Vulkan
ICD on this sytem. Not a Dawn bug either.
Bug=dawn:221
Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963
Commit-Queue: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Refactor existing memory allocators by using a common
memory type and handle.
BUG=dawn:27
Change-Id: Ieed4fa30a0bd8fedfb3a3c580920805f40b56fae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10680
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
WrapSharedHandle uses a HANDLE and an acquire key to create
a Dawn texture object.
A future change will use the acquire key to manage a keyed shared
mutex with Chromium code.
Bug: dawn:27
Change-Id: I1c0ef8d022158abf3f1c6731a37ee3f51632fcf9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10540
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This is needed so that the script to produce the isolate can correctly
detect the binary.
Bug: dawn:208
TBR: cwallez@chromium.org
Change-Id: I62fc4c40edfe9320d55a587d2176bbd9c93bb540
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10761
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch adds a perf test harness for Dawn and a simple test of
buffer upload performance. The test harness is based off of ANGLE's
perf tests.
Because perf tests are parameterized to support multiple test
variants, this patch also adds DawnTestWithParams and ParamGenerator
to support instantiating tests with additional parameters.
Bug: dawn:208
Change-Id: I60df730e9f9f21a4c29fc21ea1a8315e4fff1aa6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch implements the creation, buffer-to-texture copies and
texture-to-texture copies with BC formats on OpenGL backend. Note that
OpenGL SPEC also has the same issue about texture-to-texture copies
with compressed textures as Vulkan SPEC, so we have to skip the related
case.
The texture-to-buffer copies with BC formats and related end2end tests
will be supported in the following patches.
BUG=dawn:42
TEST=dawn_end2end_tests
Change-Id: I76b16862259cb2df77f202ed7ed433d41aa3cd47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10220
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This CL implements RenderBundle and RenderBundleEncoder in the frontend
and adds unittests for validation.
Bug: dawn:154
Change-Id: Ice5ecd384cd627ad270b73052408f8139d1ea5f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9221
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
As part of enabling WebGPU on Chrome OS, we would like to run the Dawn
unit and e2e tests as part of the Chrome OS test suite. This CL removes
the GLFW dependency because Chrome OS does not support GLFW.
The GLFWwindow is only used to create swap chains for the various
backends, but these swap chains are not actually used in the tests
(the e2e tests render to textures instead). The swap chains are only
referenced as part of an unused debugging function:
SwapBuffersForCapture which we can safely remove as per my discussions
with kainino@ and enga@.
We still need GLFW for OpenGL, so we conditionally include it on
platforms that enable the OpenGL backend (which Chrome OS is not).
Note: enga@ suggested to create a VulkanWindowlessBinding that has an
empty GetSwapChainImplementation, but after exploring the option, it
seems like a bit too many ifdefs. In the end, I think it's cleaner to
just remove the *Binding classes entirely.
BUG=chromium:993457
TEST=tests compile and pass for all values of dawn_enable_opengl
Change-Id: I067b12a23f2c236f5506252cd7727b847e79a667
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10080
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
This patch provides Chromium TRACE_EVENT macros and hooks for
implementing the TRACE_EVENT api.
Bug: chromium:958013
Change-Id: I033b1c7ca57c550504a1bea1898a1a152831922b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7060
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Validation of GPURenderBundle will share code with RenderPass
validation. Factor validation of commands for GPURenderBundle
into a separate function.
Bug: dawn:154
Change-Id: I79a229592ead27d462da0dd2d12fbdb95443ff19
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9980
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This change adds platform-dependent services that handle creating
semaphores and importing image memory. Then, we use them to wrap a
texture from an outside source, and release a signal semaphore back
when we're done with it. This will be used to allow chrome to render
dawn on Vulkan platforms.
Bug: chromium:976495
Change-Id: I9f07eaf436e10aa6bd88cffdc74fd23834d62ee0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8340
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
GPURenderBundleEncoder and GPUCommandEncoder will need to share code
for tracking resource usages.
Bug: dawn:154
Change-Id: I0286f71c4c0638f89be2754c8e9691e67e5db335
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9700
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Metal uses a physical addressing mode and buffers are just pointers in
GPU memory that don't have a size. This prevents implementing
OpArrayLength without any additional information. When a shader uses
OpArrayLength on unsized arrays, SPIRV-Cross requires an extra buffer
argument that gets the length of the buffers.
Use that workaround mechanism in the Metal backend by keeping track of
the storage buffer sizes and applying the extra "buffer length buffer"
when a pipeline requires it.
Also adds tests that OpArraySize works in all shader stages.
BUG=dawn:195
Change-Id: I6aa6089aaea85d0589ccad1756e55dd0befefcb5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9386
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This patch refactors the current implementation of BC formats to treat
it as the first extension in Dawn and adds all the related tests.
Note that in Dawn all the extensions are disabled unless we enable them
when we create the device, which means the BC formats can only be used
when we enable the related extension on the creation of the device, and
the creation of the device will fail if the adapter does not support the
extension
BUG=dawn:42
TEST=dawn_end2end_tests
TEST=dawn_unittests
Change-Id: I04d818b0218ebb3b1b7a70a4fea71779f308f85f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9520
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>