Commit Graph

1528 Commits

Author SHA1 Message Date
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
Austin Eng e79b06100f Skip tests if no adapter is available
Bug: dawn:208
Change-Id: I076fd497101dd017e8d83ae034edb7b1fa1f8581
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11941
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-09 16:23:22 +00:00
Corentin Wallez 70c8c10571 Make the dynamicOffsets optional in SetBindGroup.
BUG=dawn:22

Change-Id: I9d032d9be16a483046edc6055b86e61ae08118e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12023
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-09 16:08:42 +00:00
Ryan Harrison 16d20837cc Roll ahead to fix and update .gni to unbreak shaderc
Roll third_party/spirv-cross/ 5431e1da2..e5d3a6655 (8 commits)

5431e1da2d..e5d3a6655e

$ git log 5431e1da2..e5d3a6655 --date=short --no-merges --format='%ad %ae %s'
2019-10-07 rharrison Update SPV_VERSION from 1.4 to 1.5
2019-10-07 post Workaround MSVC issue.
2019-10-07 post Do not consider aliased struct types if the master is not a block.
2019-10-07 post Run format_all.sh.
2019-10-04 post Do not value compare JSON files for regression purposes.
2019-10-04 post Reflect: Deal with workgroup size being specialization constants.
2019-10-03 frank.richter reference: Update to include workgroup_size
2019-10-03 frank.richter reflection: Write workgroup_size to JSON for compute shaders

Created with:
  roll-dep third_party/spirv-cross

Roll third_party/shaderc/ e849e6783..621605ce2 (10 commits)

