Commit Graph

993 Commits

Author SHA1 Message Date
Austin Eng d030f64550 Reorder backend connections so that explicit APIs come first
This makes it so that default adapter discovery finds
Metal/D3D12/Vulkan first.

Change-Id: I3795bcc8a3d47eb3c53881b7fc43e8d56b4b89fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5481
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-03-11 17:16:52 +00:00
Natasha Lee 718e1dbb89 Reland "Destroy backend implementation for Buffers"
This reverts commit 9bf529ec94.

Reason for revert:
Fixed test failure by submitting basic render pass to clear out texture
before running the tests.

The test was failing previously because the texture pixel color was not
cleared before running the tests, causing unexpected
pixel colors to be compared. Creating a basic render pass clears
the texture, but since the first test fails on submit expectedly,
the pixel is never cleared.

Bug: dawn:46
Change-Id: Ic190c2d8d6af3f9d8def3370b92c6974a82a0096
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5500
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2019-03-11 17:05:22 +00:00
Austin Eng 45f9730855 Capitalize C types dawn -> Dawn
This is to match Chromium style.

Change-Id: Ic97cc03e2291c653ade9662ba3d5e629872b10ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5482
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-03-11 16:52:42 +00:00
Stephen White 97ffc1a8aa GL backend: fix baseVertex param to DrawIndexed.
Re-enable the appropriate test.

BUG=
Change-Id: I8b823b17259f7c588fda0be4fe86990d11a0a324
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5460
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-03-11 16:28:42 +00:00
Corentin Wallez 070052f6b7 Suppress -Wunguarded-availability in MetalBackend.h
Chromium will use this header and currently uses a minimum SDK version
without Metal, so it gets a compilation warning on MTLDevice. There is
no good way to guard availability in headers, so just suppress the
warning in the whole header and push the warning to usage of types in
client code.

BUG=chromium:938895

Change-Id: Id8ec224825c39a28a404be216556780713ecaf15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5440
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-03-10 11:01:40 +00:00
Austin Eng 9bf529ec94 Revert "Destroy backend implementation for Buffers"
This reverts commit b6a80b321e.

Reason for revert: dawn_end2end_tests are failing on the Chromium GPU FYI bots. Example here: https://ci.chromium.org/p/chromium/builders/ci/Win10%20FYI%20Release%20%28NVIDIA%29/4226

Original change's description:
> Destroy backend implementation for Buffers
> 
> Destroy can be used to free the GPU memory associated with resources
> without waiting for javascript garbage collection to occur.
> The buffer is validated at submission to the queue.
> So any buffer that has been destroyed before submission, will then
> invalidate the submit and result in an error.
> 
> Bug: dawn:46
> Change-Id: I40df56ce97baef01deea7552d7a6d40b558fc985
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5320
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Natasha Lee <natlee@microsoft.com>

TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,rafael.cintron@microsoft.com,natlee@microsoft.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:46
Change-Id: Iadf37a8a6675c744207ec7daaa3fd2fde7da3714
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5480
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-03-09 00:06:38 +00:00
Austin Eng 8c1a90199a Split off libdawn_wire_headers from BUILD.gn
These need to be separated from the main BUILD.gn as well.
They cannot be easily guarded behind build flags in Chromium
because the WebGPUImplementation will extend
dawn_wire::CommandSerializer.

Bug: dawn:61
Change-Id: Ic7d6bb13cc535ecddb99c832407ba1f37019ed93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5401
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-03-08 00:51:27 +00:00
Natasha Lee b6a80b321e Destroy backend implementation for Buffers
Destroy can be used to free the GPU memory associated with resources
without waiting for javascript garbage collection to occur.
The buffer is validated at submission to the queue.
So any buffer that has been destroyed before submission, will then
invalidate the submit and result in an error.

Bug: dawn:46
Change-Id: I40df56ce97baef01deea7552d7a6d40b558fc985
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5320
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2019-03-07 19:56:14 +00:00
Corentin Wallez aa9d6ad09d Only build "common" on supported systems
src/common/BUILD.gn contains common dawn configs and will be discovered
by all Chromium builds. "common" doesn't build on all system, for
example Fuchsia so we only expose the target if we are on a supported
system.

BUG=dawn:61

Change-Id: Ib12b1bd3e32529e1969fdc2fc50af05f8e97e7df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-03-07 13:39:50 +00:00
Corentin Wallez 579cf621f3 Split off common and libdawn / dawn_headers from BUILD.gn
This adds an option to dawn_generator to generate files in a different
directory so the generated stay at the same place. Otherwise compilation
errors occur because of stale versions of the headers on the CQ
builders.

BUG=dawn:61

