Commit Graph

10410 Commits

Author SHA1 Message Date
Dan Sinclair 3d1e69767a Add identifier expression tests
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>
2020-03-16 13:26:10 +00:00
Nico Weber 022952303c Suppress two -Wunreachable-code warnings.
Bug: chromium:346399
Change-Id: Ieb76cf99022230dcfb0bc6b17f95ea544040a796
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17040
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-16 10:59:56 +00:00
Jiawei Shao 1a56ce54e0 Validate creating bind group layout with storage textures
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>
2020-03-16 10:53:36 +00:00
Austin Eng 463c394905 Slab-allocate OpenGL bind groups
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>
2020-03-13 23:51:50 +00:00
Austin Eng ae96f04c0a Slab-allocate frontend D3D12 bind groups
Bug: dawn:340
Change-Id: Ie613a1b8e445a385c10eb377983440ace9ad3f4a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16746
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:34:40 +00:00
Austin Eng 79230bf213 Slab-allocate frontend Vulkan bind groups
Bug: dawn:340
Change-Id: I3ef0b8a0585fac93ffb77d4642d13c14afbae177
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16745
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:10:00 +00:00
Austin Eng 459c2f930f Slab-allocate Metal bind groups
Bug: dawn:340
Change-Id: I6185e41d9c71c49953a4de91e5f3042968679fd6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15862
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-13 22:50:00 +00:00
David Neto 9bb0dc543d spv: Build internal representation of the SPIR-V
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>
2020-03-13 20:21:45 +00:00
David Neto e5dc367a7e spv: reject invalid SPIR-V
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>
2020-03-13 20:18:06 +00:00
David Neto 1ae7c7dba9 Add SPIR-V parser impl
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>
2020-03-13 20:14:33 +00:00
Brandon Jones 0338b7ae19 Residency 3: Track Resource Heap Usages
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>
2020-03-12 13:23:22 +00:00
dan sinclair 306a2f8381 Add IdentifierExpression to WGSL writer.
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>
2020-03-12 12:43:05 +00:00
dan sinclair d9e9ff3be5 Start WGSL writer
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>
2020-03-12 12:40:01 +00:00
dan sinclair 37dbf99e34 Always define TINT_BUILD_SPV_PARSER.
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>
2020-03-11 18:43:12 +00:00
Jiawei Shao 421684f943 Support Storage Textures as Valid Binding Types
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>
2020-03-11 01:28:48 +00:00
David Neto ab0cdaf652 Add a FailStream error reporting helper
Bug: tint:3
Change-Id: Ie0bb2365a7dd6b2a5e9d0960593fac7586b02922
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16640
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:46 +00:00
David Neto f814bdc52a Add stub unit tests for spv parser
Bug: tint:3
Change-Id: I6957cddbdadbcf493fc8f1e3dbe0c6d9037dc56b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16620
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:31 +00:00
David Neto bbd8987e71 Instantiate a stubbed SPIR-V parser if file ends in .spv
- 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>
2020-03-10 22:54:12 +00:00
Dan Sinclair 49faa4c8d7 Add function tests
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>
2020-03-10 19:19:28 +00:00
Dan Sinclair 9c48ddb917 Add fallthrough statement tests
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>
2020-03-10 19:19:18 +00:00
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