This commit generalizes the way layers are handled to be more like
extensions, and adds support for gathering and enabling layer
extensions.
This is in preparation for using the VK_EXT_validation_features
extension to enable barrier validation.
Also adds logic to use the Fuchsia swapchain layer when it is available.
It seems to have been removed by mistake some time ago.
Bug: dawn:635
Change-Id: I8e5776d546ddd7940238465c7b0f187d8dd3c5bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38104
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Vulkan requires that storage images be in the GENERAL layout, and requires
that we choose a layout at VkDescriptorSet creation. This means that
since Sampled+ROStorage texture may sometimes be used as both usages in
the same pass, they must always be in the GENERAL layout even for
SampledTexture bindings.
Fix this by looking at the texture's creation usage in VulkanImageLayout
for wgpu::TextureUsage::Sampled.
Also add a regression test that triggers a Vulkan Validation Layer error
without this fix.
Bug: dawn:635
Change-Id: I4a5b94e1af20839b3b8cc080d36fca59d79f09bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38107
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
ityp::bitset allows the creation of a bitset indexed by enums. Use this
instead of our custom wrapper around bitset that only supports .Set and
.Has.
Bug: dawn:635
Change-Id: I6680feb9b1741648d974cf1cef48cb1863aa20af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38103
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Using this container is a small performance regression in the simple
cases where all subresources are the same, or when the texture has few
subrsources. However it give better performance in the hard subresource
tracking cases of textures with many subresources.
Using SubresourceStorage also makes it easier to work with compressed
storage since the compression is mostly transparent. It reduces code
duplication and prevent bugs from appearing when a developer would
forget to handle compression.
This fixes a state tracking issue in ValidatePassResourceUsage where the
function didn't correctly handle the case where the PassResourceUsage
was compressed.
Also removes the unused vulkan::Texture::TransitionFullUsage.
Also makes SubresourceStorage<T> only require operator== on T and not
operator !=.
Also fixes the texture format's aspect being used to create pipeline
barriers instead of the range's aspects.
Bug: dawn:441
Change-Id: I234b8191f39a09b541c1c63a60cccd6cee970550
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37706
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This will catch errors when someone updates an enum used with
EnumMaskIterator without updating EnumBitmaskSize. Previously it would
just ignore the extra bits, which produced super confusing bugs.
Bug: dawn:635
Change-Id: Ib0bf3f252db317a1bfdeb687b2426801a79b524d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
When trying to use ityp_array with an enum class whose underlying
type is int, warnings were fired because of a comparison between signed
and unsigned integers. Fix this by explicitly casting Size to `I` using
a constructor cast.
Bug: dawn:635
Change-Id: I5ee0101684e5847ec5ec6f71a9657fcce839a2a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38106
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
One of the helper methods to compute texture barriers didn't handle the
kReadOnlyStorage usage, which made barriers issued too small.
Issue was caught by running
StorageTextureZeroInitTests.ReadonlyStorageTextureClearsToZeroInRenderPass
with the Vulkan barrier validation enabled.
Also renames kReadonlyStorageTexture to kReadOnlyStorageTexture for
consistency.
Bug: dawn:635
Change-Id: I6e6027c380672dcdaea789c811665536b446003e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38101
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Some of the helper methods to compute buffer barriers didn't handle the
kReadOnlyStorage usage, which made barriers issued too small.
Issue was caught by running the GpuMemorySynchronizationTests with the
Vulkan barrier validation enabled.
Bug: dawn:635
Change-Id: Ice76edd21b2fa1c25cf9922418f65cfa7d802bdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
The previous VK_EXT_debug_report and VK_EXT_debug_marker extensions were
both deprecated in favor of VK_EXT_debug_utils. This commit makes Dawn
follow the ecosystem and also adds more detailed reporting of why
vkCreateInstance fails that's now supported in VK_EXT_debug_utils.
Bug: dawn:635
Change-Id: I61c89da1fd55f26d7ccf91723feedfb354efbc16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38020
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This implementation uses glBlitFramebuffer().
Bug: dawn:638
Change-Id: I4ff62967c815a7e4b04348930539b27bddf44580
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38145
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This patch adds the basic implementation of WaitableEvent and
WorkerTaskPool for multi-threaded tasks in Dawn (for example, the
multi-threaded implementation of CreateReady*Pipeline()).
BUG=dawn:529
TEST=dawn_unittests
Change-Id: Ibf84348f4c0f0d26badc19ae94cd536cef89d084
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Added root constants to emulate the behavior of other APIs under D3D12.
This patch only fixed Draw and DrawIndexed.
Bug: dawn:548
Change-Id: Ic759c22e0db1092f890d45c5db489697b1583827
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37620
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Now that the wire does enough tracking to prevent a malicious client
from freeing a device before its child objects, and the device is no
longer a "special" object with regard to reference/release, it is
safe to support multiple devices on the wire. The simplest way to
use this in WebGPU (to fix createReadyRenderPipeline validation)
is to add a reserve/inject device API similar to the one we use for
swapchain textures.
Bug: dawn:565
Change-Id: Ie956aff528c5610c9ecc5c189dab2d22185cb572
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Also enable the CopyTests on OpenGL ES, since they now pass on 3.2.
Enable all tests that are no longer failing due to crbug.com/dawn/581
and update bug references for bugs which are still failing.
Bug: dawn:581, dawn:636
Change-Id: I6b74143f11dd4e1824551720024be174f2eaa003
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38140
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This Cl updates the WGSL used by Dawn to use the new `group` decoration
instead of the deprecated `set` decoration.
Change-Id: I145aaff7721dfafff986ddc429c9cdc9389c2110
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38141
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Also implement a way to check for ANGLE.
Bug: dawn:634, dawn:580
Change-Id: I4b361d02247f91250f1ce31cfbfdd0d74b3b3060
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This is a performance test in preparation of using SubresourceStorage
in dawn_native. On the Vulkan backend with Swiftshader it shows that
SubresourceStorage will bring a small perf regression for simple cases
(<= 10%) but it that complex cases are improved significantly (up to
twice faster).
Also renames a variable to follow the mMemberName convention.
Bug: dawn:441
Change-Id: I3fec80cba39b7d2aaba08fc8fbd8ea913ed5501c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37041
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This recently broke in VS2019 (weak_ptr and shared_ptr aren't included).
Change-Id: I88edffa3e965c02d0db83e2efd0977cf86c96800
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38023
Commit-Queue: Carl Woffenden <cwoffenden@gmail.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Instead of hardcoding the number of array layers
Bug: tint:140
Bug: tint:437
Change-Id: Ic9ea6a0e2853d8dbc29a840deff0e6938ff5e4d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37849
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Change-Id: Idce1b71bdb132a1b96836d270eb2ab53fd0086f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36700
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This CL updates the WGSL texture storage syntax to use the access
decoration.
Bug: tint:286
Change-Id: I0024a0682c6a6479eb7a8436f8df4c9a76ec5e2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37880
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
- Enable internal compute pipeline in ResolveQuerySet for Timestamp
Query.
- Known issue:
The user-provided resolve buffer cannot be used as binding resources
due to missing STORAGE usage. Currently implictly add STORAGE usage
if the buffer is created with QUERY_RESOLVE usage as a workaround.
Next we will add STORAGE_INTERNAL usage instead.
Bug: dawn:434
Change-Id: Ie66090de38bc3a04a58986669cd2a128b528f960
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36222
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
If the client drops the last reference to the device, it would
dereference an invalid pointer upon calling InjectError. So, skip the
call. We can't keep the device alive if the Buffer is still alive
because we intend to make all objects internally null if you delete
their device.
It is ok to skip error injection because if the client deletes the
device, it should not expect to receive any more error callbacks.
Bug: dawn:384
Change-Id: I4c694310e4395b06cd49603fc5d4cd846799decb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37580
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
If the SPIR-V fails to validate, include the SPIR-V disassembly in the error.
If the shader fails to compile, include the shader source in the error.
Change-Id: I05f93b5dec7985c42ddf9cd14621af2a855ee640
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37282
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This should be the last change BindGroupLayout change needed to complete
the conversion to the new structure aside from removing the deprecated
code paths in the future.
Bug: dawn:527
Change-Id: I44f67de80f1b4e1b7b32909d70d74610f7a06d8d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37560
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Destroying a device will implicit destroy all its child objects.
Attempting to use a child object after results in a fatal error.
Bug: dawn:384
Change-Id: I43c27c92cacde759be83cca79ac890f41bac3927
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37002
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
The wire's device is externally owned so reference/release were no-ops.
To unify the code paths, remove the special casing and instead
take an extra ref on the device the wire server is created with. This
is functionally equivalent and will allow both the current wire code,
and the incoming change to allow multiple device/adapter creation to
both work.
This CL also makes it possible for the client to destroy the device
before child objects.
A follow-up CL will mitigate this on the server side.
Bug: dawn:384
Change-Id: Ic5427074469012dccf8689ec95a848e6ba2c1fc2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37001
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This removes the logic where the Client owns the Device and the
Device owns all other objects. Ownership should be tracked in
dawn_native either with refcounting or validation to disallow
operations after an object's parent has been destroyed.
This simplifies the wire client code in that the client only
tracks allocated handles and does not manage parent/child lifetimes.
This is an important simplification so we can support multiple WebGPU
instances, adapters, and devices on a single wire.
Bug: dawn:384
Change-Id: I8ecc7c368130b8917202150c467b5f0e7d4b753e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37000
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This is needed before supporting instances, adapters, and devices on
the wire so that the client cannot free the instance before the device.
In Dawn native, the developer still needs to make sure the device is not
freed before all child objects.
Bug: dawn:384
Change-Id: I863d44c6a8acecc7b8ea0cc0ac483f7a864162fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37003
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This issue was discovered in http://crrev.com/c/2613517 where a
device lost error on page teardown was bubbling up to the Renderer's
uncaptured error callback.
Bug: chromium:1160459
Change-Id: I64b8c7779f4808d5a4b87c131aaf2e041c512bb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
These fix the tests so that the entire of Dawn can now be built with
VS2019. Some details:
Multiples of "error C3493: 'X' cannot be implicitly captured because no
default capture mode has been specified" in BufferTests.cpp. This
appears to be a bug in VS whereby the constexprs need capturing; the
workaround, rather than explicitly name them and change the function
signature, is to make the vars also static.
In DepthStencilSamplingTests.cpp we get "warning C4310: cast truncates
constant value" for uint8_t(256). Rather than try to silence the
warning the test was removed, since the cast will *always* result in
zero, which is also the first in the test values.
To successfully build two further third-party dependencies also require
updating:
https://dawn-review.googlesource.com/c/tint/+/37700https://chromium-review.googlesource.com/c/angle/angle/+/2624888
Note: whilst this now builds the entire of Dawn with VS not yet all of
the build arguments are supported. Yet to investigate is turning on
optimisations (with is_official_build=true) which attempts to combine
"/INCREMENTAL" with "/OPT:REF" and fails (to be addressed next).
Bug: dawn:602
Change-Id: I37202992f16b999d5627022eeeb6b9fff0d4b60b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37701
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Carl Woffenden <cwoffenden@gmail.com>
The opengl backend uses glBlitFramebuffer to present frames which
is affected by the opengl scissor rect.
Bug: dawn:616
Change-Id: I0b8c3eb7139ab22a98eeb60e3ad16678e3afad5d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37101
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Mark Sibly <marksibly@gmail.com>