Commit Graph

2168 Commits

Author SHA1 Message Date
Jose Dapena Paz 1917dc27c2 IWYU: unique_ptr usage in ChunkedCommandSerializer requires including <memory>
Fix build breakage in libstdc++:
../../third_party/dawn/src/dawn_wire/ChunkedCommandSerializer.h:84:34: error: ‘unique_ptr’ is not a member of ‘std’
   84 |             auto cmdSpace = std::unique_ptr<char[]>(new (std::nothrow) char[requiredSize]);
      |                                  ^~~~~~~~~~
../../third_party/dawn/src/dawn_wire/ChunkedCommandSerializer.h:24:1: note: ‘std::unique_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?

Bug: chromium:957519
Change-Id: I35b129225882a3f9b758c4f49d1a3cace22aacfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30600
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-10-20 19:48:31 +00:00
dan sinclair c4593127cb Include compiler header
This pulls in the DAWN_UNUSED macro.

Change-Id: Id3551c7835b5177c3715d27a1c43d32c9a272bd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30520
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-10-19 20:42:50 +00:00
Corentin Wallez 6298b63df8 Roll third_party/swiftshader/ 2014e7b92..df17a7610 (79 commits)
Suppress a couple failing tests cause by Swiftshader's fast resolve
algorithm.

https://swiftshader.googlesource.com/SwiftShader/+log/2014e7b9290e..df17a76102df

$ git log 2014e7b92..df17a7610 --date=short --no-merges --format='%ad %ae %s'
2020-10-15 srisser Make abort on LOG_TRAP opt-in
2020-10-16 cwallez MetalSurface: correctly handle the window resizing.
2020-10-05 amaiorano Add unit tests for arithmetic ops with constant args
2018-02-01 eholk Handle mul instructions with two immediates on x86-32 and x86-64
2020-10-14 natsu Revert "Revert "Update virlg_hw path to reflect Minigbm""
2020-09-10 sugoi Fix CommandPool memory management
2020-10-12 bclayton SpirvShaderDebugger: Improve stepping for inlined functions
2020-10-10 natsu Revert "Update virlg_hw path to reflect Minigbm"
2020-10-10 swiftshader.regress Regres: Update test lists @ 139f5c35
2020-10-08 natsu Update virlg_hw path to reflect Minigbm
2020-09-19 capn Fix depth bias calculations
2020-10-08 capn Move interpolant clamping out of interpolate()
2020-10-08 bclayton SpirvShaderDebugger: Fix store() of arrays
2020-10-08 bclayton SpirvShaderDebugger: Improve ASSERT() messages
2020-10-07 bclayton SpirvShaderDebugger: Have Function inherit LexicalBlock
2020-09-30 capn Remove float division-by-zero prevention
2020-10-05 srisser Replace WARN with a LOG_TRAP
2020-10-05 srisser Reflect VK_KHR_create_renderpass2 being core
2020-10-05 zzyiwei Update Vulkan headers to version 1.2.156
2020-10-05 capn Regres: limit the number of GL tests opening X connections
2020-10-03 bclayton CMake: Add flag for controlling the logging level
2020-10-03 bclayton third_party/cppdap: Roll forward to 1fd23dda
2020-10-02 nicolascapens Regres: List regressions before summary
2020-09-16 vantablack Added support for AndroidHardwareBuffer
2020-10-02 bclayton Squashed 'third_party/marl/' changes from d29553a3730..f1c446ccdc0
2020-09-30 zzyiwei Use vndk/window.h instead of the system one
2020-10-01 swiftshader.regress Regres: Update test lists @ 5e947ada
2020-09-30 capn Fix clamping cube face coordinates to [0.0, 1.0) range
2020-09-30 nicolascapens Fix delegating eglCreateWindowSurface to CreatePlatformWindowSurface
2020-09-30 amaiorano Fix GN build
2020-09-18 amaiorano Optimize transcendentals for Subzero
2020-09-18 caramelli.devel EGL_KHR_platform_x11: wrong implementation in CreatePlatformWindowSurface()
2020-08-01 caramelli.devel Add DirectFB support for Vulkan WSI
2020-09-16 srisser Add VK_KHR_imageless_framebuffer
2020-09-22 bclayton SpirvShaderDebugger: Mark II
2020-09-25 bclayton Vulkan/Debug: Support Locations as hashmap keys
2020-09-28 bclayton System/Types: Add support for vec3
2020-09-28 bclayton Pipeline: Remove hack to disable spirv-opt when debugging
2020-09-25 bclayton Vulkan/Debug: Add Context::Lock::findFile()
2020-09-25 bclayton src/Pipeline: Misc fixes
2020-09-25 bclayton Vulkan/Debug: Various fixes / improvements to Thread
2020-09-25 bclayton Vulkan/Debug: Don't accumulate function breakpoints
2020-09-25 bclayton Vulkan/Debug: Overhaul Values / Variables
2020-09-25 bclayton Vulkan/Debug: Assert on locking context twice on same thread
2020-09-25 bclayton Vulkan/Debug: Add File::getBreakpoints()
2020-09-25 bclayton Vulkan/Debug: Split EventListener
2020-09-25 bclayton Pipeline: Fix return type of SIMD::Pointer::limit()
2020-09-25 bclayton Pipeline: Assign to SpirvRoutine::pointCoord
2020-09-24 sdefresne Explicitly filter assigments to sources variable
2020-09-23 egranata Fix a linker problem with ARM/thumb compatibility
2020-09-17 srisser Implement VK_KHR_image_format_list
2020-09-11 hidehiko Expand is_linux to is_linux || is_chromeos.
2020-04-08 natsu Support Gralloc4 in SwiftShader
2020-09-14 swiftshader.regress Regres: Update test lists @ dc552fce
2020-09-11 amaiorano CMake: normalize FOLDER property for third_party targets
2020-09-14 bclayton SpirvShaderDebugger: Add PRINT_EACH_DEFINED_DBG_INSTRUCTION
2020-09-14 bclayton SpirvShaderDebugger: Implement DebugValue
2020-09-14 bclayton SpirvShaderDebugger: Reduce lock contention
2020-09-11 capn Drop the float literal suffix
2020-09-01 jaebaek Allow OpTypeVoid for debug function return type
2020-09-09 sugoi Update PowerVR Samples to ToT
2020-09-08 capn Fix register assignment for constant arrays
2020-09-08 capn Fix component swizzle for uniform texel buffers
2020-09-08 sugoi Allow alphaToCoverage with a single sample
2020-08-26 capn Regres: Roll dEQP to latest tip-of-tree
2020-09-03 capn Don't assert on component swizzle matching identity
2020-07-29 caramelli.devel Minor change in detachImage() for Xcb, Xlib, Wayland WSIs
2020-08-06 sugoi DescriptorPool error fix
2020-09-02 sugoi Only use clang specific directives when clang is used
2020-08-26 capn Skip texel address sample offset if zero
2020-09-01 srisser Fix enum-hashing build error on Ubuntu 16.04
2020-09-01 capn Fix undefined behavior in minifloat conversion
2020-08-21 capn Add unit test for 11/10-bit minifloat denormal underflow
2020-09-01 capn Assert multisample resolve has equal input and output formats
2020-08-25 jaebaek Handle OpenCL.DebugInfo.100 DebugOperation
2020-08-25 jaebaek Handle DebugGlobalVariable using DebugInfoNone
2020-08-26 capn Optimize multisample resolve with SSE2 instructions
2020-08-26 capn Add a fast multisample resolve code path
2020-08-26 capn Make multisample resolve a Blitter method

Created with:
  roll-dep third_party/swiftshader

Change-Id: Ib2bd1b2c5109cc4278de388fab612418e6b1c640
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30441
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-10-19 18:35:39 +00:00
Austin Eng aff4c03663 Fix unused variable warnings on ChromeOS
Fixes the build on ChromeOS where the #ifdefs there leave some
variables unused.

Bug: none
Change-Id: I7804fd15112e49a6bda1dadcb4137804409d1642
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30463
Commit-Queue: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-10-19 16:43:19 +00:00
Austin Eng 0406d94e56 Add missing include in SwapChainVk
Missing #include <algorithm> is breaking the Skia-Dawn roll

Bug: none
Change-Id: I4ddcc0fc345f9c991782342a403f11ebd6ee5d17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30461
Commit-Queue: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-10-19 16:11:09 +00:00
dan sinclair a23082534c Fixup cmake file
Change-Id: I6355efbf4ce6cb0f946878b49a457a216544aed5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30462
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-10-19 16:08:39 +00:00
Austin Eng d676f44272 Reland "Replace the wire serializer with a no-op impl on disconnect"
This is a reland of e757c012be

It changes a global noop serializer from a global static to a local
function static that's constructed on first use.

Original change's description:
> Replace the wire serializer with a no-op impl on disconnect
>
> Now that the command serialization knows to no-op if
> GetCmdSpace returns nullptr, when the wire is disconnected,
> we can replace it with a no-op serializer that always returns
> nullptr.
>
> Bug: chromium:951558
> Change-Id: I7363fd10f529119e515eda0e743e1a7839049b9b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30000
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: chromium:951558
Change-Id: I827cdbd212fa585b542fd4ea1eb9654eec6002c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30420
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-10-19 15:59:21 +00:00
Jiawei Shao ae5f950444 Add the entry point of CreateReadyComputePipeline
This patch adds the entry point of CreateReadyComputePipeline in both
dawn_native and dawn_wire.

TODOs:
1. Add more tests in dawn_unittests and dawn_end2end_tests.
2. Put the main logic of creating a pipeline into a separate thread.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I7edd269a5422a8b85320a7f9173df925decba633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30060
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-19 01:56:08 +00:00
Corentin Wallez 47a6a94e15 Initial new swapchains on Vulkan.
Bug: dawn:269

Change-Id: I5b7a4edfa876d5a64f8f135adb619be021e4f534
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17966
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-17 23:31:37 +00:00
Austin Eng 875091308b Cleanup old/deprecated wire and native APIs
Bug: none
Change-Id: Idf9a00d8dc675e1fbc83554c487edcb2dda498c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30001
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-10-16 15:21:16 +00:00
Corentin Wallez 4196a546bf Add wgpu::TextureComponentType::DepthComparison
And deprecate using ::Float in the bind group layout for
"shadow textures" in the pipeline (along with a deprecation test).

Adds the ability to be used with DepthComparison only to depth textures,
this could potentially a breaking change if users where doing
depth-comparison on float32 textures but that's not supported in WebGPU.

Bug: dawn:527
Change-Id: Ib28b0443e3002e0aa2811713b9e843c2417e13e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30240
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-16 14:13:16 +00:00
Corentin Wallez 2a8ada7951 Format: Move the baseType to be per-aspect.
This also introduces a per-aspect supportedComponentTypes that exactly
mirrors baseType for now but will contain additional bits in the future
(like DepthComparison for depth textures).

It is also a step towards being able to create single-aspect view of
depth-stencil textures to sample either the depth or the stencil
component.

Bug: dawn:527

Change-Id: I3ab224d07c136c682cc2993b9a8599237d318130
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30103
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-10-16 14:07:06 +00:00
Austin Eng b1938273e4 Revert "Replace the wire serializer with a no-op impl on disconnect"
This reverts commit e757c012be.

Reason for revert: Uses a static initializer

Original change's description:
> Replace the wire serializer with a no-op impl on disconnect
>
> Now that the command serialization knows to no-op if
> GetCmdSpace returns nullptr, when the wire is disconnected,
> we can replace it with a no-op serializer that always returns
> nullptr.
>
> Bug: chromium:951558
> Change-Id: I7363fd10f529119e515eda0e743e1a7839049b9b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30000
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: I6549cfb27c6c5812e067ea23c6a706e84c78e1a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:951558
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30380
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-10-16 03:03:58 +00:00
Brandon Jones a63a00cd65 Allow Clearing Integer Formats To Large Values
Removes validation preventing integer formats from being cleared to
>2^24. Adds a test that clears to the largest values for UINT32 and
SINT32 formats.

Bug: dawn:537
Change-Id: I8aabd36608138725c8ddbbedd50192c0978da99c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30300
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-10-15 22:23:45 +00:00
Corentin Wallez 877664cead Fix a small typo in Format.cpp alwaus -> always
Bug: dawn:527
Change-Id: I8008dce9bfdfc3dc2782ce70d53eecec011d2316
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30241
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-15 16:42:03 +00:00
Brandon Jones 4ad35865b0 Change Device::Tick To Return Bool
Changes Device::Tick to return a boolean that denotes whether or not
Tick needs to be called again.

Bug: dawn:119
Change-Id: I9d4c7e291536d676b33fc61d652667c1fbff8c62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29980
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-10-15 16:21:03 +00:00
Austin Eng e757c012be Replace the wire serializer with a no-op impl on disconnect
Now that the command serialization knows to no-op if
GetCmdSpace returns nullptr, when the wire is disconnected,
we can replace it with a no-op serializer that always returns
nullptr.

Bug: chromium:951558
Change-Id: I7363fd10f529119e515eda0e743e1a7839049b9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-10-15 15:46:13 +00:00
Corentin Wallez 5931c0ac3b ShaderModule: Don't use Format::Type for reflection.
Previously Format::Type was used instead of wgpu::TextureComponentType
so that ::Other could server as a tag value. This was confusing and
almost the single use of ::Other.

In a follow-up CL the format baseType is changed to be a per-aspect
value, and Format::Type. This CL is a self-contained step in that
direction.

Bug: dawn:527

Change-Id: Ida834087f45a8fca17670ffe8ebd4d5c4f1cd423
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30102
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-15 13:51:33 +00:00
Corentin Wallez 49c30a70e8 TextureView: only store the Aspect as a bitfield.
In follow-up CLs the aspect of texture views becomes more important as
it is used to query the texture format's base type and supported
componenet types.

Previously asking for the AspectInfo for wgpu::TextureAspect::All could
be ambiguous for depth-stencil formats. By using the internal bitfields
the constraint is much more clear that a single bit must be set.

Bug: dawn:527

Change-Id: Iebff40f28c4a6c38ebe5a7cccf62f8ab3363e4e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30101
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-15 09:15:53 +00:00
Corentin Wallez 6298d2b70c Format: Move the TexelBlockInfo inside an AspectInfo.
In follow up CLs additional will be added to the AspectInfo, like the
supported component types.

Also simplify the logic for GetTexelInfo since all aspects are the first
aspects, except stencil which is always stencil8.

Bug: dawn:517
Change-Id: Iebbcb8a7f8fa2c4b7b06f65d6e4e8917c0a85366
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-15 09:05:03 +00:00
Corentin Wallez 73b70229af dawn.json: Expose the driver version in the adapter.
And use it to print the driver version at the start of
dawn_end2end_tests. This will help when figuring out issues
happening on CQ but not necessarily locally.

Bug: None