Change-Id: I71ceb3172b5a4e35911973a03be29d90fa684416
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5304
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-03-07 01:46:39 +00:00
Corentin Wallez abc753c9c9 BUILD.gn: Split dawn_component/generator in their own files
This will allow follow up commits to use them from the different parts
of the split-off BUILD.gn file.

BUG=dawn:61

Change-Id: I767f6c97c06ee73290d3df482880d1a2df92e187
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5301
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-03-06 23:17:39 +00:00
Austin Eng 1cc386687c Move CreateFence from Device to Queue
Bug: dawn:113
Change-Id: I5ec829d8945cdc25644f481acc07a9f6d8b13aef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5200
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-03-06 22:42:22 +00:00
Jiawei Shao b47470daa7 Return an error ComputePassEncoder when error occurs in BeginComputePass
This patch is a follow-up of the descriptorization of render pass
descriptor. In this patch we changes the return value of
BeginComputePass from nullptr to an error compute pass encoder when
there is any error in BeginComputePass() to keep it consistent with what
we do in BeginRenderPass().

This patch also provides functions to create error render/compute pass
encoders. With this patch we can create a pass encoder in error by
specifying ErrorTag in the constructor, which is more staightforward
and human readable than the current implementation.

BUG=dawn:6

Change-Id: I1899ae65804f8cecd3079dc313e7e18acb88e37c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5140
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-03-05 01:02:47 +00:00
Jiawei Shao d6eb2e7501 Fix crashes when using error textures in copy commands
This patch fixes a Dawn crash issue when using textures in error state
in the copy commands of CommandEncoder.

In Dawn's copy commands (copyBufferToTexture and CopyTextureToBuffer),
we should check if the texture is in error state or not, or the assert
ASSERT(!IsError()) in texture->GetFormat() will fail and a crash will
occur.

In current Dawn code the validations on the buffer and texture objects
in the copy commands are executed in CommandEncoder::Finish(), which
is too late for textures according to the previous investigation. This
patch moves all these validations to the call of copy commands. The
checks on buffers are also moved away to keep the consistency of the
ones on textures.

BUG=chromium:937628
TEST=dawn_unittests

Change-Id: I0bc44e76262fba5927df20c6a7551b107bad5ca1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5240
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-03-05 00:03:28 +00:00
Austin Eng c8eff1c1e1 Remove export of GLVersion from GLAD
This symbol conflicts with a duplicate symbol when we link Dawn into
Chromium on Linux.

Bug: chromium:877147
Change-Id: Iadf8ac81760085a04d82ea9116e367a1bd17cd4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-03-04 23:41:28 +00:00
Jiawei Shao 081d5c2f64 Add validations on texture sample counts in B2T and T2B copies
This patch adds validations on the sample count of the textures used in
buffer-to-texture and texture-to-buffer copies. Vulkan SPEC requires the
textures used in vkCmdCopyBufferToImage and VkCmdCopyImageToBuffer must
have a sample count equal to VK_SAMPLE_COUNT_1_BIT.

BUG=dawn:56
TEST=dawn_unittests

Change-Id: I189923eee2d8734d5ae3b57aea1a55533e8d98b7
Reviewed-on: https://dawn-review.googlesource.com/c/5220
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-03-04 12:01:59 +00:00
Jiawei Shao a8ce0a434e Add validation on the creation of 4x Multisampled textures
This patch adds validations on the creation of the multisampled textures
with sampleCount == 4. The validations include:
1. Only accept 1 or 4 as valid value of sampleCount.
2. According to Vulkan SPEC, when sampleCount > 1:
- The value of mipLevelCount can only be 1
- We cannot create cube map or cube map array texture views on this
  texture.

BUG=dawn:56
TEST=dawn_unittests

Change-Id: Iac7cbe7cd7af16216b9185afd37a80eef0712f6b
Reviewed-on: https://dawn-review.googlesource.com/c/5160
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-03-04 01:31:38 +00:00
Corentin Wallez 1c92c159ad Fix overflow in CommandAllocator
It was essentially checking "currentPtr + commandSize <= endPtr" and
commandSize could make currentPtr overflow, making the comparison
succeed when it shouldn't have. This was caught through flakiness of the
LargeCommands allocator test.

Added a test provoking an overflow in Allocate and checking nullptr is
returned.

BUG=

Change-Id: I8ae4dad5b33c9d2005027c4d45b110ee0c65dd9a
Reviewed-on: https://dawn-review.googlesource.com/c/2841
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2019-03-01 12:04:58 +00:00
Corentin Wallez 0cdf9e09c4 Implement wrapping IOSurfaces in dawn::Texture.
This allows wrapping IOSurfaces in a dawn::Texture so a Dawn application
can sample from, or render to an IOSurface. It uses Metal's
functionality for wrapping textures in MTLTexture.

