This makes all the regular WebGPU object creation handle errors properly
in the Vulkan backend instead of ASSERTing no Vulkan error is raised.
Static Create functions are added to all these types so that the details
of how the initialization is done is private, and it isn't possible to
construct an object but forget to initialize it.
BUG=dawn:19
Change-Id: I362b2d66b74dd7799ffbf69d732bc58caa97950b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is necessary because @available(macOS 10.N, *) is taken on all iOS
versions but there is no way to say the branch is just not taken on any
iOS version. The proper way to deal with this is to add additional #if
guards to just not compile the code on iOS / macOS.
BUG=dawn:225
Change-Id: I76ec01f933364e9b47b5dda1198359f2ab4d1188
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11900
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This includes several changes to make dawn.h closer to webgpu.h (apart
from the renames and copyright changes):
- Make nextInChain follow the same type convention as the rest of the
header.
- Add defines that allow skipping the procs definition or the functions
declaration part of the header.
- Sort the methods by name for each object.
- Put the callback definition inside extern "C"
- Make the enums typedef have the name of the enum twice.
BUG=dawn:22
Change-Id: I36e4587d60ca43886636ebd19d54752004f4696d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11903
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
There was still some logic associated with push constants in Dawn. This
removes it to remove some code and reclaim one buffer in Metal. Related
code was found via `git grep "push constant"`.
BUG=
Change-Id: I17de9d47872483875b6fa292f8259ef1fc4ecaf3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11904
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
More concretely this makes Result<T*, E*> able to be move-constructed
from Result<ChildClassOfT*, E*> for free.
BUG=dawn:19
Change-Id: Iea2b8997079ac3bfcf270d6b73a79cf5cac2c06f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11860
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This prevents bugs where the compiler assumes a piece of memory
will be the same if read from twice.
Bug: dawn:230
Change-Id: Ib3358e56b6cf8f1fbf449c5d564ef85c969d695b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11840
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This adds a flag to enable using the reflection compiler from
SPIRV-Cross, and also updates the build rules to make sure that the
GLSL compiler is also present when using reflection, since the
reflection compiler subclassess the GLSL compiler.
BUG=dawn:231
Change-Id: I4e227cb955a3bb794d906dabdadffdaca001352b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Closing a command list can fail. We need to handle the error
gracefully instead of ignoring it.
As a fallout from adding MaybeError to ExecuteCommandList, need to
also add MaybeError to TickImpl, and OnBeforePresent.
Bug:dawn:19
Change-Id: I13685f3dd731f4ab49cbff4ce4edfa960d630464
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11841
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
If the swapchain creates its own queue, there can be races to determine
whether the submit of the present happens first. The didn't show up
in our samples but was an issue in real apps. Passing the queue to the
swapchain makes it simple to keep operations well ordered.
BUG=dawn:225
Change-Id: I9cc8e6e8140ad4a816373cffc9bda74ee826a41b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11640
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
BUG=dawn:231
Change-Id: Id037b8c6179ff1582b05a4923447ab292a0e1258
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11820
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This CL adds missing optional label members to all descriptors. It is
not used yet but needed from the WebGPU side.
Bug: dawn:22
Change-Id: I103870f9207eed8168bc2245294888af4e1edd9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11720
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
HandleError assumes that the error is not NoError. InjectError is
an untrusted wire command and needs to validate that NoError is not
passed.
Bug: chromium:1010703, chromium:1004368
Change-Id: Id48a877ded327a6e3a54fedb2be2c54eeca5cd3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This CL adds a StringMessageMatcher to the wire unittests harness
to validate that messages are not degenerate.
Bug: chromium:1004368
Change-Id: I121a259e67938b06ccc5e9829abfa3e25fffc003
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11740
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
We were generating has_member for all pointer members which meant
it was possible to incorrectly pass nullptr for required arguments.
Bug: chromium:1009166
Change-Id: I5e32bab5ccae010468e55897ae9840ab8fda684f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11760
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
A draw should be valid if the currently set bind groups match the
current pipeline layout, irrespective of changes in pipeline layout.
This is different from the descriptor set inheritance in Vulkan which
Dawn used to follow.
Bug: dawn:201
Change-Id: I1181ba80614ae40d665094f4ea742804565f6ed3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11641
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Roll third_party/SPIRV-Tools/ 958f7e72a..9eb1c9a4c (20 commits)
958f7e72a7..9eb1c9a4c4
$ git log 958f7e72a..9eb1c9a4c --date=short --no-merges --format='%ad %ae %s'
2019-10-01 stevenperron Add continue construct analysis to struct cfg analysis (#2922)
2019-09-27 stevenperron Record trailing line dbg instructions (#2926)
2019-09-27 rharrison Add removing references to debug instructions when removing them (#2923)
2019-09-27 paulthomson spirv-fuzz: allow interestingness script arguments (#2925)
2019-09-27 ehsannas Add Kokoro bots for building with Bazel. (#2914)
2019-09-27 alanbaker Refactor the InstructionPass (#2924)
2019-09-26 afdx spirv-fuzz: do not allow a dead break to target an unreachable block (#2917)
2019-09-26 afdx spirv-fuzz: preserve some analyses when permuting blocks (#2918)
2019-09-25 alanbaker Only allow previously declared forward refs in structs (#2920)
2019-09-25 stevenperron Handle id overflow in wrap-opkill (#2916)
2019-09-25 afdx spirv-fuzz: do not replace struct indices with synonyms (#2915)
2019-09-25 afdx spirv-fuzz: Fixes to preconditions for adding dead break/continue edges (#2904)
2019-09-25 afdx spirv-fuzz: do not replace a pointer argument to a function call with a synonym (#2901)
2019-09-25 afdx spirv-fuzz: do not replace boolean constant argument to OpPhi instruction (#2903)
2019-09-24 alanbaker Remove validate_datarules.cpp (#2911)
2019-09-24 stevenperron Handle extract with no indexes (#2910)
2019-09-24 ehsannas Add Bazel build configuration. (#2891)
2019-09-24 stevenperron Handle id overflow in convert local access chains (#2908)
2019-09-24 dsinclair Add OpCopyMemory test to SVA. (#2885)
2019-09-23 dsinclair Add missing GN dependency (#2899)
Roll third_party/glslang/ 973d0e538..7bc047326 (1 commit)
973d0e5382..7bc047326e
$ git log 973d0e538..7bc047326 --date=short --no-merges --format='%ad %ae %s'
2019-09-18 laddoc Reflection will crash when the VS input symbol defines the same name with FS output symbol
Roll third_party/shaderc/ cb8b3fc5c..e849e6783 (4 commits)
cb8b3fc5ca..e849e6783d
$ git log cb8b3fc5c..e849e6783 --date=short --no-merges --format='%ad %ae %s'
2019-09-23 rharrison Add logging missing failures to spvc test script (#815)
2019-09-23 rharrison Add --update_known_failures to spvc test script (#813)
2019-09-23 rharrison Another round of cleaning the spvc test script (#811)
2019-09-23 rharrison Rolling 2 dependencies (#812)
Roll third_party/spirv-headers/ 601d73872..842ec9067 (4 commits)
601d738723..842ec90674
$ git log 601d73872..842ec9067 --date=short --no-merges --format='%ad %ae %s'
2019-09-24 ehsannas Improve the doc on using Bazel.
2019-09-24 rex.xu Bump the SPIR-V version to 1.5
2019-09-23 ehsannas Update documentation.
2019-09-18 ehsannas Add a Bazel build file.
Created with:
roll-dep third_party/SPIRV-Tools third_party/glslang third_party/shaderc third_party/spirv-cross third_party/spirv-headers
Change-Id: If888854a1b123b01cd14169d9e2ac0cf2b0eec00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11741
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This patch implements ASSERT_SUCCESS(hr) as a macro instead of a
function so that when hr fails Dawn can print out the line number of the
expression that causes the failure.
For example, previously we will always get the following error message
because ASSERT_SUCCESS is a function:
Assertion failure at ../../src/dawn_native/d3d12/DeviceD3D12.cpp:43
(ASSERT_SUCCESS): (((HRESULT)(hr)) >= 0)
Now we can get more details about where the failure occurs because now
ASSERT_SUCCESS is a macro:
Assertion failure at ../../src/dawn_native/d3d12/DeviceD3D12.cpp:59
(Initialize): (((HRESULT)(mD3d12Device->CreateCommandQueue(&queueDesc,
__uuidof(**(&mFence)), IID_PPV_ARGS_Helper(&mFence)))) >= 0)
BUG=dawn:178
Change-Id: I435ee2f418658bca276f439fcabfabbfecbff998
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11700
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This fixes a problem where client-generated errors weren't properly
captured in error scopes.
Bug: chromium:1004368
Change-Id: Ic0f6e5bc5e281c676ea7154dd217cfc8dd51be5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11642
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch fixes an undefined behaviour on Metal and Vulkan when there
is a color state whose corresponding fragment output is not declared in
the fragment shader.
According to Vulkan SPEC (Chapter 14.3), the input values to blending or
color attachment writes are undefined for components which do not
correspond to a fragment shader output. Vulkan validation layer follows
the SPEC that it only allows the shader to not produce a matching output
if the writemask is 0, or it will report a warning when the application
is against this rule.
When no fragment output matches the color state in a render pipeline,
the output differs on different Metal devices. On some Metal devices the
fragment output will be (0, 0, 0, 0) even if it is not declared in the
shader, while on others there will be no fragment outputs and the content
in the color attachments is not changed.
This patch fixes this issue by setting the color write mask to 0 to
prevent the undefined values being written into the color attachments.
With this patch, the following end2end tests will not report warnings
any more when we enable the Vulkan validation layer:
ObjectCachingTest.RenderPipelineDeduplicationOnLayout/Vulkan
ObjectCachingTest.RenderPipelineDeduplicationOnVertexModule/Vulkan
ObjectCachingTest.RenderPipelineDeduplicationOnFragmentModule/Vulkan
BUG=dawn:209
TEST=dawn_end2end_tests
Change-Id: I5613daa1b9a45349ea1459fbdfe4a12d6149f0f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11581
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Optional labels were added to command buffer descriptor and compute pass
descriptor in https://dawn-review.googlesource.com/c/dawn/+/11601.
Sadly, the wire was not updated. This CL fixes support for optional
const char*.
Bug: dawn:22
Change-Id: I23211456f5e3d5f3c0344d8b8cc604bab20015f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11660
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This patch adds the validation on the compatibility between the format
of the color states and the fragment shader output when we create a
render pipeline state object as is required in Vulkan (Vulkan SPEC
Chapter 14.3 "Fragment Output Interface"):
"if the type of the values written by the fragment shader do not match
the format of the corresponding color attachment, the resulting values
are undefined for those components".
BUG=dawn:202
TEST=dawn_unittests
Change-Id: I3a72baa11999bd07c69050c42b094720ef4708b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11461
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This CL adds an optional label to command buffer descriptor and compute
pass descriptor. It is not used yet but needed from the WebGPU side.
Bug: dawn:22
Change-Id: Id4247882a1e3cc63a007adf41c2539764f1be677
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11601
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
When storeOp is clear, texture subresource is set as not initialized
Bug: dawn:145
Change-Id: I364d7239a7ebdb9d5a28a4af559f3212be7ef15a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11560
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This patch adds the validation on the fragment shader output location to
ensure it will never exceed kMaxColorAttachments.
BUG=dawn:202
TEST=dawn_unittests
Change-Id: I4ac4463fd3dfb3c2e9ffecb370f9d9d59393c26d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11580
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This is to match the work in progress webgpu.h header.
BUG=dawn:22
Change-Id: Ia1077fef95e6bda541cddbd2f6ce40b79138e960
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9383
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This causes subtle bugs in tests when pointers in combo render pipeline
descriptors point at other combo render pipeline descriptors.
BUG=dawn:22
Change-Id: I5234df26895986fd1d7a9b4e835598177581803a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11340
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is to match the work in progress webgpu.h header.
BUG=dawn:22
Change-Id: I1371cda1b7666de8eb8283fa7e5da935d17e1d52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9381
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Disables ManySetSubData on Intel/Metal configurations, as it has started
failing on Mac 10.14.6.
Bug: dawn:228
Change-Id: Ia7d27a698deb9abc08cc04660903e5c6c93bbf50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11460
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This caused failure on macOS 10.11 because Dawn decided Metal is
supported but would go ahead and reach an UNREACHABLE() block.
BUG=chromium:1006181
Change-Id: I20739a058adaa60a71ec489e07b36ebf48ef871a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11420
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This normalizes even more the directory structure of generated files in
Dawn and removes stale autogenerated files that could be included
wrongly using a GN action.
See comment on top of dawn_generator.gni in this commit for more
context.
BUG=dawn:22
Change-Id: I8ec038f949c048431b2b643af4462f98c4ae610b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11361
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Ensure deallocate does not assert should allocation fail but still be used.
BUG=dawn:227
Change-Id: I5edd4c160bced7934970c5d59e541a3a8f7a8afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11380
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This is important so that we know that the list of allowed directories
is in sync with other parts of the build in follow-up commits.
BUG=dawn:22
Change-Id: I202bec55b510989e43acf497956e2937c9a2f60a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11360
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>