Commit Graph

195 Commits

Author SHA1 Message Date
Corentin Wallez 280b96ea8d Re-enable -Wunguarded-availability in Dawn standalone builds
By bumping the min macOS SDK version for standalone Dawn builds we are
able to re-introduce -Wunguarded-availability, which will help prevent
usage of Metal APIs without correctly checking for their availability.

BUG=

Change-Id: Iebf2f64e9f68e2a7a90fc6f3f208967f952f3487
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11400
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-11 16:54:51 +00:00
Ryan Harrison be5c135672 Refactor code to have rudimentary support for using SPVC
This is the first step for having a fully operational SPVC usage
path. This version of SPVC integration uses SPVC for setting up the
options to the compiler, but a lot of the actual interaction with
spirv-cross is done in Dawn, just via SPVC's compiler object.

Future CLs will migrate more of the spirv-cross interaction to using
the SPVC API, eventually removing the need for Dawn to know about
spirv-cross.

BUG=dawn:288

Change-Id: I68e0773f910d7fe967235b6987b3debe1d13883f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14143
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-03 20:25:13 +00:00
Ryan Harrison 0625ae2167 Add runtime toggle for using SPVC
This will be used in the future to choose between Dawn directly
accessing spirv-cross, and using spvc to mediate that interation.

This also adds in the spvc library as a dependency. This is what cause
the rollback last time, but that issue should be resolved.

BUG=dawn:281

Change-Id: Ic0b02d136ca05e2fa71844ebc85586b8866d5712
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14122
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-28 18:12:35 +00:00
Ryan Harrison 22e73a5b28 Use spvc's rules for spirv-cross
Switch over to using the rule for building spirv-cross from spvc. This
allows GN to avoid double symbol issues in future patches.

Roll third_party/shaderc/ 1d6155d86..30f0559dd (2 commits)

1d6155d867..30f0559dd2

