Metal needs buffer to buffer copy size must be a multiple of 4 bytes.
Adding validation to check this.
BUG=dawn:73
Change-Id: I9a4685d75439502017efa5455f7c2920a77f7a6d
Reviewed-on: https://dawn-review.googlesource.com/c/4900
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
WebGPU error handling assumes non-optional objects point to valid
objects. The wire code wasn't updated to produce an error when ID 0 is
requested in the non-optional case.
BUG=chromium:934360
Change-Id: I203d2ec864dabe0e76109e1932fc31cbf26291d7
Reviewed-on: https://dawn-review.googlesource.com/c/4980
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This will prevent the builders from having to install XCode on every run.
R=cwallez@chromium.org, tandrii@google.com
Change-Id: I6480968dbf7d7f05bfd670ccbbf4790eb0c21d86
Reviewed-on: https://dawn-review.googlesource.com/c/5000
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This change sets limit for stride in VertexInputDescriptor and
offset in VertexAttributeDescriptor, and adds validation code
for them.
It also uses existing descriptors to replace redundant definitions.
BUG=dawn:107
Change-Id: Ifbb07f48ec9a5baae8ae8d21865dc384670b759a
Reviewed-on: https://dawn-review.googlesource.com/c/4901
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This will help debug issues on builders.
BUG=dawn:109
Change-Id: I56d3fe391705077a95a711e7fc370459e0e70133
Reviewed-on: https://dawn-review.googlesource.com/c/4824
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This move the "use wire" option as well as instance and window creation
to the test environment. The environment will later be used to print
system information before running the tests for debugging.
BUG=dawn:109
Change-Id: Ice2f40bd5506cc69927287f9f8d51dac85f4472b
Reviewed-on: https://dawn-review.googlesource.com/c/4823
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Googletest is (at last) converging with industry-standard terminology
[1]. We previously called test suites "test cases", which was rather
confusing for folks coming from any other testing framework.
Chrome now has a googletest version that supports _TEST_SUITE_ macros
instead of _TEST_CASE_, so this CL cleans up some of the outdated usage.
[1] https://github.com/google/googletest/blob/master/googletest/docs/primer.md#beware-of-the-nomenclature
Bug: chromium:925652
Change-Id: I86067e8846e31adedcf139f9650ac4e0ed5fbb19
Reviewed-on: https://dawn-review.googlesource.com/c/4921
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Introduces pushDebugGroup, popDebugGroup, and insertDebugMarker implementations
for Vulkan and Metal using VK_EXT_debug_marker and XCode, respectively.
Bug: dawn:44
Change-Id: I0ae56c4d67aa832123f27a1fcdddf65746261e57
Reviewed-on: https://dawn-review.googlesource.com/c/4241
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Color state descriptors are a sequence of descriptors embedded
in RenderPipeline descriptor. We should use const*const* to
annotate them for supporting potential extended features added
in color state descriptors in future.
BUG=dawn:77
Change-Id: Id755569fa5076668c3db7b219b699845bc2a1d69
Reviewed-on: https://dawn-review.googlesource.com/c/4880
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This removes the CommandBufferBuilder and copies all the logic into
CommandEncoderBase instead. No changes were done to the logic except for
the implementation of CommandEncoderBase::HandleError and Finish.
BUG=dawn:8
Change-Id: I7b6f44c3cf501477422f067bd277cef470073860
Reviewed-on: https://dawn-review.googlesource.com/c/4820
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This function is currently empty and added on its own so that it can be
rolled and a called in Chromium's dawn_end2end_tests_main.cc before
functional changes. Otherwise follow-up DawnTest changes wouldn't work
running dawn_end2end_tests built in Chromium.
BUG=dawn:109
Change-Id: Ieb191c415ee6720cab8330d3c2b05f76d263adfc
Reviewed-on: https://dawn-review.googlesource.com/c/4822
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
std::codecvt has a protected destructor, so it needs some extra boilerplate to
be used with std::wstring_convert. This CL follows the example from [1].
This was working before because MSVC is nonstandard and std::codecvt::~codecvt
is public.
[1] https://en.cppreference.com/w/cpp/locale/codecvt
BUG=chromium:801780
Change-Id: Ic4b5baabcd9bfc9f60231204f050e369e79b4579
Reviewed-on: https://dawn-review.googlesource.com/c/4840
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
These were the last use of CommandBufferBuilder in Dawn except for its
implementation in dawn_native so it is removed from dawn.json.
Also removes an already disabled test that's obsoleted by the error
handling rework.
BUG=dawn:8
Change-Id: Id2b8a3d5afcd73cc77cfcb09c6a3f851b9483aea
Reviewed-on: https://dawn-review.googlesource.com/c/4761
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This test started failing on the macOS 10.14 builders as soon as it was
re-enabled. Suppress them while we investigate.
TBR=kainino@chromium.org
BUG=dawn:108
Change-Id: I7470a751d74c97558128cbbc90574b3d05629a3e
Reviewed-on: https://dawn-review.googlesource.com/c/4821
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch removes RenderPassDescriptor from BeginRenderPassCmd so that
all the backends can get the data of render pass from the non-pointer
field of BeginRenderPassCmd instead. In this patch, RenderPassDescriptor
has been removed from all Dawn backends other than the virtual function
DeviceBase::CreateRenderPassDescriptor().
This patch is one of the preparations on completely removing
RenderPassDescriptorBuilder from Dawn.
BUG=dawn:6
Change-Id: I3a78f0b2d5318c2bf85858d6fbe939b7861a2cf8
Reviewed-on: https://dawn-review.googlesource.com/c/4800
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Manages a single persistently mapped GPU heap which is sub-allocated
inside of ring-buffer for uploads. To handle larger buffers without additional
unused heaps, ring buffers are created on-demand.
BUG=dawn:28
TEST=dawn_unittests
Change-Id: If4d3e717186895b1409502c1dea5ab751a4776b2
Reviewed-on: https://dawn-review.googlesource.com/c/4440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
CommandEncoder is the replacement for CommandBufferBuilder. This commit
adds the dawn.json definition for it and an initial implementation that
wraps CommandBufferBuilder. This is done so that the code can be ported
to CommandEncoder gradually, otherwise the commit would be too big and
would risk many merge conflicts.
This converts all samples and end2end tests to use CommandEncoder.
BUG=dawn:8
Change-Id: If4ce86e6fb39ba4e0c2af6328d40e63be17d18c1
Reviewed-on: https://dawn-review.googlesource.com/c/4741
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This also makes SwapChain support WebGPU-style error handling.
BUG=dawn:8
Change-Id: I5a142ae58600445f0f44f6dbe419cb7c3cdc9464
Reviewed-on: https://dawn-review.googlesource.com/c/4660
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch removes RenderPassDescriptorD3D12 completely and moves the
creation of RTVs and DSVs to CommandBufferD3D12::RecordCommands(), where
we allocate all RTVs and DSVs used in the current command buffer in one
RTV heap and one DSV heap. Note that the method to allocate RTVs and
DSVs are too simple in this patch, and we will optimize it later.
This patch also adds a test to make sure Dawn works correctly when we
use two different render passes in one command buffer.
This patch is one of the preparations on completely removing
RenderPassDescriptorBuilder from Dawn.
BUG=dawn:6
Change-Id: I02e30c007fb8668a7474a3caf7a858782d0c92df
Reviewed-on: https://dawn-review.googlesource.com/c/4520
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
AttachmentStateDescriptor was removed in web idl. Its format info
for color attachment and depth/stencil attachment were split and
added into BlendStateDescriptor (renamed to ColorStateDescriptor)
and DepthStencilStateDescriptor (became optional) respectively.
This change makes dawn project match the revision in web idl.
BUG=dawn:106, dawn:102
Change-Id: If57b060db7b4b5d1124b4a79a3b92a3880047722
Reviewed-on: https://dawn-review.googlesource.com/c/4561
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This patch removes all the redundant creations of RenderPass in Dawn
unittests. In these tests render passes are actually never used.
BUG=dawn:6
Change-Id: I6301a150ea21af1a7ccc3b7ce2dd78351eb7e179
Reviewed-on: https://dawn-review.googlesource.com/c/4720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This is part of making buffer mapping match WebGPU
Bug: dawn:7
Change-Id: Ia97c872e398112aef0f93c98618c8a7f3ff0c19a
Reviewed-on: https://dawn-review.googlesource.com/c/4580
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
device->ValidateObject dereferences the object and would crash when
the command buffers are nullptr. This issue would have disappeared when
WebGPU error handling is implemented for command buffers. We still fix
it now to please fuzzers.
BUG=dawn:8
BUG=chromium:931880
Change-Id: Ia9d89ebdde9e2ac93de58da2201708c400a712c7
Reviewed-on: https://dawn-review.googlesource.com/c/4740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
The parameters about vertex attribute were encapsulated in
VertexAttributeDescriptor in web idl. This change construct
this descriptor accordingly.
BUG=dawn:107
Change-Id: Ia1c6e53af951d8f2a0c0b69bdca09291c2661e50
Reviewed-on: https://dawn-review.googlesource.com/c/4620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This is fixes the soon to be added -Wc++98-compat-extra-semi wraning.
TBR=kainino@chromium.org
BUG=
Change-Id: I26abb54c821a9ad0893af37b626c44d8271c216c
Reviewed-on: https://dawn-review.googlesource.com/c/4661
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Adds Destroy() to the Buffer frontend but doesn't implement
it in the backend yet.
Bug: dawn:46, dawn:7
Change-Id: I2e6bdba1484fc5f49599801b4ffe3e9a6aaf60a5
Reviewed-on: https://dawn-review.googlesource.com/c/3720
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch removes RenderPassDescriptorVk completely and move the
function RecordBeginRenderPass to CommandBufferVk.cpp, which is
a part of preparation of removing RenderPassDescriptorBuilder from
Dawn.
BUG=dawn:6
Change-Id: Id666ef2f998fa65de93deb16afedb1d53d6b8bc0
Reviewed-on: https://dawn-review.googlesource.com/c/4540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Dawn used to return "nullptr" when an error happened while creating an
object. To match WebGPU we want to return valid pointers but to "error"
objects.
This commit implements WebGPU error handling for all "descriptorized"
objects and changes the nullptr error checks into "ValidateObject"
checks. This method is used both to check that the object isn't an
error, but also that all objects in a function call are from the same
device.
New validation is added to objects with methods (apart from Device) so
they check they aren't error objects.
A large number of ASSERTs were added to check that frontend objects
aren't accessed when they are errors, so that missing validation would
hit the asserts instead of crashing randomly.
The bind group validation tests were modified to test the behavior with
both nullptrs and error objects.
Future commits will change the CommandBufferBuilder to not be a builder
anymore but an "Encoder" instead with special-cased error handling. Then
once all objects are descriptorized, the notion of builders will be
removed from the code.
BUG=dawn:8
Change-Id: I8647712d5de3deb0e99e3bc58f34496f67710edd
Reviewed-on: https://dawn-review.googlesource.com/c/4360
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This will allow implementing the following part of the WebGPU IDL using
a nullable pointer instead of an extra hasDepthStencilState boolean:
partial interface GPURenderPipelineDescriptor {
GPUDepthStencilStateDescriptor? depthStencilState;
};
BUG=dawn:102
Change-Id: Iae709831ad857fcef073f18753ab39567a8797da
Reviewed-on: https://dawn-review.googlesource.com/c/4500
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
It doesn't need to care about device creation anymore, except for the
GLFW window hints and creating a GL context to discover the adapter.
Also remove the non-adapter GetPCIInfo.
BUG=dawn:29
Change-Id: I9bc8232536a55d2f973463ae0f2e0548dfc35456
Reviewed-on: https://dawn-review.googlesource.com/c/4381
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Undefined BGLs are stored as nullptr in the pipeline layout, so to be
defensive we assert clients of PipelineLayout can't request undefined
BGLs (which forces iteration on the BGLMask).
Also fix two cases where the BGLs were iterated on incorrectly.
BUG=dawn:8
Change-Id: I3c084125b93d6684b4c79a56745632874079ebec
Reviewed-on: https://dawn-review.googlesource.com/c/4480
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
The flushing of command buffers was in an ASSERT which made them skipped
on release builds.
BUG=
Change-Id: I07bf558d1689f4bea0047a80ab3c8b04938f04a0
Reviewed-on: https://dawn-review.googlesource.com/c/4501
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This creates proper Client and Server interfaces which will be necessary
for adding additional features to the Wire for chrome integration
Bug: dawn:103
Change-Id: I181e95079b0bac85c2c6152ad8066a94b80c8d28
Reviewed-on: https://dawn-review.googlesource.com/c/4002
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>