Support for single-plane BGRA8, RG8 and R8 IOSurfaces is added as well
as tests for sampling and using BeginRenderPass to clear them.

BUG=dawn:112

Change-Id: I367dbd1a75a0c7b81901fb0aae05f1cd46af3f3a
Reviewed-on: https://dawn-review.googlesource.com/c/5101
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-03-01 12:01:18 +00:00
Corentin Wallez 2dfb3f01e7 DawnTest: Allow checking for device errors.
The previous assumption is that all validation tests would be unittests
and that the end2end tests would always produce valid sequences of
commands. This not true because we can't test the validation of
backend-specific entrypoints in the unittests.

BUG=dawn:112

Change-Id: I89e2fe017bf3ecf6a83c9e8cdf4324c33f95a721
Reviewed-on: https://dawn-review.googlesource.com/c/5100
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-28 09:45:48 +00:00
Yan, Shaobo 31ac9850ad Using split copy to fix metal issue on uploading texture from an unpacked buffer
When uploading textures from an unpack buffer, some drivers count an
extra row padding when checking if the pixel unpack buffer is big
enough. This will generate error about totalUsedBytes is larger than the
buffer.

Using split copy to take care of the last row of the unpack buffer will
workaround this issue.

BUG=dawn:74

Change-Id: I9d521d65e1f9e8039ae0388092d5e650cc4e65ce
Reviewed-on: https://dawn-review.googlesource.com/c/4940
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-28 03:18:38 +00:00
Corentin Wallez af5d1865b7 DawnTest: Use last adapter on Metal
This is a temporary workaround to make sure we test the correct adapter
on the macOS builders: on multi-GPU systems the integrated is always
listed first so we would previously only test on Intel.

However we can't change the logic for D3D12 becaue the correct adapter
is the first one.

The proper fix for this is to pass the requested PCI device and vendor
ID to dawn_end2end_tests so it can select the correct adapter, but this
requires PCI IDs to be correct with Metal, which requires rolling the
macOS 10.13 SDK in Chromium.

BUG=dawn:109

Change-Id: Ice33367b0b8850306785b10a2dafc2f68d8b84d7
Reviewed-on: https://dawn-review.googlesource.com/c/5041
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-27 10:09:46 +00:00
Brandon Jones 9c061c3437 Add ValidateCanRecordCommands to Debug Marker APIs
Add ValidateCanRecordCommands to debug marker calls in ProgrammablePassEncoder.
Fixes issue found by ClusterFuzz.

Bug=chromium:935902
Bug=dawn:44

Change-Id: If1a4890a9de49a1872711a7b1a875ddc13130e88
Reviewed-on: https://dawn-review.googlesource.com/c/5080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-27 09:25:26 +00:00
Jiawei Shao b2c5023c9c Remove RenderPassDescriptorBuilder
This patch removes RenderPassDescriptorBuilder completely from Dawn.
With this patch, RenderPassDescriptor is a structure instead of a Dawn
object, and all the checks in RenderPassDescriptorBuilder are moved into
CommandEncoder.cpp.

This patch also updates the helper functions and structures related to
RenderPassDescriptor because RenderPassDescriptor is no longer an
object but a structure with members in pointers.

BUG=dawn:6

Change-Id: Ic6d015582031891f35ffef912f0e460a9c010f81
Reviewed-on: https://dawn-review.googlesource.com/c/4902
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-02-27 09:21:56 +00:00
Yan, Shaobo 738567f148 Validate buffer to buffer copy size to be a multiple of 4 bytes
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>
2019-02-27 02:46:27 +00:00
Corentin Wallez d56f8d2e05 Remove Chrome-specific configs for GLFW and GLM
BUG=chromium:935641
BUG=chromium:935704

Change-Id: I3ebe97beb330ff8e446a54c218f4c34001259b33
Reviewed-on: https://dawn-review.googlesource.com/c/5061
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-26 09:55:23 +00:00
Corentin Wallez 9b8d2b0bbf Instance: Only discover default adapters once.
BUG=dawn:109

Change-Id: I9e54550dc8d3cdea289b3ad529a69a4cf3d5a35b
Reviewed-on: https://dawn-review.googlesource.com/c/5040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-25 17:42:56 +00:00
Corentin Wallez b92fa10557 KnownObject: Make it an error to request ID 0
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>
2019-02-25 09:49:00 +00:00
Robert Iannucci 8deadd8d02 Add named cache for xcode installation.
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>
2019-02-25 09:10:05 +00:00
Yunchao He 83684f9c13 Validate vertex format for Input State
BUG=chromium:935078, chromium:935026

