Commit Graph

1719 Commits

Author SHA1 Message Date
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
Corentin Wallez d757c300a4 Validate usage of dynamic at the BGL level.
Previously validation of the combination of dynamic with the binding
type was only done when creating the bind group when it should have been
done when the bind group layout is created.

BUG=dawn:55

Change-Id: I976f7e052f9737929fc05908af50e6ad5ceef397
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-15 10:29:08 +00:00
Yunchao He 5de3e0aaa4 Fix a few more coding style issues for shader
The indentations for shader are incorrect.

BUG=dawn:186
TEST=dawn_end2end_tests

Change-Id: I6707e46f6ebbc267a6d465bb5dd94183433f3ba0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8880
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-15 07:46:31 +00:00
Corentin Wallez 2a1d8c2b1d Remove ShaderStage that doesn't exist in WebGPU.
Instead it is replaced by one enum in dawn_native and another in utils.

BUG=dawn:22

Change-Id: I094a40c8d4e22b704e59aea60cbefd1f05c5352a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8800
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-07-12 17:52:22 +00:00
Jiawei Shao 06ab6e5b13 Metal: Code clean up in copy commands
This patch cleans up the code related to both buffer-texture and
texture-texture copies on Metal backend by moving the creation of
MTLOrigin and MTLSize into helper functions.

BUG=dawn:42

Change-Id: Ia3340b9c8b0a5001d775cd391fb8301207b4d2ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8840
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-12 07:18:11 +00:00
Corentin Wallez 2d8ba5fac6 Add rendering tests for all color formats
BUG=dawn:128

Change-Id: I32cab39e77847388a7736a51532a1b5c24a0fde7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8684
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-12 07:13:41 +00:00
Brandon Jones e896a0da66 Implement Implicit State Decays For D3D12
When resources are accessed on a command list, the resource will
implicitly decay in some scenarios. This commit tracks when the decay
occurs to more frequently enable implicit promotion.

Bug: dawn:167
Change-Id: Ide4c06454efe136baee0d39a3437a407a613bcc7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8243
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-11 22:58:55 +00:00
Yunchao He 4b24886afe Use R"(shader source)" to keep consistent
BUG=dawn:186
TEST=dawn_end2end_tests

Change-Id: I6b5b6590e917965537238ca86ec4af7ce6dc969a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8781
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-11 18:15:35 +00:00
Yunchao He 110700304f Culling and FrontFace: verify the framebuffer coordinate
This patch is to verify the framebuffer coordinate in Dawn (and WebGPU).
It shows that gl_FragCoord(0, 0) is at the top left.

BUG=dawn:43
TEST=dawn_end2end_tests

Change-Id: Ifd16488169c986d0c2c85eb92283c69e70ad33ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-07-11 15:55:45 +00:00
Corentin Wallez 002395300f Make RG11B10 non-renderable.
This also adds the extra validation needed to support non-renderable
formats, as well as tests for it

BUG=dawn:128

Change-Id: I3bc79b641aa0fd5e3358f89a87f2e457d0ecc58a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8760
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2019-07-11 14:57:15 +00:00
Jiawei Shao ea2d558479 Support BC5 formats on Metal
This patch adds the support of BC5 formats on Metal and the related
dawn_end2end_tests to verify Dawn works correctly when (bufferSize -
bufferOffset < bytesPerImage * copyExtent.depth), which is the special
case of buffer-to-texture and texture-to-buffer copies on Metal.

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: I27c384d0d8d2bb908f1ad15c2451fd23c1313598
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-10 23:58:13 +00:00
Corentin Wallez 4b90c47ce0 Add missing descriptors that are present in WebGPU.
These are the CommandEncoder, ComputePass and CommandBuffer descriptors
that contains nothing but a debug name for now but are important for
later extensibility. Defaults are added so the C++ API doesn't require
the descriptors to be passed as arguments.

Also renames variables named "info" for RenderPassDescriptor to
"descriptor" as is now the standard in the codebase.

BUG=dawn:22

Change-Id: I9de4cfbbce952d01fb79ed1d9f34825a6fa174f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8686
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-10 20:43:13 +00:00
Ryan Harrison 27e67b5f97 Rolling 4 dependencies
Roll third_party/SPIRV-Tools/ 5a93e0739..0c4feb643 (5 commits)

