Commit Graph

1452 Commits

Author SHA1 Message Date
Yan, Shaobo 351ea23830 Dynamic Buffer Offset : D3D Backend
In a typical graphics application it is a common usage to update some uniforms once per draw,
and such uniforms include the word positions, orientations, and so on. In the current state of
WebGPU, this means that for each draw call we have to create a new bind group to set the right
uniform values. Bind group creation is expected to be more expensive than
recording draws because a memory allocation is required.

The functionality of dynamic buffer offset is to reduce the number of bind groups that need to
be created.

The patch implements dynamic buffer offset on D3D backend using root descriptor.

Bug=dawn:55

Change-Id: Ia713a4edb3c0ab8f3bba048d7813f343e9dee166
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9040
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-31 01:29:42 +00:00
Jiawei Shao d08611b7a8 Move all the implementations of Toggle to Toggles.cpp
This patch moves all the code related to Toggle from Instance.cpp to
Toggles.cpp to make the code in Instance.cpp cleaner.

BUG=dawn:56

Change-Id: Ica2a779569478a58ddf21e632a211c0c5b889b00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9580
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-30 23:58:52 +00:00
Bryan Bernhart 35ad5221fb Resource Management 3: Buddy allocator
Introduces the buddy system for fast power-of-two sub-allocation.

BUG=dawn:27

Change-Id: I56836ae317ecc5a91d8341c843fc37d4f91fb5af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9260
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-30 16:46:10 +00:00
Corentin Wallez 7b57c5bb77 Check bindgroup validity first in SetBindGroup
bindgroup->GetLayout() was called before checking the bindgroup is an
error, causing an assert to fire in Debug. Adds a regression unittest.

BUG=dawn:196

Change-Id: I58e95879a7f2a7cf5c47c7b228f7e3b5bb72d8ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9560
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-30 06:49:09 +00:00
Yan, Shaobo 34f8bd8c48 Dynamic Buffer Offset : OpenGL Backend
In a typical graphics application it is a common usage to update some uniforms once per draw,
and such uniforms include the word positions, orientations, and so on. In the current state of
WebGPU, this means that for each draw call we have to create a new bind group to set the right
uniform values. Bind group creation is expected to be more expensive than
recording draws because a memory allocation is required.

The functionality of dynamic buffer offset is to reduce the number of bind groups that need to
be created.

The patch implements dynamic buffer offset on OpenGL backend using glBindBufferRange and adds
validation to check whether visibility of resources are none.

Bug=dawn:55

Change-Id: I77e10a9677d1737f377301ee89e29d904c91c298
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2019-07-30 01:21:19 +00:00
Idan Raiter 7dec2d1c56 Use Vulkan 1.1 if available
Bug: chromium:976495
Change-Id: I10940340fab44b44e26cfb025f8c932a5e62f02e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9500
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-29 23:31:49 +00:00
Corentin Wallez 10fe83305a Metal: Pack vertex buffers just after the pipeline layout
WebGPU have a 2D pipeline layout plus a vertex buffer table while Metal
has a single vertex buffer table that contains everything (including
uniform and storage buffers). Previously the space for vertex buffers
was statically allocated in that table which made the last vertex buffer
go out of bound of the Metal vertex buffer table.

This fixes the issue by packing all the vertex buffers that are used
right after the vertex buffers used by the bind groups. This is a
drive-by fix found while looking at reserving Metal vertex buffer 30 to
contain the shader storage buffer lengths.

BUG=dawn:195

Change-Id: If5c67bbc0d15c976793ef43889e50e4a360217d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9387
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-29 14:11:06 +00:00
Austin Eng b98f0faa4d Deduplicate AttachmentState shared by RenderPipeline and RenderPasses
This both deduplicates shared state by multiple passes or pipelines and
makes checking pipeline compatibility a single pointer check. It will be
useful for also checking RenderBundle compatibility.

Bug: dawn:154
Change-Id: I0fb289fab5ac76a7fbd500f64b8a6409a246ab32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9461
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-26 19:08:18 +00:00
Natasha Lee e69627f35e Backdoor to get the number of texture lazy clears for testing
Bug: dawn:145
Change-Id: Ie01b21ce490832c459e74c76a7b8d9f203552bfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2019-07-26 17:54:48 +00:00
Bryan Bernhart 506ce9bba4 Fix MSVC builder failure with NextPowerOfTwo.
Define behavior of n=0 when compiling on MSVC.

BUG=dawn:27

