Commit Graph

1854 Commits

Author SHA1 Message Date
Austin Eng 0847cb4637 Convert LayoutBindingInfo to an array of BindingInfos
This makes accessing per-index data simpler, and now that dynamic
buffer bindings are packed at the front, the old IterateBitset on
the dynamic buffer binding mask can be replaced with a simple loop
over the beginning bindings.

Bug: dawn:354
Change-Id: I1adf371c3228690758f90ab1f0de88ad8d0f950d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-26 17:22:14 +00:00
Jiawei Shao d5db214564 Collect if a storage texture is declared as multisampled in shader
This patch records if a storage texture is declared as multisampled or
not in shaders after a fix in shaderc.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: I3914ccd3bfa4d0b6ab9c7cfb650352b70ba067a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17600
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-26 00:46:38 +00:00
Bryan Bernhart 046389926f D3D12: Add end2end tests for small shader-visible heaps.
Adds a toggle to force the use of small shader-visible heaps and
whitebox tests to verify bindgroup encoding correctness.

BUG=dawn:155

Change-Id: I4118b850d9f2cb445ae805aa68ebf4fab671261b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16960
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-25 18:31:08 +00:00
Jiawei Shao 0eff2a2b46 Add validations on the creation of bind groups with storage textures
This patch adds all the validations on the creation of bind groups with
read-only and write-only storage textures.

1. Only the textures with STORAGE usage can be used as read-only or
   write-only storage textures.
2. The format of the texture view used as read-only or write-only
   storage texture must match the corresponding declarations in the
   bind group layout.
3. The texture view dimension of the texture view used as read-only or
   write-only storage texture must match the corresponding declaration
   in the bind group layout.

Note that we don't test the match of the sample count because currently
we don't support sample count > 1 when creating a texture with STORAGE
usage and creating a bind group layout with read-only or write-only
storage textrue binding type.

This patch also adds a unit test to verify that it is invalid to create
a bind group layout with either read-only or write-only storage texture
binding type and dynamic offsets.

This patch also implements the bind group with storage textures on
Vulkan to make the Vulkan fuzzer happy with this patch.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Iee1b3c49671aae8a5424882b035624248d5fc281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17583
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-25 07:53:37 +00:00
Austin Eng b867e14cac Add DAWN_NO_DISCARD to ErrorData
ErrorData should not be discarded. The error must be handled.

Bug: chromium:1063810
Change-Id: I55e782e499f307b91790db10a42878afdc7540dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17501
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-24 18:24:24 +00:00
Corentin Wallez 4c6c40d47d Validate there are at most kMaxBindingsPerGroup entries per layout.
This is a regression that was caught by the WebGPU CTS after
https://dawn-review.googlesource.com/c/dawn/+/17240 where the
BindGroupLayout validation was changed to use a set, and the check for
KMaxBindingsPerGroup removed.

This CL also adds a regression test.

Bug: dawn:354

Change-Id: I0cda545b9df7220ca53216878cf24ac8ce880648
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17620
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-24 17:29:54 +00:00
Jiawei Shao 4a858a0cbd Reland "Check bind group layout with storage texture in pipeline descriptors"
This reverts commit 7c24b6b2ff.

Reason for revert: We can reland this CL now as the fix in shaderc has
been merged.

Note that the declaration whether a storage texture is multisampled or not
cannot be extracted correctly in SPVC. The fix in Dawn will be added after
it is fixed in shaderc.

Original change's description:
> Revert "Check bind group layout with storage texture in pipeline descriptors"
>
> This reverts commit 63f2666ee7.
>
> Reason for revert: causes failures in dawn_unittests after Dawn uses SPVC by default. We need a fix in both SPVC and this CL before re-landing.
>
> Original change's description:
> > Check bind group layout with storage texture in pipeline descriptors
> >
> > This patch adds all the validations on the use of bind group layout with
> > read-only storage texture and write-only storage texture in the creation
> > of pipeline objects.
> >
> > 1. GPUBindGroupLayout.bindingType must match the type of the storage
> >    texture variable (read-only or write-only) in shader.
> > 2. GPUBindGroupLayout.storageTextureFormat must be a valid texture
> >    format that supports STORAGE usage.
> > 3. GPUBindGroupLayout.storageTextureFormat must match the storage
> >    texture format declaration in shader.
> > 4. GPUBindGroupLayout.textureDimension must match the storage texture
> >    dimension declared in shader.
> >
> > BUG=dawn:267
> > TEST=dawn_unittests
> >
> > Change-Id: Ifa3c2194dc76de14f790a0a73868e69bbb31c814
> > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17167
> > Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
> > Reviewed-by: Kai Ninomiya <kainino@chromium.org>
>
> TBR=cwallez@chromium.org,kainino@chromium.org,yunchao.he@intel.com,jiawei.shao@intel.com,shaobo.yan@intel.com,hao.x.li@intel.com,enga@chromium.org,jiajie.hu@intel.com
>
> Change-Id: Idb4083b11f22fa7e4c5c8477bc4b65b58900746e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: dawn:267
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17380
> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>

