Commit Graph

10410 Commits

Author SHA1 Message Date
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
dan sinclair 7a480f4313 [spirv-writer] Start emitting types
This CL starts the emitting of SPIR-V types. This CL adds code to emit
the `AliasType`, `BoolType`, `F32Type`, `I32Type`, `MatrixType`,
`U32Type`, `VectorType` and `VoidType`.

Bug: tint:5
Change-Id: Ic13026ca9006fc0a253d019b1a6dd984ae992fba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17561
Reviewed-by: David Neto <dneto@google.com>
2020-03-24 15:03:29 +00:00
David Neto 7c6e8ded7d reader::spirv: Fix entry point test fixture name
Bug: tint:3
Change-Id: Ie7cd4f4f45b7be527b8d38a3dd76fac860a65ad8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17563
Reviewed-by: dan sinclair <dsinclair@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-03-24 14:39:02 +00:00
David Neto a65ea31910 reader::spirv fix entry point tests
Define the ID targeted by the entry point.  Do this to avoid
asserts in the optimizer code

Bug: tint:3
Change-Id: Idbd4c8a058f2d51ff44696d2029502044d01b424
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17562
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-24 12:46:20 +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
David Neto a14fec951e readers::spirv: Emit entry points
Bug: tint:3
Change-Id: I66b99ad6ecb3f409f9df7bfa9aa6c4da65e3f66b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17582
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 22:54:36 +00:00
David Neto 14cfcd707d Add conversion of SpvExecutionModel
Bug: tint:3
Change-Id: I2b1a12beea9343ab3a8db50308e2f6fd790c654b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17581
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 22:53:42 +00:00
David Neto 1ae8e85144 reader::spirv::Parser: register user names
Bug: tint:3
Change-Id: I4391aa733079d24fb19ff2cba9f612406e63a203
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17580
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 21:40:23 +00:00
dan sinclair dc200f7d1d Add SPIR-V dump to the SPIR-V generator
This Cl adds utility classes to dump out SPIR-V disassembly of the
builder and instructions.

Bug: tint:5
Change-Id: Ib4c57025ac63cb0be456bd819461c98ffa94367f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17560
Reviewed-by: David Neto <dneto@google.com>
2020-03-23 20:59:12 +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
dan sinclair 781a4acb6f Generate errors from the SPIR-V builder.
This Cl adds error messages into the SPIR-V generator.

Bug: tint:5
Change-Id: I45c0d286dd8ec251773ff5e036322090647d780c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17521
Reviewed-by: David Neto <dneto@google.com>
2020-03-23 20:07:34 +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
dan sinclair 248170ae44 Generate entry point instructions in SPIR-V writer.
This CL updates the SPIR-V generator to create entry point instructions.

Bug: tint:5
Change-Id: I04394bd508c0871ae9563cc811b4e49e42c2bb3a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17322
Reviewed-by: David Neto <dneto@google.com>
2020-03-23 18:08:41 +00:00
David Neto 23dceb46fc Add reader::spv::ResolveMemberNamesForStruct
Bug: tint:3
Change-Id: If778e98416c19c518261c68d4afdfdc99724967f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17440
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:48:03 +00:00
David Neto ad90ee2ec3 Add reader::spirv:SuggestSanitizedMemberName
Also reader::spirv::GetMemberName

Bug: tint:3
Change-Id: I4cf2dce0703eb17a9d49452294ed0c28ea158a07
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17423
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:45:57 +00:00
David Neto ca8e6dd48d Add reader::spv::SuggestSanitizedName
Bug: tint:3
Change-Id: Ie53bbb7a0b2523a2098b485b6a5bb3d5fa4e52f9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17422
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:45:01 +00:00
David Neto 8af12f7503 Add reader::spv::Namer::FindUnusedDerivedName
Bug: tint:3
Change-Id: I0a0e5646d7bcdc89fdaaf8b956dd61ed6148c7e9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17421
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:43:41 +00:00
David Neto bd1d142134 Add reader::spv::Namer::Sanitize
Bug: tint:3
Change-Id: I4d554755dacecac0f2dacf191d85f8e339e87923
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17420
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:42:21 +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
dan sinclair 7b7ff741c5 Generate OpExtInstImport
This CL updates the SPIR-V generator to only create the GLSL import if
it's requested.

Bug: tint:5
Change-Id: I96a9100adf0a0c59dcdd82c12ac27c566ea2663f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17341
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:27:05 +00:00
David Neto d854fc1543 Rename method RegisterExtendedInstructionImports
Bug: tint:3
Change-Id: If92bd97f9a71bd676ba40430fd736cf721c38747
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17360
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-20 19:24:48 +00:00
David Neto be4c89a4d2 Add reader::spirv::Namer
A Namer is a place for saving and looking up names
based on SPIR-V IDs.

Bug: tint:3
Change-Id: I6aeb2f5f7ba63c2e0a816dcbac88f964beafabc6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17284
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-20 19:24:23 +00:00
dan sinclair 3740fd2d46 Emit functions.
This Cl adds functions to the WGSL generator.

Bug: tint:4
Change-Id: Ibc7d27597c6c0d63c82931d0fa016856359d21b5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17340
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:09:04 +00:00
dan sinclair c574295a42 Emit If statements.
This CL adds emitting of if statements to the WGSL generator.

Bug: tint:4
Change-Id: Ie79b40779a028dd40eac99c5459c971ead6cc43e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17286
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:08:56 +00:00
dan sinclair eaf2689a44 Emit else statements.
This Cl updates the WGSL writer to generate else statements.

Bug: tint:4
Change-Id: I72f6bbb6a2ab00bec3933083fd12c5da1a3dd5f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17285
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:08:07 +00:00
dan sinclair 0d00402124 Emit loop statement.
This CL emits the loop statement from the WGSL generator.

