Commit Graph

1791 Commits

Author SHA1 Message Date
Austin Eng 1fe9979ad8 Use GetBindGroupLayout in SamplerTests
Bug: dawn:276
Change-Id: I294a3e94e1134212cc8f9bccd743435a6cd67538
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14030
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:32:55 +00:00
Austin Eng da82324098 Use GetBindGroupLayout in RenderBundleTests
Bug: dawn:276
Change-Id: I07683751d4361230754e75096dd695752a9a05d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14029
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:30:55 +00:00
Austin Eng 016f3060a3 Use GetBindGroupLayout in ComputeCopyStorageBufferTests
Bug: dawn:276
Change-Id: I66291eec6b36e6d3318d6bd01fd891f354bb2be3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14022
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:25:45 +00:00
Austin Eng ca5f61f9ed Use GetBindGroupLayout in DepthStencilStateTests
Bug: dawn:276
Change-Id: Ibd3fcf7131c3c1aa4e8723f7235aa7a1dc55ff46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14026
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:24:05 +00:00
Austin Eng 159d5c6a90 Use GetBindGroupLayout in IOSurfaceWrappingTests
Bug: dawn:276
Change-Id: Ie9bc27e8cc0ec5892b6e63429124249232e69725
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14027
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:21:55 +00:00
Austin Eng 476a14a7cc Use GetBindGroupLayout in MultisampledRenderingTests
Bug: dawn:276
Change-Id: I31e879a9e4ed7cc7ccbb882502942302dfd19bb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14028
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-03 21:18:05 +00:00
Austin Eng ac89f2d619 Use GetBindGroupLayout in ComputeStorageBufferBarrierTests
Bug: dawn:276
Change-Id: I204226ab4535b69ea6a59be857c3a7bf4e71b47e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14025
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:14:55 +00:00
Austin Eng e40c87c986 Use GetBindGroupLayout in ComputeSharedMemoryTests
Bug: dawn:276
Change-Id: I024ec718b3f8423f6c271404d4beb125987290dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14024
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:08:45 +00:00
Austin Eng f9033b89e5 Use GetBindGroupLayout in ComputeIndirectTests
Bug: dawn:276
Change-Id: Ic54ce6d47d9ecf7291b824c829d76831258ab6e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14023
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:05:55 +00:00
Austin Eng cd642f9fdd Use GetBindGroupLayout in TextureZeroInitTests
Bug: dawn:276
Change-Id: I6ca2e4fd511ea86afdb7036258845d74080bc0f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14033
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 20:59:25 +00:00
Austin Eng 48befdf311 Use GetBindGroupLayout in CompressedTextureFormatTests
Bug: dawn:276
Change-Id: I364279b5d727816f1c7e0da3c55cf2cee2551eaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14021
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-03 20:56:55 +00:00
Austin Eng 3d38301020 Use GetBindGroupLayout in ColorStateTests
Bug: dawn:276
Change-Id: If5824bc4870f8842481f7b4012c47ad709395e57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-03 20:39:53 +00:00
Ryan Harrison be5c135672 Refactor code to have rudimentary support for using SPVC
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>
2019-12-03 20:25:13 +00:00
Yunchao He 969df2b3a2 Fix a typo in viewport test
BUG=dawn:53

Change-Id: Ibc768cc4695072533d6715f62f46fd4c72d40a3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14142
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-11-30 09:04:18 +00:00
Ryan Harrison fd12e1b746 Add runtime toggle to select IR generation path in SPVC
BUG=dawn:281

Change-Id: I3102fece31289d1b511a13536aaf29254501d7c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-29 15:28:26 +00:00
Ryan Harrison 77f6db7a0b Fix BUILD.gn issues for Android & Fuschia
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>
2019-11-28 19:48:45 +00:00
Yunchao He 40b10e4d65 Add memory synchronization tests - multiple write then multiple read
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>
2019-11-28 18:55:45 +00:00
Ryan Harrison 0625ae2167 Add runtime toggle for using SPVC
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>
2019-11-28 18:12:35 +00:00
Ryan Harrison 22e73a5b28 Use spvc's rules for spirv-cross
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>
2019-11-28 17:14:55 +00:00
Corentin Wallez 0ee91fc0a1 Vulkan: Choose correct libvulkan on Android
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>
2019-11-28 09:48:44 +00:00
Corentin Wallez 1e2c2f2af3 Vulkan: Don't require TRANSFER for universal queues
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>
2019-11-28 09:42:24 +00:00
Corentin Wallez 673146475f Allow compilation of Dawn on Android
BUG=dawn:286