TBR=cwallez@chromium.org,kainino@chromium.org,yunchao.he@intel.com,jiawei.shao@intel.com,shaobo.yan@intel.com,hao.x.li@intel.com,enga@chromium.org,jiajie.hu@intel.com

Bug: dawn:267, chromium:1063570
Change-Id: If762cbb206e738f4e54e75c88d506fdf3a44f280
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17461
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-03-24 00:56:53 +00:00
Austin Eng 80a1868f33 Fix MSVC build
(Manual)?SwapChainTests had a narrowing conversions from double to float

Bug: dawn:269
Change-Id: I5b07f53556fa5461877631904fa2c1ab6c8e6596
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-03-23 20:10:53 +00:00
Ryan Harrison eb7eb909c8 Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ 25ede1ced..1c8bda372 (7 commits)

25ede1ced6..1c8bda3721

$ git log 25ede1ced..1c8bda372 --date=short --no-merges --format='%ad %ae %s'
2020-03-23 jaebaek Add data structure for DebugScope, DebugDeclare in spirv-opt (#3183)
2020-03-23 ehsannas Whitelist SPV_KHR_ray_tracing (#3241)
2020-03-23 arnfranke Make file formatting comply with POSIX standards (#3242)
2020-03-19 dneto Add opt::Operand::AsCString and AsString (#3240)
2020-03-20 lujiao Add RayQueryProvisionalKHR to opt types (#3239)
2020-03-17 ehsannas Whitelist SPV_EXT_demote_to_helper_invocation for opt passes (#3236)
2020-03-17 dgkoch Add support for KHR_ray_{query,tracing} extensions (#3235)

Roll third_party/glslang/ 4b2483ee8..1f0fcbe5a (9 commits)

4b2483ee88..1f0fcbe5a3

$ git log 4b2483ee8..1f0fcbe5a --date=short --no-merges --format='%ad %ae %s'
2020-03-21 arnfranke Make file formatting comply with POSIX and Unix standards
2020-03-19 courtneygo Fix MSVC build issue - remove invalid character
2020-03-18 alele Re-add NV enums for raytracing to prevent build breaks.
2020-03-18 cepheus Fix #2132: constant matrix constructor from single non-scalar argument
2020-03-18 cepheus Bump version (also fix line endings the grammar).
2020-03-17 dkoch update known_good
2020-03-17 dkoch Add support for GLSL_EXT_ray_tracing
2020-03-17 cepheus SPV headers: Bump up to the latest header.
2020-03-16 jbolz Forbid memoryBarrierAtomicCounter for Vulkan compiles

Roll third_party/shaderc/ 362becca1..eb7bd643e (1 commit)

362becca1f..eb7bd643ef

$ git log 362becca1..eb7bd643e --date=short --no-merges --format='%ad %ae %s'
2020-03-20 jiawei.shao Extract texture dimension for storage textures (#1008)

Roll third_party/spirv-cross/ 65aa0c35d..871c85d7f (4 commits)

65aa0c35d6..871c85d7f0

$ git log 65aa0c35d..871c85d7f --date=short --no-merges --format='%ad %ae %s'
2020-03-19 post GLSL: Implement GL_EXT_shader_framebuffer_fetch.
2020-03-19 post Run format_all.sh.
2020-03-19 post GLSL/HLSL: Fix nonuniform qualifier for SSBO atomics.
2020-03-19 post GLSL/HLSL: Implement nonuniform qualifier for image atomics.

Roll third_party/spirv-headers/ a17e17e36..f8bf11a02 (5 commits)

a17e17e36d..f8bf11a025

$ git log a17e17e36..f8bf11a02 --date=short --no-merges --format='%ad %ae %s'
2020-03-17 dkoch Add shadercalls scope
2020-03-03 ntorosda Added ray flags, primitive culling flags, queries
2020-03-17 cepheus Non-functional: Update header build to match Khronos spec. builder.
2020-02-14 alele Update headers for SPV_KHR_ray_tracing.
2020-01-01 xanto Also propagate SPIRV-Headers version to CMakeLists.txt

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

Change-Id: I88e8f94106f6db72ca49fee62ec241359870c89c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17500
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-23 18:29:51 +00:00
Corentin Wallez 26e42d31f3 Properly handle SPVC errors.
Also removes a MaybeError from a function that can't return errors.

Bug: chromium:1063810
Change-Id: I9125b2b164a2892006442e26d6070d226fec8665
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17481
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-23 15:08:41 +00:00
Corentin Wallez d920adc772 Stop using SPVC by default.
SPVC only allows SPIR-V 1.0 while WebGPU samples and other existing
content outputs SPIR-V 1.3. Turning SPVC on by default broke all of
them, so we disable SPVC until we decide what to do.

Bug: chromium:1063810
Change-Id: Iedcf31960eb25b0974e8c67030232902cd58a4a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-23 12:27:21 +00:00
Austin Eng a80993da44 Support and pack unbounded binding numbers in the BGL
Also fixes a bug where we weren't validating duplicating
bindings in the shader, and where dynamic offset validation
could be incorrectly fetching the wrong bindings.

Bug: dawn:354
Change-Id: I93178c34eb4d43119e8b9de5738ae4596e9277cd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-20 21:56:30 +00:00
Corentin Wallez 11652ff8f8 Implement the webgpu.h swapchains on Metal
The webgpu.h surface-based swapchains are implement on Metal which
required adding the present mode to NewSwapChainBase.

Additional automated tests are added which require getting the Instance
so a new getter is added to DawnTest. Additional some the state tracking
of swapchains is performed in the backend, so the
SwapChainValidationTests are turned into regular DawnTests so they can
check backends do the correct state tracking. To not lose coverage of
the Null backend, a NullBackend() DawnTestParam factory is added.

Finally swapchains cannot be entirely tested in an automated fashion, so
a new example is added called "ManualSwapChainTests" that allows
manually checking a number of properties. Documentation of the controls
and a manual test plan is in a comment at the top of the example's
source.

Bug: dawn:269

Change-Id: If62fffc29a6cefdbec62747d01c523e2a5475715
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17181
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 17:07:20 +00:00
Corentin Wallez 527045fe55 Change present modes to match webgpu.h
Bug: dawn:269
Change-Id: I879ce75addde068097ec54d95ec21697d6ac2dc4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-20 16:47:50 +00:00
Corentin Wallez e5753d2fb8 Enable (and fix) the DeviceLost tests on Metal
They were failing because services of the Metal backend like the
MapRequestTracker thought that work was still pending since the device
only waited for previous commands to complete, and not also pending
commands.

Bug: dawn:68
Change-Id: I917ecefe90707b0c89f7e9b4b7379a98ed3956d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17320
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 09:14:30 +00:00
Corentin Wallez 69c5dd70e7 Fix depth-only render pipeline creation on Metal.
Bug:

Change-Id: I6e07d2a0164386f7fe2fe1776cf8228066e23959
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16700
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 09:04:00 +00:00
Jiawei Shao 7c24b6b2ff Revert "Check bind group layout with storage texture in pipeline descriptors"
This reverts commit 63f2666ee7.

Reason for revert: causes failures in dawn_unittests after Dawn uses SPVC by default. We need a fix in both SPVC and this CL before re-landing.  

Original change's description:
> Check bind group layout with storage texture in pipeline descriptors
> 
> This patch adds all the validations on the use of bind group layout with
> read-only storage texture and write-only storage texture in the creation
> of pipeline objects.
> 
> 1. GPUBindGroupLayout.bindingType must match the type of the storage
>    texture variable (read-only or write-only) in shader.
> 2. GPUBindGroupLayout.storageTextureFormat must be a valid texture
>    format that supports STORAGE usage.
> 3. GPUBindGroupLayout.storageTextureFormat must match the storage
>    texture format declaration in shader.
> 4. GPUBindGroupLayout.textureDimension must match the storage texture
>    dimension declared in shader.
> 
> BUG=dawn:267
> TEST=dawn_unittests
> 
> Change-Id: Ifa3c2194dc76de14f790a0a73868e69bbb31c814
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17167
> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,yunchao.he@intel.com,jiawei.shao@intel.com,shaobo.yan@intel.com,hao.x.li@intel.com,enga@chromium.org,jiajie.hu@intel.com

Change-Id: Idb4083b11f22fa7e4c5c8477bc4b65b58900746e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:267
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17380
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-03-20 01:44:29 +00:00
Jiawei Shao 63f2666ee7 Check bind group layout with storage texture in pipeline descriptors
This patch adds all the validations on the use of bind group layout with
read-only storage texture and write-only storage texture in the creation
of pipeline objects.

1. GPUBindGroupLayout.bindingType must match the type of the storage
   texture variable (read-only or write-only) in shader.
2. GPUBindGroupLayout.storageTextureFormat must be a valid texture
   format that supports STORAGE usage.
3. GPUBindGroupLayout.storageTextureFormat must match the storage
   texture format declaration in shader.
4. GPUBindGroupLayout.textureDimension must match the storage texture
   dimension declared in shader.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Ifa3c2194dc76de14f790a0a73868e69bbb31c814
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17167
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 00:01:19 +00:00
Ryan Harrison 27622ce1c5 Turn on usage of spvc by default
The CTS has been changed to use the version of SPIR-V that spvc is
expecting, so the issues that previously caused a rollback should no
longer occur.

BUG=dawn:337

Change-Id: Ied5c39059d417359a697930287728faf57289c62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16900
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-19 14:45:31 +00:00
Ryan Harrison 81bcbbc20e Add storage texture format reflection to spvc path
Roll third_party/shaderc/ 95185d920..362becca1 (2 commits)

95185d920a..362becca1f

$ git log 95185d920..362becca1 --date=short --no-merges --format='%ad %ae %s'
2020-03-18 rharrison Add support for storage texture format reflection (#1005)
2020-03-18 dgkoch Remove NV_EXTENSIONS conditionals (#1003)

Created with:
  roll-dep third_party/shaderc

BUG=dawn:337

Change-Id: I8b4dda98bcdac9eea170fe2a05bbeb75f48379e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17300
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-19 14:25:51 +00:00
Ryan Harrison 1f9b5960d8 Use new binding type reflection provided by spvc
This adds parity for reflection features in the spvc-only code path up
to 421684f. Additionally changes will be needed to bring support to
parity up to HEAD.

BUG=dawn:337

Change-Id: I2143587c54018da766934fa60d80aedd1ccd151b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17165
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-18 16:33:58 +00:00
Austin Eng 83e138ca96 D3D12: Fix usage of CopyResource
CopyResource may only be used for resources that have exactly the same
format, dimension, mips, layers. And it can only be used if the entire
texture region is copied.

Bug: dawn:353
Change-Id: Ia8f96cc10c88fe026e23bce2d0532624725b12e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16984
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-18 01:11:17 +00:00
Ryan Harrison b988e03982 Add in a default case to unblock shaderc rolls
The roll in Chromium is failing, because Dawn doesn't handle all of the new enum
values, but I cannot land the 'proper' fix in Dawn, because Chromium doesn't yet
know about the new enum values. Yay, cross dependencies.

So my solution is land the default case in Dawn, land the DEPS roll in Chromium,
then patch in the 'proper' cases in Dawn.

Roll third_party/shaderc/ a7657e4fa..95185d920 (2 commits)

a7657e4fa2..95185d920a

$ git log a7657e4fa..95185d920 --date=short --no-merges --format='%ad %ae %s'
2020-03-17 rharrison Rolling 4 dependencies (#1002)
2020-03-16 rharrison Add reflection support for storage textures (#1001)

Created with:
  roll-dep third_party/shaderc

Change-Id: Id73b38643d9a6d418be9c75e218fdad7a18839bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17164
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-17 18:12:57 +00:00
Natasha Lee 31eacb90f1 LoseForTesting can only be called once
Bug: chromium:1061878, dawn:68
Change-Id: Ieb35bdefc22299f828fe21e43d85fefabf500e27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17140
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-03-17 15:03:18 +00:00
Brandon Jones 1f0596818d Residency 4: Add Facilities For Budgeting Device Memory
Use D3D12's QueryDeviceVideoMemoryInfo to get the OS-determined process
budget. Also introduces an export for reserving some amount of process
memory - which keeps Dawn from using the entire process's budget.

Bug: dawn:193
Change-Id: I6c17bd703d7cb24759bcee89c03add46944fec8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16383
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-17 13:47:57 +00:00
Jiawei Shao 971a6233c2 Validate the declaration of storage texture format in shader
This patch adds the validation on the storage texture format declared in
shaders when we create a rendering or compute pipeline with read-only or
write-only storage textures.

This patch also fixes a typo in the TextureValidationTest.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Id302b4b7803d7e03b57c61de1290cc71ba940e2c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16940
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-17 10:28:07 +00:00
Austin Eng 2550e96724 Fix OpenGL over-eager lazy zero initialization for textures
Bug: dawn:145, dawn:348
Change-Id: I3b6e7b148a171bdcb50bcb825858cbf967c64c87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-17 01:51:56 +00:00
Austin Eng 1cad258869 Fix Vulkan over-eager lazy zero initialization for textures
Bug: dawn:145, dawn:348
Change-Id: I10f7bcd324799b783d8dfdc8aaae52033236b695
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16981
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-17 01:14:36 +00:00
Ryan Harrison 93f88af15b Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ 4c027048d..25ede1ced (8 commits)

4c027048d8..25ede1ced6

$ git log 4c027048d..25ede1ced --date=short --no-merges --format='%ad %ae %s'
2020-03-16 jmadill Roll external/spirv-headers/ 30ef660ce..a17e17e36 (1 commit) (#3230)
2020-03-13 vasniktel Update dependencies (#3228)
2020-03-12 greg Instrument: Debug Printf support (#3215)
2020-03-12 vasniktel spirv-fuzz: Support OpPhi when adding dead break and continue (#3225)
2020-03-12 afdx spirv-fuzz: Fix vector width issue in 'add equation instructions' pass (#3223)
2020-03-09 jbolz Allow sampledimage types as operand of OpCopyObject (#3222)
2020-03-09 vasniktel spirv-fuzz: Remove duplicated functionality (#3220)
2020-03-09 andreperezmaselco.developer spirv-fuzz: Allow OpPhi operand to be replaced with a composite synonym (#3221)

Roll third_party/glslang/ f333272eb..4b2483ee8 (7 commits)

f333272eb5..4b2483ee88

$ git log f333272eb..4b2483ee8 --date=short --no-merges --format='%ad %ae %s'
2020-03-16 mbechard Fix #2005. Allow multiple compilation units to declare identical push_constant blocks (#2123)
2020-03-11 laddoc Add flag to check whether offset is implicit or explicit (#2031)
2020-03-11 rharrison Use strcmp for all of the extended instruction set checks in the disassembler (#2107)
2020-03-10 jbolz EXT_debug_printf - make escape sequences better match C/C++
2020-03-09 jbolz disable escape sequences for #line and #error
2020-03-09 jbolz Decorate accesschain operand for nonuniform UBO loads
2020-03-09 jbolz Allow nonuniformEXT() on sampler types.

Roll third_party/shaderc/ 14f128e8d..a7657e4fa (2 commits)

14f128e8dc..a7657e4fa2

$ git log 14f128e8d..a7657e4fa --date=short --no-merges --format='%ad %ae %s'
2020-03-13 rharrison Rolling 2 dependencies (#999)
2020-03-12 rharrison Rolling 5 dependencies and updating expectations (#997)

Roll third_party/spirv-cross/ 7d42fd7f7..65aa0c35d (1 commit)

7d42fd7f7b..65aa0c35d6

$ git log 7d42fd7f7..65aa0c35d --date=short --no-merges --format='%ad %ae %s'
2020-03-10 post include/spirv_cross: Fix typo.

Roll third_party/spirv-headers/ d9ce9ca52..a17e17e36 (2 commits)

d9ce9ca52f..a17e17e36d

$ git log d9ce9ca52..a17e17e36 --date=short --no-merges --format='%ad %ae %s'
2020-03-13 jmadill Add missing header to BUILD.gn.
2020-03-09 stevenperron Export NonSemanticDebugPrintf.h in bazel build

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

Change-Id: Ie5906a75f3599673698846bb0f465432990f40f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17080
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-16 18:38:16 +00:00
Austin Eng c7e16e351f Fix D3D12 over-eager lazy zero initialization for textures
Bug: dawn:145, dawn:348
Change-Id: Iafa1644424e67020b004765a0c9ccff2e077ead3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16980
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-16 17:48:26 +00:00
Nico Weber 022952303c Suppress two -Wunreachable-code warnings.
Bug: chromium:346399
Change-Id: Ieb76cf99022230dcfb0bc6b17f95ea544040a796
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17040
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-16 10:59:56 +00:00
Jiawei Shao 1a56ce54e0 Validate creating bind group layout with storage textures
This patch adds the validation on the creation of the bind group
layout with read-only storage texture, write-only storage texture
and read-write storage texture. Currently read-write storage textures
are not supported in any shader stages.

This patch also fixes chromium:1061156.

BUG=chromium:1061156, dawn:267
TEST=dawn_unittests, dawn_end2end_tests

Change-Id: Ib42678719df48565a46e39f21c34ec640960dcdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-16 10:53:36 +00:00
Austin Eng 463c394905 Slab-allocate OpenGL bind groups
Now that all backends use slab-allocated bind groups, this patch also
moves the BindGroup implementation with owned-data into the Null backend.

Bug: dawn:340
Change-Id: I08a952075b382008fb82f1fbab3f779cc05bc2a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16747
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:51:50 +00:00
Austin Eng ae96f04c0a Slab-allocate frontend D3D12 bind groups
Bug: dawn:340
Change-Id: Ie613a1b8e445a385c10eb377983440ace9ad3f4a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16746
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:34:40 +00:00
Austin Eng 79230bf213 Slab-allocate frontend Vulkan bind groups
Bug: dawn:340
Change-Id: I3ef0b8a0585fac93ffb77d4642d13c14afbae177
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16745
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:10:00 +00:00
Austin Eng 459c2f930f Slab-allocate Metal bind groups
Bug: dawn:340
Change-Id: I6185e41d9c71c49953a4de91e5f3042968679fd6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15862
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-13 22:50:00 +00:00
Brandon Jones 0338b7ae19 Residency 3: Track Resource Heap Usages
Track what heaps are required to be resident upon command list
submission.

Bug: dawn:193
Change-Id: Icefe5aed047140f401d51018937c5364b3ed7c4f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16382
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-12 13:23:22 +00:00
Jiawei Shao 421684f943 Support Storage Textures as Valid Binding Types
This patch adds the basic validation of read-only storage texture,
write-only storage texture and read-write storage texture as new
binding types with no bind group layout provided in the creation of
pipeline state objects.

- Read-only storage textures can be used in vertex, fragment and
  compute shaders.
- Write-only storage textures can only be used in compute shaders
  due to the limitation on Metal.
- Read-write storage textures are not allowed now and they are
  reserved to be supported as an extension in the future.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Iffc432f29a855b85d59451cb3c50269e03b84627
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16661
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-11 01:28:48 +00:00
Bryan Bernhart 52d0627d56 D3D12: Pool-allocate shader-visible descriptor heaps.
Rather than destory GPU descriptor heaps upon being switched out,
heaps are stored in a list where they can be re-used once the GPU
is no longer using them.

BUG=dawn:155

Change-Id: I2074573e354f114c45afe9895e8515980d325852
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16282
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-03-09 22:56:59 +00:00
Brandon Jones f3bb4f4f32 Residency 2: Create a d3d12::Heap During Direct Allocations
When creating a directly allocated resource in D3D12, also create a
dawn_native::d3d12::Heap to represent that allocation alongside the
ResourceHeapAllocation. This matches D3D12's allocation model when using
CreateCommittedResource and makes residency management much easier.

Bug: dawn:193
Change-Id: I2280863dcfca57bad72962a2b097f8f2d4cc7dad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16381
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-03-09 15:53:19 +00:00
Ryan Harrison be6cd51888 Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ e1688b60c..4c027048d (6 commits)

e1688b60ca..4c027048d8

$ git log e1688b60c..4c027048d --date=short --no-merges --format='%ad %ae %s'
2020-03-08 andreperezmaselco.developer spirv-fuzz: Add toggle access chain instruction transformation (#3211)
2020-03-08 vasniktel spirv-fuzz: Add fuzzer pass to permute function parameters (#3212)
2020-03-06 afdx spirv-fuzz: Use better function name (#3207)
2020-03-05 afdx spirv-fuzz: Add swap commutable operands transformation (#3205)
2020-03-04 afdx spirv-fuzz: Fuzzer pass to add equation instructions (#3202)
2020-03-04 andreperezmaselco.developer Refactor FuzzerPass::ApplyTransformation code duplication. (#3206)

Roll third_party/glslang/ 56364b6b6..f333272eb (11 commits)

56364b6b60..f333272eb5

$ git log 56364b6b6..f333272eb --date=short --no-merges --format='%ad %ae %s'
2020-03-06 kainino Fix typo in Web CMakeLists
2020-03-06 foo.travis add missing string.h header for resource_limits_c.cpp
2020-03-06 foo.travis add c wrapper for standalone ResourceLimits and remove that dependency from glslang_c_interface
2020-03-05 foo.travis add stdbool.h to properly support bool type
2020-03-05 foo.travis add c interface support for TBuiltInResource and glslang::DefaultTBuiltInResource
2019-05-31 jbolz GL_EXT_debug_printf implementation
2020-03-04 s.fricke Add Android build instructions to README
2020-03-04 johnkslang Improve formatting.
2020-03-04 johnkslang Add "news" section and component status.
2020-03-03 cepheus Fix long lines in the SPIR-V generator, retrigger bots.
2020-03-03 cepheus Fix #1843: Handle built-in function output parameters to a swizzled arg

Roll third_party/shaderc/ 1059f43a3..14f128e8d (3 commits)

$ git log 1059f43a3..14f128e8d --date=short --no-merges --format='%ad %ae %s'
2020-03-04 rharrison Remove deprecated methods no longer used by Dawn (#993)
2020-03-03 dneto Get spirv.hpp from SPIRV-Headers, not Glslang (#992)
2020-03-02 rharrison Rolling 6 dependencies and updating expectations (#990)

Roll third_party/spirv-cross/ 9deb6ffbb..7d42fd7f7 (5 commits)

9deb6ffbba..7d42fd7f7b

$ git log 9deb6ffbb..7d42fd7f7 --date=short --no-merges --format='%ad %ae %s'
2020-03-05 post HLSL: Do not emit globallycoherent for SRV ByteAddressBuffer.
2020-03-04 post Add test for disable-storage-image-qualifier-deduction.
2020-03-04 post HLSL: Add option to always treat SSBO as UAV, even with readonly.
2020-03-04 post Add option to disable storage image qualifier deduction.
2020-03-04 post Remove old hack which forces NonWritable/NonReadable.

Roll third_party/spirv-headers/ 0a7fc4525..d9ce9ca52 (2 commits)

0a7fc45259..d9ce9ca52f

$ git log 0a7fc4525..d9ce9ca52 --date=short --no-merges --format='%ad %ae %s'
2020-03-02 jbolz Add NonSemantic.DebugPrintf JSON/header
2020-03-02 jbolz Fix max enum value

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

Change-Id: I540abd66fa09c216866521adeba7d352d57f6848
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16663
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-09 15:52:39 +00:00
Jiawei Shao 532be50b76 Check bindingType with shader stage when creating default pipeline layout
This patch intends to fix a crash issue when creating a rendering
pipeline with storage buffer declared in vertex shader and pipeline
layout is not set.

Without this patch, in PipelineLayoutBase::CreateDefault() the
bindingSlot.visibility is always set to Fragment and Compute when it is
a storage buffer, therefore a crash happens at the failure of the
assertion modules->IsCompatibleWithPipelineLayout() when the storage
buffer is actually declared in the vertex shader.

BUG=dawn:276
TEST=dawn_unittests

Change-Id: I56876a97d53ead5ed226dc1b9bbed1a77156b2b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16564
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-03-09 00:45:18 +00:00
Natasha Lee 7d20b44501 Respect external clear status for Textures
Use ExternalImageDescriptor->isCleared to set the clear status of
subresources so it can be correctly lazy cleared when used.

Also remove old Wrap path that uses regular texture descriptors
since we have moved to use ExternalImageDescriptor.

Bug: chromium:1036080
Change-Id: Icb605dbf3cf3f0dc8a30287e8b9b8d9134805112
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16320
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-06 19:05:15 +00:00
Corentin Wallez 2538aaf304 Roll third_party/swiftshader/ bdfcfe9cf..51b2800bb (23 commits)
https://swiftshader.googlesource.com/SwiftShader/+log/bdfcfe9cfd2a..51b2800bb317

$ git log bdfcfe9cf..51b2800bb --date=short --no-merges --format='%ad %ae %s'
2020-01-30 capn Support launching PowerVR samples from Visual Studio using SwiftShader
2020-03-04 amaiorano Subzero: implement Short4::Short4(RValue<Float4)
2020-02-28 amaiorano Subzero: don't assert about lack of atomic load/store on x86
2020-03-04 amaiorano Fix Regres regression post CMake var renaming
2020-03-03 amaiorano Subzero: fix regression in Optimizer
2020-03-03 jrprice Use LINK_FLAGS for -BSymbolic in CMake build
2020-03-03 capn Fix ASTC support for GN build
2020-03-02 swiftshader.regress Regres: Update test lists @ 416d3745
2020-03-01 capn Enable ASTC on supported builds only
2020-02-27 jmadill PipelineCache: Handle nullptr mismatch of specialization info.
2020-02-24 sugoi Implement ASTC support
2020-02-27 jonahr Add missing attribute to eglGetConfigAttrib
2020-02-27 jmadill Add codereview.settings.
2020-02-26 amaiorano Subzero: add support for variadic calls (System V)
2020-02-26 jmadill Fix comparison of specialization constant keys.
2020-02-25 amaiorano Subzero: add support for large stacks on Windows
2020-02-25 capn Build with -Bsymbolic to prevent symbol preemption
2020-02-25 capn Fix ANGLE standalone build
2020-02-25 capn Fix Android build after SPIRV-Tools update
2020-02-19 srisser Log instead of warn of unsupported extensions
2020-02-25 swiftshader.regress Regres: Update test lists @ e162b023
2020-02-24 capn Add SPIRV-Tools headers dependency
2020-02-24 capn Add SPIR-Tools include headers path for src/Pipeline

TBR=enga@chromium.org

Created with:
  roll-dep third_party/swiftshader

Change-Id: I3843e5b647a4ffd36c66896d9f262118f459a107
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16523
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-06 13:43:40 +00:00
Corentin Wallez e3f3e9a80d Revert "Vulkan: Report and enable subgroup size control device extension."
This reverts commit 4ae315b0d1.

Reason for revert: crbug.com/1059205

Bug: chromium:1059205

Original change's description:
> Vulkan: Report and enable subgroup size control device extension.
> 
> Certain Vulkan ICDs (Intel ones notably) will compile SPIR-V
> shaders with an liberal, compiler-selected, subgroup size (i.e.
> either 8, 16 or 32). For more context, see [1].
> 
> This can be a problem for compute, when one shader stores data
> in device memory using a subgroup-size dependent layout, to be
> consumed by a another shader. Problems arise when the compiler
> decides to compile both shaders with different subgroup sizes.
> 
> To work-around this, the VK_EXT_subgroup_size_control device
> extension was introduced recently: it allows the device to
> report the min/max subgroup sizes it provides, and allows
> the Vulkan program to control the subgroup size precisely
> if it wants to.
> 
> This patch adds support to the Vulkan backend to report and
> enable the extension if it is available. Note that:
> 
> - The corresponding VkStructureType enum values and
>   struct types are not rolled to the third-party Vulkan
>   headers used by Dawn yet, so vulkan_platform.h has been
>   modified to define them if necessary. This can be
>   removed in the future when the Vulkan-Headers are
>   updated in a different patch.
> 
> - This modifies VulkanDeviceInfo::GatherDeviceInfo() to
>   use VkGetPhysicalDevice{Properties2,Features2} if the
>   VK_KHR_get_device_properties2 instance extension is
>   available. Otherwise, the Vulkan 1.0 APIs
>   VkGetPhysicalDevice{Properties,Features} are used instead
>   (and it is assumed that no subgroup size control is
>   possible).
> 
> - This changes the definition of VulkanDeviceKnobs to
>   make room for the required pNext-linked chains of
>   extensions.
> 
> - A helper class, PNextChainBuilder is also provided in
>   UtilsVulkan.h to make it easy to build pNext-linked
>   extension struct chains at runtime, as required when
>   probing device propertires/features, or when
>   creating a new VkDevice handle.
> 
> Apart from that, there is no change in behaviour in this CL.
> I.e. a later CL might force a specific subgroup size for
> consistency, or introduce a new API to let Dawn clients
> select a fixed subgroup size.
> 
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=108875
> 
> Change-Id: I524af6ff3479f25b0a8bb139a062fe632c826893
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16020
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@google.com,cwallez@chromium.org,enga@chromium.org,enga@google.com,david.turner.dev@gmail.com

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

Change-Id: I893d771d7effdf83685dda3edac8a08f98d2f6e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16522
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-06 13:27:10 +00:00
Corentin Wallez 36f0388f79 Revert "Vulkan: Enforce fixed subgroup size for compute shaders."
This reverts commit 56f1678437.

Reason for revert: crbug.com/1059205
Bug: chromium:1059205

Original change's description:
> Vulkan: Enforce fixed subgroup size for compute shaders.
>
> This CL ensures that, on architectures with a varying subgroup size,
> compute shaders are always compiled with a fixed subgroup size to
> avoid consistency issues when one shader writes data in a subgroup-size
> dependent layout to GPU memory, to be read by another shader in a
> future dispatch.
>
> At the moment, only Intel ICDs are known to implement this [1],
> and the code uses a heuristics to chose the size of 16, which seems to
> be the sweet spot according to Intel engineers.
>
> + Update the PNextChainBuilder class to deal with the fact that
>   VkComputePipelineCreateInfo::pNext is defined as a const void*,
>   which created compiler errors in the previous implementation.
>
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=108875
>
> Change-Id: I332faa53b9f854a8abe43a7271f30d8c5deb2142
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16021
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@google.com,cwallez@chromium.org,enga@chromium.org,enga@google.com,david.turner.dev@gmail.com

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

Change-Id: I922eccc310505da4b4a9fc853335733ca4900fc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16521
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-06 13:03:00 +00:00
Corentin Wallez ddc5cacc27 GN: Use the hermetic XCode if available.
This matches Chromium's logic and make it less likely to break developer
workflow in the subsequent roll of Chromium's buildtools.

Bug: dawn:339
Change-Id: Ic42553827be125985a3d16b4f5d003b6662ead39
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16520
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-06 12:25:20 +00:00
Natasha Lee 1d54767364 Query if Texture subresource has been initialized
Bug: chromium:1036080
Change-Id: Ieb4c7012ae2d7d7b863c999756930b0ce45c06cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16422
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-03-05 17:07:16 +00:00
David Turner 56f1678437 Vulkan: Enforce fixed subgroup size for compute shaders.
This CL ensures that, on architectures with a varying subgroup size,
compute shaders are always compiled with a fixed subgroup size to
avoid consistency issues when one shader writes data in a subgroup-size
dependent layout to GPU memory, to be read by another shader in a
future dispatch.

At the moment, only Intel ICDs are known to implement this [1],
and the code uses a heuristics to chose the size of 16, which seems to
be the sweet spot according to Intel engineers.

+ Update the PNextChainBuilder class to deal with the fact that
  VkComputePipelineCreateInfo::pNext is defined as a const void*,
  which created compiler errors in the previous implementation.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=108875

Change-Id: I332faa53b9f854a8abe43a7271f30d8c5deb2142
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16021
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-05 10:47:05 +00:00
David Turner 4ae315b0d1 Vulkan: Report and enable subgroup size control device extension.
Certain Vulkan ICDs (Intel ones notably) will compile SPIR-V
shaders with an liberal, compiler-selected, subgroup size (i.e.
either 8, 16 or 32). For more context, see [1].

This can be a problem for compute, when one shader stores data
in device memory using a subgroup-size dependent layout, to be
consumed by a another shader. Problems arise when the compiler
decides to compile both shaders with different subgroup sizes.

To work-around this, the VK_EXT_subgroup_size_control device
extension was introduced recently: it allows the device to
report the min/max subgroup sizes it provides, and allows
the Vulkan program to control the subgroup size precisely
if it wants to.

This patch adds support to the Vulkan backend to report and
enable the extension if it is available. Note that:

- The corresponding VkStructureType enum values and
  struct types are not rolled to the third-party Vulkan
  headers used by Dawn yet, so vulkan_platform.h has been
  modified to define them if necessary. This can be
  removed in the future when the Vulkan-Headers are
  updated in a different patch.

- This modifies VulkanDeviceInfo::GatherDeviceInfo() to
  use VkGetPhysicalDevice{Properties2,Features2} if the
  VK_KHR_get_device_properties2 instance extension is
  available. Otherwise, the Vulkan 1.0 APIs
  VkGetPhysicalDevice{Properties,Features} are used instead
  (and it is assumed that no subgroup size control is
  possible).

- This changes the definition of VulkanDeviceKnobs to
  make room for the required pNext-linked chains of
  extensions.

- A helper class, PNextChainBuilder is also provided in
  UtilsVulkan.h to make it easy to build pNext-linked
  extension struct chains at runtime, as required when
  probing device propertires/features, or when
  creating a new VkDevice handle.

Apart from that, there is no change in behaviour in this CL.
I.e. a later CL might force a specific subgroup size for
consistency, or introduce a new API to let Dawn clients
select a fixed subgroup size.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=108875

Change-Id: I524af6ff3479f25b0a8bb139a062fe632c826893
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16020
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-05 10:34:25 +00:00