Change-Id: Ibdb9ab8cab53cc1e1cf8a807da53edeca616bed9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29602
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-10-14 13:33:15 +00:00
Austin Eng cac0442277 dawn_wire: Support chunked commands
This CL adds support for chunking large commands by first serializing
large commands first into a separate buffer, and then sending the
buffer data chunk by chunk.

This code path is used for large writeBuffer and writeTexture, as well
as the inline memory transfer service for buffer mapping. The transfer
for writeBuffer and writeTexture will be optimized further in Chrome,
and the inline memory transfer service is currently used only in tests.

Bug: chromium:1123861, chromium:951558
Change-Id: I02491a44e653e2383174958d9c3d4a4db6fd7bde
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28882
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-13 22:35:34 +00:00
Ryan Harrison ccaef85257 Add running spirv-val on output of Tint
This also removes an unused param from the ValidateSPIRV method.

BUG=dawn:543

Change-Id: I369a8097ef49751cedbe6605989750a292027b6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29842
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-10-13 15:42:04 +00:00
Kai Ninomiya d1bca09f4a Change rowsPerImage units from texels to blocks
Spec change: https://github.com/gpuweb/gpuweb/pull/958

Bug: dawn:520
Change-Id: I05c4792a2832d12cd68877f2b1b99cdf9ef26925
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29981
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-10-12 23:13:53 +00:00
Natasha Lee 51af1b428f Have Queue timeline tasks resolve in order
Use QueueBase to track fences in flight and map requests so that they
can be resolved in the order they were added. Before these tasks were
separately tracked in FenceSignalTracker and MapRequestTracker, so tasks
would be resolving out of order.

Bug: dawn:404
Change-Id: I8b58fb72c99f43bc4593f56e08920d48ac506157
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29441
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-10-12 22:32:33 +00:00
Corentin Wallez a7b0fdc90f Make SetScissorRect match upstream WebGPU specification.
This allows empty scissors, so add a test for it.
This disallows scissor boxes that are bigger than the renderpass
attachment so remove an end2end test for that behavior.

Update the SetScissorRect validation tests.

Bug: dawn:542
Change-Id: I5b8578a4df1b94510a9356bd4007efddf2711588
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29820
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-12 16:15:23 +00:00
Hao Li 936ef0a5f2 Query API: Timestamp Query on Metal
- Add WriteTimestamp and ResolveQuerySet on Metal
- Enable end2end tests of timestamp query on Metal
- Lazy initialize the distination buffer in ResolveQuerySet
- Update part of end2end tests to test from render pass instead of
  command encoder due to we cannot write timestamp on CommandEncoder
  without any copy commands on Metal.

Bug: dawn:434
Change-Id: Ie9217e1f5a00bc252d6293ef7521c2e343ba9259
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-10-12 11:47:22 +00:00
Corentin Wallez 6c3da3dc5b Make SetViewport validation match upstream WebGPU.
As a side-effect this allows empty viewports which need special handling
in Vulkan because it is not allowed to set width to 0 (but ok to set
height to 0).

Validation tests are updated to cover the new validation checks.

Most of the viewport end2end tests are rewritten because they didn't
pass the new validation.

A new end2end test is added to test various kinds of empty viewports to
cover the extra logic in the Vulkan backend.

Bug: dawn:542
Change-Id: I8bb25612eeed04162a6b942983167eacab3a1906
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29681
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-11 18:39:32 +00:00
Enrico Galli 1c25198384 Adding multiple of 4 validation on indirect draws and dispatches
Bug: dawn:538
Change-Id: I6f4d8fb73a9fff910bdcd105f66299dc6afb61cd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29761
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-10 00:06:30 +00:00
Stephen White 793a07e366 Fix MSVC build of SerialStorage.h.
Use "protected" rather than "private" for the using declarations.

Bug: dawn:544
Change-Id: I1166016fd11d9e2b512f08194f4f4c3f628d0c27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29845
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2020-10-08 22:14:39 +00:00
Kai Ninomiya 6b4a4a85df Fix EntryPointTests WGSL shaders for Tint roll
Should fix Chromium FYI and Dawn CQ.

Followup to https://dawn-review.googlesource.com/c/dawn/+/29521

Change-Id: I62ba98ff234d3aceb6cc429d1e23c28f3a1adcbf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29760
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-07 21:54:56 +00:00
Corentin Wallez 4171134daf Buffer: Validate the offset is aligned to 8
This is to match the upstream WebGPU spec.

Bug: dawn:445

Change-Id: I1a511ed9a2a04c7b95368ce724d69c128158f097
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29360
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-10-07 17:19:53 +00:00
dan sinclair b581d26e51 Re-enable disabled test.
The upstream Tint issues have been fixed and Tint has rolled. This CL
re-enables the disabled test.

Bug: tint:263
Change-Id: Id8a73e198c15c74c55dc9b26603f4a3850d995b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29680
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-10-07 15:45:23 +00:00
Corentin Wallez c1cce0c57d Buffer: Disallow unmapping when unmapped.
This is to match the upstream WebGPU spec.

Bug: dawn:445

Change-Id: I4246487247fdba8d90a119c1970d6d4df3235835
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29361
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-07 15:14:03 +00:00
Corentin Wallez 3066cd3387 dawn_wire: Guarantee OOM on MAX_SIZE_T sized buffers.
This can be used to simplify some logic in Blink.

Bug: dawn:445

Change-Id: I9859c51bc95f564847035533426675188eb8ef99
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29362
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-07 15:03:33 +00:00
dawn-autoroll 6620efb9a8 Roll Tint from d3f75ca0e8 to 90ee6c4360 (56 revisions)
** With manual buildfixes. **

https://dawn.googlesource.com/tint.git/+log/d3f75ca0e8be..90ee6c436017

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/tint-dawn
Please CC kainino@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Bug: None, tint:263
No-Try: True
Change-Id: I374db968c616c8a12721cdb9c73a46a3495748c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29521
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-10-06 20:10:52 +00:00
Austin Eng 16e01affcb Reland "Add a per-thread proc table using thread local storage"
This is a reland of b04a92f01b
with the deletion of a duplicate exported function in dawn_wire that
was causing a compilation failure on Windows.

Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: none
Change-Id: Id90e5372132cd93a2f8631c8185d0e71b01bc1af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29443
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-06 16:13:42 +00:00
Enrico Galli db2c2dd9b9 Add support for depthBias, depthBiasSlope, and depthBiasClamp
Bug: dawn:524
Change-Id: I2586aadbc326f58889314a2d10794bcc0572aaba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28300
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-06 08:12:29 +00:00
Kai Ninomiya 326e14f34b Revert "Add a per-thread proc table using thread local storage"
This reverts commit b04a92f01b.

Reason for revert: Build failed on win-archive-dbg; see:
https://chromium-review.googlesource.com/c/chromium/src/+/2450792

Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: I4587b457b7b2dd5d3c7457065bf4e77b95af59d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29442
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-10-05 22:35:40 +00:00
Austin Eng b04a92f01b Add a per-thread proc table using thread local storage
In situations where both dawn_wire and dawn_native are used on separate
threads (Chrome with --single-process or --in-process-gpu), it's
desirable to have a per-thread proc table so that the WebGPU C++ API can
still be used. This eliminates classes of bugs with manual
reference/release errors.

This also changes many of the GetProcs functions to return const
references to the static proc tables known at compile time, instead of a
copy.

Bug: none
Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-10-05 19:53:58 +00:00
Corentin Wallez df90930683 wire::client: Make Buffer::MapAsync surface server-side errors.
In the WebGPU specification, validation errors for mapAsync take
precedence over the early-unmap or early-destroy promise resolution.

Change the client to wait for the mapAsync status from the server before
sending the cancelation through the callback. If the server sends back
an error, then it takes precedence over the client-side status.

Also adds tests for the updated semantic.

Bug: dawn:445

Change-Id: I7bf1d8bbb3cb62d73ab19ecdf0aad2963e854964
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29300
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-05 11:03:21 +00:00
Stephen White ed3a93f690 Fix rectangular mipmap textures used as color attachments.
ValidateOrSetAttachmentSize() was asserting that
textureSize.width >> attachment->GetBaseMipLevel() is nonzero.
This is not true for rectangular textures, where the smaller dimension
may hit the lower bound and must be be clamped at 1.

Fixed by calling GetMipLevelVirtualSize() which performs the clamp.

Added a test which exercises rectangular mipmapped textures as color
attachments. This required a few fixes to the test harness, which had
the same bug as that fixed in the code (assumes (width >> size) > 0).

Bug: dawn:535
Change-Id: Idde3b68feb14d8a241803d09a094b059d9935d91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29261
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2020-10-02 16:15:40 +00:00
Brandon Jones 16ebcf601d Limit Clear Color Values to 2^24 For Integer Formats
Adds validation to ensure clear colors do not exceed 2^24 and a
corresponding unit test. Also removes intermediate float conversions
that are no longer necessary.

Bug: dawn:525
Change-Id: I020b98de85384c20da51158de79eab87f60dcf6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29040
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-01 19:56:49 +00:00
Ryan Harrison da5828c06b Add Tint SPIRV->SPIRV to fuzzing code path
Since we are intending to ship using Tint for normalization, fuzzing
should include this transform.

BUG=dawn:531

Change-Id: Ica25c3bbdc6ff392d5e31361734de43fd1c12815
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-30 17:50:14 +00:00
Corentin Wallez e2cb68b024 TextureFormatTest: Test components not present in the format.
For sampling, check that formats without 4 components sample them as
(0, 0, 0, 1) instead. For rendering, check that extra components output
by the shader are ignored.

Bug: None
Change-Id: Ib49fcaa58e984d821667e992d3ddb1bb093bdba0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29061
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-30 09:22:04 +00:00
Austin Eng ad421a248a Remove AMD test suppression in VulkanImageWrappingTests
This has been fixed by the layout transition fixes. The dedicated
memory bug doesn't seem relevant at this time.

Bug: dawn:200, dawn:206
Change-Id: I953a20850881f64f5ff5ddbede9aed3a835d22da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29123
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-29 20:54:43 +00:00
Corentin Wallez 172cd1e8df TextureFormatTests: Test more Snorm format corner cases.
Bug: None
Change-Id: I02cba96f64d62495e21ba04bb514de9fb1563507
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29060
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-29 09:47:26 +00:00
Austin Eng b2a4e87ad2 Un-skip WriteTexture test on Swiftshader
Fixed in the roll of Swiftshader.

Bug: dawn:483
Change-Id: I8baad1d8d61e7b99c01dc27f929da830ca30c8d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29081
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-28 22:05:24 +00:00
Corentin Wallez 62139fcca7 Use typed integers for the ExecutionSerial
This will prevent mixing it up with other serial types in the future.

Bug: dawn:442
Change-Id: I74e964708acc62eb0f33127cc48f1b9a7b171d11
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28923
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-28 19:35:14 +00:00
Corentin Wallez ad4a66ec8f D3D12: Use typed integers for the ExternalMutexSerial
This will prevent mixing it up with other serial types in the future.

Bug: dawn:442
Change-Id: Ia1ec00572fa268e48349f7d9e39234ec8f5d3953
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28961
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-28 17:10:24 +00:00
Corentin Wallez cac14e0067 D3D12: Use typed integers for the HeapVersionID
This will prevent mixing it up with other serial types in the future.

Bug: dawn:442
Change-Id: I32f356c62f19ef29f3bf51c19873369fb817bb16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28960
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-28 16:05:24 +00:00
Corentin Wallez 306fc502cf Use typed integers for the Fence FenceAPISerial
This will prevent mixing it up with other serial types in the future.

Bug: dawn:442
Change-Id: I1cdb35ee01be3c771183003bc357c84d46aa5745
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28922
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-28 15:11:04 +00:00
Corentin Wallez 53cdbead78 Use typed integers for the Buffer MapRequestID
This will prevent mixing it up with other serial types in the future.

Bug: dawn:442
Change-Id: Ie655d57722fcd79c82acc5aac429aed2c2741c3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-28 14:14:44 +00:00
Corentin Wallez 145f115c54 SerialQueue/Map: Take the serial type as type paramater.
This is in preparation for follow-up CLs that will use typed integers
for the various serial types.

Bug: dawn:442

Change-Id: I5296546e96acd6ac9f7a0bfc46dc7eba40cb3cf5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28921
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-28 12:28:13 +00:00
Jiawei Shao ed2b465f86 Report more detailed error information for the failures of mapAsync
This patch adds two new buffer map async status "destroyed before
callback" and "unmapped before callback" to replace the status "unknown"
so that the developers can get more details when meeting such errors in
the call of buffer mapAsync.

Note that this patch still preserves "unknown" as it is still being used
in Chromium.

BUG=dawn:533
TEST=dawn_unittests

Change-Id: I12deefb49311ea6adea72c24e4e40797dd7eb4a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28883
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-27 02:00:52 +00:00
Hao Li ddef7a04a2 Query API: QuerySet on Metal
- Add query set creation on Metal backend
- Enable end2end tests for query set creation

Bug: dawn:434
Change-Id: I7fe013192ae215b6b97cfdb646a8dd6f2596d4af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28800
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-25 08:49:30 +00:00
Corentin Wallez eec9edfd57 Standardize the use of UNREACHABLE in switches.
A lot of our switches over enum values use the following pattern:

    default:
        UNREACHABLE();
        return foo;

This is problematic because when adding a new value to one of the WebGPU
enums, there is no compilation error for switches that are missing it.
Currently we're supposed to write code and tests and fix UNREACHABLEs when
we see them.

Instead we should strive to have most switches on enums to be complete
and explicitily tag unreachable values as UNREACHABLE. Some switches
might still want to use default: UNREACHABLE() if only a couple values
need to be handled out of very many.

In this CL we go through all the UNRAECHABLEs and change them if need
be. Also an ErrorQueue class is added to avoid having
QueueBase::SubmitImpl just be UNREACHABLE (and force overriding
instead).

Bug: dawn:527
Change-Id: I33dfb4703104912cc5f001f9faf907a61324de68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28501
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-09-24 14:56:50 +00:00
Corentin Wallez a46737c0aa Add wgpu::BindingType::MultisampledTexture
And deprecate wgpu::BindGroupLayoutEntry.multisampled.

Bug: dawn:527

Change-Id: I00f38eb6b1f82f9d9aedda5da23b1350263a3044
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28562
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-09-24 11:41:07 +00:00
Corentin Wallez ed0b3cf153 Refactor PipelineLayoutBase::CreateDefault
This function was bit long and was difficult to read. Refactor it to use
a single double keyed map and helper functions.

Bug: dawn:527

Change-Id: I8c1173fd0e06256c7e7060a850996e1e90187d50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28640
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-24 11:27:47 +00:00
Yan, Shaobo 75e5ed6161 Support Noop Copy for B2T, T2B and T2T Copies
In B2T, T2B and T2T copies, copySize has 0 in width, height or depth
will trigger errors in D3D12 backend.

