Commit Graph

9082 Commits

Author SHA1 Message Date
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
Corentin Wallez 7be2a71f2b Descriptorize SwapChain.
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>
2019-02-15 11:15:58 +00:00
Jiawei Shao c8b067d2df D3D12: Remove RenderPassDescriptorD3D12
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>
2019-02-15 10:55:08 +00:00
Yunchao He 108bcbd5c9 Split AttachmentStateDescriptor, in order to match web idl
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>
2019-02-15 02:20:57 +00:00
Yunchao He 4dec7371a2 Construct VertexInputDescriptor, in order to match web idl
BUG=dawn:107

Change-Id: Ic219fb98a88a7ac597fbdc592f604f27b76d756b
Reviewed-on: https://dawn-review.googlesource.com/c/4721
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-02-14 23:56:07 +00:00
Jiawei Shao e7bb3fd119 Remove redundant RenderPass in Dawn unittests
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>
2019-02-14 23:51:18 +00:00
Austin Eng 1541c8ba7a Remove |start| and |size| from buffer mapping
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>
2019-02-14 19:31:17 +00:00
Austin Eng 1198270483 Split wire tests into multiple test files
Bug: dawn:104
Change-Id: I0dc46dabc92c98df13dbf596dea63aeaaea85d3d
Reviewed-on: https://dawn-review.googlesource.com/c/4562
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-14 18:47:07 +00:00
Corentin Wallez 0f0c40de68 QueueSumit: Validate commands != nullptr before checking they are valid
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>
2019-02-14 18:13:47 +00:00
Yunchao He 6fe9b9821a Fix a bug in example CubeReflection
BUG=dawn:31

Change-Id: I9dccca881f0d4d035f1bcf5b1ccdf3df12f69c36
Reviewed-on: https://dawn-review.googlesource.com/c/4700
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-02-14 08:05:37 +00:00
Yunchao He b2207737ab Construct VertexAttributeDescriptor, in order to match web idl
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>
2019-02-14 00:35:39 +00:00
Corentin Wallez 445869d2b0 Fix extra semicolon in DAWN_UNUSED_FUNC
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>
2019-02-13 22:11:48 +00:00