Previously the surface extensions were only enabled so we could import
VkSurfaceKHR's created from GLFW. To implement the webgpu.h
surface-based swapchains, we are going to use the extension entrypoints
too.
This changes vulkan_platform.h to set defines that make vulkan.h expose
the entrypoints and datatypes for all the Vulkan extensions we might
care about for a given compilation configuration.
Bug: dawn:269
Change-Id: If4202ff5e31c816eccb5f5381bd36b660a3b6c5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17964
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
MetalFunctionData::function was uninitialized when an error happened
its destructor would run, calling release on a garbage pointer.
Bug:
Change-Id: Ib72038da2a07b4e0f27ec929ec08f303c54dcc62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17760
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Previously the code ASSERTed that the semaphores didn't exist on
destroy, but that's not necessarily the case. Handle destruction more
correctly.
Bug: dawn:269
Change-Id: If123e0e20b4ee157c70a1b8cc2f3b20a9473f55e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17963
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
All Vulkan implementations on macOS have EXT_metal_surface available
(MoltenVk, Swiftshader and gfx-rs), and it matches webgpu.h's surface
creation from a CAMetalLayer more closely.
Bug: dawn:269
Change-Id: I313cd366b3509fb8930552406d150f08fc8e3666
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17962
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
VulkanFunctions handles the storing of Vulkan function pointers so Dawn
doesn't need the declarations for Vulkan entrypoints.
Bug: dawn:269
Change-Id: I25f05d4a82fd31a60b22257261e940ce276f5eac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17960
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This change mainly does a code refactoring. It moves resource tracking
tests from CommandBufferValidationTests.cpp to a separate test file.
It also adds a few tests, like copy dst/src doesn't impact resources
used in render/compute pass.
More tests about resource usage tracking will be added into this
separate test file.
Bug: dawn:359
Change-Id: I29d9b87b8de9a07b39ee1087e9f6a53ad10fe8fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Add a Context::Reset method to clear state.
Hide the member behind an accessor.
Change-Id: Iafb7c39249f66f70c5a99a8ed1c69f2c0238834f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17742
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the type generation for OpTypePointer.
Bug: tint:5
Change-Id: I9cfe6c4fbd9173df925421f278abd1afbda50fc9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17840
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation of OpTypeArray and OpTypeRuntimeArray to the
SPIR-V writer.
Bug: tint:5
Change-Id: If3764ddb2499b8a196039521b8d9f80842626bcf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17821
Reviewed-by: David Neto <dneto@google.com>
This CL updates the SPIR-V writer to generate the OpConstantTrue,
OpConstantFalse and OpConstant instructions.
Bug: tint:5
Change-Id: I660554c491e4eb569e3902fce0973fae3f27e6c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17820
Reviewed-by: David Neto <dneto@google.com>
CL#14740 modified the result format but
the test runner script was never updated.
This fixes the result format and metric check.
Bug: dawn:208
Change-Id: I3a128b91e20ff8629b091ef4bf8fdd6fb616ba0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17921
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
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>
This CL changes the struct generation to emit the `OpName` for the
struct instead of doing it in a separate type alias pass. The struct
name was the only thing that needed to be output in the type alias pass
and this makes sure it's only emitted if used.
Bug: tint:5
Change-Id: I7389a3cd61812171fceeaae99253610152aa523d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17860
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL moves all test files to the anonymous namespace.
Change-Id: Ie5ae0efe907c03eeb441e90f31c976844172b594
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17900
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL fixes up several documentation and linter warnings.
Change-Id: Ic367ba1937f20dfe47a8c8e4035c17e8a3d0f2e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17880
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
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>
This CL updates the SPIR-V writer to emit the OpTypeFunction and
OpFunction instructions.
Bug: tint:5
Change-Id: I85ead161ca37304a977213257a825ff268d29f2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17741
Reviewed-by: David Neto <dneto@google.com>
This Cl replaces the TypeManager singleton with a context object.
Bug: tint:29
Change-Id: Ia662709db1b562c34955633977ce4363f28f238e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17780
Reviewed-by: David Neto <dneto@google.com>
This CL adds a helper to emit a block of statements from the WGSL
writer.
Change-Id: I6fe62d894882c0a0fdc8865967bfa4887f3a65a3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17761
Reviewed-by: David Neto <dneto@google.com>
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>
This Cl adds a comment about the type manager being a singleton and
synchronization requirements.
Change-Id: I91618516b26c18aa6b47e7e564b4b3a8eecc1009
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17740
Reviewed-by: David Neto <dneto@google.com>
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>
For now, it only handles scalar types
Bug: tint:3
Change-Id: Ic20e18a4f80790e6cd10d4c06dd2abfd8f67a304
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17700
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds generation of Struct types to the SPIR-V writer.
Bug: tint:5
Change-Id: Ibcabf7b1a688026297de682f4825d5195d8007d2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17701
Reviewed-by: David Neto <dneto@google.com>
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>
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>
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>
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>
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>
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>
(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>
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>
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>
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>