Change-Id: If9d454833f5b3d8f0183eba2bc5a54f9ca6e56a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9440
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-26 11:20:08 +00:00
Jiawei Shao 9d2ccaf65c Vulkan: Support recreating swapchain with SwapChain.Configure()
This patch adds the support of recreating a swapchain with SwapChain.
Configure() on Vulkan backends.
1. Query the Vulkan surface information again.
2. Clean up old swapchain.

BUG=dawn:177

Change-Id: Id7e9e07e9dbbba4a71322367cae10fb179106220
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-25 01:08:14 +00:00
Bryan Bernhart 2718177841 Resource Management 4: Stress test buffer writes
Add test for many buffer writes.

BUG=dawn:27

Change-Id: I026c3b9a6d30c7c6634b89db9798902b036150c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9280
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-24 20:09:44 +00:00
Austin Eng fde94905fe Factor EncodingContext out of CommandEncoderBase.
This patch factors the CommandAllocator, CommandIterator, and error
handling out of CommandEncoderBase so it can later be used by the
RenderBundleEncoder.

Bug: dawn:154
Change-Id: Ia4f8c3ce7f432f0887b619bd8090aa9bec7330fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9181
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-07-24 18:15:24 +00:00
Natasha Lee 8944f0205b Test that sampled textures in compute and render pass get lazy cleared
Bug: dawn:145
Change-Id: I719faf0a07a2011be0cdee3a7bead2437f524ba7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8660
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2019-07-23 20:30:24 +00:00
Stephen White 68d97adf88 Prefer <cstring> to <string.h>.
Change-Id: I9f862ebfc589379f27cb5e92a80080946988efcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9360
Commit-Queue: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-23 17:04:34 +00:00
Corentin Wallez 4e3b218e96 Introduce a format table in the OpenGL
The information about formats in OpenGL will grow to include more
information than just (internalFormat, format, type) and will gain more
logic to depend on GL version and available extensions over time.

BUG=dawn:128

Change-Id: I63a6ac7d48797fb4a9f97a65871306e640cf41d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9201
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-23 06:40:54 +00:00
Jiawei Shao 722c4fa8b2 Fix missing header in OpenGLFunctions.cpp
This patch adds the missing header <tuple> in OpenGLFunctions.cpp to
fix a build error on Windows that the compiler cannot find the
definition of std::tie().

BUG=dawn:190

Change-Id: I35d1f258d3b6197187d626870f3347e195881da8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9300
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-23 06:34:14 +00:00
Bryan Bernhart 07b5be3bc5 Resource Management 2: Buffer mapping error handling
Add error handling for buffer mapping ops.

BUG=dawn:27

Change-Id: I9a66baf74c27b137990608c31cb04af8023594b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9241
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-23 00:04:59 +00:00
Corentin Wallez 23dd12459c Fix compilation of the OpenGL backend on Mac
OpenGLBackend.cpp would end up including KHR/khrplatform.h when the
libdawn_native target that contains it doesn't have a dependency on the
khr_platform target. Fix this by making libdawn_native_sources expose
some of its dependencies as public_deps.

BUG=

Change-Id: I45c05a064e4b73ab7ac6f5f6258e7983e5fc085d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9205
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-22 23:32:29 +00:00
Bryan Bernhart 40793232d8 Resource Management 1: Math ops
Support 64-bit log2 and power-of-two alignment.

BUG=dawn:27

Change-Id: I2d254e5dda9626a6e26017b0d8e33f5db4c9298d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9224
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-07-22 21:42:18 +00:00
Austin Eng 0e338ff986 Fix compilation of MemoryTransferService Read/WriteHandle on Windows
Inner classes needed the macro DAWN_WIRE_EXPORT.

Bug: dawn:156
Change-Id: If45ff9ed14623be32e7821ba3a60791a365bb0dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9240
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-22 19:09:09 +00:00
Corentin Wallez 4e9923cb96 Remove suppression fixed for Linux Intel Vulkan
This was fixed by https://dawn-review.googlesource.com/c/dawn/+/9160
that avoids doubling the size of the internal ringbuffer each
re-allocation.

BUG=chromium:980737

Change-Id: Ic8052eb4e9d2b835534aeaef4e1db43489523602
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9206
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-07-22 14:16:39 +00:00
Corentin Wallez ba84fb2977 OpenGL: Add support for backend validation
This uses the OpenGL debug ouput functionality to make the driver call
us back when an error happens so we can ASSERT and fail.

BUG=dawn:190

