Commit Graph

1589 Commits

Author SHA1 Message Date
Li, Hao 77f091ce46 Align the size of Uniform and Storage buffer to 16 bytes in Metal
On Metal, it requires the size of the constant buffer to be no less
than the size of the constant buffer block defined in shader, and
the overall size of the constant buffer must be aligned to the
largest alignment of its members.

BUG=dawn:139

Change-Id: I37730b1415baecb6638aaaacec87789decf07606
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10920
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2019-09-07 03:08:45 +00:00
Bryan Bernhart 22c3ff73c1 Resource Management 6: VK support for resource allocation.
Refactor existing memory allocators by using a common
memory type and handle.

BUG=dawn:27

Change-Id: Ieed4fa30a0bd8fedfb3a3c580920805f40b56fae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10680
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-09-05 17:36:47 +00:00
Corentin Wallez a900ccebcf Remove indirection for computeStage
This is to match the work in progress webgpu.h header.

BUG=dawn:22

Change-Id: I0904297bb4411b12f9d99e8457d32613058ef9b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9380
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-05 09:41:17 +00:00
Corentin Wallez a560104617 Match WebGPU's TextureViewDescriptor.dimension defaults.
This matches the choice made in https://github.com/gpuweb/gpuweb/pull/424

BUG=dawn:214

Change-Id: I9913f2c9c2f40b1ccc40c51cf79f50c171a48b3d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-05 09:35:57 +00:00
Corentin Wallez c6c7a42e6e Remove indirection for vertexStage
This is to match the work in progress webgpu.h header.

Also contains a fix for the wire where it wouldn't GetExtraRequiredSize
for structures that are by-value members of other structures.

BUG=dawn:22

Change-Id: I3c706bf9cd7a550d40fd667877f032c860d0a032
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9382
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-05 09:35:07 +00:00
Corentin Wallez d55bd7ad94 Make TextureFormat/ViewDimension::None Undefined and value 0.
This matches the conclusion the changes in the webgpu-header pull
request where we discussed these values:
https://github.com/webgpu-native/webgpu-headers/pull/5

BUG=dawn:22
Bug=dawn:214

Change-Id: I7e9168c2b5e09dcb4c1882725a5cc0580a73d853
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10860
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-05 09:12:32 +00:00
Ryan Harrison 3bcb567d8f Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ 5a581e738..19b256616 (14 commits)

5a581e738c..19b256616d

