This is the first step for having a fully operational SPVC usage
path. This version of SPVC integration uses SPVC for setting up the
options to the compiler, but a lot of the actual interaction with
spirv-cross is done in Dawn, just via SPVC's compiler object.
Future CLs will migrate more of the spirv-cross interaction to using
the SPVC API, eventually removing the need for Dawn to know about
spirv-cross.
BUG=dawn:288
Change-Id: I68e0773f910d7fe967235b6987b3debe1d13883f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14143
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
BUG=dawn:287
Change-Id: If39e1211cedefa5d02f1ea2f3ae00f6195e1e916
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14141
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
The change adds multiple write then multiple read tests for gpu memory
synchronization test. It covers all common usages: write into storage
buffers, then read the data as vertices, indices, and uniforms.
The different usages are done via separate buffers, and one mixed buffer
via two tests.
I added two uniform buffers/usages in these two tests. I will replace one
uniform buffer by readonly storage buffer later. Then all readonly usages
will be covered. So it is also useful to verify the upcoming implementation
on backend for readonly storage buffer.
BUG=dawn:275
Change-Id: Ifbe086f55064e7b26cfc42ebc9c56edaf7e9d5a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13940
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This will be used in the future to choose between Dawn directly
accessing spirv-cross, and using spvc to mediate that interation.
This also adds in the spvc library as a dependency. This is what cause
the rollback last time, but that issue should be resolved.
BUG=dawn:281
Change-Id: Ic0b02d136ca05e2fa71844ebc85586b8866d5712
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14122
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Switch over to using the rule for building spirv-cross from spvc. This
allows GN to avoid double symbol issues in future patches.
Roll third_party/shaderc/ 1d6155d86..30f0559dd (2 commits)
1d6155d867..30f0559dd2
$ git log 1d6155d86..30f0559dd --date=short --no-merges --format='%ad %ae %s'
2019-11-27 rharrison Remove spvc's dependency on shaderc's util library (#914)
2019-11-27 rharrison Clean up how include dirs are propegated for spirv_cross (#912)
Created with:
roll-dep third_party/shaderc
BUG=dawn:281
Change-Id: I49cf237dcab884e84180f83cbbb21acfa549fe61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14121
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Contrary to Linux, libvulkan.so on Android doesn't have the additional
.1 at the end (libvulkan.so.1 on Linux)
BUG=dawn:286
Change-Id: I22f06121b81e0fe08faae7d105a7c2094e788184
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14104
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
The Vulkan specification requires that GRAPHICS and COMPUTE queue
support transfer operations, but it doesn't require them to expose the
TRANSFER flag. Make Dawn not require that flag so it can find a
universal queue on Adreno drivers.
BUG=dawn:286
Change-Id: Id4811e2077b27aa7db5ce554a4fd919c3cdcdb96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14101
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Roll third_party/shaderc/ 24536bdd3..1d6155d86 (1 commit)
24536bdd3c..1d6155d867
$ git log 24536bdd3..1d6155d86 --date=short --no-merges --format='%ad %ae %s'
2019-11-27 rharrison Moving spirv-cross dep from Dawn into shaderc (#911)
Created with:
roll-dep third_party/shaderc
BUG=dawn:285
Change-Id: I47d202166f9e34c88e7aad75d6a3c8aa9a7d6499
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14120
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Also update shaderc override to be the correct directory
BUG=dawn:285
Change-Id: I021755bbc8f50daa65b6964f3e42d395b51bb94a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This adds swiftshader as a dependency of Dawn, and when it is present
dawn_use_swiftshader=true will force usage of it. (due to a Vulkan
loader limitation we can't have both regular drivers and swiftshader in
the same VkInstance).
BUG=dawn:283
Change-Id: Ib94f4dcca652eb380e994f007cdcfb145b1a5102
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Disabling this while refactoring how dependencies are set up to avoid
breaking various builds and rolls.
BUG=dawn:285
Change-Id: Iaca2614fb73277a1ea850f90a487693cd4c54fcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Roll third_party/SPIRV-Tools/ 2ee9aaa28..85f3e93d1 (2 commits)
2ee9aaa288..85f3e93d13
$ git log 2ee9aaa28..85f3e93d1 --date=short --no-merges --format='%ad %ae %s'
2019-11-22 mattst88 Respect CMAKE_INSTALL_LIBDIR in installed CMake files (#3054)
2019-11-20 rharrison Add missing dealloc (#3061)
Roll third_party/glslang/ f4d466852..38b4db48f (6 commits)
f4d4668529..38b4db48f9
$ git log f4d466852..38b4db48f --date=short --no-merges --format='%ad %ae %s'
2019-11-23 cepheus Fix#1983: __ is okay starting with ES 300, rather than 310.
2019-11-22 cepheus Fix#1987: Use large enough built-in buffer to hold vec4 of maxint-64.
2019-11-21 dsinclair Check for ENABLE_SPVREMAPPER flag in CMakeList files.
2019-11-18 Arfrever Respect CMAKE_INSTALL_LIBDIR in installed CMake files
2019-11-14 andreas.floejt Add a test for 8- and 16-bit construction.
2019-11-11 andreas.floejt Fix construction issue for 8 and 16 bit types.
Roll third_party/shaderc/ c7f5cfd07..da52fae11 (6 commits)
c7f5cfd07f..da52fae116
$ git log c7f5cfd07..da52fae11 --date=short --no-merges --format='%ad %ae %s'
2019-11-21 rharrison Revert "Convert to using standard spirv_cross deps in BUILD.gn (#902)" (#905)
2019-11-21 9856269+sarahM0 Add spvc parser support for OpTypeForwardPointer, OpTypeAccelerationStructureNV (#903)
2019-11-21 rharrison Convert to using standard spirv_cross deps in BUILD.gn (#902)
2019-11-21 rharrison Convert spvc parser flag from build time to runtime (#901)
2019-11-21 9856269+sarahM0 Add spvc parser support for OpGroupDecorate, OpGroupMemberGecorate, OpDecorateStringGOOGLE, and OpMemberDecorateStringGOOGLE (#899)
2019-11-20 9856269+sarahM0 Add spvc parser support for OpUndef, OpString, OpMemberDecorate, OpDecorationGroup, OpLine, and OpNoLine (#898)
Created with:
roll-dep third_party/SPIRV-Tools third_party/glslang third_party/shaderc third_party/spirv-cross third_party/spirv-headers
Change-Id: I89de33e4bcee1d73e8ee91fcbe8984939fa8fe3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14034
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This change adds GPU memory synchronization tests for buffer. The tests cover
data flow from render pass to compute pass via storage buffer, and vice versa.
It is the last one for the series of memory sync tests for buffer.
BUG=dawn:275
Change-Id: Ic866161cadc0fa9df4c441f3970783077f3a9bd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13921
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This patch makes the |layout| member of the Render|ComputePipelineDescriptor
optional. If it is not provided, a default layout is created from the
ShaderModules provided and used to replace the layout in the descriptor.
Then, pipeline.GetBindGroupLayout may be called to get the existing, or
the computed bind group layout. If no bind group layout exists at the
provided index, an empty bind group layout is returned.
Bug: dawn:276
Change-Id: I276ed0296a2f1f2d8131fa906a4aefe85d75b3a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13741
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
The TextureComponentType and TextureViewDimension of resources in
the shader must match those in the bind group layout.
This patch also extracts the texture view dimension from the SPIRV.
Bug: dawn:202
Change-Id: Ie155f17109f4f1b5d9b386d757062ae5ffe5da67
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13861
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This was used to make the distinction between native-only methods that
were those manipulating "natively defined" types, and the rest. Now that
all "natively defined" objects are "callback" instead this name didn't
make sense.
The only relevant thing is that in C there are the Reference and Release
methods that don't appear in dawn.json and shouldn't be exposed on C++
objects. Hence most of the native_methods() calls in the templates are
updated to be c_methods() calls except for the webgpu_cpp templates that
use type.methods directly.
BUG=dawn:22
Change-Id: I65c160b8b8a829e4728862c65bc67268a46f445e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13902
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This replaces all instances of "natively defined" with callbacks and
adds information about the callbacks arguments so that their typedefs
can be autogenerated in dawn.json.
Also adds all the methods using callbacks to the list of handwritten
client commands so that the wire templates don't try to generate code
for them.
BUG=dawn:22
Change-Id: I30ce01e3e688a16b31efa74d0c94ebafdca00985
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13901
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This patch factors resource usage tracking so it is separate from
command validation, allowing the bulk of command validation to be
completely skipped.
In DrawCallPerfRun/Vulkan_DynamicPipeline_DynamicBindGroup, disabling
validation cuts roughly 74 nanoseconds (20%) of CPU time, per draw.
In DrawCallPerfRun/Vulkan_DynamicBindGroup, disabling validation
cuts roughly 35 nanoseconds (17%) of CPU time, per draw.
In DrawCallPerfRun/Vulkan_MultipleBindGroups, disabling validation
cuts roughly 45 nanoseconds (14%) of CPU time, per draw.
Bug: dawn:271
Change-Id: I517b85840ba18c6a554b83f34a1d0aef1a8c56a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13520
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This reverts commit 1954436fe2.
Reason for revert:
The shaderc side of this multi-patch brings in a dependency on glslang, which uses a static initializer, which chromium doesn't like.
Original change's description:
> Convert spvc build flag to a runtime toggle
>
> Also moves some of the spirv_cross code into the main library that was
> feature guarded, since spvc requires it.
>
> BUG=dawn:281
>
> Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,rharrison@chromium.org
Change-Id: Ia9a025fb4440c96874d1b45776a9f97023ca591d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13941
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
There were some missing DAWN_NATIVE_EXPORT arributes for new structures
in VulkanBackend.h which resulted in linking errors.
BUG=chromium:996470
Change-Id: I45deb56faf5fd77ecfa96ebda99d31d0109d98ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13900
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
It is invalid to specify a resolve source region on GPUs that do not
support sample positions. Instead, the entire region rect should be
set to all zeros or "empty" to always resolve the entire region.
Bug: dawn:36
Change-Id: I23575b2186bffbcb2e236988558b78f97375a126
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13501
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Also moves some of the spirv_cross code into the main library that was
feature guarded, since spvc requires it.
BUG=dawn:281
Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This CL implements the MemoryService for importing memory and
creating VkImages from a dma-buf handle. Under the hood, it uses the
VK_EXT_external_memory_dma_buf and
VK_EXT_image_drm_format_modifier extensions to find a memory type
that supports dma-buf import. In addition, the extensions are also
used to properly specify the stride and tiling of the dma-buf to
vkAllocateMemory and vkCreateImage.
BUG=chromium:996470
Change-Id: Ie72d73117a4cbafcb40468aab0952b783351d499
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13785
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
The test would previously fail because the mappedData pointer stayed
non-null which meant the spin-loop waiting for the map read callback
would exit immediately.
BUG=dawn:278
BUG=dawn:280
Change-Id: I53e5974571d7684b09903c599bb65c0d8efe4d8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13821
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Trusted users of Dawn should be able to use it without the
overhead of command validation. This patch adds the toggle and
skips validation for object creation.
Bug: dawn:271
Change-Id: Ica9a1988177685d73e2c36e05c4d525ad1ab0fdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13802
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This CL adds an API to import a dma-buf into Dawn as a WGPUTexture.
We also add a descriptor type enum to the base
ExternalImageDescriptor struct. This is because all memory import
code (e.g. MemoryService, Texture::CreateFromExternal) takes the
a base ExternalImageDescriptor as a parameter. The dma-buf external
memory and image services, however, will need to downcast to
ExternalImageDescriptorDmaBuf to access import parameters like
stride. Explicitly adding a type enum will let us more safely verify
the type before downcasting.
BUG=chromium:996470
Change-Id: I2d9883a15e9059a91f2c7bdb7a96d74373e18c56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13782
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
This CL introduces SupportsCreateImage and CreateImage to the
external memory service API to provide different implementations for
creating VkImages for different types of external image handles.
While opaque FD and Zircon seem to share the same vkCreateImage
implementation, dma-buf import will require the use of the
VkImageDrmFormatModifierExplicitCreateInfoEXT [1] struct (among
other differences) with vkCreateImage.
[1] https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkImageDrmFormatModifierExplicitCreateInfoEXT.html
BUG=chromium:996470
Change-Id: I3eb11f8877d4465f5fcdd4089d5fdd8acbc1da10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13781
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
An earlier CL [1] enabled Vulkan validation layers on Linux which
also enables validation layers on Chrome OS. Unfortunately, this
changes breaks the Chrome OS build of Dawn:
.../vulkan.h:63:10: fatal error: 'xcb/xcb.h' file not found
This is because including the validation layers also includes
the Vulkan-Headers repo which has a BUILD file that defines
VK_USE_PLATFORM_XCB_KHR [2]. XCB (and all of X11, for that matter)
is not supported on Chrome OS even though it is a Linux platform.
This is a quick fix for the problem to unbreak the BUILD, but I
think we should discuss what a long-term fix looks like. Do we send
a patch to Khronos to add an "is_chromeos" branch to their BUILD
file a la Fuchsia?
Also, as mentioned by cwallez@ in a different CL of mine, we should
really set up a Chrome OS trybot to catch these earlier. I can
assign a bug to myself for that!
[1] https://dawn-review.googlesource.com/c/dawn/+/13787
[2] https://github.com/KhronosGroup/Vulkan-Headers/blob/master/BUILD.gn#L23
Change-Id: Ic5fb4fa7990cc2232a7416145877e24b10a2a7b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13880
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
Currently does nothing interesting, future CLs will flesh out the
functionality.
BUG=dawn:281
Change-Id: I89750a45ff5a42a13e1494cafd433bb7ef719b10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13841
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>