Change-Id: I4b6d7a860384dfeccc1c37383fd4cbdc09d7dc05
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9204
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-22 10:02:49 +00:00
Corentin Wallez fefb3ab120 OpenGL: Use the correct size to lazy-clear mips
We would incorrectly use the size of the first mip level to clear
non-zero mip levels. This was found while enabling debug output in
the OpenGL backend.

BUG=dawn:190

Change-Id: I29a87b87057d425d1c131d11afdc7ca4716607c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9202
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-22 09:50:21 +00:00
Corentin Wallez 9dffe11696 OpenGL: Don't bind non-existent shader resources.
In OpenGL we have to query a resource's location or index before we can
bind it. The driver can tell us that the resource doesn't exist using
special values (-1 for locations, GL_INVALID_INDEX for indices). This
happens when Dawn compiles a pipeline that has bind group bindings that
none of the shader modules uses.

This was found while enable OpenGL debug output.

BUG=dawn:190

Change-Id: I58b3a1a65f87b4408985c1258f1a95379e6b540e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9203
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-22 09:24:51 +00:00
Austin Eng 69f1db7248 Add RenderEncoderBase to match WebGPU class hierarchy.
This is needed so that RenderBundleEncoder and RenderPassEncoder can
share code. This patch also moves EndPass out of ProgrammablePassEncoder
and into both RenderPassEncoder and ComputePassEncoder. Render bundles
do not have EndPass.

Bug: dawn:154
Change-Id: Ib7126b2ba718b0b93e3d6f15c429ac910c0d5d31
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9180
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-20 01:34:56 +00:00
Yunchao He c0b8132f55 Implement RenderPassEncoder::SetViewport: impl on backends
Implement SetViewport on the rest backends: D3D12 and Metal

BUG=dawn:53
TEST=dawn_end2end_tests

Change-Id: I2e552867080eb8c35db641d1a61b0341d2a0a048
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9020
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-19 21:57:39 +00:00
Stephen White 472bd1ec29 Add some missing #includes.
Skia-dawn found these; not sure why Chrome and Dawn standalone don't.

Change-Id: I43706fbaca94d1718de0be727151dd8f3a191df2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9220
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-19 21:51:09 +00:00
Corentin Wallez 47b107003d dawn.json: Removed unused "face" bitmask
It was replaced by "cull mode" but we forgot to remove it.

BUG=dawn:22

Change-Id: I2195ed64d1df05b01baf37d477a2a7cc6cf1156c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9200
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-19 21:28:38 +00:00
Austin Eng 72724b8d25 Add wire tests and mocks for the MemoryTransferService
This CL tests integration of the MemoryTransferService with buffer mapping.
It tests the basic success and error cases for buffer mapping, and it tests
mocked failures of each fallible MemoryTransferService method that an embedder
could implement.

Change-Id: Iece660fb49664cc6a09a0b0b8dbe59e2882a6017
Bug: dawn:156
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8841
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-19 16:16:58 +00:00
Austin Eng 6a5418a760 Add MemoryTransfer interfaces to the wire
This patch adds MemoryTransfer client/server interfaces and
uses it to implement data transfers for buffer mapping.

This patch also provides a default "inline" implementation of
the MemoryTransfer which is used if the embedder does not
provide one on initialization.

Because implementations of MemoryTransfer perform their own
serialization, a skip_serialize option is added to WireCmd records.

Bug: dawn:156
Change-Id: I2fa035517628a3ad465b0bc18a6ffc477e2bd67f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8642
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-07-19 16:01:48 +00:00
Jiawei Shao 49aae0f3bd Double the size of the ring buffer only when it is not big enough
Currently Dawn always doubles the size of the largest ring buffer
everytime when DynamicUploader::Allocate() is called, which is not
necessary and will cause out-of-memory errors when this function is
called for too many times. This time fixes this behaviour by only
doubling the size of the largest ring buffer when it is not big enough
for the request buffer size.

BUG=dawn:108
TEST=dawn_end2end_tests

Change-Id: I734493dbc632ca8e9a30c1ceeb0b7b9e0474656b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9160
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-19 00:09:28 +00:00
Yunchao He 91ec571d17 Impl RenderPassEncoder::SetViewport: add more tests
This patch meant to add tests for SetViewport to verify that the
viewport we set in one render pass will not impact the viewport(s)
in other render pass(es).

These newly added tests exposed a potential error on OpenGL backend.

This patch also implemented SetViewport and fixed the bug on OpenGL.

BUG=dawn:53, dawn:189
TEST=dawn_end2end_tests