$ git log 5a581e738..19b256616 --date=short --no-merges --format='%ad %ae %s'
2019-09-04 zoddicus For WebGPU<->Vulkan optimization, set correct execution environment (#2834)
2019-09-04 40687079+rumblehhh Export SPIRV-Tools targets on installation (#2785)
2019-09-04 jmadill GN: Add Chromium GoogleTest deps. (#2832)
2019-09-03 stevenperron Upadate CHANGES
2019-09-03 greg Instrument: Be sure Float16 capability on when generating float16 null (#2831)
2019-09-03 greg Add --relax-float-ops and --convert-relaxed-to-half (#2808)
2019-09-03 jmadill GN: Make SPIRV-Tools target use public_deps. (#2828)
2019-09-03 stevenperron Fold Fmix should accept vector operands. (#2826)
2019-09-02 afdx Fix end comments in header files (#2829)
2019-08-30 bclayton AggressiveDCEPass: Set modified to true when appending to to_kill_ (#2825)
2019-08-30 stevenperron Replace SwizzleInvocationsAMD extended instruction. (#2823)
2019-08-30 stevenperron Replace SwizzleInvocationsMaskedAMD extended instruction. (#2822)
2019-08-30 cwallez Fix gn check (#2821)
2019-08-29 stevenperron Amd ext to khr (#2811)

Roll third_party/glslang/ 796df2d74..56f61ccce (3 commits)

796df2d74e..56f61cccef

$ git log 796df2d74..56f61ccce --date=short --no-merges --format='%ad %ae %s'
2019-09-02 lryer code refine
2019-08-30 cepheus Placeholder fix for part of #1870.
2019-08-30 cepheus Non-functional: Make whitespace/braces consistent for a recent commit.

Roll third_party/shaderc/ f4786674e..3b038fa1c (3 commits)

f4786674e3..3b038fa1c3

$ git log f4786674e..3b038fa1c --date=short --no-merges --format='%ad %ae %s'
2019-09-04 zoddicus Pass in source not target env into spirv-opt (#799)
2019-09-04 cwallez Use agreed upon include paths for spirv-cross (#795)
2019-09-03 zoddicus Rolling 5 dependencies and updating known_failures (#796)

Roll third_party/spirv-cross/ ee7357f2a..f24654db8 (13 commits)

ee7357f2a6..f24654db8c

$ git log ee7357f2a..f24654db8 --date=short --no-merges --format='%ad %ae %s'
2019-09-04 post Add test case for interlocks in control flow.
2019-09-04 post Make sure not to propagate loads outside interlock region.
2019-09-04 post Add interlock test for split functions doing begin/end.
2019-09-04 post Deal with complex interlock cases in GLSL.
2019-09-04 post Add test shader for simple case of interlocked callstack.
2019-09-04 post Deal with call stacks when analyzing access.
2019-09-04 post Analyze complex cases for fragment interlocks.
2019-08-04 cdavis Support the SPV_EXT_fragment_shader_interlock extension.
2019-08-02 cdavis MSL: Add support for sampler Y'CbCr conversion.
2019-08-30 t.roughton Clang-format changes
2019-08-30 t.roughton Update tests to account for all non-entry-point functions being inlined
2019-08-29 t.roughton Inline all non-entry-point functions
2019-06-10 t.roughton MSL: inline all emitted functions

Roll third_party/spirv-headers/ 059a49598..38cafab37 (1 commit)

059a49598c..38cafab379

$ git log 059a49598..38cafab37 --date=short --no-merges --format='%ad %ae %s'
2019-08-30 cepheus Minor tweak for Rev. 2 of SPIR-V 1.4.

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

Change-Id: Icab7f6d423709089e6793048f2578021d0688173
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10900
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-05 06:40:52 +00:00
Austin Eng 45238d775a Add empty implementations of Push/PopErrorScope
This adds Push/PopErrorScope to the API with empty implementations which
just call the error callback. Also adds unittests that the wire callbacks
return as expected.

Bug: dawn:153
Change-Id: I63826360e39fbac4c9855d3d55a05b5ca26db450
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10543
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-04 22:54:03 +00:00
Corentin Wallez f5c44772a6 Use the agreed upon include path for spirv-cross.
Everyone using spirv-cross includes its headers via <spirv_msl.hpp> for
example. Make Dawn match that convention so it can play better with the
setup used by other projects.

Still leave <spirv-cross/spirv_msl.hpp> working for now because it is
used by shaderc_spvc. A follow up CL to that repo will do the same
change.

BUG=

Change-Id: I9dc590a809d7ba733113b07930a285acfca64a66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10801
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-04 08:47:14 +00:00
Austin Eng ce2adba679 Fix parsing of DawnPerfTest --override-steps argument
Bug: dawn:208
Change-Id: I1abee97758383558946ace06d2ea4844be40e7b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10720
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-04 02:29:44 +00:00
Natasha Lee 086835f3ff Vulkan: Use dynamic uploader for temp buffer when clearing textures.
Use dynamic uploader so that we don't have to create a new buffer each
time we lazy clear.

Bug: dawn:145
Change-Id: I2d7a769532bd303fdabb7fc70051b70a1114cc07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2019-09-03 18:21:41 +00:00
Corentin Wallez c7910d19fe Fix missing virtual on destructor
BUG=

Change-Id: Id5571ec775c8cf0109dd5348c2054e524911e0e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-03 07:47:45 +00:00
Rafael Cintron 179d7b28a3 Add WrapSharedHandle to D3D12 backend
WrapSharedHandle uses a HANDLE and an acquire key to create
a Dawn texture object.

A future change will use the acquire key to manage a keyed shared
mutex with Chromium code.

Bug: dawn:27
Change-Id: I1c0ef8d022158abf3f1c6731a37ee3f51632fcf9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10540
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-02 19:19:34 +00:00
Bryan Bernhart 824424fa35 Fix MSVC build error due to sign mismatch.
BUG=dawn:219

Change-Id: I2560b6c82c60208d446f75bc829ed50078fde3c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10762
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-08-30 23:46:51 +00:00
Bryan Bernhart 58e68e0665 Disable flaky BC texture tests.
Disables all BC texture tests failing
on non-wire Intel/Vulkan bots.

BUG=dawn:199

Change-Id: I8e4dd32c3fc79b94b94103484c2e9b6013e008ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10721
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-08-30 19:20:36 +00:00
Austin Eng 3c26e42e36 Add dawn_perf_tests as a data_dep of dawn_perf_tests_temp_group
This is needed so that the script to produce the isolate can correctly
detect the binary.

Bug: dawn:208
TBR: cwallez@chromium.org
Change-Id: I62fc4c40edfe9320d55a587d2176bbd9c93bb540
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10761
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-08-30 19:16:46 +00:00
Natasha Lee adbecedad5 D3D12: clear nonrenderable texture formats
Clears nonrenderable color formats and merges zero vs nonzero clears
to use the same code path.

Bug: dawn:145
Change-Id: Ibe0745907688e149e6d017ff088a05f4b613b4a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10140
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-08-30 18:19:56 +00:00
Jiawei Shao 864bae4cc6 Enable two BindGroupTests on Metal
This patch enables BindGroupTests/ReusedUBO and BindGroupTests/UBOSamplerAndTexture
on Metal as both of them can pass with the latest version of SPIRV-Cross.

BUG=dawn:33
TEST=dawn_end2end_tests

Change-Id: I906d782a93232dd272edb93f30952ba6cac1d6d2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-08-30 07:55:25 +00:00
Ryan Harrison f018c05e44 Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ 0cbdc7a2c..5a581e738 (8 commits)

0cbdc7a2c3..5a581e738c

$ git log 0cbdc7a2c..5a581e738 --date=short --no-merges --format='%ad %ae %s'
2019-08-29 bclayton spvtools::Optimizer - don't assume original_binary and optimized_binary are aliased (#2799)
2019-08-28 stevenperron Check feature mgr in context consistency check (#2818)
2019-08-26 stevenperron Refactor instruction folders (#2815)
2019-08-23 8729214+jonahryandavis Add missing files to BUILD.gn (#2809)
2019-08-22 afdx Extend reducer to remove relaxed precision decorations (#2797)
2019-08-22 stevenperron Handle Id overflow in private-to-local (#2807)
2019-08-21 stevenperron Even more id overflow in sroa (#2806)
2019-08-21 stevenperron Add name for variables in desc sroa (#2805)

Roll third_party/glslang/ 95609e6d9..796df2d74 (35 commits)

95609e6d92..796df2d74e

$ git log 95609e6d9..796df2d74 --date=short --no-merges --format='%ad %ae %s'
2019-08-28 rharrison Change to initializing the variable
2019-08-28 rharrison Return nullptr after assert to avoid uninitialized variables
2019-08-28 cepheus ESSL/SPV: Fix #1856: Allow ESSL shaders to compile to OpenGL SPIR-V.
2019-08-28 cepheus Documentation: Provide more detail in setting up the environment.
2019-08-27 cwallez BUILD.gn: Add missing HLSL files.
2019-08-26 cwallez GN build (for Chromium): enable HLSL in dependents.
2019-08-26 baldurk Dereference any array type before expanding root-level SSBO members
2019-08-23 dneto GN build (for Chromium): enable HLSL
2019-08-22 jbolz GL_NV_integer_cooperative_matrix support
2019-08-22 cepheus Bump revision.
2019-08-22 cepheus GLSL: Inherit memory qualifiers, both declaratively and in execution.
2019-08-22 jonahr Fix conformance with -Wextra-tokens
2019-08-21 cepheus Bump version.
2019-08-21 cepheus web: Fix accidental additon of refract() prototypes and update README.
2019-08-13 cepheus Web: Turn off includes, independent preprocessing path, fine tune all.
2019-08-11 cepheus Web: Make switched methods all be non-virtual, more web-dependent code,
2019-08-10 cepheus Web: Optional error management and error tightening.
2019-08-09 cepheus Web: Use isEsProfile() instead of run-time testing; remove more atomics
2019-08-08 cepheus Web: Remove unused stage functionality, SPIR-V logger, and hex_utils
2019-08-08 cepheus Web: Remove unnecessary GLSL numeric types, and some collateral.
2019-08-08 cepheus Web: Tighten up sampling code and interfaces.
2019-08-07 cepheus Web: Complete the removal of vendor-specific #ifdef's, including CMake.
2019-08-06 cepheus Web: Prune grammar and lexor down to needed subset.
2019-08-06 cepheus Web: Generalize _EXTENSIONS* in SPIR-V back-end.
2019-08-06 cepheus Web: Turn off bracket-style attributes, reflection, and IO mapping.
2019-08-01 cepheus Web: Remove/rationalize a set of *_EXTENSIONS, using GLSLANG_WEB.
2019-07-31 cepheus Web: First pass of tabling the built-in function declarations.
2019-07-28 cepheus Web: Selectively remove a few key features, using #ifndef GLSLANG_WEB
2019-07-27 cepheus Web: Change a bunch of HLSL methods from dynamic to compile-time known.
2019-07-27 cepheus Web: Remove a few additional HLSL constructs with ENABLE_HLSL.
2019-07-26 cepheus Web: Add sanity check test suite for smaller-footprint builds.
2019-08-20 cepheus Bump revision.
2019-08-14 kainino convert_glsl_to_spirv: fail early, reduce copies, remove input buffer allocation
2019-07-25 kainino make glslang.js easy to use
2019-08-14 kainino enable build for node

Roll third_party/shaderc/ 210fac890..f4786674e (10 commits)

210fac8904..f4786674e3

$ git log 210fac890..f4786674e --date=short --no-merges --format='%ad %ae %s'
2019-08-28 zoddicus Seperate non-API spvc code into private source file (#794)
2019-08-27 zoddicus Rolling 7 dependencies and updating known_failures (#791)
2019-08-27 zoddicus Add ToVulkan API methods (#792)
2019-08-27 zoddicus Refactor internals of conversion API to be more modular (#785)
2019-08-25 dneto Remove extra semi-colons (#790)
2019-08-23 dneto GN build: enable HLSL in Glslang (#789)
2019-08-22 9856269+sarahM0 spvc: Add option to inject code to enforce robust-buffer-access
2019-08-21 dneto Force Glslang to support HLSL in its interface (#784)
2019-08-21 zoddicus Fix some Python2 vs 3 issues in update_build_version.py (#783)
2019-08-20 zoddicus Manually cast fuzzing data to avoid new GCC warning (#782)

Roll third_party/spirv-cross/ 4ce04480e..ee7357f2a (11 commits)

4ce04480ec..ee7357f2a6

$ git log 4ce04480e..ee7357f2a --date=short --no-merges --format='%ad %ae %s'
2019-08-29 post MSL: Add {Base,}{Vertex,Instance}Index to bitcast_from_builtin_load.
2019-08-02 cdavis GLSL: Fix post-depth coverage for ESSL.
2019-08-28 post Run format_all.sh.
2019-08-27 post GLSL: Assume image and sampler can be RelaxedPrecision.
2019-08-27 post MSL: Deal with array copies from and to threadgroup.
2019-08-27 post Do not allow base expressions for non-native row-major matrices.
2019-08-27 post Deal with ldexp taking uint input.
2019-08-26 post Move branchless analysis to CFG.
2019-08-26 post Elide branches to continue block when continue block is also a merge.
2019-08-26 post Deal correctly with sign on bitfield operations.
2019-08-26 post Fix variable scope when switch block exits multiple times.

Roll third_party/spirv-headers/ e4322e3be..059a49598 (1 commit)

e4322e3be5..059a49598c

$ git log e4322e3be..059a49598 --date=short --no-merges --format='%ad %ae %s'
2019-06-12 cepheus Grammar: Add instruction-printing classes.

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

Change-Id: Iaa7791ec4d7ed0c383ba19544e74e0281372495c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10660
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-08-29 16:24:01 +00:00
François Beaufort 13c472e196 Make vertex input descriptor optional
Following WebGPU spec change at https://github.com/gpuweb/gpuweb/issues/378,
vertexInput descriptor from GPURenderPipelineDescriptor should not be
required anymore.

BUG=dawn:22

Change-Id: I5d2500a758f44b7a7db2d2c23b359f1012221227
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10640
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-08-29 15:56:31 +00:00
Jiawei Shao 18b2cb51d7 Enable CopyTests_T2B.Texture2DArrayMip/Vulkan on Intel
This patch enables CopyTests_T2B.Texture2DArrayMip/Vulkan on Intel
because it can pass on the Mesa driver version >= 18.2.8

BUG=dawn:101
TEST=dawn_end2end_tests

Change-Id: I93bb6458989a6602ddda1adef5be0194362147d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10580
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-08-29 09:08:50 +00:00
Yan, Shaobo b58435c6f9 Vertex buffer stride size needs to be a multiple of 4 bytes
Metal requests that stride size of vertex buffer needs to be a multiple of 4 bytes. Dawn
should also follow the restriction.

BUG=dawn:130

Change-Id: I92eb67e944ab170a5dac5305c930bae507cb034d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10621
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-08-29 08:20:02 +00:00
Austin Eng ca0eac314b Add Dawn perf test harness
This patch adds a perf test harness for Dawn and a simple test of
buffer upload performance. The test harness is based off of ANGLE's
perf tests.

Because perf tests are parameterized to support multiple test
variants, this patch also adds DawnTestWithParams and ParamGenerator
to support instantiating tests with additional parameters.

Bug: dawn:208
Change-Id: I60df730e9f9f21a4c29fc21ea1a8315e4fff1aa6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-08-28 23:18:10 +00:00
Bryan Bernhart 650859b420 Use first-fit policy to reduce upload memory.
Reverts CL9160 by replacing the existing policy with one
that re-uses smaller ring-buffers.

Before
*RESULT BufferUploadPerfRun/D3D12_SetSubData: wall_time= 397865.698113 ns
*RESULT BufferUploadPerfRun/D3D12_SetSubData: wall_time= 398025.660377 ns
*RESULT BufferUploadPerfRun/D3D12_SetSubData: wall_time= 438816.754717 ns

After
*RESULT BufferUploadPerfRun/D3D12_SetSubData: wall_time= 118189.847059 ns
*RESULT BufferUploadPerfRun/D3D12_SetSubData: wall_time= 116808.235294 ns
*RESULT BufferUploadPerfRun/D3D12_SetSubData: wall_time= 117133.964706 ns

No change for Vulkan. About 3x faster with D3D.

BUG=dawn:211

Change-Id: Iaa6b0ef50305bf7df482f7e10e92353320039965
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10441
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-08-28 16:06:50 +00:00
Bryan Bernhart 7ffd2346f8 Resource Management 5: D3D support for resource allocation.
Refactor existing resource allocators by adding a memory type
and memory handle.

BUG=dawn:27, dawn:153

Change-Id: I090b6ab40e7eaa0d7ea5ce1e8b760e961be9b559
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9420
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-08-27 23:36:26 +00:00
Kai Ninomiya f0b17d00b9 Use TextureFormat::None for RenderBundleEncoder and AttachmentState
Bug: dawn:214
Change-Id: Ia9432582b0a5627c00d46ebcfa63ebf1ba246651
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10520
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-08-27 22:19:16 +00:00
Austin Eng 45ea7e66bf Rename SetErrorCallback to SetUncapturedErrorCallback
This is to better match the naming of the uncapturederror event
in WebGPU.

Bug: dawn:153
Change-Id: Ic2bc1f46bf3d1f0d14cbd5cb8ea6e54d1679f987
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10542
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-08-27 21:43:56 +00:00
Austin Eng cb0cb658d4 Rename DeviceErrorCallback to ErrorCallback and add ErrorType arg
This same callback will be used for push/pop error scope.

Bug: dawn:153
Change-Id: I2771539e13f8a4e6a59f13c8082689d25ba44905
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10460
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-08-27 21:41:56 +00:00
Austin Eng 5603dc9044 Rename ContextLost to DeviceLost
DeviceLost is a better name because we don't have a "context" as in
OpenGL.

Bug: dawn:153
Change-Id: Idf7fcb731a0e138f46a81fb31f0d11ff58b4fa96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10541
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-08-27 18:10:03 +00:00
Kai Ninomiya 4078ed8b62 Remove Texture::createDefaultView
https://github.com/gpuweb/gpuweb/pull/389

Bug: dawn:214
Change-Id: I86b8c46c71c3e5b9622ab3656124b312d3e85a7a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10420
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-08-27 17:56:23 +00:00
Corentin Wallez b9b088f57e Rename ShaderStageBit to ShaderStage.
This is to follow changes to WebGPU's IDL and header file where the Bit
suffix disappeared. This caused a conflict with
utils/dawn_native::ShaderStage that were both renamed to
SingleShaderStage.

BUG-dawn: 22
Change-Id: I7b085686775fa19e4b4a3b54979903d72f3ef660
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10462
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-08-27 08:42:29 +00:00
Corentin Wallez 9e9e29f7a6 Remove Bit from TextureUsageBit and BufferUsageBit
This is to match the naming convention of WebGPU's WebIDL and webgpu.h

BUG=dawn:22

Change-Id: Ia91c5a018403e6a72eb0311b5f1a072d102282a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10461
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-08-27 08:21:39 +00:00
Brian Ho e25a3aede0 Overload stream insertion for DawnTestParam
Passing "--gtest_list_tests" as an argument to the gtest binary lists
the tests in the binary. However, when the test suite is parameterized
(like in the case of dawn_end2end_tests), the output will list the
string name of the parameter along with the test name. Since there is no
stream insertion overload for DawnTestParam, we get this output:

./dawn_end2end_tests --gtest_list_tests
BasicTests.
  BufferSetSubData/OpenGL  # GetParam() = 56-byte object <03-00 00-00 19...
  BufferSetSubData/Vulkan  # GetParam() = 56-byte object <04-00 00-00 19...
  ...

This CL adds an implementation to display the string name of the param
instead.

BUG=chromium:993457
TEST=run ./dawn_end2end_test --gtest_list_tests

Change-Id: Ifae65a9eaf96448341e6ed1894f116f1af1154b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10240
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-08-27 01:44:29 +00:00
Jiawei Shao b097b3100b Vulkan: workaround texture-to-texture copy issue with compressed formats
This patch adds the workaround for the Vulkan SPEC issue in the T2T
copies with compressed formats when the parameter "extent" fitting in
one subresource but not fitting in another. You can get the detail of
the issue through the following link:
https://github.com/KhronosGroup/Vulkan-Docs/issues/1005

This patch implements the workaround for this issue by splitting the
affected T2T copy into a T2B and a B2T copy with an internal buffer.

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: I29c48da0b5ff85f9860839a82733e8c1c43acfc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10020
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-08-27 00:07:09 +00:00
Jiawei Shao 27c3fc5bd3 Metal: Initialize mSupportedExtensions in the constructor of Adapter
This patch adds a missing call of InitializeSupportedExtensions() in the
constructor of Adapter on Metal backend so that we can correctly create
device with required extensions on Metal.

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: Ifba41d2ae43ca054df2b0f3f19503f66fe641a72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10500
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-08-27 00:04:29 +00:00
Kai Ninomiya 93196db8ef Implement new defaults for Texture::CreateView
https://github.com/gpuweb/gpuweb/pull/389 except for removing createDefaultView
https://github.com/gpuweb/gpuweb/pull/407

This will need to slightly change again when
https://github.com/gpuweb/gpuweb/pull/424 lands.

Bug: dawn:214
Change-Id: Id904b55cea6d77fcf7d971bd743468c7d82a9aa8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10440
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-08-26 22:51:19 +00:00
Austin Eng f19c328b5b Fix NextPowerOfTwo for 64-bit MSVC
This test was failing consistently on win-msvc-dbg and occasionally
on win-msvc-rel. It's suspected the hardware does not properly
support __lzcnt64 so the function is implemented with _BitScanReverse64.

Bug: dawn:213
Change-Id: I0712f87787aad4aad7233bfb72846ec3dba96239
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10481
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-08-26 16:50:05 +00:00
Rafael Cintron 25cc723823 Fix mFenceEvent HANDLE leak
dawn_native::d3d12::Device::mFenceEvent is created in Initialize
but is never closed.

Fix is to close in the destructor if it has been previously created.

Bug: dawn:215
Change-Id: Ie9e7a395fe6fe791e2581295ed12f20070671afa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10480
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-08-23 22:41:48 +00:00
Austin Eng 3f21e11e24 Fix RenderBundleValidationTests
These tests were consistently failing on MSVC Debug builds.

Bug: dawn:154, dawn:213
TBR: cwallez@chromium.org
Change-Id: I83a51dd3ac705ccfcc34fa6a643d499a9cbe694f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-08-22 19:02:06 +00:00
Jiawei Shao 9d9d76c590 OpenGL: Support B2T and T2T copies with BC formats
This patch implements the creation, buffer-to-texture copies and
texture-to-texture copies with BC formats on OpenGL backend. Note that
OpenGL SPEC also has the same issue about texture-to-texture copies
with compressed textures as Vulkan SPEC, so we have to skip the related
case.

The texture-to-buffer copies with BC formats and related end2end tests
will be supported in the following patches.

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: I76b16862259cb2df77f202ed7ed433d41aa3cd47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10220
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-08-22 08:19:13 +00:00
Corentin Wallez 23edf95528 Update .gitignore
Gclient now creates a .cipd directory so we ignore it. third_party/stb
was removed so we stop ignoring it.

BUG=

Change-Id: Iad1b9309f32f900cd19f199ba51acafd2b936358
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10360
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-08-21 14:13:33 +00:00
Corentin Wallez ba9f3a8e11 OpenGL: Use non-filtering samplers for int/uint texture.
Using a sampler with filtering on int / uint textures makes them
incomplete, causing them to sample black on very conformant drivers.
Each opengl::Sampler is updated to create to GL sampler, a filtering one
and a non-filtering one.

PipelineGL and CommandBufferGL takes advantage of the new
BGLBinding::textureComponentType to know which of the two samplers to
use.

BUG=dawn:128

Change-Id: Idbf5668213bbe6a8639847d57e2be1244f97800c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10282
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-08-21 13:01:23 +00:00
Corentin Wallez f463a20291 Add BGLBinding::textureComponentType
This is a new compatibility constraint that the texture component type
must match between what's declared in the shader and the bind group.

 - Format is updated to include the component type of the format.
 - Validation and state tracking is updated to reflect the new
BGLBinding member.
 - TextureFormat tests are updated to pass with the added validation and
to remove a redundant enum definition.
 - BGLBinding::multisampled validation is added because it was next to
modified code for the BGLBinding::textureComponentType validation.
 - A redundant BGL caching test was removed.

BUG=dawn:128

Change-Id: I9c4ae92062769c3ecf74caf46f27415344dfad77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10281
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-08-21 12:16:33 +00:00
Ryan Harrison ae2b9f4720 Rolling 3 dependencies
Roll third_party/SPIRV-Tools/ f701237f2..0cbdc7a2c (9 commits)

f701237f2d..0cbdc7a2c3

$ git log f701237f2..0cbdc7a2c --date=short --no-merges --format='%ad %ae %s'
2019-08-20 dneto Remove unimplemented method declaration (#2804)
2019-08-18 stevenperron Handle overflow in wrap-opkill (#2801)
2019-08-16 stevenperron More handle overflow in sroa (#2800)
2019-08-16 greg Instrument: Add support for Buffer Device Address extension (#2792)
2019-08-15 toomas.remmelg Update remquo validation to match the OpenCL Extended Instruction Set Specification (#2791)
2019-08-15 jaebaek Use ascii code based characters (#2796)
2019-08-14 jaebaek Change the way to include header (#2795)
2019-08-14 alanbaker Fix validation of constant matrices (#2794)
2019-08-14 stevenperron Replace OpKill With function call. (#2790)

Roll third_party/glslang/ 37fc4d27d..95609e6d9 (1 commit)

37fc4d27d6..95609e6d92

$ git log 37fc4d27d..95609e6d9 --date=short --no-merges --format='%ad %ae %s'
2019-08-14 johnkslang Set theme jekyll-theme-merlot

Roll third_party/shaderc/ b3b228c60..210fac890 (2 commits)

b3b228c60d..210fac8904

$ git log b3b228c60..210fac890 --date=short --no-merges --format='%ad %ae %s'
2019-08-20 zoddicus Rolling 4 dependencies (#779)
2019-08-13 zoddicus Rolling 3 dependencies (#777)

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

Change-Id: Ic0be3537340be4180d10a4fd02e921e138f44205
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10300
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-08-20 21:04:31 +00:00
Corentin Wallez 87ded961ee Remove 16 bit normalized texture formats
They were removed from the WebGPU spec because they cannot be supported
everywhere, for example on recent Qualcomm chips.

BUG=dawn:128

Change-Id: I189bd1b34105f215699ddd404341bbee964c8679
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10280
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-08-20 20:58:01 +00:00
Austin Eng 0beb43809a Validate RenderBundle texture formats
Adds validation and unittests that render bundle color attachments are
color renderable texture formats and depth/stencil attachments are
depth/stencil texture formats.

Bug: dawn:154
Change-Id: I4d062a82b32fb38820fb3ebeb4c265306aa7af24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10261
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-08-19 22:49:08 +00:00
Austin Eng d8cdcea0ee Validate the RenderBundle debug groups must be well nested
This patch also adds unittests to check the behavior.

Bug: dawn:154
Change-Id: I49f4c0ab98cd823231a701192bdb725937960833
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10260
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-08-19 22:48:48 +00:00
Brian Ho ee3de1e1f3 Remove undefined behavior from NextPowerOfTwo
This CL removes undefined behavior from NextPowerOfTwo(0). Currently on
Linux, calling NextPowerOfTwo(0) simplifies down to:
  - 1ull << (64 - __builtin_clzll(0 - 1));
  - 1ull << (64 - __builtin_clzll(INT_MAX));
  - 1ull << (64 - 0);
  - 1ull << 64

Since 64 is the same width as the long long in our left operand, this
left shift results in undefined behavior (C++11 standard 5.8.1). For a
default Chrome compile, this does not cause any issues; 1ull << 64
results in 0.

In ChromeOS, however, we compile with ThinLTO which, among other things,
inlines various functions in the interest of performance. When
NextPowerOfTwo is inlined, the undefined behavior of our invalid left
shift borks the stack which causes the Math.NextPowerOfTwo unit test to
fail.

BUG= chromium:993457
TEST= verified that Math.NextPowerOfTwo now passes with LTO

Change-Id: I2702ba0b780203643da1d98ad0380098c7b3eab0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10180
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
2019-08-16 18:44:14 +00:00
Idan Raiter 09c12ca696 Validate shared semaphore and memory handles
Checks if we support specific handles and specific usages on the
current device. If we don't, Supported() fails and we stop the import.

Bug: chromium:976495
Change-Id: Icfe044a3c4d912913823728100888ab05f22afd5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10160
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2019-08-16 17:58:44 +00:00
Idan Raiter 786f76574a Add vulkan external memory large image test
This test catches when image layout is broken, by copying a non-trivial
image after it's imported across devices.

Bug: dawn:206
Change-Id: Ic980cfe31c0e564176c6c060f4a1fab220737938
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10162
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2019-08-16 17:36:54 +00:00