5a93e07392..0c4feb643b

$ git log 5a93e0739..0c4feb643 --date=short --no-merges --format='%ad %ae %s'
2019-07-08 33432579+alan-baker Remove extra semis (#2717)
2019-07-08 33432579+alan-baker Validate usage of 8- and 16-bit types with only storage capabilities (#2704)
2019-07-07 afdx Shrinker for spirv-fuzz (#2708)
2019-07-04 stevenperron Perform merge return with single return in loop. (#2714)
2019-07-04 stevenperron Do not inline OpKill Instructions (#2713)

Roll third_party/glslang/ 4b4b41a63..8aa9a7bb8 (1 commit)

4b4b41a634..8aa9a7bb8f

$ git log 4b4b41a63..8aa9a7bb8 --date=short --no-merges --format='%ad %ae %s'
2019-07-06 rex.xu Change implementation of gl_SIMDGroupSizeAMD

Roll third_party/shaderc/ 77d7b65ee..e9bb8f287 (2 commits)

77d7b65ee2..e9bb8f2874

$ git log 77d7b65ee..e9bb8f287 --date=short --no-merges --format='%ad %ae %s'
2019-07-08 zoddicus Add verbose flag to run_spirv_cross_tests.py (#753)
2019-07-08 zoddicus Rolling 4 dependencies and update known_failures (#755)

Roll third_party/spirv-cross/ c5904dd24..53ab2144b (5 commits)

c5904dd245..53ab2144b9

$ git log c5904dd24..53ab2144b --date=short --no-merges --format='%ad %ae %s'
2019-07-08 post Fall back to complex loop if non-trivial continue block is found.
2019-07-08 post Add test shaders for NonUniformEXT propagation.
2019-07-08 post Propagate NonUniformEXT to dependent expressions.
2019-07-05 post Add simple test for extended debug operations.
2019-07-04 lifeng.pan Parse SPIR-V debug information extended instructions, as well as OpNoLine.

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

Change-Id: Iabdabe4f0b25f89cbc41f8fbf55bd588b374ba44
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-07-09 15:29:29 +00:00
Corentin Wallez bb218b8aea Implement WebGPU formats on D3D12
BUG=dawn:128

Change-Id: I1a71df25d9b7f003882366f052b83085ac5d1258
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8620
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-09 12:04:39 +00:00
Jiawei Shao 3e1bca702c Metal: Move all the computation in buffer-texture copies to one function
This patch refactors the code of buffer-texture copies on Metal backend
by moving all the computations on the split of one buffer-texture copy
into multiple copies into one function ComputeTextureBufferCopySplit so
that a lot of redundant code can be removed.

BUG=dawn:42

Change-Id: Ie82e34e55aad3981d7b19da786da383e0a9a985c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8700
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-09 08:47:07 +00:00
Yan, Shaobo f697fe3b7d Add dynamic attribute in bind group layout binding
WebGPU remove dynamic-uniform-buffer and dynamic-storage-buffer but add a new attribute in
BindgroupLayoutBinding to record whether a buffer resource is dynamic.
Dawn need to align with this change.

BUG=dawn:180

Change-Id: I873ad2ec75575e72d184f89a6e3698dff6df50d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8520
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-09 07:58:57 +00:00
Corentin Wallez 8f93871dff Add default values to dawn.json for dawncpp.h
This adds almost all default values in descriptors that are present in
WebGPU to the C++ interface for Dawn.

This also fixes the indentation of dawncpp.h both by reindenting the
template, and making the indentation counting in generator_lib.py more
precise.

BUG=dawn:22

Change-Id: I9a852d26f78a3349f3d6eee7237407d1cf8ca426
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8680
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-07-08 19:20:22 +00:00
Corentin Wallez 6be313225e Invert component names in RG11B10 and RGB10A2
The CL that introduced this formats reordered their components based on
the name of the Vulkan formats, but it turns out that WebGPU lists
components from low bits to high-bits while Vulkan PACK32 formats are
listed from high to low. So the format component orders match, except
for RGB10A2 which is actually BGR10A2 in Vulkan. Instead the Vulkan
backend is updated to correctly use the RGB10A2 format.

BUG=dawn:128

Change-Id: If7f045f020429c44c84b9aed34a4a80107208d5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8601
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2019-07-08 10:12:16 +00:00
Corentin Wallez ec05355c72 Rename Transfer[Src|Dst] to Copy[Src|Dst]
This is to match the equivalent rename in WebGPU's IDL.

BUG=dawn:22

Change-Id: Ibdf75869e58835d984df559878b884c55310a403
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8623
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
2019-07-08 10:05:46 +00:00
Corentin Wallez 3c3e2bc4d9 Use mipLevel/arrayLayer for TextureCopyView
These are the names for the level/slice concept in WebGPU and this one
occurence was forgotten in the previous rename.

BUG=dawn:22

Change-Id: I0aef05e21b2291cf02712034c6ddc3ab62ecbc33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8681
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-07-08 09:41:51 +00:00
Corentin Wallez a0491c9141 Rename AddressMode::MirroredRepeat to MirrorRepeat.
This is to match the name in the WeBGPU IDL.

BUG=dawn:22

Change-Id: I0a4a7b62afa30cfd699d90efb2dd0c085778883b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8624
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
2019-07-08 09:36:31 +00:00
Corentin Wallez 7843076b01 Implement WebGPU formats on Metal.
This removes the R5G6B5 format that's only available on iOS on Metal and
leaves A2RGB10 unimplemented because it has inverted R and G channels
compared to Metal's RGB10A2 format.

BUG=dawn:128

Change-Id: I9b960d00f281b4d32318bad3360826b8db5bcb72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8600
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-08 09:28:51 +00:00
Corentin Wallez 5df84cea03 Make TextureAspect match WebGPU
It was changed from a bitmask to an enum. It isn't used in Dawn yet.

BUG=dawn:22

Change-Id: I13b39e0ea137fd24470cf23bb4bd94dfcaf66d19
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8626
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-08 08:55:21 +00:00
Corentin Wallez e409acf561 Rename SamplerDescriptor::compareFunction to compare.
This is to match the WebGPU IDL.

BUG=dawn:22

Change-Id: I63e32fe980c1727562055221ea2769a670461e93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8625
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-08 08:29:57 +00:00
Li, Hao 35716c204d Add adapter filter flag by vendor id for end2end tests
Now end2end tests always run with first adapter (the last adapter for
Metal because of dawn:29) on multi-GPU systems. Add
'--adapter-vendor-id' flag to make it run with specified adapter.

BUG=dawn:181

Change-Id: Iaff3ab92a502f88b24e4aa8a5ed3cb4d1d5925e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8460
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-08 03:25:54 +00:00
Corentin Wallez 769edd065b Fix compilation on MSVC
BUG=

Change-Id: Ic813917322fdec5ccd97ebedd13435ba243d1de4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8622
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-07 17:53:13 +00:00
Yunchao He d2631f86e7 Implement Culling and FrontFace
This patch implements Culling and FrontFace on backends, and add tests too.

This test also verified that we couldn't invert FrontFace on Metal backend.
Otherwise, the tests would fail on all HWs.

But we do need to invert CCW/CW on OpenGL backend. Because Y axis is up in
OpenGL while Y axis is down in WebGPU.

Bug=dawn:43

Change-Id: I7dd0922477397a13c5f7208e104ff352a673a556
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8420
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-07-06 00:11:10 +00:00
Corentin Wallez c6d2d8e8fb Suppress failure on Win NVIDIA GTX 1660
BUG=chromium:981393

Change-Id: I0b3f45ad963f62e12ec77c251a81bc0076958e12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8621
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-07-05 13:16:19 +00:00
Jiawei Shao 3392b200c6 Support BC5 formats on D3D12
This patch adds the support of BC5 formats on D3D12 backend. On D3D12,
the "rowPitch" refers to the number of bytes in a row of blocks (which
covers up to 4 scanlines at once) for the textures in BC formats.

This patch also adds the related end2end tests for four typical cases of
B2T and T2B copies on D3D12:
(1) copyBytesPerRowPitch + byteOffsetPerRowPitch <= rowPitch and
    texelOffset.y == 0
(2) copyBytesPerRowPitch + byteOffsetPerRowPitch <= rowPitch and
    texelOffset.y > 0
(3) copyBytesPerRowPitch + byteOffsetPerRowPitch > rowPitch
(4) texelOffset.z > 0

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: If27ab3e56596e25c1c5be787ca021c0748021a46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-05 08:06:30 +00:00
Yan, Shaobo 3789858479 Fix the failures in dynamic buffer offset tests with Vulkan validation layer enabled.
The root causes of these failures are as follows:
1. 'fragmentStoresAndAtomics' feature is not enabled when we create the Vulkan device.
2. The binding value of dynamic buffer offset end2end test not set correctly.

For failure reason 1, this patch enabled fragmentStoresAndAtomics.
For failure reason 2, this patch modify dawn validation logic in SetBindGroup to check
binding size and update binding size in dynamic buffer offset end2end test.

BUG=dawn:170

Change-Id: I46f12453d4c83d9d3c7de6e183442cf516335f2f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8320
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-05 08:01:10 +00:00
Yunchao He 050ab49a23 Implement RenderPassEncoder::SetViewport - front end
This patch implements RenderPassEncoder::SetViewport. It also adds
validation code, and validation tests as well.

BUG=dawn:53
TEST=dawn_unittests

Change-Id: Idc27f4098761a57fc10e53be82bd3c4b35b53cb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8542
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-04 15:30:59 +00:00
Ryan Harrison c9b9290cc8 Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ 001e823b6..5a93e0739 (17 commits)

001e823b65..5a93e07392

$ git log 001e823b6..5a93e0739 --date=short --no-merges --format='%ad %ae %s'
2019-07-04 afdx Refactor reducer options (#2709)
2019-07-03 52076061+digit-google Fix BUILD.gn for Fuchsia platform build. (#2692)
2019-07-02 cmarcelo Validate that in OpenGL env block variables have Binding (#2685)
2019-06-28 51214578+jmacnak-nv Update type for loaded builtin GlobalInvocationID in pass instrumentation (#2705)
2019-06-26 afdx Warn when input facts are invalid. (#2699)
2019-06-26 afdx Got rid of redundant declaration. (#2698)
2019-06-26 afdx Disallow movement of unreachable blocks. (#2700)
2019-06-25 afdx Refactor fuzzer transformations (#2694)
2019-06-25 joseph.kucia Fix Component decoration validation for arrays (#2697)
2019-06-21 kpet Replace global static map with an array of pairs (#2691)
2019-06-21 joseph.kucia Basic validation for Component decorations (#2679)
2019-06-20 zoddicus Add infrastructure for maintaining and using DEPS (#2684)
2019-06-20 33432579+alan-baker Fix store to uniform Vulkan check (#2688)
2019-06-20 kpet Add all accepted target environments to the tools' help texts (#2687)
2019-06-19 afdx Represent uniform facts via descriptor set and binding. (#2681)
2019-06-19 zoddicus Roll external/spirv-headers/ 8b911bd2b..de99d4d83 (8 commits) (#2682)
2019-06-19 ehsannas Whitelist SPV_GOOGLE_user_type. (#2673)

Roll third_party/glslang/ f9d08a25f..4b4b41a63 (10 commits)

f9d08a25fb..4b4b41a634

$ git log f9d08a25f..4b4b41a63 --date=short --no-merges --format='%ad %ae %s'
2019-07-03 cepheus HLSL: Fix #1815: Don't constant fold spec-constant array indexing.
2019-07-02 jbolz update spirv-headers to pick up demote_to_helper_invocation
2019-07-02 cepheus Standalone: Fix #1814: Check that linkage was specified for reflection.
2019-07-02 cepheus Build: Tweak PR #1808 to avoid an implicit conversion warning.
2019-07-01 jbolz Implement GL_EXT_demote_to_helper_invocation
2019-06-25 syoussefi Remove __DATE__ and __TIME__ usage
2019-06-25 syoussefi Remove extraneous semicolons
2019-06-21 jbolz Add a bunch of missing cases to promoteConstantUnion. Use macros to expand all the cases more simply.
2019-06-21 jbolz Add test for constant type conversion
2019-06-21 digit BUILD.gn: Fix file for use with Fuchsia platform build.

Roll third_party/shaderc/ 3c76b8aa3..77d7b65ee (39 commits)

3c76b8aa36..77d7b65ee2

$ git log 3c76b8aa3..77d7b65ee --date=short --no-merges --format='%ad %ae %s'
2019-07-03 zoddicus Rolling 4 dependencies and updating known_failures (#754)
2019-07-02 dneto Add --target-spv option to set target SPIR-V version (#750)
2019-07-02 zoddicus Remove old logging infra from run_spirv_cross_tests.py (#749)
2019-06-28 zoddicus Enable implicit fallthrough warning and fix examples of (#747)
2019-06-28 zoddicus Rolling 2 dependencies (#748)
2019-06-26 zoddicus Rolling 4 dependencies and update known_failures (#745)
2019-06-26 zoddicus Catch low level exceptions instead of crash (#744)
2019-06-25 zoddicus Add jobs flag to spirv cross tests script (#743)
2019-06-25 zoddicus Extract common test environment bits out into a class (#738)
2019-06-25 52076061+digit-google Fix BUILD.gn for Chromium build. (#741)
2019-06-25 52076061+digit-google BUILD.gn fixes for Fuchsia. (#733)
2019-06-25 dneto Remove Appveyor artifacts link. (#739)
2019-06-24 zoddicus Remove SetShaderModel from API (#734)
2019-06-20 zoddicus Move script fixes from other SPIRV related repos (#732)
2019-06-19 zoddicus Import improvements to DEPS roll script (#729)
2019-06-19 dneto Update CHANGES (#730)
2019-06-19 dneto Add -fnan-clamp (#725)
2019-06-18 zoddicus Add script to generate manual roll patch (#727)
2019-06-18 zoddicus Rolling 4 dependencies (#728)
2019-06-17 google-shaderc-autoroll Roll third_party/glslang def9662348b0..9db72785beb3 (1 commits) (#721)
2019-06-17 google-shaderc-autoroll Roll third_party/spirv-cross 4104e363005a..146dc453bcec (2 commits) (#722)
2019-06-17 zoddicus Manually roll DEPS to get past test failure (#717)
2019-06-17 google-shaderc-autoroll Roll third_party/googletest fd20d1eccef6..176eccfb8f42 (1 commits) (#718)
2019-06-17 google-shaderc-autoroll Roll third_party/googletest e110929a7b49..fd20d1eccef6 (5 commits) (#715)
2019-06-15 google-shaderc-autoroll Roll third_party/re2 0c95bcce2f1f..848dfb7e1d7b (2 commits) (#712)
2019-06-14 google-shaderc-autoroll Roll third_party/googletest f7c178ecb33c..e110929a7b49 (2 commits) (#709)
2019-06-14 google-shaderc-autoroll Roll third_party/googletest 26afdba792e5..f7c178ecb33c (2 commits) (#707)
2019-06-14 google-shaderc-autoroll Roll third_party/spirv-cross 00a8539d1ddf..4104e363005a (3 commits) (#698)
2019-06-14 google-shaderc-autoroll Roll third_party/googletest af4c2cb098a3..26afdba792e5 (1 commits) (#703)
2019-06-13 dneto Update glslc tests for -finvert-y option (#704)
2019-06-13 andrejnau Pass InvertY to glslang (#695)
2019-06-13 google-shaderc-autoroll Roll third_party/googletest 89656ddbe62f..af4c2cb098a3 (2 commits) (#702)
2019-06-13 google-shaderc-autoroll Roll third_party/spirv-headers 9cf7c3a7d2d2..de99d4d834ae (1 commits) (#697)
2019-06-12 google-shaderc-autoroll Roll third_party/googletest 076b7f778883..89656ddbe62f (1 commits) (#694)
2019-06-12 google-shaderc-autoroll Roll third_party/spirv-cross fccf1d046204..00a8539d1ddf (1 commits) (#691)
2019-06-12 google-shaderc-autoroll Roll third_party/spirv-cross 5e9e8918f9a2..fccf1d046204 (1 commits) (#690)
2019-06-12 google-shaderc-autoroll Roll third_party/spirv-headers 9242862c84fe..9cf7c3a7d2d2 (1 commits) (#689)
2019-06-11 zoddicus Roll all DEPS to HEAD (#685)
2019-06-10 google-shaderc-autoroll Roll third_party/effcee 8f0a61dc95e0..b83b58d177b7 (2 commits) (#677)

Roll third_party/spirv-cross/ 05ea05509..c5904dd24 (31 commits)

05ea055096..c5904dd245

$ git log 05ea05509..c5904dd24 --date=short --no-merges --format='%ad %ae %s'
2019-07-03 post Don't use scalar dot().
2019-07-03 post MSL/HLSL: Support scalar reflect and refract.
2019-07-03 post Fix variable scope when an if or else block dominates a variable.
2019-05-31 cdavis MSL: Support SubgroupLocalInvocationId and SubgroupSize in all stages.
2019-07-01 post MSL/HLSL: Support OpOuterProduct.
2019-05-31 cdavis MSL: Support SPV_KHR_multiview.
2019-06-28 post Deal with scalar input values for distance/length/normalize.
2019-06-27 post Run format_all.sh.
2019-06-27 post HLSL: Does not support case-fallthrough.
2019-06-27 post Handle more cases with FP16 and texture sampling.
2019-06-26 post Add C API for get_declared_struct_member_size.
2019-06-26 post MSL: De-virtualize get_declared_struct_member_size.
2019-06-26 post MSL: Fix minor XCode /analyze warning.
2019-06-25 post Fix declaration of loop variables with a Phi helper copy.
2019-06-24 post MSL: Add support for SubgroupSize / SubgroupInvocationID in fragment.
2019-06-24 post MSL: Support custom bindings for argument buffer itself.
2019-06-24 post Workaround GCC 9 bug.
2019-06-21 post Run format_all.sh.
2019-06-21 post MSL: Actually return the autobinding value in C API.
2019-06-21 post Old MSVC does not like +[] constructs.
2019-06-21 post Deal with OpPhi and case fallthrough.
2019-06-21 post MSL: Add C API for querying automatic resource bindings.
2019-06-21 post MSL: Rewrite how resource indices are fallback-assigned.
2019-06-20 post Deal with switch block fallthrough more correctly ...
2019-06-20 post Rewrite how switch block case labels are emitted.
2019-06-19 post MSL: Error out on int64_t/uint64_t buffer members.
2019-06-11 post MSL: Support 64-bit integers.
2019-06-13 post MSL: Support PrimitiveID in fragment and barycentrics.
2019-06-13 post GLSL: Support NV barycentrics.
2019-06-12 post MSL: Support OpImageQueryLod.
2019-06-11 post MSL: Support MinLod operand.

Roll third_party/spirv-headers/ de99d4d83..29c11140b (2 commits)

de99d4d834..29c11140ba

$ git log de99d4d83..29c11140b --date=short --no-merges --format='%ad %ae %s'
2019-07-01 jbolz add SPV_EXT_demote_to_helper_invocation
2019-06-15 antiagainst Reserve ID 23 for MLIR SPIR-V Serializer

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

Change-Id: Iab9ba95ad6c107a1aa49f7eefde0081347788db7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8580
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-07-04 14:39:59 +00:00
Jiawei Shao 72508d6d06 Support BC5 formats on Vulkan
This patch supports BC5 formats on Vulkan backends and adds related
Dawn end2end tests.

For the textures with BC formats, they could have non-multiple-of-4
sizes on the non-zero mipmap levels in sampling, but we are still
required to provide texture data in complete 4x4 blocks in texture
copies because that is the size of which they are stored in GPU memory.

In this patch, we refer the term "physical memory size" as the memory
size of the texture subresource in GPU memory, and the term "virtual
memory size" as the size used in texture sampling. As Dawn requires
the Extent3D in texture copies must fit in the physical memory size,
while Vulkan requires it must fit in the virtual memory size, this
patch recalculates the imageExtent to ensure it always follow this
Vulkan validation rules.

For Dawn end2end tests, note that we use pure green and pure red for
the textures because BC5 does not support SRGB formats. Furthermore,
"CopyPartofTextureSubResourceIntoNonZeroMipmapLevel" is skipped in
this patch because there is an issue on the T2T copies from a region
within the virtual size of one texture to another one that exceeds
the virtual size of another texture in Vulkan SPEC.

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: I17518cd335fb13125cb753bbf879bc06eb20e426
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-02 23:55:55 +00:00
Austin Eng c246494dbf Skip ManySetSubData test on Linux Vulkan Intel.
This test is crashing on the bot upgrade to Ubuntu 19.04.

TBR=cwallez@chromium.org
Bug: chromium:980737
Change-Id: I3fe1860fb14ae41c19dae0b0a82db2410d505a96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8540
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-07-02 23:40:15 +00:00