Commit Graph

1917 Commits

Author SHA1 Message Date
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