Change-Id: Ia2e74f003c02acdcf983b24a3386efab30793652
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-07-18 16:17:34 +00:00
Corentin Wallez 1546bfbdec Precompute all the Formats at Device creation in the FormatTable
This is needed for two reasons:
 - TextureBase and TextureViewBase stored Formats by value which isn't too
much overhead at this time but will get bigger in the future.
 - The OpenGL backends needs its own GLFormat structure to store data about
each format which will eventually contain complicated logic to detect
support in the GL driver so it shouldn't be duplicated in Textures.

The computations of the information about Format is moved from being done
whenever they are needed to being precomputed at DeviceBase initialization.
This makes each format have a constant "index" in that can be used in the
backends to address their own structure, for example a GLFormat table.

Also some DeviceBase pointers were made const for validation.

BUG=dawn:128

Change-Id: I37d1e9c739b87cddcea09cb1759e175704d90f9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9101
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-18 09:25:04 +00:00
Corentin Wallez d6cc1fe099 Add an implementation of Result<const T*, E*>
The existing implementation of Result with tagged pointers was not able
to handle constant pointers for the result. This is required in
follow-up CLs to return internal formats in a ResultOrError.

This CL extracts the tagged pointer logic out of Result<T*, E*> so it
can be shared with Result<const T*, E*>.

Tests are also added to cover Result<const T*, E*>.

BUG=dawn:128

Change-Id: Id19ae8e1153bcfcaf94d95ac314faf2b23af6f91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9100
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-17 19:01:50 +00:00
Corentin Wallez 9dbb81f004 Add missing validation for unsupported texture view dims.
BUG=chromium:984809

Change-Id: Iea6bf88f79f9749237052c16e0ab2dd15d7d4308
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9081
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-17 14:49:37 +00:00
David 'Digit' Turner ee0fa175a3 Update Vulkan headers to v1.1.115
This updates the content of third_party/khronos/vulkan
to match the upstream v1.1.115 headers.

+ update third_party:vulkan_headers to define the VK_USE_PLATFORM_XXX
  macros directly, since this better matches the upstream BUILD.gn
  file behaviour.

NOTE: A better patch would use a DEPS entry to get the Vulkan
      headers. That's exactly what [1] does, but fails to
      integrate with Chromium due to its messy situation
      regarding the use of vulkan headers.

      Once the Chromium situation is fixed, it will be possible
      to remove third_party/khronos/vulkan entirely and rely
      on a DEPS entry.

[1] https://dawn-review.googlesource.com/c/dawn/+/9080

BUG=NONE

Change-Id: Id9a3be3e079119368236c0323823e36bec1a056d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9082
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-17 14:48:27 +00:00
François Beaufort 0326b8012b Use whole size of buffer if binding buffer size is UINT64_MAX
Following WebGPU spec change at https://github.com/gpuweb/gpuweb/issues/331,
bind groups in Dawn now use the whole size of the buffer if binding buffer
size is UINT64_MAX.

Bug: dawn:22
Change-Id: If28d905e634432755dad5c67c69eadedcee53dfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8863
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
2019-07-17 08:54:19 +00:00
David 'Digit' Turner 56a21a6151 Make GN //src/common target easier to use when Vulkan is enabled.
Ensure that //src/common exports the appropriate config settings
when vulkan is enabled. This CL tries to address several issues
at once:

- A target that depends on //src/common and wants to find
  "common/vulkan_platform.h" needs to have "${dawn_root}/src"
  in its include_dir.

- Same target needs to have DAWN_ENABLE_VULKAN macro to avoid
  a compile #error message when including "common/vulkan_platform.h"

- Same target needs to be able to find <vulkan/vulkan.h> which
  is included by "common/vulkan_platform.h".

This is achieved by ensuring that the "dawn_internal" config,
is provided as a public_config by the GN ":common" target.
And by adding third_party/vulkan_headers as a public_deps
if |dawn_enable_vulkan| is true.

Note that "dawn_internal" is used by several other targets
in Dawn BUILD.gn files, hence why it was not renamed to something
else like "dawn_common_config" here.

+ Simplify targets that currently depend on ":common" so they
  no longer need to add vulkan_headers as an explicit dependency.

Change-Id: I2030c1e209a8186c141d4c06a0d52fb21695bb51
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8962
Commit-Queue: David Turner <digit@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-17 08:54:18 +00:00
Takuto Ikuta cf20678c0d Use xenial explicitly for builder
This CL completely migrates dawn linux builder from trusty to xenial.