Bug: tint:4
Change-Id: I45be066ed306a71df053f7e61e6201a10a3d1056
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17283
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:07:00 +00:00
dan sinclair 5f64aee763 Emit switch statements.
This CL updates the WGSL generator to output switch statements.

Bug: tint:4
Change-Id: I4450b10932960691c76e76869105ade01fdd5a79
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17282
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:06:52 +00:00
dan sinclair 4202d7d016 Emit variable statements
This Cl updates the WGSL writer to output variable statements.

Bug: tint:4
Change-Id: Ic557ea0c1b366644a8496dd43e4cfd85b9e8a84f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17281
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:06:45 +00:00
dan sinclair 187f9165a5 Emit Unless statement.
This CL adds unless statement to the WGSL generator.

Bug: tint:4
Change-Id: Id171cb1438d290938f1da946c23992bdae688359
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17280
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:05:32 +00:00
dan sinclair b42c76c47d Emit regardless.
This Cl updates the WGSL writer to emit the regardless statement.

Bug: tint:4
Change-Id: Iab35f3f0d956bd6cdd1411a06b4ca022147b0f87
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17261
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:05:22 +00:00
dan sinclair 2a6e275057 Emit Return statements.
This CL adds emitting return statements into the WGSL writer.

Bug: tint:4
Change-Id: Ia2331f7c20e3a3e3af1aa1553cef83bec315eae3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17260
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:05:10 +00:00
dan sinclair c083af83ea Add Kill, Nop and Fallthrough to WGSL writer
This CL adds the Kill, Nop and Fallthrough statements to the WGSL
writer.

Bug: tint:4
Change-Id: Ic0c635cfa7ca4c3195c593b119f9436ffeb1f9dc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17201
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:05:02 +00:00
dan sinclair 17686fc57c Emit WGSL continue statement.
This Cl adds support for emitting the WGSL continue statement.

Bug: tint:4
Change-Id: I20f87d46e707bdd7ae2a517983e779988892c445
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17200
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:04:54 +00:00
dan sinclair 37f4fb0f75 Emit case statement
This CL adds case statements to the WGSL generator.

Bug: tint:4
Change-Id: Ic7945646d79b7c3e9e1cb1cf57d1633a28f45fc0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17180
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:04:45 +00:00
dan sinclair bf5ab65e98 Emit WGSL Break statement.
This CL adds emitting of the break statement to the WGSL writer.

Bug: tint:4
Change-Id: Iceae8cf8c1c77d63455621ea23f566af57c9e717
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17163
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:02:05 +00:00
dan sinclair 7f9d570a5a Emit assignment statement.
This CL updates the WGSL writer to emit the assignment statement nodes.

Bug: tint:4
Change-Id: I8a52f4e96c61ecb9e97cd3da41f4a1aa718e8d37
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17162
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:01:57 +00:00
dan sinclair daff3e2616 Emit UnaryOp expression.
This CL updates the WGSL generator to emit the UnaryOpExpression node.

Bug: tint:4
Change-Id: I54046b5238a45994f7a4ed27941bd22b0c75f836
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17161
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:01:47 +00:00
dan sinclair 09671ab6f1 Emit UnaryMethod expressions.
This CL updates the WGSL generator to output UnaryMethodExpression
nodes.

Bug: tint:4
Change-Id: If43c0e5c12a967f08cc23e816d292353490404cf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17160
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:01:38 +00:00
dan sinclair cbabfa8ca1 Emit UnaryDerivative in WGSL writer.
This CL updates the WGSL writer to emit the unary derivative expression.

Bug: tint:4
Change-Id: I18c0fd56d88f98a6c5d37e176d98ab7b3077a50c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17120
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:01:29 +00:00
dan sinclair 49568e162d Emit relation expressions.
This CL updates the WGSL writer to emit the relational expressions.

Bug: tint:4
Change-Id: I2b2f5e40f2091ce2b7715773f3811aed7ed61f6a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17100
Reviewed-by: David Neto <dneto@google.com>
2020-03-20 19:01:19 +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
David Neto 2920659a47 Rolling 3 dependencies
Roll third_party/googletest/ e588eb1ff..482ac6ee6 (8 commits)

e588eb1ff9..482ac6ee63

$ git log e588eb1ff..482ac6ee6 --date=short --no-merges --format='%ad %ae %s'
2020-03-17 absl-team Googletest export
2020-03-16 dmauro Googletest export
2020-03-13 absl-team Googletest export
2020-03-06 absl-team Googletest export
2020-03-03 absl-team Googletest export
2020-03-03 absl-team Googletest export
2020-02-21 johan.mabille Fixed warnings
2020-01-29 krystian.kuzniarek remove a dead reference to the Autotools script

Roll third_party/spirv-headers/ 0a7fc4525..f8bf11a02 (9 commits)

0a7fc45259..f8bf11a025

$ git log 0a7fc4525..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-03-13 jmadill Add missing header to BUILD.gn.
2020-03-09 stevenperron Export NonSemanticDebugPrintf.h in bazel build
2020-03-02 jbolz Add NonSemantic.DebugPrintf JSON/header
2020-03-02 jbolz Fix max enum value
2020-01-01 xanto Also propagate SPIRV-Headers version to CMakeLists.txt

Roll third_party/spirv-tools/ e1688b60c..60104cd97 (18 commits)

e1688b60ca..60104cd974

$ git log e1688b60c..60104cd97 --date=short --no-merges --format='%ad %ae %s'
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)
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)
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)

Created with:
  roll-dep third_party/googletest third_party/spirv-headers third_party/spirv-tools

Change-Id: I7f0e82cf5bbd38f6473757c74689ac35d23e53c1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17342
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-19 18:31:59 +00:00