Change-Id: Ia65b57fde12a1260d29913f61f9b24eded7dbc30
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13822
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-28 09:40:54 +00:00
Ryan Harrison 00b1e38f3b Re-enable spirv-cross fuzzers
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>
2019-11-27 20:56:14 +00:00
Ryan Harrison 2559fc0b84 Removing for_fuzzers target
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>
2019-11-27 15:07:53 +00:00
Corentin Wallez 74cebd6879 Allow using swiftshader with the Vulkan backend
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>
2019-11-26 18:21:51 +00:00
Ryan Harrison 80d71ecd12 Remove build rules for spvc support & spirv-cross fuzzers
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>
2019-11-26 17:42:51 +00:00
Corentin Wallez 20c014cee7 Fix typo in the name of wgpuGetProcAddress
BUG=dawn:22

Change-Id: Id8213f1d06313d0ab1ee5845e892f88ff803fbc2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14060
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-26 17:28:11 +00:00
Ryan Harrison e9356045a4 Rolling 3 dependencies
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>
2019-11-25 18:39:00 +00:00
Corentin Wallez 8e9c3f663c Fix compilation on MSVC
BUG=

Change-Id: I9f33a4c26cc2ca1e6d6cdbc245d929175867b1e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13961
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2019-11-23 03:40:53 +00:00
Yunchao He 733842c59d Add memory synchronization tests - render to compute and vice versa
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>
2019-11-23 00:20:53 +00:00
Brian Ho e568fe138e Remove WrapVulkanImageOpaqueFD
This CL removes the deprecated WrapVulkanImageOpaqueFD now that it
no longer being called in Chromium [1].

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1931145

BUG=chromium:996470

Change-Id: I19a7ff36e39b5ed07c68f422cd053f480a7c177e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
2019-11-22 21:00:43 +00:00
Austin Eng f6eb890f4c Implement getBindGroupLayout
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>
2019-11-22 17:02:22 +00:00
Austin Eng d0993ba83a Test TextureComponentType and TextureViewDimension compatibility
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>
2019-11-22 16:40:22 +00:00
Corentin Wallez aca8c4a528 Remove the concept of "native_methods" in the generators
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>
2019-11-22 14:02:52 +00:00
Corentin Wallez 540ababb6b Introduce a "callback" type in dawn.json
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>
2019-11-22 13:18:22 +00:00
Austin Eng 4b0b7a532a Skip validation during command recording when skip_validation is on
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>
2019-11-21 22:09:41 +00:00
Ryan Harrison 48bf745b96 Revert "Convert spvc build flag to a runtime toggle"
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>
2019-11-21 20:31:05 +00:00
Corentin Wallez 3f195e7d42 Fix link in standalone on Linux
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>
2019-11-21 18:54:42 +00:00
Bryan Bernhart 12e780d709 Fix D3D12 render-pass failure when GPU does not support sampling positions.
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>
2019-11-21 18:16:02 +00:00
Ryan Harrison 1954436fe2 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>
2019-11-21 18:08:15 +00:00
Bryan Bernhart 127cd1f258 Skip small texture alignment test on NV GPUs.
Windows bots may fail should GPU/drivers not support 4KB alignments,
specifically NV GTX 1160.

Bug: dawn:282
Change-Id: I0f66792c198774ef7265bdab691488945ee7dc35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 18:05:52 +00:00
Brian Ho 899c17090f Implement a dma-buf MemoryService
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>
2019-11-21 16:02:10 +00:00
Corentin Wallez 0d4a7b0ba5 Correctly reset mappedData in MapTwice buffer test
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>
2019-11-21 12:49:30 +00:00
Austin Eng 4d15609d26 Add a toggle to disable Dawn validation
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>
2019-11-21 00:48:39 +00:00
Brian Ho 98ba76af00 Define an interface to import dma-bufs
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>
2019-11-20 23:57:03 +00:00
Brian Ho ae687f5b83 Add CreateImage support to MemoryService
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>
2019-11-20 23:53:43 +00:00
Brian Ho 858f93b86f Disable Vulkan validation layers on Chrome OS
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>
2019-11-20 20:31:31 +00:00
Ryan Harrison 8f3dc5836b Add in flag for using spvc instead of direct spriv-cross access
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>
2019-11-20 18:10:11 +00:00
Brian Ho d3123137b1 Request dma-buf Vulkan extensions
This CL adds a few Vulkan extensions to be used for importing
dma-bufs as VkImages.