Change-Id: I9c27cae2a0aa1ec23b8203a4d9b95e1d6d98a868
Reviewed-on: https://dawn-review.googlesource.com/c/5020
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-24 17:32:35 +00:00
Yunchao He 87bf834109 Add more validations for input state
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>
2019-02-22 15:08:03 +00:00
Corentin Wallez fda0617505 DawnTest: Print system configuration on env SetUp
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>
2019-02-21 17:36:11 +00:00
Corentin Wallez 0b2f55257a DawnTest: add a test environment to contain global data.
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>
2019-02-21 16:29:12 +00:00
Corentin Wallez e30d5e17e4 Require a semicolon at the end of DAWN_INSTANTIATE_TEST
TBR=kainino@chromium.org
BUG=chromium:926235

Change-Id: I67d8c594cd8dc060482e16de39b1996e01e9b44f
Reviewed-on: https://dawn-review.googlesource.com/c/4960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-21 14:57:01 +00:00
Nico Weber e3b27e6661 dawn: Remove semicolons.
A cleanup needed for turning on -Wextra-semi in Chromium builds.

Bug: chromium:926235
Change-Id: I3d2b517ad21dfae9e7dc06613a7fe3e98d783b2a
Reviewed-on: https://dawn-review.googlesource.com/c/4841
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-21 14:39:01 +00:00
Victor Costan 56006dcf65 test: Replace _TEST_CASE_ with _TEST_SUITE_.
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>
2019-02-21 09:43:40 +00:00
Victor Costan d097e7cd3b Roll googletest to the same version as Chromium.
Bug: chromium:925652
Change-Id: I849ae33666322b2282232767dbfb67195148cd32
Reviewed-on: https://dawn-review.googlesource.com/c/4920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-21 09:26:20 +00:00
Jiawei Shao 2030166137 Rename several parameters to match WebGPU IDL
This patch renames the following parameters to match the latest WebGPU
IDL:
- BindGroupDescriptor.numBindings -> bindingCount
- BindGroupLayoutDescriptor.numBindings -> bindingCount
- BindGroupDescriptor.numBindings -> bindingCount
- queue.submit(numCommands, ..) -> commandCount
- RenderPipelineDescriptor.numColorStates -> colorStateCount
- TextureDescriptor:
  arraySize -> arrayLayerCount
  levelCount -> mipLevelCount
- TextureViewDescriptor:
  levelCount -> mipLevelCount
  layerCount -> arrayLayerCount

BUG=dawn:80

Change-Id: I615842dd5754d1ae1ddff31e25403bb3161f0201
Reviewed-on: https://dawn-review.googlesource.com/c/4881
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-21 00:45:19 +00:00
Brandon Jones 11d32c8095 Implementation of Debug Marker APIs
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>
2019-02-20 20:21:00 +00:00
Yunchao He 938811eef9 Use const*const* to annotate color state descriptors
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>
2019-02-20 13:00:36 +00:00
Corentin Wallez f20f5b9493 WebGPU error handling 5: Move CmdBufBuilder logic to CmdEncoder
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>
2019-02-20 11:46:16 +00:00
Corentin Wallez 3499d3ee97 DawnTest: Add function to init test environment.
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>
2019-02-18 15:07:44 +00:00
Tom Anderson c1d15b1dbf Fix build error with use_custom_libcxx=true on Windows
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>
2019-02-18 10:48:53 +00:00
Corentin Wallez 37b715deec WebGPU error handling 4: CommandEncoder for wire tests
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>
2019-02-18 09:42:03 +00:00
Corentin Wallez 2f321dd4ab Suppress BufferSetSubDataTests.ManySetSubData on Mac Intel
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>
2019-02-18 09:37:53 +00:00
Jiawei Shao 81da14f45c Remove RenderPassDescriptor from BeginRenderPassCmd
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>
2019-02-18 08:56:03 +00:00
Yunchao He 7775258f98 Rename BlendState to ColorState, in order to match web idl
BUG=dawn:106

Change-Id: Id2cb1788becfacd09bd7f420d6525d22f96d1fe2
Reviewed-on: https://dawn-review.googlesource.com/c/4781
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-16 02:27:30 +00:00
Bryan Bernhart 67a73bd9fa Memory manager: buffer uploads (Metal+refactor) - Part 3
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>
2019-02-15 21:18:40 +00:00
Corentin Wallez 695b68d100 WebGPU error handling 3: CommandEncoder for validation tests
BUG=dawn:8

Change-Id: I16ad900387adcbaf793177e97a96a5f19dcc47a0
Reviewed-on: https://dawn-review.googlesource.com/c/4760
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-02-15 13:10:38 +00:00
Corentin Wallez e1f0d4e639 WebGPU error handling 2: CommandEncoder for samples and end2end tests
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>
2019-02-15 12:54:08 +00:00