BUG=chromium:981741
Change-Id: I5e9bdba7bd58355acaaeb9eebb120155b7996fd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9060
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-17 08:37:49 +00:00
David 'Digit' Turner 8605d2eb86 Enable Vulkan extensions for Linux, Windows, Android and Fuchsia.
This CL ensures that when <vulkan/vulkan.h> is included, the
appropriate VK_USE_PLATFORM_XXX macro is defined to enable the
declaration of platform-specific types and extensions.

Note that for Linux, this requires an xlib_with_undefs.h header
to remove annoying macros that are defined by <X11/X.h> (i.e.
Success, Always, None) and which prevent compilation of other
Dawn sources that use the same symbols as enum value names.

Change-Id: I0c8d95fe8043d75ba3f74789e0fe2e3e4a477703
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8961
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: David Turner <digit@google.com>
2019-07-17 08:22:19 +00:00
Li, Hao 6eb681cc54 Metal: use the IORegistry to get the PCI ids
MTLDevice.registryID points to an entry in the IORegistry from which we
are able to find the entry for the actual GPU device, which contains
properties for the PCI device and vendor ids.

But MTLDevice.registryID is introduced from macOS 10.13. For macOS <=
10.12, we get the PCI ids by matching them with MTLDevice.name.

BUG=dawn:120, dawn:184

Change-Id: If4040c623fc61115c88d453eee0f2d05ed17a546
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8920
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2019-07-17 01:04:50 +00:00
Li, Hao 1ffb0d6a02 OpenGL: use vendor name to get PCI vendor id
OpenGL doesn't allow to query PCI information, but we can get vendor name through glGetString(GL_VENDOR), then match it with vendor id.

BUG=dawn:184

Change-Id: Icdcdc6bfdb5cd561b5057e8b2eab06df2dd5cea1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8940
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2019-07-17 01:04:30 +00:00
Jiawei Shao 5580970f59 Support all BC formats on D3D12, Metal and Vulkan
This patch adds the support of all BC formats on D3D12, Metal and
Vulkan and related end2end tests.

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: I50caf687d3cfee7df80070952f55f96dc363a830
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-17 00:00:10 +00:00
Yunchao He d6f13c645b Implement RenderPassEncoder::SetViewport: add end2end tests
The main aim of this CL is to add tests for SetViewport. But it
also implements the feature on Vulkan backend to verify the tests.

BUG=dawn:53
TEST=dawn_end2end_tests

Change-Id: I9578b2d9650cb952ce67cf91f79e9682c9932ee3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8820
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-07-16 19:27:09 +00:00
François Beaufort 4af9808400 Make rasterization state descriptor optional
Following WebGPU spec change at https://github.com/gpuweb/gpuweb/issues/347,
the rasterizationState from GPURenderPipelineDescriptor should not be
required anymore.

BUG=dawn:22
Change-Id: Ic458396665a7e2fbd942aa7f50138cc96497ff33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
2019-07-16 17:01:59 +00:00
Corentin Wallez d3e7f944ab Fix double to float conversion warning on MSVC
BUG=

Change-Id: Iccae33f4c925c554e73e40a70d490a26d54949bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9001
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-16 15:05:09 +00:00
Yan, Shaobo c8ab96cdd9 Add an end2end test to ensure dawn cache system considers dynamic attributes
Binding layout uses an attribute to mark dynamic resource. And this should be taken into
consideration when determining whether two bindingInfo are equal.

Otherwise, dawn cache system may take two different bind group layouts(they have same binding
resource type, masks and visibilities but one bind group has dynamic resource and the other
not) as the same. This will return wrong bind group layout object to user and cause validation
error when user tries to use dynamic buffer offset.

BUG=dawn:188

Change-Id: I11b158724c7592718af434b48c9e3f2f9bb72b93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8901
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-16 08:37:49 +00:00
Corentin Wallez f07e85c604 Add missing WebGPU enums and defaulted members.
These additions to dawn.json don't require changes to users of the C++
API so they are done now to prepare for webgpu.h. Validation is added
that forbids using the new enum values and non-default values for
members until they are implemented.

BUG=dawn:22

Change-Id: Ie6f3384243d6874e7aca4b94733409755a066c93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8862
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-15 20:47:56 +00:00
Corentin Wallez dd15b11b21 Add .gitattributes to normalize EOL
BUG=

Change-Id: I7b77180eaf440f9d1894216e5a1a0b56af1de2cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8860
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-15 12:23:18 +00:00