Commit Graph

10410 Commits

Author SHA1 Message Date
Brandon Jones 7982cc0527 Residency 5: Implement and Integrate Residency Management
Adds all D3D12 residency management logic.

Bug: dawn:193
Change-Id: Ibc160289c29cc85817dcfaaef1b92d04599aa802
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16384
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-03-31 15:31:56 +00:00
dan sinclair 32a68fec42 Fix type of gl_GlobalInvocationId in compute boids.
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>
2020-03-31 15:06:07 +00:00
Yunchao He 276b065265 Add validation tests for resource usage tracking - 4
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>
2020-03-30 23:34:55 +00:00
dan sinclair e49bd5eeb4 Rename VariableStatement to VariableDeclStatement.
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>
2020-03-30 22:46:48 +00:00
dan sinclair a322f5ddfa Update initializer names.
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>
2020-03-30 22:46:06 +00:00
David Neto e68c9b4075 [spirv-reader] Convert struct types
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>
2020-03-30 21:14:28 +00:00
David Neto 4da4c696e2 [spirv-reader] Get decorations
Bug: tint:3
Change-Id: Idfd49c5bfc8629c17f42f954d65c881865548b8a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18140
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-30 21:09:59 +00:00
Corentin Wallez d25b8e14f4 Fix compilation on iOS where setDisplaySyncEnabled isn't available.
Bug: dawn:269
Change-Id: I607983aaf437c39082156151b79887e72d529247
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18260
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-30 20:45:05 +00:00
Ben Wagner a0d8362e00 Add std:: to nullptr_t
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>
2020-03-30 20:40:05 +00:00
Rafael Cintron c602c86907 Call ID3D12SharingContract::Present on WebGPU swap buffer destroy
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>
2020-03-30 20:31:45 +00:00
dan sinclair 8ae34868cf [spirv-writer] Generate return statements
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>
2020-03-30 20:03:24 +00:00
dan sinclair 5cd08fd72a [spirv-writer] Add initializer generation.
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>
2020-03-30 20:01:38 +00:00
David Neto b020cd900e [wgsl-writer] Restore huggie-style braces
Change-Id: Ieec33cccbfeb2589d1292103001f0de5267e02bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18040
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-30 19:56:59 +00:00
dan sinclair 15cbc98a8c [spirv-writer] Start global variable output
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>
2020-03-30 19:49:01 +00:00
Ryan Harrison 4da46462d7 Rolling 4 dependencies
Roll third_party/SPIRV-Tools/ 1c8bda372..fd773eb50 (5 commits)

1c8bda3721..fd773eb50d

