The variable was incorrectly set to be a `vec3<f32>` instead of a
`vec3<u32>`.
Bug: tint:24
Change-Id: I84262a185925c50adf3a149f5f93f45124499596
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18400
Reviewed-by: David Neto <dneto@google.com>
This patch adds tests to verify that resource usage tracking is per
each pass (neither per each draw/dispatch, nor per each command
encoder or command buffer).
Bug: dawn:358
Change-Id: I7bd05de3539ff2d11bb58cd34a370015907e4666
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18180
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This CL renames VariableStatement to VariableDeclStatement to make it
clearer what it was modeling.
Bug: tint:25
Change-Id: Idd0d27fad7cc402f286e1abad74092c9d1961d91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18341
Reviewed-by: David Neto <dneto@google.com>
This Cl updates the names of the initializer expressions to be clearer.
* InitializerExpression -> ConstructorExpression
* ConstInitializerExpression -> ScalarConstructorExpression
* TypeInitializerExpression -> TypeConstructorExpression
Bug: tint:26
Change-Id: Ib046497f589cc65d1d64bc172015588348feeffe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18340
Reviewed-by: David Neto <dneto@google.com>
Handle as many member decorations as the Tint AST can express right now.
See crbug.com/tint/30
Bug: tint:3
Change-Id: I6d04f1beb438b3d952a76886fbd9c6b7ea701d81
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18160
Reviewed-by: dan sinclair <dsinclair@google.com>
Fixes compiler error on Linux about bare nullptr_t not existing.
Bug:
Change-Id: I1eb97d40e9ff564775d4ec7bbc54430481475f34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Wagner <bungeman@chromium.org>
In PIX's D3D12-only mode, there is no way to determine frame boundaries
for WebGPU since Dawn does not manage DXGI swap chains. Without
assistance, PIX will wait forever for a present that never happens.
If we know we're dealing with a swapbuffer texture, inform PIX we've
"presented" the texture so it can determine frame boundaries and use the
texture's contents for the UI.
Bug: dawn:364
Change-Id: I7eb628c460e1e7c446ad91b29b03dd7b54545afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18060
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
This CL adds the code to generate OpReturn and OpReturnValue statements.
Bug: tint:5
Change-Id: Ia4e4f6eb3f8b182be0caea88147d23fe4b6e341c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18300
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation for the ConstInitializer and TypeInitializer
expression. The global variable method has been extended to output the
constant and variable initializers.
Bug: tint:5
Change-Id: I2b3783d0e5a8bbf7a6aba9cf6e154910568bdb5d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18241
Reviewed-by: David Neto <dneto@google.com>
This CL starts adding global variable output to the SPIR-V writer. This
does not handle constants or initializers at this point.
Bug: tint:5
Change-Id: Id06533b2ec1f61feadf66f3e43a484f6f3765546
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17922
Reviewed-by: David Neto <dneto@google.com>
We want to release pending commands in Device::WaitForIdleForDestruction()
so that when we call TickImpl(), we can reset the command allocators.
Bug: dawn:269
Change-Id: Ibd8fdd685a4e9ed7cce8176ba097bc67687bcd97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18101
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch adds resource usage tracking tests for overwritten
situations within a draw/dispatch:
1) multiple SetIndexBuffer
2) multiple SetVertexBuffer on the same index
3) multiple SetBindGroup on the same index
We should track the overwritten resources even though they
are not used in render/compute pass.
Bug: dawn:357
Change-Id: I1e804c9aebfc62acb82513db51b6ae94a85579fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18000
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Bug: tint:3
Change-Id: I9655ddbe48f2660f88be68bc52c9467d805043ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18080
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This moves BindGroupLayoutBase::BindingInfo into the dawn_native
namespace and changes ShaderModule::BindingInfo to extend it with
SPIR-V ids.
Bug: dawn:354
Change-Id: I6a2187e94c0200bee729cf8290f74e4f8c648334
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17920
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
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>