This CL adds tests for the identifier expression AST node.
Bug: tint:11
Change-Id: Ie7dd4f1de3d8a23ac7e878285564d8c5fc9e1250
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16502
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
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>
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>
For convenience, use the SPIRV-Tools' optimizer representation.
Bug: tint:3
Change-Id: I1b046209584e1e907045d496b0f8d7b36fca79bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16660
Reviewed-by: dan sinclair <dsinclair@google.com>
Use the SPIRV-Tools validator, with the WebGPU0 environment.
Bug: tint:3
Change-Id: Id1132d209fd939ed68587034761e97da9b35b21d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16821
Reviewed-by: dan sinclair <dsinclair@google.com>
The parser impl saves a copy of the SPIR-V binary.
Bug: tint:3
Change-Id: I5d61c87123c0bcb417d0c7004e0ef4e3c8fbb027
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16642
Reviewed-by: dan sinclair <dsinclair@google.com>
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>
This CL extends the WGSL writer to output IdentiferExpression and fills
out the variable with initializer test case and implementation.
Bug: tint:4
Change-Id: I9db9affb5ec4c4c109488f60bbc81bf3a96eee35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16744
Reviewed-by: David Neto <dneto@google.com>
This CL is the start of a WGSL writer.
Bug: tint:4
Change-Id: Ib2c2580d9e50c36664088556d9b8feec76935211
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16560
Reviewed-by: David Neto <dneto@google.com>
This CL always sets the define for building the SPV_PARSER. This fixes
undefined errors on certian platforms.
Change-Id: I5f84295cb7ddf23d64efd9a4d00717c84bc698aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16800
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
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>
- spv parser just errors out for now
- link against SPIRV-Tools-opt
- Fixe CMake variable TINT_ENABLE_SPV_PARSER --> TINT_BUILD_SPV_PARSER
Bug: tint:3
Change-Id: Ie4ef9b03e001fca3cc11f65a425612755857feac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16600
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds tests for the function node.
Bug: tint:11
Change-Id: I10b1fb73ae93bf90162948ab42e2a74d4aca7987
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16501
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds tests for the fallthrough statement.
Bug: tint:11
Change-Id: I1bc8677e00aa9eb446a096bd2600104550480d77
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16500
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds a test for the to_str method of the BuiltinDecoration.
Bug: tint:11
Change-Id: Ia350058fc4f551d62195527f0a6b86751ba92b8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16481
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds a test for the binding decoration to_str method.
Bug: tint:11
Change-Id: Id9d16bdb68c4b68fb8bd67dae898f8b7a17ee6c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16468
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds more tests for the entry point to str method.
Bug: tint:11
Change-Id: I54bb349d606d05221d649215b7b2c6477cca6819
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16480
Reviewed-by: David Neto <dneto@google.com>
This Cl extends the array accessor to verify the sub expressions are
also valid.
Bug: tint:11
Change-Id: Ieaa9643e07deaa8c406743c3bbb6fbe3ca9cb1ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16467
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds tests for the else statement AST node.
Bug: tint:11
Change-Id: I30c024775d188223d5a3875ee973ffc8ac78c645
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16466
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds tests for decorated variable and updates the API to be
slightly nicer.
Bug: tint:11
Change-Id: I0bd5b8b6e6f682dc9d405e02e51d5dbcaeccc5f3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16465
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
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>
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>
This CL adds tests for the continue statement AST node.
Bug: tint:11
Change-Id: I6339947c338b4b035f7947cb45e33bf2dcb6fe3e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16464
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
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>
This CL adds unit tests for the const initializer expression.
Bug: tint:11
Change-Id: I9fb9dd77447ac20921997614816cd75272d4e05a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16463
Reviewed-by: David Neto <dneto@google.com>
This CL adds unit tests for the cast expression AST element.
Bug: tint:11
Change-Id: Ia5d82a00ef2a4c16d6591095b7674f1c14a33c5f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16462
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
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>
This Cl adds tests for the case statement class.
Change-Id: I585fdff9631ed44e6fb297328ed164297f5fa8f3
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16421
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
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>
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>
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>
This CL adds unit tests for the call expression. The IsValid method is
extended to verify none of the provided parameters are a nullptr.
Change-Id: I5dfd3ec1f086ef02ab965218a1d8610a1c212628
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16360
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds unit tests for the break statement.
Change-Id: I78300ea6661e9c331795aedd344ac74c63dd8e25
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16342
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds unit tests for the assignment statement methods.
Change-Id: I4aea8f22b530bf43b7dfdc2b82b5414cf6590fea
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16341
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This Cl updates the .gitignore with the .gclient and .gclient_entries
files.
Bug: tint:12
Change-Id: I645016ca83396c0616f2ad3f69d2ce510be59b53
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16580
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds unit tests for the as expression and fixes up a few issues
along the way.
Change-Id: I4591f31c1a48ea5580a87a129c728ef3c9be2c7c
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16340
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL moves build_module into an anonymous namespace which fixes up a
build warning about missing prototypes.
Change-Id: I8b2f427e32e7851c24492099103565ab0119f4fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16503
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
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>
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>