This patch bypass the command record step for noop copy. But all
validation rules still applies to the copy.

BUG=dawn:255

Change-Id: I4d01cef2e3c1f78440014c2c6ac63a48310d99af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28521
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-23 10:28:26 +00:00
Corentin Wallez a3651d2fe0 Fix deprecation errors for indexFormat being set.
Bug: dawn:502
Change-Id: Ib49a1e6cceb0632792a499314f5e0e4b3434deb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28780
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-23 07:23:56 +00:00
Corentin Wallez 9d0d18d952 Fix compilation on ChromeOS
TBR=enga@chromium.org
Bug: dawn:200
Change-Id: I35a414a25deed9d1d66e7ce510a704aaa0548fa9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-23 07:21:06 +00:00
Austin Eng 0b29732cd8 Pass the old/new VkImageLayouts to Vulkan image import/export
Returning the layouts from an export operation and then using
them in a subsequent import operation allows the import to preserve
the texture contents.

This fixes Vukan image wrapping on some AMD/NVIDIA devices.

Bug: dawn:200
Change-Id: Icbb6e759856d410bb69724b9f439bc3088756d19
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28380
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-22 20:10:46 +00:00
Brandon Jones 670858da9b Change wgpu::Color from floats to doubles
Change dawn.json to reflect changes in the WebGPU IDL. Also fixes any
conversion issues in Dawn.

Bug: dawn:525
Change-Id: Ifb46329f073bcf31d43342f20f4819eac061d5a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-09-22 16:51:36 +00:00
Bryan Bernhart 6db3a24c19 Revert "Disable debug layer logger"
This reverts commit 52a588f3c9.

Reason for revert: added a workaround to filter out messages.

Original change's description:
> Disable debug layer logger
>
> This logger is producing too much output on Windows and causing
> Chromium's gtest harness to kill the tests.
>
> Tbr=cwallez@chromium.org
> No-Try: true
> Bug: chromium:1130483
> Change-Id: I1990bc800bbb7eda62901d14f656375c30fbeef2
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28740
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org

Bug: chromium:1130483
Change-Id: Ifeee73838a957f619dfdb977f21585fe8abacc3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-09-22 16:23:06 +00:00
Corentin Wallez 5b4e5fbe1f Simplify the BindGroupLayout validation code.
It was using a lot of calls to helper functions full of switches that
were hiding the logic that's relatively simple.

Bug: dawn:527
Change-Id: Iaf2603efa255df5ba2f44989b5375d433f04d5df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28561
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-09-22 13:47:05 +00:00
Corentin Wallez aeda49ba50 Reuse BGL validation in default layout computations.
Instead of calling validation functions directly in
PipelineLayoutBase::CreateDefault, use ValidateBGLDesc and
ValidatePipelineLayoutDesc.

  Also makes the visibility of the default layout match the aggregation as
in the WebGPU spec.

  Also makes refcounting of BGLs a bit less manual at the bottom of
CreateDefault.

  Also adds tests for minBufferBindingSize and visiblity aggregation in
the default layout computations.

Bug: dawn:527
Change-Id: I6bbd5f3de8b235dddf6cbd2bedfd34a094fcb277
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28560
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-09-22 11:04:45 +00:00
Austin Eng 52a588f3c9 Disable debug layer logger
This logger is producing too much output on Windows and causing
Chromium's gtest harness to kill the tests.

Tbr=cwallez@chromium.org
No-Try: true
Bug: chromium:1130483
Change-Id: I1990bc800bbb7eda62901d14f656375c30fbeef2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-21 21:21:04 +00:00
Enrico Galli 6e2415256c Handle debug markers commands on command encoder
This CL adds support for InsertDebugMarker, PushDebugGroup, and
PopDebugGroup commands to CommandBuffer backends.

Bug: dawn:44

Change-Id: Iaf075023d3072534fca02b71c0e205cbaa46cd0f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28602
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
2020-09-18 23:10:11 +00:00
Corentin Wallez 1da25e5103 Add -Wduplicate-enum and -Wrange-for-analysis
These warnings are used in Skia.

Bug: None
Change-Id: I1948f448a89b0c213ce1aacd6bb8532f90d399be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28160
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-18 14:38:01 +00:00
Corentin Wallez c01b26490a Remove wgpu::BindingType::StorageTexture
It isn't in the upstream WebGPU spec and completely unimplemented in
Dawn.

Bug: dawn:527
Change-Id: I2023c7b1de2a9fa50d26ab1678b7ef7e32c64af6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28500
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-18 10:31:40 +00:00
Hao Li d6498a41ab Query API: Timestamp Query on Vulkan
- Add WriteTimestamp and ResolveQuerySet on Vulkan
- Enable end2end tests of timestamp query on Vulkan
- Lazy initialize the distination buffer in ResolveQuerySet

Bug: dawn:434
Change-Id: Idbd117d6c198f6726ed922c08d030bb6fbae8be6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-09-18 01:27:40 +00:00
Bryan Bernhart ac3765e663 D3D12: Align UBO sizes to 256B.
D3D debug layer uses the descriptor size (width) to
validate CBV bounds when directly allocating UBOs.
This causes validation failure when the buffer size
is misaligned (ie. not a multiple of 256B) even
through the underlying resource heap size is always
64KB aligned.

This change always aligns the buffer size to be 256B
to avoid such validation error should sub-allocation
fail.

BUG=dawn:506

Change-Id: Ic9072934cac65cfd25d0e2a20cb364bd3ca88e3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26820
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-09-17 23:30:40 +00:00
Ryan Harrison 95e715873d Enable running robust buffer access pass on shaders
In addition to adding the pass running logic, how shaders are stored
in the ShaderModule is changed, so that cached shader that was used to
create the ShaderModule is differentiated from the
modified/intermediate shader that is actually being passed to
SPIRV-Cross.

Also rolling SPIRV-Tools to pick up a fix for a bug I discovered in
the RBA pass implementation.

Roll third_party/SPIRV-Tools/ fd05605be..34ef0c3fd (25 commits)

fd05605bef..34ef0c3fdc