$ git log 1d6155d86..30f0559dd --date=short --no-merges --format='%ad %ae %s'
2019-11-27 rharrison Remove spvc's dependency on shaderc's util library (#914)
2019-11-27 rharrison Clean up how include dirs are propegated for spirv_cross (#912)

Created with:
  roll-dep third_party/shaderc

BUG=dawn:281

Change-Id: I49cf237dcab884e84180f83cbbb21acfa549fe61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14121
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-28 17:14:55 +00:00
Ryan Harrison 00b1e38f3b Re-enable spirv-cross fuzzers
Roll third_party/shaderc/ 24536bdd3..1d6155d86 (1 commit)

24536bdd3c..1d6155d867

$ git log 24536bdd3..1d6155d86 --date=short --no-merges --format='%ad %ae %s'
2019-11-27 rharrison Moving spirv-cross dep from Dawn into shaderc (#911)

Created with:
  roll-dep third_party/shaderc

BUG=dawn:285

Change-Id: I47d202166f9e34c88e7aad75d6a3c8aa9a7d6499
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14120
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-27 20:56:14 +00:00
Corentin Wallez 74cebd6879 Allow using swiftshader with the Vulkan backend
This adds swiftshader as a dependency of Dawn, and when it is present
dawn_use_swiftshader=true will force usage of it. (due to a Vulkan
loader limitation we can't have both regular drivers and swiftshader in
the same VkInstance).

BUG=dawn:283

Change-Id: Ib94f4dcca652eb380e994f007cdcfb145b1a5102
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-26 18:21:51 +00:00
Ryan Harrison 80d71ecd12 Remove build rules for spvc support & spirv-cross fuzzers
Disabling this while refactoring how dependencies are set up to avoid
breaking various builds and rolls.

BUG=dawn:285

Change-Id: Iaca2614fb73277a1ea850f90a487693cd4c54fcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-26 17:42:51 +00:00
Austin Eng f6eb890f4c Implement getBindGroupLayout
This patch makes the |layout| member of the Render|ComputePipelineDescriptor
optional. If it is not provided, a default layout is created from the
ShaderModules provided and used to replace the layout in the descriptor.

Then, pipeline.GetBindGroupLayout may be called to get the existing, or
the computed bind group layout. If no bind group layout exists at the
provided index, an empty bind group layout is returned.

Bug: dawn:276
Change-Id: I276ed0296a2f1f2d8131fa906a4aefe85d75b3a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13741
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2019-11-22 17:02:22 +00:00
Ryan Harrison 48bf745b96 Revert "Convert spvc build flag to a runtime toggle"
This reverts commit 1954436fe2.

Reason for revert:
The shaderc side of this multi-patch brings in a dependency on glslang, which uses a static initializer, which chromium doesn't like.

Original change's description:
> Convert spvc build flag to a runtime toggle
> 
> Also moves some of the spirv_cross code into the main library that was
> feature guarded, since spvc requires it.
> 
> BUG=dawn:281
> 
> Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,rharrison@chromium.org

Change-Id: Ia9a025fb4440c96874d1b45776a9f97023ca591d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13941
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-21 20:31:05 +00:00
Ryan Harrison 1954436fe2 Convert spvc build flag to a runtime toggle
Also moves some of the spirv_cross code into the main library that was
feature guarded, since spvc requires it.

BUG=dawn:281

Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 18:08:15 +00:00
Brian Ho 899c17090f Implement a dma-buf MemoryService
This CL implements the MemoryService for importing memory and
creating VkImages from a dma-buf handle. Under the hood, it uses the
VK_EXT_external_memory_dma_buf and
VK_EXT_image_drm_format_modifier extensions to find a memory type
that supports dma-buf import. In addition, the extensions are also
used to properly specify the stride and tiling of the dma-buf to
vkAllocateMemory and vkCreateImage.

BUG=chromium:996470

Change-Id: Ie72d73117a4cbafcb40468aab0952b783351d499
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13785
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 16:02:10 +00:00
Ryan Harrison 8f3dc5836b Add in flag for using spvc instead of direct spriv-cross access
Currently does nothing interesting, future CLs will flesh out the
functionality.

BUG=dawn:281

Change-Id: I89750a45ff5a42a13e1494cafd433bb7ef719b10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13841
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-20 18:10:11 +00:00
Corentin Wallez 54e5072f5b BUILD.gn: Only build dawn_bindings in standalone
The BackendBinding that implement correct interactions between Dawn and
GLFW windows is only needed when compiling the Dawn samples. This only
happen in standalone so move the dawn_bindings there.

This fixes an issue where the ChromeOS build would discover the Dawn
BUILD.gn file and try to build dawn_bindings that depended on a fake
GLFW target, making the GLFW #includes fail.

With dawn_binding moved in dawn_standalone, all targets discoverable by
a Chromium build that use GLFW do so behind the dawn_enable_opengl flag,
which is always false on ChromeOS.

Also reverts https://dawn-review.googlesource.com/c/dawn/+/13620 because
we want to allow building dawn_end2end_tests on ChromeOS even if the
browser doesn't use_dawn.

BUG=1025326

Change-Id: I8ab965c5da68ca422912b21f87f65e32e789ee8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13820
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brian Ho <hob@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-19 18:58:50 +00:00
Yunchao He 612a63abe1 Add memory synchronization tests - storage to uniform sync
This CL adds end2end tests for memory synchronization tests for buffer.
It adds a few tests that write into storage buffer in compute pass,
then read via uniform binding from the same buffer in render pass.

BUG=dawn:275

Change-Id: Ic98a10aab4cdcddecd60662438d4b8bdd34fafbc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13580
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-18 04:28:24 +00:00
Elly Fong-Jones 9b67273de9 build: assert use_dawn
This will help flush out future errors where targets depend on this
target in configs where it won't build or isn't used.

Bug: None
Change-Id: Iebfc6b9afbd9b4fd9616d87bcaf8cd83a2163777
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13620
Commit-Queue: Elly Fong-Jones <ellyjones@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-14 17:07:05 +00:00
Brandon Jones 700cfe7664 Implement D3D12 Native Render Passes
Uses D3D12 native render pass API when possible. On pre-RS5 builds of
Windows, Dawn will fall back to a software emulated render pass. A
toggle was added to provide test coverage to the emulated render pass
implementation and used in tests that test render pass functionality in
particular.

Bug: dawn:36
Change-Id: I297a3ec7655b68d28204db2d3ab78cb82bb4e7a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13082
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2019-11-12 18:14:21 +00:00
Kai Ninomiya ae1f25fee8 Update naming for vertex state
- VertexInputDescriptor -> VertexStateDescriptor
- VertexBufferDescriptor -> VertexBufferLayoutDescriptor
- VertexBufferDescriptor.stride -> .arrayStride
- VertexAttributeDescriptor.offset no longer optional

gpuweb PR: https://github.com/gpuweb/gpuweb/pull/469

Bug: dawn:22
Change-Id: I5431df4ba22cfbdb1bc81e6709e562cd736892a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13100
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-07 22:23:29 +00:00
Li, Hao 0e1bef3251 Add Vulkan validation layers on Windows
Deploy self-built Vulkan validation layers instead of system installed
one. And it will reuse third_party/angle's Vulkan validation layers if
building with chromium.

Bug: dawn:150
Change-Id: I94e26f7a152fb2a1c39bcb102d60024f4d65eee6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-07 12:13:27 +00:00
Bryan Bernhart 2cdf132c0f Support for small resource placement.
Enables use of 4KB resource alignments where permitted.
This saves heap memory (4KB vs 64KB per allocation) and improves re-use.

BUG=dawn:27

Change-Id: I7a0a30252f480db2d0fa7f5d949207a56e3aa2e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12900
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-05 19:34:45 +00:00
Corentin Wallez 0558f99119 Vulkan: Reuse descriptor pools
This changes puts descriptor pools in the BindGroupLayout so that they
can be reused between descriptors with the same layout.

This makes the DrawCallPerf.Run/Vulkan_NoReuseBindGroups benchmark go
from 1400ns to 800ns per run.

BUG=dawn::256

Change-Id: Ia9baf7f998d9ff4d552e255c80069b67c6a9ac40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-05 15:44:05 +00:00
Austin Eng 64a3bb93dc Add DrawCallPerf tests
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>
2019-10-31 03:20:31 +00:00
Austin Eng 84bcf44fae Only mark objects as cached right before inserting into the cache
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>
2019-10-30 00:20:03 +00:00
Corentin Wallez 45b51f5df7 Make unittests and fuzzers use webgpu.h
BUG=dawn:22

Change-Id: Iff5465ad7a9456f9c6b2ee380af748b3afc129b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12741
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-28 22:15:47 +00:00
Corentin Wallez 04863c42be Make examples and utils use webgpu.h
BUG=dawn:22

Change-Id: I602d6a3422b493d199f3fded61ff1666bc2d9d7d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12702
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-25 11:36:47 +00:00
Corentin Wallez 1fdcb16b69 Make dawn_wire use the webgpu.h header
BUG=dawn:22

Change-Id: I4963aa27322086e74947a1a6265c921e2c7d3d85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12700
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-24 22:27:27 +00:00
Corentin Wallez ca35435716 Preliminary changes to Vulkan memory suballocation
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>
2019-10-24 21:28:16 +00:00
Corentin Wallez 60a04dd18c Vulkan: Use the ResourceMemoryAllocator for all resources
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>
2019-10-24 21:24:27 +00:00
Pawel Pluciennik 20b416235a Move ldflags (Metal dependency) to libdawn_native.
Bug: chromium:1003381
Change-Id: I1cb0f0404dde9936f4fb8f64588535a84e50c957
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12600
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-24 09:44:13 +00:00
Corentin Wallez 1f6c8c4d54 Make dawn_native use the webgpu.h header
BUG=dawn:22

Change-Id: I66e2d998f5e09030e40ec88813cd65c492018fd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-23 11:57:41 +00:00
Bryan Bernhart c833c0c592 D3D12: Enable sub-allocation for MSAA and non-MSAA textures.
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>
2019-10-22 21:01:11 +00:00
Austin Eng 7b3cc35cb6 D3D12/Vulkan: Insert storage buffer barriers between compute pass dipatches
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>
2019-10-22 17:28:20 +00:00
Pawel Pluciennik 3c79cf2ab9 Metal.framework must be optional instead of hard requirement.
It's required to execute binary on Mac 10.10.

Problem has been revealed after integrating 1002023.
It's not visible by default,
because clang under the hood changes hard requirement to optional.

See:
- https://chromium-review.googlesource.com/c/chromium/src/+/1792702
- https://bugs.chromium.org/p/chromium/issues/detail?id=1003381 discussion.

Bug: chromium:1003381
Change-Id: I46e8da1092748256985ca4c2b90244f2ac5d422c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-21 11:35:49 +00:00
Jiawei Shao 5c2f5f3961 Implement serialization/deserialization of DawnDeviceProperties
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>
2019-10-20 03:01:56 +00:00
Austin Eng 92a011a253 Record and dump trace events in the perf tests
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>
2019-10-17 19:00:32 +00:00
Bryan Bernhart 154badfe2f Resource Management 8: placed resource sub-allocation.
- Adds d3d allocators (placed resource + heap).
- Support for heap tier 1 but only buffers.
- Suballocation optimization is enabled for allocations under 4MB.

BUG=dawn:27

Change-Id: I79177830670d1f322bbadf45f797415a3e9208d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-17 17:25:28 +00:00
Austin Eng cc071e45bb Split generation of dawncpp headers from libdawncpp
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>
2019-10-16 10:26:01 +00:00
Natasha Lee f3d50baf85 D3D12 replace ASSERT_SUCCESS with better error handling
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>
2019-10-16 09:26:54 +00:00
Corentin Wallez c57b180208 Add dawnGetProcAddress.
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>
2019-10-15 12:08:48 +00:00
Corentin Wallez 96496828a0 Split the libdawn target in components with a single purpose.
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>
2019-10-15 11:44:38 +00:00
Rafael Cintron 8bde031abe Add CommandRecordingContext to D3D12
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>
2019-10-10 18:06:58 +00:00
Bryan Bernhart e16a901fb8 D3D12: Move resource into allocation handle.
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>
2019-10-09 16:50:42 +00:00
Bryan Bernhart 21dfc91954 Resource Management 7: Device memory sub-allocation using buddy allocator.
Uses a large buddy system to allocate binary sized heaps on-demand.

BUG=dawn:27

Change-Id: I72e425c23e601da6ee53827423bef7ff13be049c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10880
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-03 18:17:31 +00:00
Bryan Bernhart 0da52f2d92 D3D12: Move resource allocators from device into manager.
Encapsulates resource allocation using a manager class.

BUG=dawn:27

Change-Id: I7a496261dcede647d32e44d96ed27237bf418fb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11742
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-02 21:45:09 +00:00
Bryan Bernhart 450e212cf5 Remove device dependencies from ringbuffer.
Allows ringbuffer sub-allocator to be used for non-staging memory.

BUG=dawn:155

Change-Id: Id0021907f520909aaebaf79e992124a47797d38d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-09-18 22:06:41 +00:00
Corentin Wallez 7dda7d0f2e Clarify disabled warning for Metal in BUILD.gn
BUG=

Change-Id: I7f0715bbaaae433d2f1a93c5a2496f28d466e150
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11220
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-18 04:40:32 +00:00
Corentin Wallez 897ebc7a71 Normalize generated file paths to match main tree.
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>
2019-09-18 04:33:12 +00:00
Corentin Wallez 5e9082daa4 Add some missing headers in BUILD.gn files.
BUG=dawn:225

Change-Id: Ie1ebe62caea48353b6b3579c9405b5cc700fba66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11302
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-17 21:36:15 +00:00
Austin Eng 7f3f331ce6 Support setting bind groups before pipeline for all backends
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>
2019-09-17 19:25:27 +00:00
Austin Eng be990077f4 Support ErrorScopes for asynchronous GPU execution
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>
2019-09-17 18:24:07 +00:00
Corentin Wallez 785ec66b66 BUILD.gn: Correctly skip GLFW on ChromeOS
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>
2019-09-12 16:33:31 +00:00