$ git log e849e6783..621605ce2 --date=short --no-merges --format='%ad %ae %s'
2019-10-08 rharrison Fix various build issues for chromium & dawn (#835)
2019-10-08 stevenperron Use a better python idiom (#834)
2019-10-08 stevenperron Fix up use of private spirv-tools headers. (#833)
2019-10-07 rharrison Roll spirv-cross ahead and update known_failures to fix build breakage (#831)
2019-10-07 9856269+sarahM0 spvc: Add an empty opt pass (#816)
2019-10-07 9856269+sarahM0 spvc: Add known_invalid file (#823)
2019-10-04 dneto Add support for targeting SPIR-V 1.5 (#822)
2019-10-03 rharrison Revert "Add spvc compiler to returned result (#821)" (#827)
2019-10-03 rharrison Add spvc compiler to returned result (#821)
2019-10-02 rharrison Rolling 4 dependencies (#817)

Created with:
  roll-dep third_party/shaderc

Change-Id: I9e77d5c78eb647c1f117c356306e6dff7613722a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11963
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-10-09 14:40:10 +00:00
Corentin Wallez e09869ed52 Vulkan: Handle errors when wrapping external images
This also introduces another combinator to ConsumeError for
ResultOrError.

BUG=dawn:19

Change-Id: Ic204313436f5e919473d604efd049fe3d3c27a66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11862
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-09 10:11:00 +00:00
François Beaufort c932f33093 Attribute offset needs to be multiple of 4 bytes
Metal requires offset to be 4 bytes aligned. This CL makes sure a
validation error is fired when offset is not a multiple of 4.

See https://developer.apple.com/documentation/metal/mtlvertexattributedescriptor/1515785-offset

Bug: dawn:22
Change-Id: I8be26fc1851e3aea7cfdbd5c92dfb4169fdaed5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11902
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-10-09 06:12:10 +00:00
Corentin Wallez e986cb9254 Vulkan: Add proper error handling for all regular object creation.
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>
2019-10-08 08:16:11 +00:00
Bryan Bernhart bc8e7ea286 Fix MSVC build error due to implicit descriptor heap offset cast.
BUG=dawn:233

Change-Id: Ia42d7e99df910f245b7c78be16b7916c0730e8a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11960
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-08 07:46:51 +00:00
Corentin Wallez b629c50a20 Guard macOS or iOS specific code in #if guards
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>
2019-10-08 07:44:21 +00:00
Corentin Wallez 97231682d0 Make dawn.h closer to webgpu.h
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>
2019-10-08 07:38:01 +00:00
Corentin Wallez a83e0cdbcc Remove stray push constant code.
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>
2019-10-08 07:37:02 +00:00
Corentin Wallez bd481fc199 Allow ResultOrError to downcast from backend to frontend types
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>
2019-10-08 07:36:03 +00:00
Corentin Wallez 5f53d5302f Fix RenderPassDescriptor to be extensible.
BUG=dawn:22

Change-Id: Ib9c2cd3259db0e07fa02134ce6d0d5d75a24546c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11901
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-08 07:34:43 +00:00
Mathieu-Andre Chiasson 720988d878 Fixed compilation issue on clang 6.x
Bug:dawn:235
Change-Id: If96dbb9f70ee95a93fc1f14a9741903c3fd32b66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11942
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-10-08 01:55:57 +00:00
Austin Eng 8eb8385e2e dawn_wire: Tag deserialize commands with volatile pointer
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>
2019-10-07 20:38:47 +00:00
Ryan Harrison d561448d0d Add build time flag to control enabling SPIRV-Cross reflection
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>
2019-10-07 15:47:27 +00:00
Rafael Cintron 86d921e048 Add MaybeError to d3d12::Device::ExecuteCommandList
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>
2019-10-07 15:32:10 +00:00
Jinho Bang 0b82671047 Rename PipelineStageDescriptor to ProgrammableStageDescriptor
This is to match the WebGPU's WebIDL[1].

[1] https://github.com/gpuweb/gpuweb/pull/359

Bug: dawn:22
Change-Id: Id0cf0a7a6605ea7ec474d0f0885685ed21875dce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11883
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-07 12:23:09 +00:00
Corentin Wallez 90a5595bbe dawn_wsi: Pass the Metal queue to the SwapChainImpl
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>
2019-10-07 08:18:09 +00:00
Ryan Harrison cc47878116 Adding missing reflection API sources to SPIRV-Cross targets
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>
2019-10-04 15:55: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
François Beaufort 277d2e15d5 Add missing optional label member to descriptors
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>
2019-10-03 14:56:49 +00:00
Austin Eng 3fd022ef60 Validate injected errors are not NoError
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>
2019-10-03 14:40:09 +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
Austin Eng 867f72058a Add missing "strlen" parameter for Device InjectError command.
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>
2019-10-02 06:35:38 +00:00
Austin Eng 4379e8f34f dawn_wire: Only generate has_member for optional members
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>
2019-10-02 06:35:08 +00:00
Austin Eng dc9f1e6806 Add validation tests for WebGPU bind group "persistence"
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>
2019-10-02 06:27:58 +00:00
Ryan Harrison c15160f3ab Rolling 4 dependencies
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>
2019-10-01 17:16:53 +00:00
Jiawei Shao deb28ea45d D3D12: Implement ASSERT_SUCCESS as macro instead of function
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>
2019-10-01 02:30:32 +00:00
Bryan Bernhart e6b93e8706 D3D12: Use ringbuffer allocator for descriptor heaps.
Enable descriptor heap re-use by using ringbuffer.

BUG=dawn:155

Change-Id: I72e3fb98a64dc1af671e185e2114868a577a0554
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9460
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-01 02:19:02 +00:00
Austin Eng e06f01be71 dawn_wire: Forward client-generated errors to the server
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>
2019-09-30 22:50:59 +00:00
Jiawei Shao 55a00c7a1f Set writemask to 0 when no fs output matches color state on Metal and Vulkan
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>
2019-09-30 07:27:57 +00:00
Bryan Bernhart 52bd6b7da6 Move kInvalidOffset to RingBufferAllocator namespace.
BUG=dawn:27

Change-Id: I1c580d8e41c4f9bb10b638297b4c3a3fa61a0d93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11680
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-27 21:26:13 +00:00
François Beaufort f622a44750 Fix support for optional const char*
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>
2019-09-27 21:25:43 +00:00
Bryan Bernhart 86ac0b93c9 Rename INVALID_OFFSET to kInvalidOffset.
BUG=dawn:27

Change-Id: Ida590a2b3cf3da17bbedf6ef61d72eaaa443bc4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11561
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-27 15:11:52 +00:00
Jiawei Shao 64f4dd7127 Add check between color state format and fragment shader output
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>
2019-09-26 00:12:41 +00:00
Mathieu-Andre Chiasson 09cc2b92c7 Fixed compilation issues when using libstdc++
Bug:dawn:229
Change-Id: I18ce6330bc4597db4f2c4548698b38ab2c826203
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-25 19:32:01 +00:00
François Beaufort 6ac5a9250d Add label to command buffer and compute pass descriptors
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>
2019-09-25 13:56:48 +00:00
Natasha Lee cf0e9d93f1 Add StoreOp::Clear
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>
2019-09-25 13:08:28 +00:00
Jiawei Shao 05be0ff348 Validate fragment output location doesn't exceed kMaxColorAttachments
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>
2019-09-25 01:21:28 +00:00
François Beaufort c3b613296d Rename GPUBindGroupLayoutBinding dynamic to hasDynamicOffset
Following WebGPU change at  https://github.com/gpuweb/gpuweb/pull/427,
this CL renames GPUBindGroupLayoutBinding dynamic to hasDynamicOffset.

Bug: dawn:22
Change-Id: Ie1c2bf4b1f6764c83be7cfe04f4f1a1d2205f685
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11500
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-24 11:08:17 +00:00
Bryan Bernhart 41f8aa550b Return Dawn result upon submit.
Missing OOM error should submit fail to create a descriptor heap.

BUG=dawn:177

Change-Id: I6ccc10f3e0b8de0bd21caa9aca35f4f269ce51e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11540
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-23 21:21:10 +00:00
Ryan Harrison 27a35eb2a9 Rolling 3 dependencies
Roll third_party/SPIRV-Tools/ 08fcf8a4a..958f7e72a (10 commits)

08fcf8a4ab..958f7e72a7

$ git log 08fcf8a4a..958f7e72a --date=short --no-merges --format='%ad %ae %s'
2019-09-23 afdx Employ the "swarm testing" idea in spirv-fuzz (#2890)
2019-09-23 afdx Fix operand index in spirv-fuzz (#2895)
2019-09-23 dneto Update DEPS: effcee, re2, googletest (#2881)
2019-09-23 dneto Add method comment for opt::Function::WhileEachInst (#2867)
2019-09-20 stevenperron Use OpReturn* in wrap-opkill (#2886)
2019-09-20 afdx Fix to CMakeLists for spirv-fuzz tests (#2888)
2019-09-20 afdx Allow validation during spirv-fuzz replay (#2873)
2019-09-20 afdx Disable long-running fuzzer tests by default (#2887)
2019-09-19 stevenperron Revert "Use OpReturn* in wrap-opkill"
2019-09-19 stevenperron Use OpReturn* in wrap-opkill

Roll third_party/glslang/ f7a48b153..973d0e538 (1 commit)

f7a48b153f..973d0e5382

$ git log f7a48b153..973d0e538 --date=short --no-merges --format='%ad %ae %s'
2019-09-20 cepheus GLSL/SPV: Fix #1900: Drop const on literal when doing an object copy.

Roll third_party/shaderc/ 68b6857ac..cb8b3fc5c (1 commit)

68b6857ac0..cb8b3fc5ca

$ git log 68b6857ac..cb8b3fc5c --date=short --no-merges --format='%ad %ae %s'
2019-09-19 rharrison Rolling 6 dependencies and update known_failures (#809)

Created with:
  roll-dep third_party/SPIRV-Tools third_party/glslang third_party/shaderc third_party/spirv-cross third_party/spirv-headers

Change-Id: I2e18f0533a45b243521569194415706d418d8b54
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11520
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-09-23 20:19:50 +00:00
Corentin Wallez d46cabd73f Fix the orientation of CubeReflection
BUG=dawn:224

Change-Id: I1a6c3509245cadd0c95256e4985dac6feee50829
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11441
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-20 23:53:27 +00:00
Corentin Wallez c81a717379 Remove indirection for colorStates
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>
2019-09-20 23:22:27 +00:00
Corentin Wallez b8dbada76d Make ComboRenderPipelineDescriptor non copyable.
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>
2019-09-20 23:15:47 +00:00
Yunchao He 394553b02e Set y-axis up in normalized coordinate system.
BUG=dawn:224

Change-Id: I6bb4946e87b593f1d62a13b3b8ab38f21d3e9ffb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10201
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-09-20 23:04:47 +00:00
Corentin Wallez a838c7d497 Remove indirection for colorAttachments
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>
2019-09-20 22:59:47 +00:00
Brian Sheedy 0c4d75931a Disable BufferSetSubData.ManySetSubData on Metal
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>
2019-09-20 22:16:03 +00:00
Corentin Wallez 38b295de38 Fix availability check for MTLCopyAllDevices
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>
2019-09-20 17:40:53 +00:00