$ git log fd05605be..34ef0c3fd --date=short --no-merges --format='%ad %ae %s'
2020-09-16 rharrison Fix missed modification flagging (#3814)
2020-09-16 andreperezmaselco.developer spirv-fuzz: Use an irrelevant id for the unused components (#3810)
2020-09-16 stefanomil spirv-fuzz: Improvements to random number generation (#3809)
2020-09-16 greg Add buffer oob check to bindless instrumentation (#3800)
2020-09-16 vasniktel spirv-fuzz: Remove CanFindOrCreateZeroConstant (#3807)
2020-09-15 andreperezmaselco.developer spirv-fuzz: Add bit instruction synonym transformation (#3775)
2020-09-16 vasniktel spirv-fuzz: Skip unreachable blocks (#3729)
2020-09-15 afdx Fix build errors (#3804)
2020-09-15 vasniktel spirv-fuzz: Handle invalid ids in fact manager (#3742)
2020-09-15 vasniktel spirv-fuzz: Support memory instructions MoveInstructionDown (#3700)
2020-09-15 stefanomil spirv-fuzz: Pass submanagers to other submanagers when necessary (#3796)
2020-09-15 stefanomil spirv-fuzz: Transformation to flatten conditional branch (#3667)
2020-09-14 46493288+sfricke-samsung spirv-val: Add BaseInstance, BaseVertex, DrawIndex, and ViewIndex (#3782)
2020-09-14 dnovillo Properly mark IR changed if instruction folder creates more than one constant. (#3799)
2020-09-11 afdx Add missing file to BUILD.gn (#3798)
2020-09-11 antonikarp spirv-fuzz: Add TransformationDuplicateRegionWithSelection (#3773)
2020-09-11 afdx spirv-reduce: Support reducing a specific function (#3774)
2020-09-10 afdx spirv-reduce: Refactoring (#3793)
2020-09-10 afdx Favour 'integrity' over 'coherence' as a replacement for 'sanity'. (#3619)
2020-09-10 antonikarp spirv-fuzz: Fix header guards in transformations/fuzzer passes (#3784)
2020-09-10 paulthomson spirv-fuzz: Add SPIRV_FUZZ_PROTOC_COMMAND (#3789)
2020-09-10 paulthomson Add missing include (#3788)
2020-09-09 paulthomson Improve spirv-fuzz CMake code (#3781)
2020-09-08 stevenperron Allow SPV_KHR_8bit_storage extension. (#3780)
2020-09-08 stefanomil spirv-opt: Add function to compute nesting depth of a block (#3771)

Created with:
  roll-dep third_party/SPIRV-Tools

BUG=dawn:523,dawn:480

Change-Id: I1f424f5fe6d67999412f286e831ea2ea26372b9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-17 19:58:40 +00:00
Austin Eng 4099f65525 Typeify VertexBufferSlot and VertexAttributeLocation
Bug: dawn:442
Change-Id: Ic4c29eed51984d367dc7fd6055e33d26bfc7faed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28041
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-17 19:07:00 +00:00
Hao Li 6419bddd9b Add buffer lazy initialization before resolve queries on D3D12
- Reomve buffer initialization at buffer creation in end2end tests,
and implement lazy initialization when resolving queries to buffer
on D3D12 backend.
- Add buffer lazy zero init tests for resolveQuerySet on D3D12.
- For other backends, buffer lazy initialization will be added when
its resolve method is implemented.

Bug: dawn:434
Change-Id: Ib91c004b37ca912135a1c2fbb53bbd16e2d4eac6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28461
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-09-17 01:59:29 +00:00
Corentin Wallez 19b910d796 Make dawn components support CMake's BUILD_SHARED_LIBS
Convention in CMake land is that libraries default to STATIC or
SHARED based on BUILD_SHARED_LIBS. Do that for Dawn components
that users will link against, but make sure to correctly set
macros used for the export headers.

Bug: None

Change-Id: I6a96cb95706b63c18942424baada11ff81691866
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28503
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-16 19:03:18 +00:00
Corentin Wallez c236769548 Fix CMake build on Mac
Bug: None
Change-Id: I7e5410338707628ac0632e20ba720c3f271a1751
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28502
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-16 17:11:28 +00:00
Hidehiko Abe 948b3a0555 Expand is_linux to is_linux || is_chromeos.
Currnetly ,is_linux GN variable is set to true on Chrome OS build,
but it is planned to be set false. This CL is the preparation
to keep the bahavior compatible.

Bug: chromium:1110266
Test: Build locally.
Change-Id: Iffbfafe3ac5b00899804afa7471a04709046610a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28340
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
2020-09-11 02:24:16 +00:00
Bryan Bernhart 9427c97d9c Fix ASSERT in WindowsDebugLogger again
If debugger was already attached, closing
the exit handle would incorrectly assert.

Bug: None
Change-Id: I322591c66a9885a260a87750e066ba2e9d07fe23
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28321
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-10 15:53:47 +00:00
Corentin Wallez 498d5ea20a Rename BC6HRGBSfloat to BC6HRGBFloat
Bug: dawn:22
Change-Id: Ib579e15ff923cbd7c4f523a58c2ef582d39ba7c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-10 08:48:57 +00:00
Jiawei Shao 87f25134a8 Vulkan: Combine all the barriers before dispatch() in one call
This patch combines all the resource barriers added before each
dispatch() into one call to reduce the number of
vkCmdPipelineBarrier() in the Vulkan command buffer.

BUG=dawn:522

Change-Id: I1b5943e62eb0a09db96de12196fcabb3448e9e4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28283
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-10 00:26:07 +00:00
Corentin Wallez 39d1cc9e9c ShaderModule: Add support for multiple entryPoints
Also adds validation tests that reflection data is correctly computed by
entryPoint, and end2end tests that using a shader module with multiple
entryPoints works correctly.

Bug: dawn:216
Change-Id: Id2936bb220d4480872a68624996e4c42452a507d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28244
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 23:11:57 +00:00
Corentin Wallez b8712c01c1 D3D12: Make HLSL generation per-entrypoint.
Also make the CompileShaderDXC/FXC standalone functions because
they don't use ShaderModule except to GetDevice().

Bug: dawn:216
Change-Id: Iaec9abe52ad4422891474086c3b973baf07046a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28243
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:55:17 +00:00
Corentin Wallez 28efed139f OpenGL: Make GLSL generation per-entrypoint.
Bug: dawn:216
Change-Id: I7b4c0e9c210af59711318a744d8055cfb9b82092
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28242
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:51:37 +00:00
Corentin Wallez 676e8f39df Metal: Use ShaderModule reflection when possible.
This change the Metal backend in preparation for supporting multiple
entrypoints:

 - Explicitly set the spirv_cross entry point before compiling.
 - Moves gathering of the local size to the frontend as it will be
   useful for validation in the future.
 - Query spirv-cross for the modified entrypoint name instead of
   duplicating the code in Dawn.
 - Move some conversion helpers from ShaderModule.cpp to their own
   SpirvUtils file.

Bug: dawn:216
Change-Id: I87d4953428e0bfeb97e39ed22f94d86ae7987782
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28241
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:47:07 +00:00
Corentin Wallez 947201da19 Make ShaderModuleBase use its own spirv_cross for reflection.
Bug: dawn:216
Change-Id: Ie79aaeb3a878960606e8c09a4969bf7a1dbe1b13
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28240
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:44:57 +00:00
Aleksi Sapon 97b880e6ff Add missing CMake spirv-cross dependency
Also add a missing SPIRV-Tool link

Change-Id: I0d81b6878f09017147b9ccbe21a5784383535ba9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-09 16:39:00 +00:00
Jiawei Shao 12e97ed6a7 Transition bind group resource states before dispatch in compute pass
This patch fixes a crash issue in both D3D12 and Vulkan backends.
Previously on D3D12 and Vulkan before a compute pass we transitioned
the states of all the resources used in the pass, and before each
dispatch call we only checked if the states of the storage buffers,
read-only storage textures and write-only storage textures need to
be transitioned. This behavior causes two issues:

1. In a compute pass a buffer or texture can be used as both read-only
and writable usages in different dispatch calls (e.g. as storage
buffer in the first dispatch, and as the uniform buffer in the next
dispatch), while this is invalid state combination on D3D12 and isn't
allowed by D3D12 validation layer.
2. In the above case, the state of the buffer is not transitioned into
UNIFORM, which does not match the required state in the next dispatch.

This patch fixes this issue by transitioning all the states in the
current bind group before each dispatch() instead of the beginning
of the compute pass.

BUG=dawn:522
TEST=dawn_end2end_tests
Change-Id: Ibeb6c41dc493ee1068b43bd89ed5a15f2331ef75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27942
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-09 01:14:38 +00:00
Austin Eng 7b7e098b11 Typeify ColorAttachmentIndex
Also moves BindingNumber, BindGroupIndex, and BindingIndex to
IntegerTypes.h. Future TypedIntegers should be declared here.

Bug: dawn:442
Change-Id: I5ba8de3412fb48b7957b67e7c413a5097f8ec00f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27880
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-09 00:08:38 +00:00
Aleksi Sapon 22e5e179fa Vulkan: unused resolve attachments must be marked as such
Change-Id: I61e1e6469c20149df5c6296ee237efced36a163c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28145
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-08 20:24:45 +00:00
Jiawei Shao 62442aceb0 D3D12: Combine all the barriers before dispatch() in one call
This patch combines all the resource barriers added before each
dispatch() into one call to reduce the number of ResourceBarrier() call
in the D3D12 command list.

BUG=dawn:522

Change-Id: I31d1520925e79f6a4ef8168a3713466866b2108c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28100
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-04 01:41:17 +00:00
Ryan Harrison 2cdb9f1ed1 Remove SPVC toggles and excise remaining references
BUG=dawn:521

Change-Id: Ib6428ca366a70d73096f9b4442c1b7fb69a539ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28142
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-03 18:39:37 +00:00
Corentin Wallez 9e261b46a4 Fix compilation with dawn_enable_wgsl=false
Bug: None
TBR=rharrison@chromium.org
TBR=enga@chromium.org
Change-Id: I5376983a0aefbd355a2d2a5da822a34bd6f264dc

Change-Id: I89c8c1e14030f01b76cab0f61cd76526a96ca01e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28120
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-03 08:45:40 +00:00
Ryan Harrison c35e2ba379 Remove usages of SPVC
Remove all usages of SPVC from the code and update the fuzzers. Some
of the include paths and deps came transitively from spvc, so needed
to update build rules.

This patch does NOT remove the flags related to spvc usage, they are
just no-ops as the moment. After this patch lands I will remove the
usage of those flags from the bots, then remove the flags.

BUG=dawn:521

Change-Id: I0d7c3e28f79354c78f00c48b6a383b823094a069
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27900
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-02 22:09:08 +00:00
Austin Eng a1758eef07 Cleanup: always clear Vulkan textures with vkCmdClear*Image
Previously, this code path was gated on whether or not the texture
format is renderable. This should not be the case as this Vulkan
command only requires the texture to have TRANSFER_DST.

Bug: dawn:145
Change-Id: Ifd8f75a70477a8d159c04d1180247cd076c767bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27941
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-09-02 21:03:29 +00:00
Austin Eng ea82272fd6 Cleanup: Make TexelBlockInfo a member of Format, not superclass
Bug: dawn:439
Change-Id: I1255086d29e8b85045776f183b3fb563eec0b090
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27940
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-02 18:50:09 +00:00
Corentin Wallez 8ec8f31e3b Make ShaderModule reflection go through EntryPointMetadata
PipelineBase now collects the EntryPointMetadata for all its
stages which makes the rest of the code agnostic to the entrypoint
name (except D3D12 and OpenGL that required transition hacks and
will be fixed in follow-up CLs).

Bug: dawn:216

Change-Id: I643da198cb2a20a9d94d805a2dc783d6d4346ae9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27260
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-02 15:57:39 +00:00
Corentin Wallez e9bc506e0a TextureVk: Add a couple TODOs related to barriers.
Bug: None
Change-Id: I2da575ce7b79c92f5a2a320334e51e571f672b46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28003
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-02 12:56:29 +00:00
Jiawei Shao 8800135793 Remove Toggle LazyClearBufferOnFirstUse
This patch removes the Toggle LazyClearBufferOnFirstUse and uses
the Toggle::LazyClearResourceOnFirstUse, which means buffer lazy
initialization has been enabled by default in Dawn.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I6b247d9442b57b6bb3cb5a2208467036fef6b293
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-02 00:21:08 +00:00
Austin Eng f114a68b8f Update depth-stencil copy validation
Depth/stencil copies of partial subresources is disallowed in
WebGPU because this is a D3D12 restriction. This restriction
need also to be enforced on B2T, T2B and WriteTexture.

This CL also fixes the subresource whole size calucation to use
the mip level. Previously, the 0th level size was always used.

This CL updates the validation to be correct and adds tests.
The DepthStencilCopy tests are factored into smaller helpers to
reduce code duplication.

Bug: dawn:439
Change-Id: I45d4836f6be1707c5171bddef875e535e935f7f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26660
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-01 18:40:18 +00:00
Brandon Jones ccda6a0009 Various cleanups for updated indexFormat handling
Addresses post-merge comments left by cwallez@ on
https://dawn-review.googlesource.com/c/dawn/+/27182

BUG=dawn:502

Change-Id: I9bce09da9bb46e92a4c613df2279bdefdd06d747
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2020-09-01 18:32:49 +00:00
Jiawei Shao 1c4a7f780f Fix the initialization of the buffers with MapRead and MapAtCreation
This patch fixes the issues on the initialization of buffers with
MapRead usage and mappedAtCreation == true.
1. The buffers with MapRead usage and mappedAtCreation == true can be
   read from the CPU side just after the creation of the buffer,
   however at that time the internal pending command buffers may not
   be executed, thus causing the buffer is not cleared as is expected.
2. On D3D12 the buffer with MapRead and mappedAtCreation == true is
   created on the READBACK heap, so all the data written in the CPU
   side cannot be uploaded to the GPU memory. When the buffer is mapped
   again all the original data written through the CPU pointer will be
   overwritten by the data in the GPU memory (which means it is also
   cleared to 0).

This patch fixes this issue by:
1. clearing the buffers with mappedAtCreation == true on the CPU side.
2. on D3D12 making the buffer with MapRead and mappedAtCreation == true
   use the staging buffer instead of mapping itself.

Note that this change is only related to the code path with Toggle
"nonzero_clear_resources_on_creation_for_testing" enabled, currently
we don't plan to do the similar change when we enable Dawn wire.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I2b3d0840333e8d99759800ab9fc141d0a7cf2f8d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-01 08:08:57 +00:00
Austin Eng 0b89b27263 Move client-side OnCompletion callbacks to the server.
We need callbacks to be processed server-side so that callback
ordering can be made consistent.

Bug: dawn:516
Change-Id: Ie5590ca33fce6bda431f93ae9ff8e832468109c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27481
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-08-28 21:23:50 +00:00
Corentin Wallez 9ed8d518ca Unify ProgrammableStageDescriptor handling in PipelineBase
Previously both Render and Compute pipelines handled extracting data
from the ProgrammableStageDescriptors. Unify them in PipelineBase in
preparation for gathering EntryPointMetadata in the PipelineBase.

Bug: dawn:216
Change-Id: I633dd2d8c9fdd0c08bb34cbf18955445951e312f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27263
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-08-28 14:26:00 +00:00
Jiawei Shao 900bd341a3 Enable TextureSubresourceTest.MipmapLevelsTest on Vulkan w/ validation
This patch re-enables TextureSubresourceTest.MipmapLevelsTest on Vulkan
with validation layer because the bug in Vulkan validation layer has
been fixed.

BUG=dawn:517
TEST=dawn_end2end_tests

Change-Id: I654603369717a32c5c9168621fb81e8a822d50d0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27560
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-27 13:12:29 +00:00
Xinghua Cao 8c012e8796 D3D12: fix shader model comparison
D3D12_SHADER_MODEL is encoded as 0xMm with M the major version and
m the minor version. After decoding D3D12_SHADER_MODEL to a custom
shader model format as Mm, which is a decimal value, it's meaningless
to compare these two values.

Bug: dawn:426
Change-Id: I3eb9a2a1392307616a5ac4d0aa49790bcc363629
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
2020-08-27 02:56:05 +00:00
Brandon Jones 8575cb3ec7 Add setIndexBufferWithFormat method
First step of a multi-part change to bring the setIndexBuffer
method up-to-date with the current WebGPU spec. This change
preserves the previous setIndexBuffer semantics for backwards
compatibility until developers have been notified and given
a grace period to transition to the new signature.

BUG=dawn:502
Change-Id: Ia8c665639494d244f52296ceadaedb320fa6c985
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27182
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-08-27 01:13:35 +00:00
Austin Eng 320c6c87b2 Revert "Skip TextureSubresourceTest.MipmapLevelsTest on Vulkan w/ validation"
This reverts commit e8dc820fbc.

Reason for revert: The Vulkan validation layers bug has been fixed

Original change's description:
> Skip TextureSubresourceTest.MipmapLevelsTest on Vulkan w/ validation
> 
> This test is broken after a validation layers update.
> 
> Tbr=cwallez@chromium.org
> Bug: dawn:517
> Change-Id: Ia685ba7bd17d8cdb49477997aaee4e5a9f00f9c7
> 
> Change-Id: I6f05516f00c8d05b96c8af578e09df9dc416385b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27123
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:517
Change-Id: I844960bfda35be59659ee88ff8b5028fbd0ca612
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27400
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-26 15:26:32 +00:00
Corentin Wallez 4f8bdaf473 Make ShaderModuleBase use an internal EntryPointMetadata
WGSL and SPIR-V modules can contain multiple entrypoints, for different
shader stages, that the pipelines can choose from. This is the first CL
in a stack that will change Dawn internals to not rely on ShaderModules
having a single entrypoint.

EntryPointMetadata is introduced that will contain all reflection data
for an entrypoint of a shader module. To ease review this CL doesn't
introduce any functional changes and doesn't expose the
EntryPointMetadata at the ShaderModuleBase interface. Instead
ShaderModuleBase contains a single metadata object for its single entry
point, and layout-related queries and proxied to the EntryPointMetadata
object.

Finally some small renames and formatting changes are done.

Bug: dawn:216
Change-Id: I0f4d12a5075ba14c5e8fd666be4073d34288f6f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27240
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-26 09:57:52 +00:00
Jiawei Shao ef74473347 Fix issues in end2end tests for enabling buffer lazy clear by default
This patch cleans up some issues in the end2end tests that will cause
test failures when we enable buffer lazy initialization by default.

This patch also skips a test that always fails with Vulkan validation
layer.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I40f643615b3fec4e52c90d576285534a99950915
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26960
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-08-23 06:08:05 +00:00
Corentin Wallez ce78ce2e28 Tiny cleanup of GetMappedRange.
Fix the last TODOs for the deletion of the "old mapping".

Bug: dawn:445
Change-Id: Ie7443446e4696cf38801980db3d3cfdb09094578
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27060
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-08-22 11:08:34 +00:00
Austin Eng e8dc820fbc Skip TextureSubresourceTest.MipmapLevelsTest on Vulkan w/ validation
This test is broken after a validation layers update.

Tbr=cwallez@chromium.org
Bug: dawn:517
Change-Id: Ia685ba7bd17d8cdb49477997aaee4e5a9f00f9c7

Change-Id: I6f05516f00c8d05b96c8af578e09df9dc416385b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27123
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-21 00:23:59 +00:00
Bryan Bernhart ef0fee48c4 D3D12: check if resource manager exists before releasing
ClusterFuzz injects errors into the device which may not
initialize the resource manager which would later fail upon
shutdown. This adds a check to see if the resource manager
exists before releasing the pool.

BUG=chromium:1117595

Change-Id: Ie2b90f947f3ddd3906ecabc65e959915c1f7e386
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-08-20 17:06:39 +00:00
Jiawei Shao ab4e4feb01 Workaround Intel Mesa driver issue about T2B copy with stencil aspects
In the test DepthStencilCopyTests/FromStencilAspect we are writing into
gl_FragDepth but we disable the depth writing when creating the render
pipeline, which causes Intel Mesa driver hangs when the test is running
on it. In this patch we try to add workaround to this issue by enabling
the depth writing.

BUG=dawn:439
TEST=dawn_end2end_tests

Change-Id: I618246097a26ee62c830f0ac8dc1aa0ab4d224a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27000
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-08-20 16:17:59 +00:00
Corentin Wallez f7123d7463 Remove MapRead/WriteAsync and CreateBufferMapped
Bug: dawn:445

Change-Id: I0b0755b6bb754d1fff99aa59b08362f89950e300
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26301
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-20 14:22:29 +00:00
Tomek Ponitka d720785616 Refactoring Queue::WriteTexture implementation
More code is now shared across backends.

Bug: dawn:483
Change-Id: I7ca1b8cbc2f12e408c94fbe5bca9fd29e47e0004
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27021
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-20 13:29:39 +00:00
Tomek Ponitka 7f265d1d40 Fixing offset alignments when using DynamicUploader
When using a dynamic uploader we didn't align the offset
that the allocated memory might have already had.
That fixes WriteTexture, WriteBuffer, ClearTexture and
on D3D12 ClearBuffer.

Bug: dawn:512
Change-Id: I64c7511ad6b0d3d6a28a494e1324a10ad4d38091
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27020
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-08-20 11:25:49 +00:00
Hao Li eff9ef0f22 Query API: QuerySet on Vulkan
- Implement QuerySet on Vulkan backend.
- Enable end2end tests on Vulkan. The timestamp tests will be enabled
  in following CL which implement timestamp query.

Bug: dawn:434
Change-Id: I7ee04380c5f6b5af561cc23e28637dcae70bc7b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-08-20 00:40:07 +00:00
Corentin Wallez 2f6e4ec6c0 Add wgpu::TextureFormat::RGB9E5Ufloat
Also update RG11B10Float to be name RG11B10Ufloat

Bug: dawn:22

Change-Id: I0ea76dc25c37ebaeb4c2c2c2a119d00940acc145
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25760
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-08-19 21:51:20 +00:00
Austin Eng b54c82ed39 Support depth-only/stencil-only COPY_SRC on OpenGL
Bug: dawn:439
Change-Id: I09d33d3115d54c03e3ba5a32f34843065edb8020
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24961
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-18 18:53:26 +00:00
Corentin Wallez caec4ab04a Metal: Remove usage of MTLTextureUsagePixelFormatView
This usage is only needed when reinterpreting formats, which Dawn
doesn't support yet, and has a significant cost in that textures can't
be compressed as well.

Bug: dawn:510
Change-Id: I6e416a97c84a708f97d83f9b15c60b05bbf15908
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26881
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-08-18 15:39:06 +00:00
Dirk Pranke 9aed03dcb0 Fix visibility rules for configs enforced by latest GN.
Prior versions of GN had a bug (gn:22) where visibility rules
for configs weren't enforced properly.

This CL tweaks the visibility settings of some configs to conform
to the latest version.

Change-Id: If0e9f06667d3d89bcd0bbfc938e159e590e11e27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26929
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-08-18 13:26:26 +00:00
Corentin Wallez 7268e7d36f OpenGL: Unconditionally set glFrontFace
Previously glFrontFace was called only if some cull mode was set. This
was incorrect because the front face also influences whether a triangle
uses stencilFront or stencilBack.

Because OpenGL default to GL_CCW (which with the Y-flip is the inverse
of wgpu::FrontFace::CCW that's default in the descriptor), if
stencilFront != stencilBack and cull mode is none, then the incorrect
stencil face descriptor was used.

Also adds a regression test for this issue.

Bug: dawn:508
Change-Id: I00d93bda6d4f030cf9db472a9f2b0deefc72707f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26880
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-08-18 12:30:06 +00:00
Austin Eng c0fd9d0945 D3D12: only lazy clear OutputAttachment textures with render target ops
Previously, lazy clearing always added DEPTH_STENCIL or RENDER_TARGET to
textures because we cleared using ClearDepthStencilView or
ClearRenderTargetView. Now, we're able to clear using copies.

This also allows textures to actually use the small resource heap
placement optimization. Doing so generates debug layer warnings when the
small alignment is first tried but rejected. This CL silences those
warnings.

Bug: dawn:145
Change-Id: Id385846536b337cddcfdadc5739561c7adc30c8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26840
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-08-17 18:39:25 +00:00
Bryan Bernhart 988f19e208 Pool sub-allocated resource heaps.
Allow resource heaps to be recycled when
no longer used.

BUG=dawn:496

Change-Id: I36518f8b0c0b26d2cceecc4e7b05e00a5fd5bd25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26126
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-08-17 17:47:15 +00:00
Austin Eng 5e9b29fab9 Fix ASSERT in WindowsDebugLogger
SetEvent returns non-zero on success, not zero.

Tbr=cwallez@chromium.org
Bug: none
Change-Id: Ib6ea74b19799bc3211136a5788b2bce8880f3b17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26841
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-14 22:44:02 +00:00
Austin Eng f580096468 end2end_tests: Forward Windows debug messages to stderr
When validation layers are enabled, D3D12 warnings and error
messages are logged to the shared DBWIN_BUFFER segment of memory.
This CL has makes the test environment watch for new events and
logs them to stderr so they show up in the test bot logs. This helps
debug problems in the D3D12 backend which previously just crashed
with a general Device Lost message.

Bug: none
Change-Id: I0eaddf9e16303bd65579e85fe6693bd8cdfbd8da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26640
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-14 21:02:12 +00:00
Corentin Wallez 24b5971b84 Remove deprecated wgpu::BufferCopyView members
Bug: dawn:22

Change-Id: Iec26e9945443411a8f322a80d7e63c96c74f3508
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26702
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-14 09:31:00 +00:00
Idan Raiter d315022be5 Add Metal vertex pulling behind a flag
Implements vertex pulling on the Metal backend, hidden behind a flag
until ready for use (we are missing support for more complicated vertex
input types).

Bug: dawn:480
Change-Id: I38028b80673693ebf21309ad5336561fb99f40dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26522
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-13 23:53:59 +00:00
Idan Raiter e1604b9a64 Enable robust buffer access pass if robustness on
Turns on SPVC buffer access pass if robustness is also enabled.

Bug: dawn:480
Change-Id: Ib4d74e177f4f65139219f3ce8662566370f4a108
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26741
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-13 20:53:59 +00:00
Enrico Galli 76d9e34bbc Eagerly destroy CommandBuffer commands after submission
Command buffers hold references to all encoded objects. Freeing them
eagerly significantly reduces the amount memory held before the JS GC
clears the command buffers.

Bug: dawn:262, dawn:372
Change-Id: I68dfa973f980fba8d94611ed1de3c593bdb91a63
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26562
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-13 20:25:39 +00:00
Corentin Wallez 13f3340173 Remove wgpu::Buffer::SetSubData
Bug: dawn:22

Change-Id: Id2bb79e84064c0d81d4dec5e85340d015806f9bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26701
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-13 16:01:08 +00:00
Corentin Wallez e236f7df27 Remove deprecated array layer descriptor members
- wgpu::TextureDescriptor::arrayLayerCount
 - wgpu::TextureCopyView::arrayLayer

Bug: dawn:22

Change-Id: I41a8b50c667f28c2496e0ad2e1d4ca655bf6c154
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26700
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-13 14:38:48 +00:00
Jiawei Shao 2b1c0b0e92 Clean up BufferZeroInitTests
BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I8a9a4d45fe93e1071b8508ba7ddd2bf9545a3c63
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26641
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-08-13 12:03:28 +00:00
Corentin Wallez 2088cdec66 Update tests to use new mapping APIs
This CL updates all tests not specific to the old mapping API to use the
new mapping APIs. (a couple old tests that caused difficult diffs were
removed early).

Also fix an issue where the mapAsync callback wasn't fired with Unknown
when the buffer was destroyed.

Bug: dawn:445

Change-Id: I0101f533ecb1fd995066742b60a833dc2ad522aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-08-12 19:32:25 +00:00
Corentin Wallez 1aff02d444 Small nits for the implementation of WriteTexture in D3D12
Bug: None

Change-Id: Id44ff878ac3fc9762008a7f8b95ee65072aa1fcd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26600
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-08-12 08:43:24 +00:00
Austin Eng 37f547456c Support depth-only/stencil-only copies on D3D12
Bug: dawn:439
Change-Id: I919a5e7bcb46f1817f9b15aaf49a1a72680aa47a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24960
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-12 01:57:54 +00:00
Tomek Ponitka 11c0f579b1 Adding validation for requiredBytesInCopy overflow
Also some uint32_t computations are now done on uint64_t.

Bug: dawn:482
Change-Id: Ia0094e16999ec3a9fec193f27760e73cd14d289c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-08-11 12:04:52 +00:00
Natasha Lee cbec3179ef Implement Queue::WriteTexture in D3D12
Bug: dawn:483
Change-Id: I9e5f54abc6675acbb11a021a3d38aea7195017c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26320
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-10 22:29:49 +00:00
Brandon Jones ccf01e74ec Re-add heap usage tracking for textures in a pass
Heap usage tracking for textures in a pass was mistakenly removed when
texture subresource transitions was implemented. This must be re-added
for residency management to work (and not crash the application).

Bug: dawn:193
Change-Id: Ie5e9622f88a70d153232d5d72bb11846f4164e87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26461
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-08-10 16:58:29 +00:00
Jiawei Shao 1662e97f32 Add tests for lazily initializing indirect buffers
This patch adds the end2end tests on the buffer lazy-initialization on
indirect buffers. In the last patch we have already supported buffer
lazy initialization on all the buffers used in a render pass and compute
pass, so in this patch we just need to add tests to ensure buffer lazy
initializations run as we expect on indirect buffers.

This patch also enables all the tests with write-only storage textures
on Metal, Vulkan and OpenGL with SPVC parser as these tests only fail
on D3D12 backends.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: If40b0129d6766e854cf1efdaea539a740a86ae66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26340
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-10 00:48:58 +00:00
Enrico Galli 101a5829d5 DawnTest: Prevent infinite loops in DawnTest.
WaitABit waits forever should a device loss occurs, which
happens when a bug is introduced. This can lock up the console
preventing debugging when needed the most.

Bug: dawn:495
Change-Id: I0b13ddfa75abbb9c43f7dd545fa9c41be79a697c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25960
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-08-08 01:05:59 +00:00
Austin Eng 2cf5a08cfc Track depth/stencil aspects independently
This enables depth-stencil textures to track per aspect state
independently. It lifts the restriction that depth and stencil
store ops must be the same as they now have independent clear
states. It will also enable correct barriers on Vulkan and D3D12.

Bug: dawn:439
Change-Id: I8a73187df57a1d7eee6790cb4395bdecf42b63aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26127
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-06 17:00:29 +00:00
Ryan Harrison fa4b74d479 Remove temporary disabling of validation check
Change-Id: I8bf7f4850689c240152a7a87ed42d7637c69ed45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26380
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-08-05 18:18:04 +00:00
Tomek Ponitka 7ce4924a35 Fixing linear texture data validation on bytesPerRow
This makes the validation match the spec more.
Since the change makes the validation throw less errors
than it used to, most of the tests should still be fine,
except for those I fixed.

Bug: dawn:482
Change-Id: I1d01356df66c897191a2305df419f088b45c8467
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26302
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-08-05 16:43:24 +00:00
Ryan Harrison 076a4e5820 Roll 6 dependencies and bypass changed API usage
Roll third_party/glslang/ 3ee5f2f1d..2de6d657d (6 commits)

3ee5f2f1d3..2de6d657dd

$ git log 3ee5f2f1d..2de6d657d --date=short --no-merges --format='%ad %ae %s'
2020-08-04 john SPV: Standalone; sanity check the client GLSL input semantics option value.
2020-08-04 john SPV: Use more correct SPV-Tools environment, partially addressing #2290
2020-08-04 john SPV: Fix #2363: include trailing newline named text SPV output.
2020-07-03 ShabbyX Use GLSLANG_ANGLE to strip features to what ANGLE requires
2020-07-31 bclayton Revert changes that migrate to `thread_local`.
2020-07-27 dneto Avoid spurious warning about uninit var

Created with:
  roll-dep third_party/glslang

Roll third_party/shaderc/ cfacaaffd..c626b912d (1 commit)

cfacaaffd1..c626b912dc

$ git log cfacaaffd..c626b912d --date=short --no-merges --format='%ad %ae %s'
2020-07-29 dsinclair Update some language usage. (#1124)

Created with:
  roll-dep third_party/shaderc

Roll third_party/spirv-cross/ f5e9f4a17..82d1c43e4 (6 commits)

f5e9f4a172..82d1c43e40

$ git log f5e9f4a17..82d1c43e4 --date=short --no-merges --format='%ad %ae %s'
2020-08-03 cdavis MSL: Fix handling of matrices and structs in the output control point array.
2020-07-29 post Add some test cases for complex type aliasing scenario.
2020-07-29 post Ensure that we use primary alias type when emitting flattened members.
2020-07-29 post GLSL: Be more aggressive about using type_alias.
2020-07-29 post Only rewrite type aliases for the base type.
2020-07-28 post GLSL: Add option to force flattening IO blocks.

Created with:
  roll-dep third_party/spirv-cross

Roll third_party/spirv-headers/ 979924c8b..3fdabd0da (4 commits)

979924c8bc..3fdabd0da2

$ git log 979924c8b..3fdabd0da --date=short --no-merges --format='%ad %ae %s'
2020-08-03 44190824+mmerecki Reserve SPIR-V token range for upcoming Intel extensions. (#165)
2020-07-29 alanbaker Update BUILD.bazel and BUILD.gn (#166)
2020-07-29 alanbaker Publish the headers for the clspv embedded reflection non-semantic extended instruction set (#164)
2020-07-29 johnkslang Update the registry in spir-v.xml to modernize and split out opcodes. (#156)

Created with:
  roll-dep third_party/spirv-headers

Roll third_party/SPIRV-Tools/ 150be20d4..8bc27a1cf (17 commits)

150be20d43..8bc27a1cfb

$ git log 150be20d4..8bc27a1cf --date=short --no-merges --format='%ad %ae %s'
2020-08-04 vasniktel spirv-fuzz: Remove OpFunctionCall operands in correct order (#3630)
2020-08-04 vasniktel spirv-fuzz: Handle capabilities during module donation (#3651)
2020-08-04 vasniktel spirv-fuzz: Refactor boilerplate in TransformationAddParameter (#3625)
2020-08-03 vasniktel spirv-fuzz: TransformationMoveInstructionDown (#3477)
2020-07-31 jaebaek Remove DebugDeclare only for target variables in ssa-rewrite (#3511)
2020-07-31 vasniktel Fix typo in ASAN CI build (#3623)
2020-07-30 stefanomil spirv-fuzz: Transformation to add loop preheader (#3599)
2020-07-30 stefanomil spirv-fuzz: Pass to replace int operands with ints of opposite signedness (#3612)
2020-07-30 jaebaek Debug info preservation in loop-unroll pass (#3548)
2020-07-30 alanbaker Validator support for non-semantic clspv reflection (#3618)
2020-07-30 vasniktel spirv-fuzz: Fix memory bugs (#3622)
2020-07-29 andreperezmaselco.developer spirv-fuzz: Implement the OpOuterProduct linear algebra case (#3617)
2020-07-30 vasniktel spirv-fuzz: Compute corollary facts from OpBitcast (#3538)
2020-07-29 dj2 Update some language usage. (#3611)
2020-07-29 vasniktel spirv-fuzz: Relax type constraints in DataSynonym facts (#3602)
2020-07-29 vasniktel spirv-fuzz: Remove non-deterministic behaviour (#3608)
2020-07-29 afdx Avoid use of 'sanity' and 'sanity check' in the code base (#3585)

Created with:
  roll-dep third_party/SPIRV-Tools

Roll third_party/tint/ c5cd8f5bd..f18d737b4 (26 commits)

https://dawn.googlesource.com/tint/+log/c5cd8f5bd382..f18d737b4e93

$ git log c5cd8f5bd..f18d737b4 --date=short --no-merges --format='%ad %ae %s'
2020-08-04 rharrison Rolling 7 dependencies and fix BUILD.gn
2020-07-30 dsinclair [ast] Add texture types to the AST.
2020-07-30 dsinclair Add SamplerType to AST.
2020-07-30 dsinclair [hlsl-writer] Add loop support.
2020-07-30 dsinclair [hlsl-writer] Add if/else statements.
2020-07-30 dsinclair [hlsl-writer] Emit variable declarations.
2020-07-30 rharrison Add SPIR-V Reader Fuzzer
2020-07-30 rharrison Remove _exe suffix from sample program
2020-07-30 rharrison Change the default for BUILD.gn to build all the modules
2020-07-30 rharrison Simplify fuzzer targets to ease adding additional targets
2020-07-30 dsinclair Fixup build warnings
2020-07-30 dsinclair [wgsl-reader] Add stride support.
2020-07-30 dsinclair [wgsl-writer] Emit array stride decoration.
2020-07-30 idanr Add BlockStatement insert and non-const global_variables
2020-07-30 sarahmashay [Validator] Using pointers instead of refs
2020-07-29 dsinclair [hlsl-writer] Add member accessor emission.
2020-07-29 dsinclair [hlsl-writer] Add AsExpression to the HLSL backend.
2020-07-29 dsinclair [hlsl-writer] Add BlockStatement support.
2020-07-29 dsinclair [hlsl-writer] Emit discard.
2020-07-29 dsinclair [hlsl-writer] Emit array accessors.
2020-07-29 dsinclair [hlsl-writer] Add alias type support.
2020-07-29 dsinclair [hlsl-writer] Add constructor emission.
2020-07-29 dsinclair Add hlsl writer tests to BUILD.gn
2020-07-29 dsinclair [hlsl-writer] Add type emission.
2020-07-29 dsinclair Update some language usage.
2020-07-29 dneto [spirv-reader] Only support column-major matrices

Created with:
  roll-dep third_party/tint

Change-Id: I68064a00fb428d91aa00efa45f729bab1af2b103
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26281
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-08-04 21:27:58 +00:00
Austin Eng 0a4342793e Implement depth-only/stencil-only copies on Vulkan and Metal
Bug: dawn:439
Change-Id: I07ab014f4f13b73c09b2eecc48cd38b06d88166a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24684
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-08-04 19:46:37 +00:00
Jiawei Shao e84a1b1376 Add tests for lazy initializing vertex and index buffers
This patch adds the end2end tests on the buffer lazy-initialization on
vertex and index buffers. In the last patch we have already supported
buffer lazy initialization on all the buffers used in a render pass and
compute pass, so in this patch we just need to add tests to ensure
buffer lazy initializations run as we expect on vertex and index
buffers.

This patch also adds the missing checks on all the BufferZeroInitTests
to ensure the buffers are not lazily initialized when we validate if
their data is all set to zero in these tests.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: If2156027b23e9d90619b7814a542380f48af85ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26140
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-08-04 08:18:36 +00:00
Hao Li c0acb25318 Query API: Timestamp Query on D3D12
- Add implementation of WriteTimestamp and ResolveQuerySet on D3D12, but
not add compute shader to post-process the result yet.
- Add end2end tests for timestamp query on command encoder/render
pass/compute pass.

Bug: dawn:434
Change-Id: I7f763bc46d651818da3f69bc72ea2e403cf2674d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25845
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-08-04 06:41:56 +00:00
Tomek Ponitka 1ea3a22f52 Adding a validation for destroyed textures in Queue::WriteTexture
That was missing. There's a new validation test for that and two
tests for submitting copy commands with destroyed buffer/texture
(I think only a mapped buffer was covered so far).
Also fixing some error state tests.

Bug: dawn:483
Change-Id: I691f34722e96866a06465b4b3b0cae9d31c08a84
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26161
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-03 19:22:33 +00:00
Tomek Ponitka eac38cfbc1 Fixing a deprecated arrayLayer value inside Queue::WriteTexture
Chromium always sends arrayLayer instead of origin.depth since
the migration hasn't been finished yet. This wasn't caught
in Dawn's testing since we are using origin.depth everywhere.

Bug: dawn:483
Change-Id: I13b1ccfb016eea01a3291ca439457db09966e9a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26160
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-08-03 09:11:52 +00:00
Corentin Wallez 8c201dfadc Allow arrayLayerCount=0 during the deprecation period.
The value 0 is the default value for default-constructed C descriptors
and should be allowed.

Bug: dawn:22
Change-Id: I876ec4d9c6d70a798b0d6cea5c2ccecaad850eff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-08-03 09:00:12 +00:00
Jiawei Shao 8c9858e9b8 Fix clearing sint/uint color attachments on Vulkan and OpenGL
This patch fixes a bug on the clear of color attachments with signed or
unsigned integer formats on Vulkan and OpenGL by using the correct APIs
to set the clear color for signed/unsigned integer formats.

BUG=dawn:497
Change-Id: If1bc9858875e6384e71c15bb6770fbbb10045037
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26041
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-08-01 04:18:17 +00:00
Jiawei Shao fada501190 Metal: Add shader compilation error message to DAWN_VALIDATION_ERROR
BUG=dawn:498

Change-Id: I850956a6c57ffe9d77e0729e89da6d9a62076509
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26060
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-07-31 00:03:43 +00:00
Bryan Bernhart f03590a754 D3D12: Dynamic shader-visible heap allocation.
Allocates shader-visible descriptor heaps at a much
smaller size then pool-allocates them upon reaching
the max size. This strategy avoids always wasting memory
for lighter users while still maximizing performance for
heavy users.

BUG=dawn:155

Change-Id: I0519235c901d0283b98ee824eeb0cda6de70b210
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25620
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-30 21:50:32 +00:00
Austin Eng 0d9fce100d Add texture aspect to texture copy view and validation tests
Bug: dawn:439
Change-Id: I0ca283f58fe2b63ac3a8c468f8ea1bb2d300856f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24683
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-30 15:29:57 +00:00
Austin Eng b8a56af176 Rephrase Format::aspect enum as an enum class mask
Format::aspect should be a mask so that it is easier to iterate over
and test if an aspect is present.

This CL also re-exports wgpu's EnumClassBitMask helpers in dawn_native.
It also adds an EnumMaskIterator which wraps BitSetIterator to allow
iterating over the enums in an enum mask.

Bug: dawn:439
Change-Id: I08180a45b27c6031e2f80b0fa1801716677fd813
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24682
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-30 15:25:37 +00:00
Kai Ninomiya 38ba51ce7a Make shim headers at <webgpu/*> that point to <dawn/*>
Emscripten's headers live at <webgpu/*>; this makes it so projects don't
have to ifdef which #include path to use.

Bug: dawn:160
Change-Id: I39efee44447470551a78db0abd062f4a2fe9083a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26020
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-30 09:15:27 +00:00
Jiawei Shao a36a91a445 Support lazy initialization on the buffers bound into a bind group
BUG=dawn:414

Change-Id: Ice592d6427747941406431709999d08778f0f221
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25861
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-07-30 08:20:17 +00:00
Bryan Bernhart 03cf7c3eae Enable GBV by default for correctness tests.
Dawn apps using debug builds may hang due to
GBV being always on by default. This change turns
on GBV for correctness tests only.

BUG=dawn:490

Change-Id: I2728d834ed53f9acc7556f8d1178d718c0b49457
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25421
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-07-29 19:44:41 +00:00
Tomek Ponitka 2c8e1f2f11 Optimizing memcpy inside Queue::WriteTexture
Fixing an earlier TODO.

Bug: dawn:483
Change-Id: I19d961512caea1f9d502d7e58b56cd3846c9f7f3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25983
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-07-29 18:37:51 +00:00
Corentin Wallez f93fa6acd9 dawn_wire: Implement CreateBufferMapped on top of mappedAtCreation
Reland with a fix for narrowing of uint64_t to size_t of the buffer size
in 32 bit mode.

This inverts the shimming to have the old mapping at creation method
be implemented on top of the new method..

Also updates Wire tests to use mappedAtCreation instead of
CreateBufferMapped.

TBR=senorblanco@chromium.org
Bug: dawn:445
Change-Id: I89fe84b6e0b5d0d4a5c6a2db7b38cb7d6cd063f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25981
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-29 17:01:11 +00:00
Tomek Ponitka ab04da48f4 Enabling alphaToCoverage
Added the alphaToCoverage functionality with some
end2end tests. There is no validation for disabling alphaToCoverage
mode if SV_Coverage is statically used by the shader yet.

Bug: dawn:494
Change-Id: I9df15b35697ea05a064b092edae9d5d20f73c4d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25761
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-29 11:44:41 +00:00
Tomek Ponitka 9ecb99344f Roll third_party/spirv-cross/ to enable shader-output mask in HLSL
0376576d2d..f5e9f4a172

$ git log 0376576d2..f5e9f4a17 --date=short --no-merges --format='%ad %ae %s'
2020-07-23 tommek Adding BuiltInSampleMask in HLSL

Created with:
  roll-dep third_party/spirv-cross

Change-Id: I1a9702ce1da046e7c987deaa1994de019d570fb3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-07-29 10:10:21 +00:00
Corentin Wallez 9d0b9d7212 D3D12Info: programmatically compute the shader profiles.
Bug: dawn:426
Change-Id: Ic360b95e908404137e01a00439b93e5b9b1828ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24380
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-29 09:34:11 +00:00
Corentin Wallez b88b1a15c7 Revert "dawn_wire: Implement CreateBufferMapped on top of mappedAtCreation"
This reverts commit 0811ecc775.

Reason for revert: Makes the Dawn roll fail.

Original change's description:
> dawn_wire: Implement CreateBufferMapped on top of mappedAtCreation
> 
> This inverts the shimming to have the old mapping at creation method
> be implemented on top of the new method..
> 
> Also updates Wire tests to use mappedAtCreation instead of
> CreateBufferMapped.
> 
> Bug: dawn:445
> 
> Change-Id: I77dcfe72040e5bf187c41fe99c8dd785d5156a07
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25701
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: Ied940d505fdf576860697dee8df2548c73581eba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:445
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-29 09:10:13 +00:00
Tomek Ponitka 225a2b46b0 Enabling sampleMask usage in RenderPipelineMTL
Added the sampleMask functionality in Metal.

Bug: dawn:491
Change-Id: Id4a14d0cc715dc701c6f29e4588ce327c5b26cba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25481
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-07-29 08:19:59 +00:00
Kai Ninomiya bce1cbd0e2 CMake: add -framework Metal to dawn_native
Bug: None
Change-Id: Ic71747e48e3d1a737f73bac37cced760af4f195d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25940
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-29 07:21:09 +00:00
Kai Ninomiya a390d7f84f Disable "all" warnings when compiling MSL code
Hopefully works around an issue where some Metal drivers treat warnings
as errors.

Bug: dawn:493
Change-Id: Ia535502a14fd4215ff74eee2662dfbde7e01bc4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25841
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-28 18:51:28 +00:00
Corentin Wallez 0811ecc775 dawn_wire: Implement CreateBufferMapped on top of mappedAtCreation
This inverts the shimming to have the old mapping at creation method
be implemented on top of the new method..

Also updates Wire tests to use mappedAtCreation instead of
CreateBufferMapped.

Bug: dawn:445

Change-Id: I77dcfe72040e5bf187c41fe99c8dd785d5156a07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25701
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-28 15:30:07 +00:00
Corentin Wallez 5b007a519a dawn_wire: Implement MapRead/WriteAsync on top of MapAsync
This inverts the shimming to have the old mapping entrypoints be
implemented on top of the new mapping entrypoint.

Bug: dawn:445

Change-Id: I98c81b2873d506790b1b19048c5289c62d1b83ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25700
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-28 09:00:11 +00:00
Jiawei Shao c11a19145f Support buffer lazy initialization before CopyTextureToBuffer
BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I5bdd6333029170d47ea240388e7b7d80750ae5d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25643
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-07-28 01:58:50 +00:00
Austin Eng 361a0d8334 Update max storage buffer bindings per stage to 6
This is a temporary change to unblock Tensorflow.js until we
expose querying and setting GPULimits.

Bug: none
Change-Id: Iad851b2be260e9fade7c326bc7fcde39b46cf7fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-27 21:24:17 +00:00
Bryan Bernhart 1f16229c9b Disable MultisampledRenderingTests on NV/D3D12.
E2E tests fail to pass with backend validation. Disable these tests
until there is resolution from the investigation.

BUG=dawn:462

Change-Id: I0325bafb31cc706be122a601ecfe154bf8880b5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25680
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-27 19:50:21 +00:00
Hao Li d5a4775cfc Query API: QuerySet on D3D12
- Implement QuerySet object creation on D3D12 backend.
- Add end2end tests for the creation on D3D12 backend.

Bug: dawn:434
Change-Id: I9657792ca5cba8f156471783a7c13f6d36b7a19e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25225
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-07-25 14:48:12 +00:00
Kai Ninomiya 0d158ac681 Fix some bugs in buffer mapping in the wire client
Bug: dawn:445
Change-Id: Ibfc55e26c2bc1757811669d84e54e9f775bee8f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25440
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-23 18:27:56 +00:00
Corentin Wallez c7ae7a0012 Implement sampleMask in D3D12 and OpenGL.
Some tests are not enabled in D3D12 yet because SPIRV-Cross lacks
support for gl_SampleMask.

Bug: dawn:491

Change-Id: I6cce56b5d0ab883f39b8d58987246c08a23b6410
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25580
Reviewed-by: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-23 16:26:16 +00:00
Tomek Ponitka 4d9cadd58a Enabling sampleMask usage in RenderPipelineVk
Added the sampleMask functionality in Vulkan with some
end2end tests including tests for the shader-output
mask.

Bug: dawn:491
Change-Id: Ib39682d8857729adb4776bc2f2d8e759bf75677b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25340
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-23 11:30:56 +00:00
Xinghua Cao 92ebe87b74 Vulkan: Set apiVersion dawn targets
Set apiVersion to Vulkan 1.0 if the instance only supports
Vulkan 1.0. Otherwise set apiVersion to Vulkan 1.2, treat
1.2 as the highest API version dawn targets.

Bug: dawn:426
Change-Id: I322eaa0a93a518df36b86717c2ed5a98c5d056ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25065
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
2020-07-20 08:44:29 +00:00
Jiawei Shao d0dd661f18 Implement buffer lazy initialization before CopyBufferToTexture()
This patch adds the check and implementations of buffer lazy
initialization before CopyBufferToTexture().

The support of buffer lazy initialization before CopyTextureToBuffer()
is much more complicated than what we do for CopyBufferToTexture(), so
we decide to put it in another CL instead of writing them together with
CopyBufferToTexture().

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I45fdcdde2c9a0dafff23623815fc35c877990ef1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25140
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-20 02:08:59 +00:00
Austin Eng 1233b66c90 Guard [MTLDevice recommendedMaxWorkingSetSize] only on MacOS
Bug: none
Change-Id: Id5d23151953dfc5401776180b42d921adc22833b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25161
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-07-18 00:43:17 +00:00
Austin Eng 4a4c76b8b5 Add offset argument in BufferZeroInit mapping test
The CL that added offset/size args landed about the same time
as the CL that adding zero init mapping tests (without the args).

Tbr=cwallez@chromium.org
Bug: dawn:445, dawn:414

Change-Id: I388399d425c3a3c12be79b160686caaf3d81a89c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25162
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-18 00:22:27 +00:00
Corentin Wallez f6e7044697 Add offset and size to Get[Const]MappedRange.
Bug: dawn:445
Change-Id: I73758d95e61d1fbe69f328907a6170a1b27d785b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24983
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-07-17 18:50:37 +00:00
Austin Eng 4b7ca6bf96 Call vkFreeCommandBuffers before destroying the vkCommandPool
This should not be necessary as the command pool should own the
memory if it was created without the creation flag
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT. However, some drivers
leak memory if vkFreeCommandBuffers is not called.

Bug: chromium:1082181
Change-Id: Ia437fc17b2a304a248b9227b43cfff1868f9f10e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25062
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-07-17 15:26:56 +00:00
Austin Eng 64dd82e94f Remove depth sampling tests of non-normalized depth values
Depth texture values outside the 0-1 range are not supported without
an extension.

Bug: dawn:413, dawn:367
Change-Id: I75e7f0de054d6f9a4bac7c6b955c65db810fe36e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-17 15:18:57 +00:00
Austin Eng e01dd678d3 Make common/ compile with Emscripten
Projects using Dawn that are compiled with Emscripten may use some
of our common headers and utilities. ex.) creating a ShaderModule
from SPIR-V. Add handling for __EMSCRIPTEN__ to Platform.h so
compiling to WASM works.

Also, implement GetExecutablePath on Emscripten as unreachable.
This is only ever used to search native paths in the Vulkan backend.

Bug: none
Change-Id: I5d9d6e27e287cb34e7af3214add1c4bc8c6a0f70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25064
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-17 14:52:47 +00:00
Tomek Ponitka 7f4980e7d2 Optimizing WriteTexture offset on Vulkan
Added an additional alignment on the staging buffer offset in
WriteTexture on Vulkan to match
VkPhysicalDeviceLimits::optimalBufferCopyOffsetAlignment.
We now allocate some additional memory in the staging buffer for that
purpose.

Bug: dawn:483
Change-Id: Ic5b95aa57f6c241e0ab9f9853b4c3152e52e5630
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24982
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-17 09:45:26 +00:00
Tomek Ponitka 73652263df Changing validation order for linear texture data
Changed the order of validation blocks in ValidateLinearTextureData.
It doesn't match the order in spec now, but for the algorithm to
compute required bytes in copy we need the conditions which come
after the ones relating to it. Also switched the order of
ValidateLinearTextureData and ValidateTextureCopyRange for similar
reasons.

Bug: dawn:483
Change-Id: If00ae769d170ea12494258721916ec55d79e2880
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25041
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-17 09:44:46 +00:00
Hao Li 5c89c8dc70 Query API: ResolveQuerySet
Add ResovleQuerySet on CommandEncoder and its validation tests.

Bug: dawn:434
Change-Id: Ibba166dd11e15430cd5f6647676a47ce67481844
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24303
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-07-17 09:02:46 +00:00
Jiawei Shao 77eb64eb8c Implement buffer lazy initialization before mapping
This patch implements buffer lazy initialization beffor MapAsync() and
buffer creation with BufferDescriptor.mappedAtCreation == true.

Note that this patch doesn't initialize buffers in MapReadAsyc() and
MapWriteAsync() because they are deprecated and will be removed soon.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: Ifea99833897081f599c45797e0829c57de1ac926
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24687
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-07-17 09:01:26 +00:00
Tomek Ponitka 2733af5c75 Optimizing WriteTexture row pitch on Vulkan
Fixing an earlier TODO about aligning bytesPerRow in WriteTextureImpl
to VkPhysicalDeviceLimits::optimalBufferCopyRowPitch.

Bug: dawn:483
Change-Id: Ided2d367177f2f886a84f232c77f1f9f0d50d05d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24981
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-17 08:33:16 +00:00
Corentin Wallez 450b6f4f84 Use MapAsync callback for server->client map callbacks.
This changes the format of the server->client callback for async mapping
to match MapAsync. Previously there were two callbacks, one for
MapReadAsync and one for MapWriteAsync.

Bug: dawn:445

Change-Id: I3330c07ac8bb6d1fa9019563e9c946875e852639
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24821
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-07-17 07:38:36 +00:00
Austin Eng b92a363a1a Vulkan: Fix MemoryServiceZirconHandle CreateImage
vkCreateImage when bound to imported memory, must also have
a VkExternalImageCreateInfo struct in its pNext chain that
has VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA
as a handleType.

This was discovered when tests started failing after a roll
of the Vulkan validation layers.

Bug: none
Change-Id: Ic7fc95f963062c8740e714a490adf6a020fed220
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-17 07:30:36 +00:00
Austin Eng cb2938a1af D3D12: Bucket descriptor allocation by powers of two
WebGPU currently allows as many as 108 view descriptors per bind
group. This is too many to have one descriptor allocator per size,
so we need to bucket them by size.

Bug: dawn:443, dawn:488
Change-Id: I4fc8cf7cd0dc8292bb6a8488fd2ceb7575e1e5f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24787
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-17 01:11:16 +00:00
Austin Eng e8e089ad28 Add missing headers to BUILD.gn and CMakeLists.txt
Bug: none
Change-Id: I101935b8f75b3cbcf0f79a429f7a850ce62e90e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25063
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-07-16 21:45:06 +00:00
Austin Eng 34f5133104 Validate 1D texture bindings cannot be multisampled
Bug: chromium:1104737
Change-Id: I61d631f7fce2c7d68823f265f06f75069af765a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25101
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-16 20:43:26 +00:00
Corentin Wallez c15c6eb9d8 dawn_wire/server: Use MapAsync to do Map[Read/Write]Async
This changes the format of the client->server command for async mapping
to match MapAsync and updates the doer on the server to implement it via
MapAsync. Previously the command had an isWrite boolean that routed to
either MapReadAsync or MapWriteAsync.

Also updates the Wire tests using mock_webgpu.h for the new server-side
traces.

Bug: dawn:445

Change-Id: I673cbe5e08b7c71539e8678dbb07b4043a9fadb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24820
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-16 17:07:05 +00:00
Corentin Wallez 2a232ba399 DawnTest: Use MapAsync for expectations.
Bug: dawn:445
Change-Id: I1ef0e0f2eef03565254fb07a1ffca51cddeb0a97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25040
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-16 16:35:40 +00:00
Corentin Wallez af09f74913 Roll third_party/swiftshader/ ad65826a2..e8dd233c7 (10 commits)
Also removes suppressions for tests that pass after
https://swiftshader-review.googlesource.com/c/SwiftShader/+/46509

https://swiftshader.googlesource.com/SwiftShader/+log/ad65826a2ab1..e8dd233c7a85

$ git log ad65826a2..e8dd233c7 --date=short --no-merges --format='%ad %ae %s'
2020-07-16 cwallez Fix B<->T copies of multiple array layers and unpacked rowpitch
2020-07-15 bclayton Regres: Collate and add new documentation for Regres
2020-04-08 natsu Support Gralloc3 in SwiftShader
2020-07-14 swiftshader.regress Regres: Update test lists @ cd0af645
2020-07-13 capn Undefine Bool after the headers that define them
2020-07-11 capn Remove dead ASTC code for GLES
2020-07-09 capn Rename command classes to match API calls
2020-06-04 srisser Add decoder for BC6h
2020-06-15 sugoi Image dirtiness
2020-07-09 amaiorano Android: build against llvm-10 instead of llvm-7

Created with:
  roll-dep third_party/swiftshader

Bug: None

Change-Id: Ife6dcf9f832e4aaab40de3bdb62d4b1eb258d2f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25042
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-16 15:09:55 +00:00
Tomek Ponitka e28cc55cac Implementing Queue::WriteTexture in Vulkan
Added implementation of writeTexture in Vulkan.

Bug: dawn:483
Change-Id: Id74b6518c46caf59e07a9d16dd51d8c28340fd50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24660
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-16 09:08:41 +00:00
Tomek Ponitka ce665b4624 Adding TextureZeroInitTests for WriteTexture
Added TextureZeroInitTests: WriteWholeTexture, WriteTextureHalf,
WriteWholeTextureArray, WriteTextureArrayHalf,
WriteWholeTextureAtMipLevel, WriteTextureHalfAtMipLevel.

Bug: dawn:483
Change-Id: I54a1c9c918f8289df5285135cd27e01f2bef07b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24740
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-15 20:17:17 +00:00
Natasha Lee 5a1d39ad0b [D3D12] Add DXGIAdapter to AdapterDiscoveryOptions
This gives Chromium the option to give Dawn the correct dxgi adapter to use

Bug: chromium:1036711
Change-Id: Ica544d2e76d1c300038fa07b5b639a35c43f60b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-07-15 18:26:17 +00:00
Tomek Ponitka 9d66c5353f Implementing Queue::WriteTexture in Metal
Added implementation of writeTexture in Metal. It's using a
staging buffer instead of writing directly from the CPU to
the texture, because Dawn uses the private storage mode for
most of the Metal textures.

Bug: dawn:483
Change-Id: I6b85ee8bbe343881337bdb203a122dc1f1523177
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24581
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-15 18:06:07 +00:00
Sylvain Defresne 212c5bd9b2 Convert GN libs lists to frameworks
GN recently added support for Apple frameworks to link, rather than
overloading the libs lists. This pulls .frameworks out of the libs
lists, so that GN can stop supporting .frameworks in libs in the
future.

Bug: chromium:1052560
Change-Id: I0b57a3c4c995887a57937317db30b67cf7a7f0f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24281
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-15 09:59:46 +00:00
Jiawei Shao 3b17f0bde8 Optimize B2T and T2B copies with multiple texture layers on D3D12
This patch optimizes the implementation of buffer-to-texture and
texture-to-buffer computations on D3D12 backends by computing
TextureCopySplits once for all the 2D texture array layers in the
copy instead of computing it once per layer. You can see the
comments in the function D3D12::ComputeTextureCopySplits() for more
details.

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: I1b66d24d2418147957fbe03e2c25144bd043a62e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24643
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-07-15 08:33:39 +00:00
Austin Eng b31f5e717e Remove kMaxBindingsPerGroup limit
kMaxBindingsPerGroup is not a real WebGPU limit. Code in Dawn that
uses it now uses dynamically sized vectors, optimistic stack_vecs or
a different limit like kMaxDynamicBuffersPerPipelineLayout.

The CL introduces kMaxOptimalBindingsPerGroup=32 which is used to size
the static portion of stack_vecs, but the value is tentative.

Bug: dawn:443
Change-Id: I08e06bed6531bed8b4365f36cf2fc0579ac5f180
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23502
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-07-14 22:20:35 +00:00
Corentin Wallez 0d52f800a1 Implement Buffer::MapAsync
MapAsync in dawn_native is fully implemented and only missing
a couple cleanups that can be done once MapRead/WriteAsync are
removed.

MapAsync in dawn_wire is left as a pure shim on top of
MapRead/WriteAsync and will be transitioned to its own commands
in follow-ups.

All MapRead/WriteAsync end2end and validation tests are duplicated
for MapAsync.

Bug: dawn:445

Change-Id: Ib1430b9257149917be19a84f13e0ddd2a8eccc32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-07-14 12:30:14 +00:00
Corentin Wallez 92f501dbfd Roll third_party/swiftshader/ f6f11215c..ad65826a2 (15 commits)
This fixes a couple of end2end copy tests that were failing with
swiftshader.

https://swiftshader.googlesource.com/SwiftShader/+log/f6f11215cd93..ad65826a2ab1

$ git log f6f11215c..ad65826a2 --date=short --no-merges --format='%ad %ae %s'
2020-07-03 capn Fix copying of multiple image layers
2020-07-02 capn Fix copying of multisample images
2020-07-02 capn Fix image slice / plane name usage
2020-07-09 amaiorano Android: add llvm-10 build file and fix build
2020-07-08 amaiorano Add llvm-10 configs for Android
2020-07-09 amaiorano Add arm64 support for Darwin to llvm-10 configs
2020-07-08 amaiorano Add validation and platform restrictions to LLVM-10 update script
2020-07-07 capn Remove unsupported formats
2020-07-02 sdefresne Convert GN libs lists to frameworks
2020-07-08 amaiorano Update llvm 10 Darwin config
2020-07-08 amaiorano Update llvm 10 Linux config
2020-07-06 amaiorano Enable Kokoro LLVM 10 builds on Windows
2020-07-06 amaiorano Add llvm-10 configs for Windows
2020-07-06 amaiorano Copy and modify update.py for LLVM 10
2020-07-07 swiftshader.regress Regres: Update test lists @ f6f11215

Created with:
  roll-dep third_party/swiftshader

Bug: swiftshader:152

Change-Id: Ie7cc23ef38e1befb952f2b92a8fb33d465687604
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24661
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-14 06:58:54 +00:00
Austin Eng e700a6a764 Add ityp::vector class and unittests
In order to remove the kMaxBindingsPerGroup limit in Dawn, some static
ityp::arrays need to be made dynamically sized. This CL adds ityp::vector
wrapping std::vector.

This CL also fixes the assumption that ityp::stack_vec iterators are pointers

Bug: dawn:442, dawn:443
Change-Id: I8698cbba3ea80ac063ab918a77f223c527720d08
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24480
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-07-14 01:32:43 +00:00
Austin Eng 8e316f1177 Add per-stage and per-pipeline-layout limits and validation
This CL adds per-stage and per-pipeline-layout limits according
to the WebGPU spec. It also slightly increases kMaxBindingsPerGroup
from 16 to 24 so that these limits can be effectively tested
without hitting kMaxBindingsPerGroup. kMaxBindingsPerGroup is not a
real WebGPU limit and will be removed in future patches.

Bug: dawn:443
Change-Id: I72be062cd31dea4ebd851f2d9f8274a77f286846
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24481
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-14 00:53:23 +00:00
Kai Ninomiya 261b05d3dd PipelineStatisticsName -> PipelineStatisticName
To match upstream WebGPU (and be grammatically more correct).

Upstream webgpu.h change:
https://github.com/webgpu-native/webgpu-headers/pull/60

Bug: dawn:22
Change-Id: Id665e883259b9297a90c13b43187461c64fdc3da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24702
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-13 18:21:03 +00:00
Kai Ninomiya 3e6db22fa8 Add BufferCopyView.layout and deprecate old fields
Bug: dawn:22
Change-Id: Idc37faf5edaa01a6fb1a38d1a81022ad652cf428
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24622
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-13 17:23:33 +00:00
Enrico Galli b9285f69ba Rename Buffer::IsMapWritable to Buffer::IsMappableAtCreation
Renaming method to better reflect the actual usage.

Bug: none
Change-Id: I3fcdeffaa06fceae9d5818f79c3b7985fb1885ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24701
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-12 16:16:01 +00:00
Kai Ninomiya 53405b54d5 Add occlusionQuerySet for compatibility with upstream webgpu.h
Adds RenderPassDescriptor.occlusionQuerySet for struct compatibility
with upstream webgpu.h, and validation errors that it's not used (since
it's not implemented).

Bug: dawn:22
Change-Id: I05ac75105038a0d7569cc720170e55f35b0f80d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24620
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-11 03:15:16 +00:00
Yunchao He 0b43a803bf Remove a unnecessary validation test in bind group
binding index >= kMaxBindingsPerGroup is actually valid.

Bug: none

Change-Id: Idfba743d50013b7115f125b6441fd49732dffc96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24700
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-07-10 23:30:56 +00:00
Brandon Jones 7695afc902 Implement Validation For DepthStencilAttachment ReadOnly
Implements validation for RenderPassDepthStencilAttachmentDescriptor depthReadOnly and
stencilReadOnly flags to match WebGPU specification. Includes corresponding unit tests.

bug: dawn:485
Change-Id: I21e624850d5a393469569417f102fb979dbfdf27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24602
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-10 23:13:58 +00:00
Bryan Bernhart 8c255acbe4 Add GPU detection for WARP
Adds WARP to known vendor/device Ids so
tests can detect when MBR is being used.

BUG=dawn:463
TEST=dawn_end2end_tests

Change-Id: I19f16dfeb4839c5a7c0a993bab94d2b6ca4ca36d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24680
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-07-10 22:58:48 +00:00
Kai Ninomiya 2afea0c671 Autoformat all tests and examples
Bug: none
Change-Id: I69904944db1d4c2fbcca74bb8b66b5a7524e76bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24642
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-10 20:33:08 +00:00
Kai Ninomiya 6328356129 Autoformat everything except tests/examples
Done by:
- Appending an extra newline at the end of src/**/*.{cpp,h,mm,gn}
  except src/tests/*
- Running git cl format --full to format the full contents of every
  changed file

Bug: none
Change-Id: Id88fc5ed0c5efbbc93b2c6a305c2f98465fe646d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-10 18:19:38 +00:00
Kai Ninomiya 479689912e Reorder minBufferBindingSize to match upstream webgpu.h
Bug: dawn:22
Change-Id: I409a2de9f1704613d1cdbda976c3ab50eff48d46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24603
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-09 20:49:43 +00:00
Enrico Galli c9fc175bba D3D12: Empty CPU written range in Unmap calls on READBACK heaps
In order to remove a warning in the D3D debug layer, this patch passes
an empty range CPU written range to calls of Unmap on READBACK
buffers.

Bug: dawn:419
Change-Id: Ic4dcbf31beb3a257c3d88896f4bb97e19caf0cc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24301
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-09 20:40:53 +00:00
Tomek Ponitka c98988de11 Added validation tests for copying to 2d-array textures
Added validation tests for CommandEncoder::CopyB2T, CommandEncoder::CopyT2B and
Queue::WriteTexture which involve copying or writing to multiple layers
of a 2d-array texture.

Bug: dawn:483
Change-Id: I23f580dff86cd2512a94b41c9c0ce795122a045e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24443
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-07-09 17:33:13 +00:00
Jiawei Shao dab10eae8a Implement buffer lazy initialization before CopyBufferToBuffer
This patch implements buffer lazy initialization before
CopyBufferToBuffer() behind the toggle LazyClearBufferOnFirstUse.
- If the source buffer is not initialized, it will be cleared to 0
  before CopyBufferToBuffer().
- If the destination buffer is not initialized and the copy doesn't
  overwrite the whole buffer, it will be cleared to 0 before
  CopyBufferToBuffer(), otherwise the buffer shouldn't be cleared.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I3d0512c6376a1ed8928e86f8e56fefebc16910fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24360
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-09 09:15:22 +00:00
Corentin Wallez d3bf2188aa Remove usage of the UNIT_TEST macro.
It is breaking the roll of Dawn in Chromium because on ChromeOS the
macro is defined on the command-line, causing the compilation to fail
because of a macro redefinition.

Bug: None
TBR=enga@chromium.org
Change-Id: I13eebb9b40f2a5f7c1eed4e3572de3eda2db8bb6

Change-Id: I4797211f4d9ff122d992d78aeac83fd4f0585ff6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24580
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-09 07:00:32 +00:00
Corentin Wallez 1318c603d9 Don't rely on null::Queue::Submit resolving mapping operations.
In the validation tests, we relied on Queue.Submit(0, nullptr) to
resolve mapping operations. This is fragile so we replace it with a
FlushMappingOperations() function that uses device.Tick() instead.

This allows removing the mapSerial argument from
Buffer::MapRead/WriteAsyncImpl (which was the actual goal of this CL).

Bug: dawn:445
Change-Id: Id98822287370c371bebb83afb8e290e17f3c1b55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24381
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-09 06:12:04 +00:00
Austin Eng d761d5a575 Add Chromium's StackVector base class and ityp::stack_vec
In order to lift Dawn's restriction on the number of bindings
per bind group, static sized arays need to be converted to
dynamically sized vectors. This CL adds Chromium's StackVector
class which behaves like std::vector but provides a stack allocator
to allocate small vectors on the stack. Dawn can use this to avoid
making separate heap allocations for a smaller, realistic binding
counts.

The CL also adds an ityp::stack_vec class to support using
a StackVector with TypedInteger indices.

Bug: dawn:442, dawn:443
Change-Id: I7604c02b3ea52cd63990a2e8b45ed238a5d52232
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-08 20:27:30 +00:00
Corentin Wallez 8a9919980f Don't leak buffers if MapAtCreation fails.
This required changing DeviceBase::CreateBufferImpl to return
ResultOrError<Ref<BufferBase>>

Bug: chromium:1103154
Change-Id: I1a5811d293333b6ef29c988a08f2f1f84ac65702
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24500
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-07-08 19:45:40 +00:00
Corentin Wallez 519edd5890 Fix MSVC compilation.
- Fix a struct vs. class in forward declaration of std::hash
 - Fix an unsigned vs. signed compare in BitSetIterator
 - Fix the assumption that std::array::[const_]iterator is a pointer.
 - Fix for reinterpret_cast from uint64_t to uint64_t not being allowed
   for vulkan_platform.h
 - Fix for a 32bit shift being expanded to 64bit.

Bug: None
Change-Id: I5f2bf8745aa1ef1eba9916fcf6ff7801b48f61cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24501
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-08 18:50:30 +00:00
Tomek Ponitka a9c7d64aad Adding Queue::WriteTexture
Added Queue::WriteTexture with validation but no actual
implementation. Tests were mostly taken from validation tests
for copying buffer to texture. Validation tests for CopyB2T
and WriteTexture do not cover 2d-array textures yet.

Bug: dawn:483
Change-Id: I9027eb615c02fe2265cde912f6ba17a235b94728
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-07-08 18:42:30 +00:00
Enrico Galli 83fe1bc34d D3D12: Added default optimized clear color to resource creation
Adding zero as the optimized clear value to silence a warning in
the D3D12 debug layer. Warning will still occur under non-zero
clears.

Bug: dawn:418
Change-Id: Idada948950f28130618834d966b237dcc39460c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24300
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-08 07:39:56 +00:00
Bryan Bernhart 7622be0544 D3D12: Avoid re-binding sampler tables.
Skip re-binding samplers since sampler heap
allocations are cached and the pipeline would
redundantly get set every draw. This is
particularly important for draw heavy scenarios.

After the change:
+3% in RendererPerfTest/1.* via SkiaDawn
+100% for Forest Demo FPS (55ms vs 28ms)

BUG=dawn:479

Change-Id: I93cbca4e365d6ff89ec86fc15eaccf70b49ea916
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24161
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-07-07 23:32:52 +00:00
Corentin Wallez b2ea1915d4 Implement GPUBufferDescriptor.mappedAtCreation.
This CL:

 - Adds mappedAtCreation to dawn.json
 - Changes dawn_native to implement CreateBufferMapped in terms of
   mappedAtCreation.
 - Duplicates all the CreateBufferMappedTests to mappedAtCreation tests
   (both validation and end2end).
 - Implements dawn_wire's mappedAtCreation in terms of
   CreateBufferMapped. The reversal in dawn_wire will be done in a
   follow-up CL.

Bug: dawn:445

Change-Id: I70b9fa729b1402524a6b993c3f288987eb65c6c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24083
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-07-07 11:21:51 +00:00
Tomek Ponitka 0f5d496f12 Rephrasing CopyBufferToTexture validation
Moved some of the validation helper functions from CommandEncoder.cpp
to CommandValidation.cpp. This will make them accessible for
Queue::WriteTexture. Also introduced ValidateLinearTextureData
and ValidateTextureCopyRange which combine already implemented
checks in a way that's defined in WebGPU spec.

Bug: dawn:483
Change-Id: I04304c5e4906f3745c6adf75758fae179c6ffcfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24283
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-07 10:18:51 +00:00
Corentin Wallez 9585c468a2 Update dawn.json to more closely match webgpu.h
- Move wgpu::TextureUsage::Storage at the end of the enum.
 - Reorder some methods of device to be in alphabetical order.
 - Reorder members of wgpu::QuerySetDescriptor.
 - Change SurfaceDescriptorFromHTMLCanvasID to
   SurfaceDescriptorFromCanvasHTMLDescriptor.

Bug: dawn:22
Change-Id: Ib18fbaf153ad2969b0d0c4e49682e8736b00776c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-06 18:50:00 +00:00
Corentin Wallez dbf805fe8d Update GetMappedRange to not produce validation errors
GetMappedRange never produces errors and instead returns nullptr when it
is disallowed. When in a correct state, should return a valid pointer as
much as possible, even if the buffer is an error or if the device is
lost.

Adds tests for error buffers and device loss, and modify existing tests
to not expect a device error.

Also removes some dead code in the Vulkan backend and adds a fix for
missing deallocation of VkMemory on device shutdown.

Bug: dawn:445

Change-Id: Ia844ee3493cdaf75083424743dd194fa94faf591
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24160
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-07-06 18:08:10 +00:00
Xinghua Cao db34c78910 Check FP16 support on D3D backend
True FP16 is only supported in DXC through Shader Model 6.2, also
check the value of the Native16BitShaderOpsSupported member of
D3D12_FEATURE_DATA_D3D12_OPTIONS4 to view whether hardware actually
supports FP16 operations.

BUG=dawn:426
TEST=dawn_end2end_tests

Change-Id: If675f7ba650cb1bd8c792928b70619b9ccda048a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23243
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
2020-07-06 08:28:00 +00:00
Jiawei Shao 80f927d763 Implement buffer lazy initialization before writeBuffer
This patch implements buffer lazy initialization before writeBuffer():
if the buffer is not initialized and writeBuffer() doesn't cover the
whole buffer, the buffer will be cleared to 0, otherwise the buffer
shouldn't be cleared.

This patch also introduces a toggle LazyClearBufferOnFirstUse for the
development of buffer lazy initialization: before buffer lazy
initialization being completely supported, all the related code will
only be enabled behind this toggle to prevent the buffers with valid
content being unexpectedly cleared.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I99a2aa98ca4b9b21d69c6b32080afb525e2c4ad3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24041
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-06 08:24:30 +00:00
Dirk Pranke 59ccb1f6de Add proper data_deps to dawn_perf_tests.
Currently the Chromium build defines a wrapper build target
for Dawn (//chrome/test:dawn_perf_tests) that seems to exist
only to specify some extra data dependencies. By moving this
data dependencies onto the Dawn dawn_perf_tests itself, this
removes a problematic target in Chromium that would otherwise
block my planned changes for crbug.com/816629.

Bug: chromium:816629
Change-Id: I428698fe164bd1aad09c8dba14e57a4b7acebb1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24302
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-03 05:47:07 +00:00
Corentin Wallez f695264d30 Broaden -Wno-tautological-type-limit-compare
In https://dawn-review.googlesource.com/c/dawn/+/24162 it was added
inside the is_win condition so it didn't take effect on Linux.

TBR=enga@chromium.org
TBR=senorblanco@chromium.org
Bug: None
Change-Id: Icc9ea20ed3a5ae4e5c514ce32bff88009ad82b1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-02 09:21:08 +00:00
Jiawei Shao 4d007f34f3 Fix bugs in the multi-layer copies with BC formats on D3D12 and OpenGL
This patch fixes two bugs in the copy commands with BC formats and
multiple array layers on D3D12 and OpenGL and adds two end2end tests as
the regression tests.

This patch also removes "viewArrayLayer" in the struct CopyConfig used
in CompressedTextureBCFormatTest and sets the base array layer into
CopyConfig.copyOrigin3D.z instead.

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: I1c2e6b79fb7c44fc996655ab5a908e27ba8c4729
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24183
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-02 09:08:09 +00:00
Idan Raiter bcc65f2d48 Vulkan: Enable robust buffer access if validation is on
Bug: dawn:480
Change-Id: Id145fab2fe24b70a063c3cc1f75f0a565635abf8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24182
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-01 21:37:57 +00:00
Austin Eng 509b811a75 Vulkan: Fix MemoryServiceOpaqueFD CreateImage
vkCreateImage when bound to imported memory, must also have
a VkExternalImageCreateInfo struct in its pNext chain that
has VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT as a
handleType.

This was discovered when tests started failing after a roll
of the Vulkan validation layers.

Tbr=cwallez@chromium.org, senorblanco@chromium.com
Bug: none
Change-Id: I4692d650af27b9325342baeda34a0d982fc49041
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24200
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-07-01 20:44:47 +00:00
Corentin Wallez 96c78ec737 Disable -Wtautological-type-limit-compare
This unblocks a roll into Skia.

Allow comparison against type limits that might be tautological on
32bit or 64bit systems. Without this the following produces an error
on 64bit:

  if (myUint64 > std::numeric_limits<size_t>::max()) {...}

Bug: None
Change-Id: I31fc579738b6fb85b40cfeac8f30936161a15da1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24162
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-01 14:36:56 +00:00
Tomek Ponitka 5fb974cf47 Changing pointers to Ref<> in GetOrCreateBGL
DeviceBase::GetOrCreateBindGroupLayout and
DeviceBase::GetOrCreateEmptyBindGroupLayout are now returning
ResultOrError<Ref<BindGroupLayoutBase>> instead of
ResultOrError<BindGroupLayoutBase*>.

Bug: dawn:466
Change-Id: I223864325aba9011b0ba6dc67589ead48d930309
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24082
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-01 13:09:46 +00:00
Hao Li 5191adc58c Query API: WriteTimestamp
Add WriteTimestamp API on CommandEncoder, ComputePassEncoder and
RenderPassEncoder.

Bug: dawn:434
Change-Id: Ifeca4efed01d80459d6fefa22ba05bea699b541f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23244
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-07-01 10:48:16 +00:00
Tomek Ponitka 268fe254ec Added constraints for too large uniform buffer bindings
Added a constraint in ValidateBufferBinding function checking for too
large uniform buffer bindings. Added MaxUniformBufferBindingSize
test in BindGroupValidationTest.

Bug: dawn:436
Change-Id: I31c6e2236ce928d5e81c43455eb18cf4eacdc0f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24081
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-30 18:49:20 +00:00
Bryan Bernhart bd2ab92853 D3D12: Limit QueueWriteBufferTests.ManyWriteBuffer
The stress test is causing timeouts on slower GPUs
due to the TDR threshold being hit. This halves the
number of writes required to complete the test.

BUG=dawn:228

Change-Id: I18dfa68b39a2c079b89eeadc78a69675e5c3269f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-06-30 18:48:20 +00:00
Corentin Wallez f7fab5a259 dawn_native: Use correct integer width for SetSubData.
SetSubData's count is a uint64_t while Queue::WriteBuffer's is a size_t
so we add a small validation check that no narrowing will occur.

No test is added because SetSubData will be removed soon, and it will be
hard to test because of the Null backend's artificial OOM.

This was found while debugging an unrelated fuzzer issue.

Bug: chromium:1099621
Change-Id: I27a9da2b94f51e889c5573f88d4a0a73fea5985c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23961
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-30 18:46:32 +00:00
Corentin Wallez 00d6215be9 dawn_wire/client: Add ToAPI and FromAPI helpers.
In the client code, we often need to translate between WGPUObject (the
API type) to Object* (the internal client type). This added a bunch of
reinterpret_casts that make the code less readable and more fragile.

This CL adds FromAPI and ToAPI helpers in the autogenerated
ApiObjects_autogen.h header, that convert between API and internal types
in a type-safe way.

Bug: dawn:445

Change-Id: Ia1bf624f0315ced496b95cb660adf88abd916d71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24063
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-30 18:39:50 +00:00