Commit Graph

9990 Commits

Author SHA1 Message Date
Dan Sinclair cc9d7851e1 Add builtin decoration to_str test.
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>
2020-03-10 19:19:06 +00:00
Dan Sinclair d70d07c5b9 Add binding decoration to string test
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>
2020-03-10 19:18:51 +00:00
Dan Sinclair 89b2aa1207 Extend entry point to str testing
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>
2020-03-10 19:18:29 +00:00
Dan Sinclair 18747b657a Extend array accessor validity checks
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>
2020-03-10 19:11:35 +00:00
Dan Sinclair adb80f005a Add else statement AST tests
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>
2020-03-10 17:48:25 +00:00
Dan Sinclair 3a1368dead Add DecoratedVariable tests
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>
2020-03-10 17:47:56 +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
Dan Sinclair b893115c17 Add ContinueStatement unit test
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>
2020-03-09 13:23:22 +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
Dan Sinclair f981455a1c Add ConstInitializerExpression tests
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>
2020-03-06 21:18:50 +00:00
Dan Sinclair 11be14076b Add cast expression tests
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>
2020-03-06 21:18:19 +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
Dan Sinclair a659b2113d Add case statement tests
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>
2020-03-06 14:28:01 +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
Dan Sinclair 00cf5a4894 Add test for call expression
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>
2020-03-05 20:35:57 +00:00
Dan Sinclair 51c811bfa8 Add BreakStatement test
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>
2020-03-05 20:29:13 +00:00
Dan Sinclair 796f65fb70 Add test for assignment statement.
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>
2020-03-05 20:20:39 +00:00
Dan Sinclair bf2b8973ed Add gclient files to gitignore
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>
2020-03-05 18:17:32 +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
Dan Sinclair 91e57dd7d8 Add unit tests for AsExpression
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>
2020-03-05 16:35:40 +00:00
dan sinclair 19e26f2fec Move build_module into an anonymous namespace
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>
2020-03-05 16:35:25 +00:00
Ryan Harrison db6ade73b2 Convert dependency management to using gclient
BUG=tint:12

Change-Id: I9c6b9cdd584f9a2e6c360c9a457069670146da7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16482
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-05 15:58:27 +00:00
Dan Sinclair 707705ddf4 Add issue tracker to README
Change-Id: I27b20007786703e514f6d9c94c31d27443b8e2d7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16400
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 15:06:38 +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
Brandon Jones 2de34c1791 Residency 1: Add Chromium's LinkedList to /common/
A Chromium's LinkedList class to Dawn. Implementation and header are
a direct copy/paste. This is to be used to implement an LRU Cache
for the ResidencyManager class.

Bug: dawn:193
Change-Id: I7cb02649590be4db0fe54c9d80557ac49efc34de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16380
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-03-05 09:54:06 +00:00
Sarah Mashayekhi 462dd675e1 v-0001: Only allowed import is GLSL.std.450
Bug: tint:10

Change-Id: I566ff378c4cd72febc0a73434b5dfe1039ef2c42
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16420
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Commit-Queue: Dan Sinclair <dsinclair@google.com>
2020-03-04 20:51:29 +00:00
Austin Eng e5534c4419 Add SlabAllocator and tests
Bug: dawn:340
Change-Id: I6fa1948261e8e6f91324464dade3e9954bd833e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15861
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-04 17:48:24 +00:00
Dan Sinclair afc144ee95 Fixup googletest deps
I picked the wrong googletest folder when switching to chromium deps.
This CL fixes it to use the correct one.

Bug: tint:9
Change-Id: I9da1b3a7418f6738ffe8ac89aaa7104868b236c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@google.com>
2020-03-04 14:48:39 +00:00
Dan Sinclair e631c00cba Switch to the chromium mirror for DEPS
This Cl upates the deps file to use the chromium mirror instead of
github directly.

Change-Id: Ie38bae8b171027f08054345df9ffd3ed940c1281
Bug: tint:9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16460
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
2020-03-04 14:15:39 +00:00
Corentin Wallez 35645a601a Roll Dawn's copy of the Vulkan headers.
Bug: None
TBR=enga@chromium.org
Change-Id: I5c5ff19601b6506c9e2ff7b852a4b97b3eb5d70f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Turner <digit@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-04 12:23:54 +00:00
Bryan Bernhart 9b5ecdf536 D3D12: Remove extra pre-pass used for RTV/DSV allocation.
Instead of tracking RTV/DSVs before the start of the pass to allocate
memory for CPU descriptors, allocate them at the start of the pass,
removing the need to loop through the entire command buffer each
Submit().

