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>
Austin added barriers for storage buffer in compute pipeline in
this patch (https://dawn-review.googlesource.com/c/dawn/+/12301).
This case now can work fine.
Bug: dawn:236
Change-Id: Id449ae5053f1f018ea95c271bff7e4ab2180a937
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12640
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@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>
webgpu.h is the "official" header for WebGPU in native and is being
developed in https://github.com/webgpu-native/webgpu-headers
dawn.h and dawncpp.h are changed to become webgpu.h and webgpu_cpp.h
respectively and use the new naming convention. New dawn.h and dawncpp.h
headers are created that just proxy the types, constants and functions
to their WebGPU counterpart.
Almost no naming change is done in Dawn in this commit, which help check
that the proxying headers work correctly. A couple changes were
necessary, in particular for tests of the internal of dawncpp.h, and a
workaround for a standard library bug for std::underlying_type was
removed because it is no longer needed and got in the way.
Finally since some templates were renamed to match the name of the file
they create instead of using the generic "api" name.
BUG=dawn:22
Change-Id: I12ee22d0b02ccb5b8a52ceccabb3e63ce74da007
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
11on12 has a bug where D3D12 resources used only for keyed
shared mutexes are not released until work is submitted to
the device context and flushed.
The most minimal work we can get away with is issuing a
TiledResourceBarrier.
ID3D11DeviceContext2 is available in Win8.1 and above.
This suffices for a D3D12 backend since both D3D12 and 11on12
first appeared in Windows 10.
Bug:dawn:217
Change-Id: I422eedf0de9c41777ab704f63520e2f2584f2afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12520
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
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>
Parameter syncInterval of function Preset specifies how to synchronize
presentation of a frame. To turn off vsync in D3D12 backend,
set syncInterval to 0 which represents the presentation occurs
immediately.
BUG=dawn:237
Change-Id: Ic17f00bae5af9fd6bca4130d6e2282f3c34de4e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12303
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yizhou Jiang <yizhou.jiang@intel.com>
Dawn creates a keyed shared mutex for all wrapped resources and acquires
the mutex before the texture is used in an ExecuteCommandList call.
To coordinate with external clients, backend API has been extended
to allow clients to get and set the acquire key.
Pending and queue command lists have now been merged into one.
A future change will adjust GetPendingCommandContext to return a raw
command context without the need for error handling.
Bug:dawn:217
Change-Id: Ia96c449c305586407153f05ce75a40794b96027e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12220
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Roll third_party/SPIRV-Tools/ 253806adc..e3da3143b (14 commits)
253806adc4..e3da3143b2
$ git log 253806adc..e3da3143b --date=short --no-merges --format='%ad %ae %s'
2019-10-17 kubak Disallow use of OpCompositeExtract/OpCompositeInsert with no indices (#2980)
2019-10-17 rharrison Add fuzzer for spirv-dis call path (#2977)
2019-10-17 rharrison Check binary->code existence before destroying (#2979)
2019-10-17 akb825 Improved CMake install step. (#2963)
2019-10-16 kubak Support constant-folding UConvert and SConvert (#2960)
2019-10-16 rharrison Add fuzzer for spirv-as call path (#2976)
2019-10-15 afdx spirv-fuzz: Refactor 'copy object' and 'construct composite' transformations (#2966)
2019-10-15 dneto Update SPIR-V binary header test for SPIR-V 1.5 (#2967)
2019-10-14 afdx spirv-fuzz: Refactor 'split blocks' to identify instructions differently (#2961)
2019-10-11 alanbaker Validate that selections are structured (#2962)
2019-10-11 afdx spirv-fuzz: Rework id descriptors (#2959)
2019-10-11 afdx spirv-fuzz: Add fuzzer pass to add NoContraction decorations (#2950)
2019-10-11 afdx spirv-fuzz: Add fuzzer pass to change function controls (#2951)
2019-10-10 paulthomson reduce: add large tests and fix (#2947)
Roll third_party/glslang/ 4b97a1108..834ee546f (23 commits)
4b97a11081..834ee546f9
$ git log 4b97a1108..834ee546f --date=short --no-merges --format='%ad %ae %s'
2019-10-17 jbolz Only apply volatile semantics to atomics when using Vulkan Memory Model
2019-10-16 dsinclair Use commandline options instead of ENV variables
2019-10-16 rharrison Keep code style improvements
2019-10-16 dsinclair Indenting
2019-10-15 dsinclair Update CMakeLists.txt
2019-10-15 dsinclair Move TARGETDIR as well
2019-10-15 dsinclair Make runtests configurable.
2019-10-15 rharrison Fix config issues and revert previous fixes for semi-colon issues
2019-10-16 swda.durl Added an option to make pch enabled in Cmake
2019-10-15 wahlster find Python and add External subdir only if BUILD_EXTERNAL option was set (on by default) and /External dir exists
2019-10-14 cepheus GLSL/SPV: Pre SPIR-V 1.5, subgroupQuadBroadcast index must be constant
2019-10-12 geothrock remove redundant check
2019-10-12 Xottab-DUTY Fixed typo in README.md
2019-10-11 rharrison Forgot that GCC doesn't recognize this flag
2019-10-11 rharrison Remove unnecessary semi-colons and add warning about them
2019-10-10 cepheus Fix#1924: Promote SPV_EXT_physical_storage_buffer to KHR when required.
2019-10-10 greg Update spirv-tools known good.
2019-10-10 cepheus Fix#1924: Emit SPV_EXT_physical_storage_buffer, not the KHR form.
2019-09-04 lryer Fix code style issue and remove setXfbBufferStride new paramte
2019-09-02 lryer Adjusting code interface
2019-08-25 geothrock Add support for GL_ARB_explicit_uniform_location
2019-08-06 james.rumble Handle install vs build include directories
2019-08-06 james.rumble Export glslang targets on installation
Roll third_party/spirv-cross/ e5d3a6655..a92668bc1 (8 commits)
e5d3a6655e..a92668bc11
$ git log e5d3a6655..a92668bc1 --date=short --no-merges --format='%ad %ae %s'
2019-10-17 post Fix OpVectorExtractDynamic with spec constant op index.
2019-10-16 post Travis: Update PATH for Python3 on Windows.
2019-10-14 post MSL: Add opt-in support for huge IABs.
2019-10-14 post HLSL: Fix unrolled S/G LE/LT/GE/GT opcodes.
2019-10-14 post GLSL: Deal correctly with bitwidth on integer compares.
2019-10-14 post HLSL: Partially implement Unordered compare.
2019-10-14 post GLSL: Support unordered floating point compare.
2019-10-11 post MSL: Fix regression with OpCompositeConstruct from std140 float[].
Roll third_party/spirv-headers/ b252a5095..af64a9e82 (2 commits)
b252a50953..af64a9e826
$ git log b252a5095..af64a9e82 --date=short --no-merges --format='%ad %ae %s'
2019-10-15 cepheus Versioning: Complete the versioning change in recent commits.
2019-10-14 nicolai.haehnle buildHeaders: update version to SPIR-V 1.5
Created with:
roll-dep third_party/SPIRV-Tools third_party/glslang third_party/shaderc third_party/spirv-cross third_party/spirv-headers
Change-Id: I0396a3e0e20e7cfc74603ef60512c2c715eb2c70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12440
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@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>
We now have a build step that ensures only the allowed generated file
directories are present so we don't need to remove the default includes
config anymore.
BUG=dawn:22
Change-Id: Id835d1bbb1f52a46ea6502f33b419e70207bba10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12420
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
The current BufferUpload perf test calls WaitForGPU at the end of
every step to time how long the batch of uploads took. Future tests
will want to have multiple Steps or Frames in flight to mimic real
applications that use double or triple buffering. This patch removes
WaitForGPU and adds a |maxStepsInFlight| argument which a test can
set to configure how many steps can be running on the GPU.
For the BufferUpload tests, this is still 1.
Bug: dawn:208
Change-Id: I95ae12b2358e0283088205bd2ffd20532ea62871
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12302
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
An exported function of libdawn_native wasn't in libdawn_native_sources
instead of libdawn_native which made it not exported on Windows.
BUG=dawn:22
Change-Id: I824f1d4af18f8308b88e1650837cbe62374ace72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: 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>
Do explicit uint8_t -> float conversions (as was previously done for TextureVk).
Add a missing #include.
Change-Id: If7616ec00e2ea2cf55b9b0cc966b0436a5a21d9d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12280
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Stephen White <senorblanco@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 commit add a toggle to turn off vsync in Dawn.
When turn off vsync, choose vulkan present mode VK_PRESENT_MODE_IMMEDIATE_KHR
if the mode is available on the system, but if the mode isn't supported,
choose default mode VK_PRESENT_MODE_FIFO_KHR.
BUG=dawn:237
Change-Id: If400262b67cc8051422745e3bed737431183c0b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yizhou Jiang <yizhou.jiang@intel.com>
QueueWaitIdle can fail but if it fails, the error codes show that we
can't do anything about it so we just ignore the result.
BufferGetMemoryRequirements should always return memory types bits that
allow Dawn to select a good memory type of a resource.
BUG=dawn:19
Change-Id: I52beebf9f2be2bfb997ca9c1bf306618a73c9c4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12183
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Fails on NVIDIA cards when Vulkan validation layers are enabled becuase the maximum size of a single allocation cannot be larger than or equal to 4G on some platforms.
BUG=dawn:241
Change-Id: I863a2219287d3d363b3013027ba8fc9df846b42d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12141
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This patch adds an ASSERT expression on the object parameter of
DeviceBase::ValidateObject() so that Dawn won't crash in the debug
build when a nullptr object is being used unexpectedly.
BUG=dawn:209
Change-Id: I52ad57b58eb59edf04afc9963e260436d93e673e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit makes the following changes:
- Unused fences are reset when they will next be used so there is a
single place where error handling is needed, either for resetting
an existing fence, or for creating a new fence.
- All accesses to VkCommandBuffer are moved to using the
CommandRecordingContext and GetPendingCommandBuffer is removed.
- Instead of tracking both a current (VkCommandBuffer + Pool) and
a command recording context that contains the same VkCommandBuffer,
the RecordingContext now holds the pool too, as well as a tag to
know if it was ever queried (meaning it contains commands).
- mRecordingContext is now always valid, such that
GetRecordingContext() doesn't need to return an error.
BUG=dawn:19
Change-Id: I853d4ecdc6905b66e842688f39d863e362f59b66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12022
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Upload perf depends on buffer size. Try small and large buffers
to ensure allocation tuning is more accurate.
BUG=dawn:208
Change-Id: I1ee23454e86a31cf0a316946bc87550dad51e5c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11961
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@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>
According to https://github.com/gpuweb/gpuweb/issues/405, None is a
valid value for GPUBindGroupLayoutBinding visibility to be passed in.
Bug: dawn:22
Change-Id: I7b30b7ab8ed6824718573fa25fad5d509846db55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Following WebGPU spec change at
https://github.com/gpuweb/gpuweb/pull/468, this CL changes all
occurrences of setVertexBuffers to setVertexBuffer.
Bug: dawn:22
Change-Id: I48b551a89dc0934dfa61e661e9546a2b7eafd2fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12020
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@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>