$ git log 1c8bda372..fd773eb50 --date=short --no-merges --format='%ad %ae %s'
2020-03-26 stevenperron Start SPIRV-Tools v2020.3
2020-03-26 stevenperron Finalize SPIRV-Tools v2020.2
2020-03-26 stevenperron Update CHANGES
2020-03-25 alanbaker Fix identification of Vulkan images and buffers (#3253)
2020-03-23 alanbaker Disallow phis of images, samplers and sampled images (#3246)

Roll third_party/glslang/ 1f0fcbe5a..08c02ced7 (38 commits)

1f0fcbe5a3..08c02ced79

$ git log 1f0fcbe5a..08c02ced7 --date=short --no-merges --format='%ad %ae %s'
2020-03-30 dsinclair Remove unused variables.
2020-03-30 cepheus Fix #2163: improve comments for addProcess() and the preamble.
2020-03-30 ntfs.hard printf format
2020-03-30 ntfs.hard unused var
2020-03-30 ntfs.hard bitwise on boolean
2020-03-30 ntfs.hard opposite inner condition
2020-03-27 greg Update spirv-tools known_good to latest stable
2020-03-26 neslisah.torosdagli accelerationStructureEXT - issue #2152
2020-03-26 neslisah.torosdagli accelerationStructureEXT - issue #2152
2020-03-26 neslisah.torosdagli pass by reference updates
2020-03-26 neslisah.torosdagli pass-by-reference updates
2020-03-25 gcmn Add missing braces to if condition
2020-03-25 neslisah.torosdagli switch format update
2020-03-24 neslisah.torosdagli copyright notice changes removed from unchanged files
2020-03-24 neslisah.torosdagli copyright notice changes removed from unchanged files
2020-03-24 neslisah.torosdagli copyright notice changes removed from unchanged files
2020-03-24 neslisah.torosdagli spirv.hpp reverted to commit f368dcbb7d8af23f0cba3015d0f4dda9dc3aa66d
2020-03-24 neslisah.torosdagli .travis updated to origin, rayQueryCheck removed
2020-03-23 neslisah.torosdagli const rayFlag defs used in the test cases in stead of numerical values
2020-03-23 neslisah.torosdagli compute and fragment shader test_cases added for rayQuery
2020-03-23 neslisah.torosdagli rayQuery test cases added
2020-03-23 neslisah.torosdagli rayQueryEXT function parameter
2020-03-23 neslisah.torosdagli rayQueryEXT assignment is allowed.
2020-03-23 neslisah.torosdagli test names updated
2020-03-23 kainino update README
2020-03-23 kainino Fix build on CMake 2.8, and fix Web build
2020-03-23 neslisah.torosdagli wait time increased for the install
2020-03-23 neslisah.torosdagli rayQuery test cases disabled
2020-03-20 neslisah.torosdagli GL_EXT_ray_query glslang updates, and test cases added.
2020-03-19 neslisah.torosdagli comment update, rayQueryEXT is writable, readonly check removed.
2020-03-19 ntorosda GL_EXT_ray_query updates
2020-03-18 cepheus Fix #2132: constant matrix constructor from single non-scalar argument
2020-03-19 neslisah.torosdagli comment update, rayQueryEXT is writable, readonly check removed.
2020-03-19 ntorosda GL_EXT_ray_query updates
2020-03-18 cepheus Fix #2132: constant matrix constructor from single non-scalar argument
2020-03-19 neslisah.torosdagli comment update, rayQueryEXT is writable, readonly check removed.
2020-03-19 neslisah.torosdagli GL_EXT_ray_query updates
2020-03-19 ntorosda GL_EXT_ray_query updates

Roll third_party/shaderc/ 3d915b280..f085b9745 (4 commits)

3d915b2802..f085b9745f

$ git log 3d915b280..f085b9745 --date=short --no-merges --format='%ad %ae %s'
2020-03-30 dgkoch Roll glslang dependency to SDK-candidate tag (#1024)
2020-03-30 rharrison Add support for WebGPU to shaderc (#1021)
2020-03-26 rharrison Convert compile options to require explicit environments (#1019)
2020-03-26 dgkoch Roll glslang dependency (#1018)

Roll third_party/spirv-cross/ 871c85d7f..9b3c5e12b (1 commit)

871c85d7f0..9b3c5e12be

$ git log 871c85d7f..9b3c5e12b --date=short --no-merges --format='%ad %ae %s'
2020-03-26 post Add support for forcefully zero-initialized variables.

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

Change-Id: I2ac0196e769f6602d93d9a0659901c05cbcad5e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18280
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-30 19:28:45 +00:00
Natasha Lee 29d712f9de D3D12 Immediately release pending commands
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>
2020-03-30 11:37:44 +00:00
David Neto 5556b4acdd ast::Literal constructor is explicit
Fixes a lint issue

Change-Id: I98225fe5bf966c6fbf9b3b0c88e3d4dcc6a91cca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18041
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-28 00:44:50 +00:00
Yunchao He 81431f5034 Add validation tests for resource usage tracking - 2
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>
2020-03-27 21:40:47 +00:00
David Neto a8bcec3ac1 [spirv-reader] Add TODO for ArrayStride
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>
2020-03-27 21:11:05 +00:00
Austin Eng 06508118eb Merge BindGroupLayout and ShaderModule BindingInfos
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>
2020-03-27 18:54:03 +00:00
David Neto 48442a6cee Fix compilation errors
Change-Id: I4cb46d93559089894d8cecb4ff24b87d208b0f85
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18021
Reviewed-by: David Neto <dneto@google.com>
2020-03-27 17:20:20 +00:00
Corentin Wallez ba53617f6f Vulkan: Load functions for surface extensions we support.
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>
2020-03-27 16:50:59 +00:00
Corentin Wallez 12944c84c9 Metal: Don't crash on invalid shaders
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>
2020-03-27 16:50:11 +00:00
Corentin Wallez ffd94da5f1 Vulkan: Free recording context semaphores on destroy.
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>
2020-03-27 16:48:39 +00:00
Corentin Wallez e784d8d0dc Vulkan: Use EXT_metal_surface instead of MVK_macos_surface
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>
2020-03-27 16:37:17 +00:00
Corentin Wallez a44221d05b Vulkan: Make GatherSurfaceInfo use ResultOrError
Bug: dawn:269

Change-Id: I80ac5ce170b2e7630d8524cd34375bf0f1c67a60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17961
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-27 16:35:17 +00:00
Corentin Wallez 97ec825cde Vulkan: Don't use vulkan.h's prototypes.
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>
2020-03-27 16:32:24 +00:00
Yunchao He 3665d28e6e Add validation tests for resource usage tracking
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>
2020-03-27 15:52:50 +00:00
dan sinclair 136fa11d53 Fixup compilation issues with type manager.
This CL fixes up some issues with the type manager.

TBR=dneto@google.com

Change-Id: I2d05935f26490fd8d20b1b6b1b61692a45e4a0f3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17940
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-27 01:50:13 +00:00
David Neto 288674904d [reader-spirv] Convert array, runtime array types
Bug: tint:3
Change-Id: If0d7d38cc777bce3d86dfd83669c1572331d4ed6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17800
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-27 00:49:03 +00:00
David Neto a8cd18e9e7 Context object owns a TypeManager
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>
2020-03-27 00:47:16 +00:00
dan sinclair 20145170fc [spirv-writer] Generate pointer types
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>
2020-03-27 00:47:03 +00:00
dan sinclair 083def41c0 [spirv-writer] Add array type generation.
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>
2020-03-27 00:46:43 +00:00
dan sinclair 113fb07071 [spirv-writer] Generate constants
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>
2020-03-27 00:45:34 +00:00
Bryan Bernhart 4b1be08ec9 perf_tests: Update perf_test_runner format.
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>
2020-03-26 17:46:25 +00:00
Austin Eng 0847cb4637 Convert LayoutBindingInfo to an array of BindingInfos
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>
2020-03-26 17:22:14 +00:00
dan sinclair bf46de42ad [spirv-writer] Emit struct names
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>
2020-03-26 15:49:06 +00:00
dan sinclair 989cee6d33 Move tests into anonymous namespace.
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>
2020-03-26 15:31:43 +00:00
dan sinclair f26d9a8f26 Cleanup doc and lint warnings.
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>
2020-03-26 15:31:36 +00:00
Jiawei Shao d5db214564 Collect if a storage texture is declared as multisampled in shader
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>
2020-03-26 00:46:38 +00:00
dan sinclair 33d34650e8 [spirv-writer] Emit function signatures.
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>
2020-03-25 19:43:20 +00:00
dan sinclair 9981b63fa4 Use a context object instead of a singleton
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>
2020-03-25 19:16:36 +00:00
dan sinclair 0984214d8b [wgsl-writer] Add statement writer helper.
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>
2020-03-25 18:54:01 +00:00
Bryan Bernhart 046389926f D3D12: Add end2end tests for small shader-visible heaps.
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>
2020-03-25 18:31:08 +00:00
dan sinclair 235ceebe37 Add type manager synchronization comment.
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>
2020-03-25 15:56:43 +00:00
David Neto 5e6d033a9e [reader-spirv] Convert vector, matrix types
Bug: tint:3
Change-Id: I4857d36da65fce7a413258f33d7dc4f3d9501c9b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17702
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-25 14:33:45 +00:00
Jiawei Shao 0eff2a2b46 Add validations on the creation of bind groups with storage textures
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>
2020-03-25 07:53:37 +00:00
David Neto 71e1d81654 Add reader::spirv::ParserImpl::ConvertType
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>
2020-03-24 21:42:16 +00:00
dan sinclair 69b9c1b8e0 [spirv-writer] Generate struct types
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>
2020-03-24 21:40:10 +00:00
David Neto 6cd52e30ef Fix typo
Change-Id: Ic5845cff3e6e708ce88670f3d6038e339a94f33e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17660
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-24 19:55:29 +00:00