BUG=dawn:256

Change-Id: I72faff8951095c6a45207bfe5b12936715c58abf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16261
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-03 19:28:03 +00:00
Dan Sinclair e4b68bafda Add unit test for ArrayAccessorExpression
This CL adds unit tests for the array accessor expression class.

Change-Id: I97a7b366a2303b071040164cbcda404fe0592d90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16281
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
2020-03-03 14:09:27 +00:00
David Neto a00a571d81 Rolling 3 dependencies
Roll third_party/googletest/ 41b5f149a..e588eb1ff (9 commits)

41b5f149ab...e588eb1ff9

$ git log 41b5f149a..e588eb1ff --date=short --no-merges --format='%ad %ae %s'
2020-02-27 absl-team Googletest export
2020-02-25 absl-team Googletest export
2020-02-19 absl-team Googletest export
2020-02-12 absl-team Googletest export
2020-02-11 absl-team Googletest export
2020-02-11 absl-team Googletest export
2020-02-10 absl-team Googletest export
2020-02-10 absl-team Googletest export
2020-02-07 absl-team Googletest export

Roll third_party/spirv-headers/ 5dbc1c321..0a7fc4525 (1 commit)

5dbc1c3218...0a7fc45259

$ git log 5dbc1c321..0a7fc4525 --date=short --no-merges --format='%ad %ae %s'
2020-02-26 dneto Add grammars, C header, and header generator for vendor and KHR extended instruction sets (#143)

Roll third_party/spirv-tools/ fe10239f9..e1688b60c (16 commits)

fe10239f92...e1688b60ca

$ git log fe10239f9..e1688b60c --date=short --no-merges --format='%ad %ae %s'
2020-02-28 dneto Avoid use of Python distutils.dir_util (#3203)
2020-02-28 rharrison Adding WebGPU specific Workgroup scope rule (#3204)
2020-02-25 jaebaek Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
2020-02-25 geofflang Combine extinst-name and extinst-output-base into one arg. (#3200)
2020-02-23 nicolasweber Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201)
2020-02-21 geofflang Add missing dependencies when generating spvtools_core_tables (#3199)
2020-02-21 afdx Brief guide to writing a spirv-fuzz fuzzer pass (#3190)
2020-02-21 47594367+rg3igalia Fix ignored const qualifier warning in static_cast (#3197)
2020-02-20 stevenperron Make spvOpcodeString part of the public API (#3174)
2020-02-20 danyspin97 Fix static libraries linking order (#3189)
2020-02-18 bclayton vscode: Add missing fields to schema.Opcode (#3169)
2020-02-18 siglesias spirv-val: Add support for SPV_AMD_shader_image_load_store_lod (#3186)
2020-02-14 afdx spirvfuzz: Fix type-related bug, change undef to zero, and add assert (#3188)
2020-02-11 afdx spirv-fuzz: Fuzzer pass that adds access chains (#3182)
2020-02-10 afdx spirv-fuzz: Fuzzer pass to add function calls (#3178)
2020-02-10 afdx spirv-fuzz: Ensure that donated variables are always initialized (#3181)

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

Change-Id: If0c1b679c2bc6863c21bcf78368dae16f5662b45
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16300
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Dan Sinclair <dsinclair@google.com>
2020-03-03 14:09:01 +00:00
Natasha Lee 6f92b9160b Also use ExternalImageDescriptor in D3D12 and Metal Backends
Bug: chromium:1036080
Change-Id: I358b0441c168ca075b09ab028c2f6d9df2a44d59
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-03-02 22:27:46 +00:00
Dan Sinclair 6e581895a5 Initial commit 2020-03-02 15:47:43 -05:00
Ryan Harrison cb90835dd9 Rolling 4 dependencies
Roll third_party/SPIRV-Tools/ 8910ea5f1..e1688b60c (4 commits)

8910ea5f1c..e1688b60ca

$ git log 8910ea5f1..e1688b60c --date=short --no-merges --format='%ad %ae %s'
2020-02-28 dneto Avoid use of Python distutils.dir_util (#3203)
2020-02-28 rharrison Adding WebGPU specific Workgroup scope rule (#3204)
2020-02-25 jaebaek Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
2020-02-25 geofflang Combine extinst-name and extinst-output-base into one arg. (#3200)

Roll third_party/glslang/ 07e1a0a67..56364b6b6 (6 commits)

07e1a0a67a..56364b6b60

$ git log 07e1a0a67..56364b6b6 --date=short --no-merges --format='%ad %ae %s'
2020-03-01 cepheus Copyright update, mostly to trigger bots again.
2020-03-01 cepheus Fix #2095: correct the indentation.
2020-02-28 cepheus Fix #1461: set the SPIRV-Tools' optimizer's target environment.
2020-02-28 cepheus Fix #2091, remove incorrect assert for division by 0.0.
2020-02-28 wangli28 Add vcpkg installation instructions
2020-02-28 sk Fix for #2075: removed DefaultTBuiltInResource from glslang_c_interface.cpp

Roll third_party/spirv-cross/ c5f7b5575..9deb6ffbb (1 commit)

c5f7b55756..9deb6ffbba

$ git log c5f7b5575..9deb6ffbb --date=short --no-merges --format='%ad %ae %s'
2020-03-02 post Add -V alias for --vulkan-semantics.

Roll third_party/spirv-headers/ 5dbc1c321..0a7fc4525 (1 commit)

5dbc1c3218..0a7fc45259

$ git log 5dbc1c321..0a7fc4525 --date=short --no-merges --format='%ad %ae %s'
2020-02-26 dneto Add grammars, C header, and header generator for vendor and KHR extended instruction sets (#143)

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

Change-Id: I20d05fbd4e1ce6a9ffb5bbed091524830aea68de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16280
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-02 19:12:46 +00:00
Austin Eng 3ded65e807 Default initialize all descriptors
Some dawn_unittests crash on some configurations because the
uninitialized |label| member crashed string serialization.
Default initialize all descriptors to avoid this problem.

Bug: none
Change-Id: I6ea1851ebb6f54690a28ba396e0beaa85d8670cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16260
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-02-28 22:29:15 +00:00
Austin Eng e299afa9ec Support CPU adapters in dawn_end2end_tests
This is so we can run the end2end_tests using Swiftshader. We still
prefer the discrete, then integrated GPUs so that normal testing uses
the real GPU.

Bug: dawn:283
Change-Id: I17a1ffd8aa88ddeaafa019feb67deeb25cdd2da0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Mark Henderson <mehe@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-02-27 17:47:19 +00:00
Bryan Bernhart 0363c3e46d D3D12: Allocate GPU bind groups at draw/dispatch.
Instead of counting descriptors to be allocated for the entire command
buffer in a pre-pass, the bindgroup state tracker is used to allocate
only dirty bindgroups upon recording draw/dispatch. If the heap has no
more room and must be changed, bindgroups will be re-created according
to the BGL.

A future change will address the CPU descriptors and removal of the
pre-pass.

BUG=dawn:256,dawn:307

Change-Id: I6603de17cfda713bd4512c46e1c93618ca01bb7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13400
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-02-27 01:14:22 +00:00
Austin Eng a9d7d47842 Add Toggles to disable base vertex and base instance rendering
These are not supported on some older OpenGL, OpenGL ES, and iOS
devices.

Bug: dawn:343
Change-Id: I70def749ae57fcfe2895f8556674dd241941d3d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16163
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-26 08:24:20 +00:00
Austin Eng 2f0f850da8 Add Toggle to disable sampler compare function on Metal.
This Toggle is set if MTLFeatureSet_iOS_GPUFamily3_v1 is not supported.

Bug: dawn:342
Change-Id: Ia5f43e87fdd2c13eaffe9557cb0ce9a06dec3b29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16180
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-26 08:06:00 +00:00
Ryan Harrison 227568451b Add in --no-use flags for spvc features
BUG=dawn:344

Change-Id: Ifa9e1e3167ecfe7d38c16f393cec0443ea1589f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16164
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-02-25 22:05:39 +00:00
Natasha Lee 17a8498982 ObjectStorage Allocate nullptr when id is 0
Bug: chromium:1052673
Change-Id: I16e39807a48f7a2c937b2a993f3a17cc8f58eac3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16161
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-02-25 19:20:15 +00:00
Corentin Wallez 73c58010c7 infra: Use macOS 10.15 and newer OSX SDK.
Bug: dawn:339
Change-Id: If25b3ace5ee6fe8d58054f9421a3417870dda750
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16200
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-25 17:12:27 +00:00