In particular, we need:
  - VK_EXT_external_memory_dma_buf
  - VK_EXT_image_drm_format_modifier

BUG=chromium:996470

Change-Id: I7a3dfd0184177c756b07613fbfe140506f54584c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13783
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-20 18:06:33 +00:00
Ryan Harrison 39695fd41d Rolling 4 dependencies
Roll third_party/SPIRV-Tools/ 12e54dae1..2ee9aaa28 (11 commits)

12e54dae16..2ee9aaa288

$ git log 12e54dae1..2ee9aaa28 --date=short --no-merges --format='%ad %ae %s'
2019-11-19 rharrison Initialize binary for use as guard later (#3058)
2019-11-19 stevenperron Handle OpPhi with no in operands in value numbering (#3056)
2019-11-19 stevenperron Kill the id-to-func map after wrap-opkill (#3055)
2019-11-18 rharrison Convert stderr and stdout in status to strings on assignment (#3049)
2019-11-14 dneto Update README (#3047)
2019-11-14 pierremoreau Update README (#3048)
2019-11-13 dneto Avoid uninit warning in GCC (#3044)
2019-10-23 bclayton utils/vscode: Add SPIR-V language server support
2019-11-11 bclayton utils/vscode: Add go language server packages.
2019-11-12 alanbaker Fix operand access of composite in upgrade memory model (#3021)
2019-11-12 alanbaker Validate array stride does not cause overlap (#3028)

Roll third_party/glslang/ 37dcb8945..f4d466852 (1 commit)

37dcb89457..f4d4668529

$ git log 37dcb8945..f4d466852 --date=short --no-merges --format='%ad %ae %s'
2019-11-14 cepheus HLSL: Fix #1976: Don't let ENABLE_HLSL change struct/class layout.

Roll third_party/shaderc/ 0865050e5..c7f5cfd07 (11 commits)

0865050e54..c7f5cfd07f

$ git log 0865050e5..c7f5cfd07 --date=short --no-merges --format='%ad %ae %s'
2019-11-20 rharrison Rolling 4 dependencies (#897)
2019-11-19 rharrison Migrate away from nosetest to unittest (#896)
2019-11-18 9856269+sarahM0 Add spvc parser support for control flow instructions (#894)
2019-11-15 dneto Android.mk: Avoid polluting NDK build's test tree. (#888)
2019-11-15 rharrison Add access to MSL options needed by Dawn (#893)
2019-11-14 9856269+sarahM0 Add spvc parser support for all OpConstant.* and OpSpecConstant.* (#886)
2019-11-13 dneto Android.mk: Fix detection of spirv-headers directory (#887)
2019-11-13 9856269+sarahM0 Add spvc parser support and unit tests for: OpTypeMatrix, OpTypeRuntimeArray, OpTypeImage, OpTypeSampler, OpTypeSampledImage (#885)
2019-11-13 rharrison Remove the deprectated all-in-one generation API (#883)
2019-11-13 rharrison Expose spirv_cross compiler to ease integration into Dawn (#884)
2019-11-13 9856269+sarahM0 Add spvc parser support and unit tests for: OpTypeBool, OpTypeFloat, … (#881)

Roll third_party/spirv-headers/ af64a9e82..204cd131c (2 commits)

af64a9e826..204cd131c4

$ git log af64a9e82..204cd131c --date=short --no-merges --format='%ad %ae %s'
2019-11-20 Tobias.Hector Off-by-one errors
2019-11-20 Tobias.Hector Reserve a new block of 64 opcodes

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

Change-Id: Id1417493410e35b951d1d4623576b11fa2baab2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13840
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-20 15:43:21 +00:00