Commit Graph

2342 Commits

Author SHA1 Message Date
Jiawei Shao ed2b465f86 Report more detailed error information for the failures of mapAsync
This patch adds two new buffer map async status "destroyed before
callback" and "unmapped before callback" to replace the status "unknown"
so that the developers can get more details when meeting such errors in
the call of buffer mapAsync.

Note that this patch still preserves "unknown" as it is still being used
in Chromium.

BUG=dawn:533
TEST=dawn_unittests

Change-Id: I12deefb49311ea6adea72c24e4e40797dd7eb4a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28883
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-27 02:00:52 +00:00
Hao Li ddef7a04a2 Query API: QuerySet on Metal
- Add query set creation on Metal backend
- Enable end2end tests for query set creation

Bug: dawn:434
Change-Id: I7fe013192ae215b6b97cfdb646a8dd6f2596d4af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28800
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-25 08:49:30 +00:00
Corentin Wallez eec9edfd57 Standardize the use of UNREACHABLE in switches.
A lot of our switches over enum values use the following pattern:

    default:
        UNREACHABLE();
        return foo;

This is problematic because when adding a new value to one of the WebGPU
enums, there is no compilation error for switches that are missing it.
Currently we're supposed to write code and tests and fix UNREACHABLEs when
we see them.

Instead we should strive to have most switches on enums to be complete
and explicitily tag unreachable values as UNREACHABLE. Some switches
might still want to use default: UNREACHABLE() if only a couple values
need to be handled out of very many.

In this CL we go through all the UNRAECHABLEs and change them if need
be. Also an ErrorQueue class is added to avoid having
QueueBase::SubmitImpl just be UNREACHABLE (and force overriding
instead).

Bug: dawn:527
Change-Id: I33dfb4703104912cc5f001f9faf907a61324de68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28501
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-09-24 14:56:50 +00:00
Corentin Wallez a46737c0aa Add wgpu::BindingType::MultisampledTexture
And deprecate wgpu::BindGroupLayoutEntry.multisampled.

Bug: dawn:527

Change-Id: I00f38eb6b1f82f9d9aedda5da23b1350263a3044
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28562
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-09-24 11:41:07 +00:00
Corentin Wallez ed0b3cf153 Refactor PipelineLayoutBase::CreateDefault
This function was bit long and was difficult to read. Refactor it to use
a single double keyed map and helper functions.

Bug: dawn:527

Change-Id: I8c1173fd0e06256c7e7060a850996e1e90187d50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28640
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-24 11:27:47 +00:00
Yan, Shaobo 75e5ed6161 Support Noop Copy for B2T, T2B and T2T Copies
In B2T, T2B and T2T copies, copySize has 0 in width, height or depth
will trigger errors in D3D12 backend.

This patch bypass the command record step for noop copy. But all
validation rules still applies to the copy.

BUG=dawn:255

Change-Id: I4d01cef2e3c1f78440014c2c6ac63a48310d99af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28521
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-23 10:28:26 +00:00
Corentin Wallez a3651d2fe0 Fix deprecation errors for indexFormat being set.
Bug: dawn:502
Change-Id: Ib49a1e6cceb0632792a499314f5e0e4b3434deb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28780
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-23 07:23:56 +00:00
Corentin Wallez 9d0d18d952 Fix compilation on ChromeOS
TBR=enga@chromium.org
Bug: dawn:200
Change-Id: I35a414a25deed9d1d66e7ce510a704aaa0548fa9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-23 07:21:06 +00:00
Austin Eng 0b29732cd8 Pass the old/new VkImageLayouts to Vulkan image import/export
Returning the layouts from an export operation and then using
them in a subsequent import operation allows the import to preserve
the texture contents.

This fixes Vukan image wrapping on some AMD/NVIDIA devices.

Bug: dawn:200
Change-Id: Icbb6e759856d410bb69724b9f439bc3088756d19
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28380
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-22 20:10:46 +00:00
Brandon Jones 670858da9b Change wgpu::Color from floats to doubles
Change dawn.json to reflect changes in the WebGPU IDL. Also fixes any
conversion issues in Dawn.

Bug: dawn:525
Change-Id: Ifb46329f073bcf31d43342f20f4819eac061d5a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-09-22 16:51:36 +00:00
Bryan Bernhart 6db3a24c19 Revert "Disable debug layer logger"
This reverts commit 52a588f3c9.

Reason for revert: added a workaround to filter out messages.

Original change's description:
> Disable debug layer logger
>
> This logger is producing too much output on Windows and causing
> Chromium's gtest harness to kill the tests.
>
> Tbr=cwallez@chromium.org
> No-Try: true
> Bug: chromium:1130483
> Change-Id: I1990bc800bbb7eda62901d14f656375c30fbeef2
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28740
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org

Bug: chromium:1130483
Change-Id: Ifeee73838a957f619dfdb977f21585fe8abacc3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-09-22 16:23:06 +00:00
Corentin Wallez 5b4e5fbe1f Simplify the BindGroupLayout validation code.
It was using a lot of calls to helper functions full of switches that
were hiding the logic that's relatively simple.

Bug: dawn:527
Change-Id: Iaf2603efa255df5ba2f44989b5375d433f04d5df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28561
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-09-22 13:47:05 +00:00
Corentin Wallez aeda49ba50 Reuse BGL validation in default layout computations.
Instead of calling validation functions directly in
PipelineLayoutBase::CreateDefault, use ValidateBGLDesc and
ValidatePipelineLayoutDesc.

  Also makes the visibility of the default layout match the aggregation as
in the WebGPU spec.

  Also makes refcounting of BGLs a bit less manual at the bottom of
CreateDefault.

  Also adds tests for minBufferBindingSize and visiblity aggregation in
the default layout computations.

Bug: dawn:527
Change-Id: I6bbd5f3de8b235dddf6cbd2bedfd34a094fcb277
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28560
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-09-22 11:04:45 +00:00
Austin Eng 52a588f3c9 Disable debug layer logger
This logger is producing too much output on Windows and causing
Chromium's gtest harness to kill the tests.

Tbr=cwallez@chromium.org
No-Try: true
Bug: chromium:1130483
Change-Id: I1990bc800bbb7eda62901d14f656375c30fbeef2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-21 21:21:04 +00:00
Austin Eng dcd37fa4f4 Rolling 5 shader dependencies
Roll third_party/tint/ e7ec7f168..d3f75ca0e (21 commits)

https://dawn.googlesource.com/tint/+log/e7ec7f16895a..d3f75ca0e8be

$ git log e7ec7f168..d3f75ca0e --date=short --no-merges --format='%ad %ae %s'
2020-09-17 dsinclair Add support for multisampled textures.
2020-09-17 dj2 [wgsl-writer] Emit texture types.
2020-09-16 dsinclair [type-determiner] Handle pointer arguments.
2020-09-15 tommek [wgsl-reader] Adding texture_sampler_types to type_decl
2020-09-14 dsinclair [hlsl-writer] Implement some disabled tests.
2020-09-10 dneto [spirv-reader]: entry point names are WGSL identifiers
2020-09-10 dneto Fix doxygen: don't describe return of void method
2020-09-10 sarahmashay [validation] add cts tests for switch
2020-09-10 sarahmashay [validation] validate switch statement
2020-09-10 tommek Adding a TODO for updating textureLoad on storage images
2020-09-08 dneto Simplify getting entry point function
2020-09-08 dneto Fix GCC warnings
2020-09-08 tommek [wgsl-reader] Parsing storage texture type
2020-09-08 tommek [wgsl-reader] Parsing image storage type
2020-09-08 tommek [ast] Change intrinsic function names to camel case
2020-09-08 tommek [spirv-writer] Removing GenerateConstantFloatZeroIfNeeded
2020-09-07 tommek [spirv-writer] Fixing memory leaks in texture intrinsics tests
2020-09-03 dneto [spirv-reader] Set entry point name
2020-09-03 tommek [spirv-writer] Generating texture intrinsic operations
2020-09-03 sarahmashay [validation] add const variables shouldn't have a storage class
2020-09-03 sarahmashay [writer] add a return to convert_image_format_to_spv

Created with:
  roll-dep third_party/tint

Change-Id: Ia3e55f55e39ec0a8adb6b3f1f9d7910d8a31cb77


Roll third_party/SPIRV-Tools/ 34ef0c3fd..60ce96e2f (5 commits)

34ef0c3fdc..60ce96e2ff

$ git log 34ef0c3fd..60ce96e2f --date=short --no-merges --format='%ad %ae %s'
2020-09-18 afdx spirv-fuzz: Add pass recommendations (#3757)
2020-09-18 stefanomil spirv-fuzz: Consider all ids from dead blocks irrelevant (#3795)
2020-09-18 afdx Fix header guard macros (#3811)
2020-09-18 antonikarp spirv-fuzz: Fix TransformationDuplicateRegionWithSelection (#3815)
2020-09-17 46493288+sfricke-samsung spirv-val: Add DeviceIndex (#3812)

Created with:
  roll-dep third_party/SPIRV-Tools

Change-Id: Ia8b545abfa18bb36d5725e9bf75a068c3d5fb2f0


Roll third_party/spirv-headers/ 3fdabd0da..060627f0b (2 commits)

3fdabd0da2..060627f0b0

$ git log 3fdabd0da..060627f0b --date=short --no-merges --format='%ad %ae %s'
2020-09-10 syoussefi Register the ANGLE compiler (#168)
2020-09-08 cepheus Rebuild of latest headers, which slightly moves OpTerminateInvocation

Created with:
  roll-dep third_party/spirv-headers

Change-Id: Ia90e56b028e31ddf83a73aaefdaba761928e3d1b


Roll third_party/spirv-cross/ bdbef7b1f..8891bd351 (3 commits)

bdbef7b1f3..8891bd3512

$ git log bdbef7b1f..8891bd351 --date=short --no-merges --format='%ad %ae %s'
2020-09-17 post Clean up conditional branch codegen.
2020-09-17 post Deal with case where a selection construct conditionally merges/breaks.
2020-09-14 post Implement a simple evaluator of specialization constants.

Created with:
  roll-dep third_party/spirv-cross

Change-Id: If8d41684b0f0c822741ac08a19c2221e0e7410d4


Roll third_party/glslang/ 517f39eee..4dcc12d1a (11 commits)

517f39eee4..4dcc12d1a4

$ git log 517f39eee..4dcc12d1a --date=short --no-merges --format='%ad %ae %s'
2020-09-18 rex.xu SPIRV: Add more utility functions to build some opcodes (#2398)
2020-09-15 laddoc Preprocessor related issue fix (#2378)
2020-09-14 rex.xu SPIRV: Add disassembly support for multiple literal strings (#2397)
2020-09-14 laddoc Fix scope definition in ES 100. (#2379)
2020-09-14 john Fix #2385: guard against constant_id on non-const.
2020-09-12 shuizhuyuanluo Try to find python interpreter from host first
2020-09-11 ShabbyX Allow subpassLoad for ANGLE
2020-09-08 tobias.hector Added missing copyright amendment
2020-09-07 rex.xu SPIRV: Fix some disassembly issues
2020-09-03 tobias.hector Error when initializing rayQuery with assignment
2020-09-02 rex.xu Parser: Fix wrong names of extension macros

Created with:
  roll-dep third_party/glslang

Change-Id: I896179d682441cb24de0a0fc0eaa49684258e781
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28680
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-18 23:19:21 +00:00
Enrico Galli 6e2415256c Handle debug markers commands on command encoder
This CL adds support for InsertDebugMarker, PushDebugGroup, and
PopDebugGroup commands to CommandBuffer backends.

Bug: dawn:44

Change-Id: Iaf075023d3072534fca02b71c0e205cbaa46cd0f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28602
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
2020-09-18 23:10:11 +00:00
Corentin Wallez 1da25e5103 Add -Wduplicate-enum and -Wrange-for-analysis
These warnings are used in Skia.

Bug: None
Change-Id: I1948f448a89b0c213ce1aacd6bb8532f90d399be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28160
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-18 14:38:01 +00:00
Corentin Wallez c01b26490a Remove wgpu::BindingType::StorageTexture
It isn't in the upstream WebGPU spec and completely unimplemented in
Dawn.

Bug: dawn:527
Change-Id: I2023c7b1de2a9fa50d26ab1678b7ef7e32c64af6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28500
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-18 10:31:40 +00:00
Hao Li d6498a41ab Query API: Timestamp Query on Vulkan
- Add WriteTimestamp and ResolveQuerySet on Vulkan
- Enable end2end tests of timestamp query on Vulkan
- Lazy initialize the distination buffer in ResolveQuerySet

Bug: dawn:434
Change-Id: Idbd117d6c198f6726ed922c08d030bb6fbae8be6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-09-18 01:27:40 +00:00
Bryan Bernhart ac3765e663 D3D12: Align UBO sizes to 256B.
D3D debug layer uses the descriptor size (width) to
validate CBV bounds when directly allocating UBOs.
This causes validation failure when the buffer size
is misaligned (ie. not a multiple of 256B) even
through the underlying resource heap size is always
64KB aligned.

This change always aligns the buffer size to be 256B
to avoid such validation error should sub-allocation
fail.

BUG=dawn:506

Change-Id: Ic9072934cac65cfd25d0e2a20cb364bd3ca88e3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26820
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-09-17 23:30:40 +00:00
Ryan Harrison 95e715873d Enable running robust buffer access pass on shaders
In addition to adding the pass running logic, how shaders are stored
in the ShaderModule is changed, so that cached shader that was used to
create the ShaderModule is differentiated from the
modified/intermediate shader that is actually being passed to
SPIRV-Cross.

Also rolling SPIRV-Tools to pick up a fix for a bug I discovered in
the RBA pass implementation.

Roll third_party/SPIRV-Tools/ fd05605be..34ef0c3fd (25 commits)

fd05605bef..34ef0c3fdc

$ git log fd05605be..34ef0c3fd --date=short --no-merges --format='%ad %ae %s'
2020-09-16 rharrison Fix missed modification flagging (#3814)
2020-09-16 andreperezmaselco.developer spirv-fuzz: Use an irrelevant id for the unused components (#3810)
2020-09-16 stefanomil spirv-fuzz: Improvements to random number generation (#3809)
2020-09-16 greg Add buffer oob check to bindless instrumentation (#3800)
2020-09-16 vasniktel spirv-fuzz: Remove CanFindOrCreateZeroConstant (#3807)
2020-09-15 andreperezmaselco.developer spirv-fuzz: Add bit instruction synonym transformation (#3775)
2020-09-16 vasniktel spirv-fuzz: Skip unreachable blocks (#3729)
2020-09-15 afdx Fix build errors (#3804)
2020-09-15 vasniktel spirv-fuzz: Handle invalid ids in fact manager (#3742)
2020-09-15 vasniktel spirv-fuzz: Support memory instructions MoveInstructionDown (#3700)
2020-09-15 stefanomil spirv-fuzz: Pass submanagers to other submanagers when necessary (#3796)
2020-09-15 stefanomil spirv-fuzz: Transformation to flatten conditional branch (#3667)
2020-09-14 46493288+sfricke-samsung spirv-val: Add BaseInstance, BaseVertex, DrawIndex, and ViewIndex (#3782)
2020-09-14 dnovillo Properly mark IR changed if instruction folder creates more than one constant. (#3799)
2020-09-11 afdx Add missing file to BUILD.gn (#3798)
2020-09-11 antonikarp spirv-fuzz: Add TransformationDuplicateRegionWithSelection (#3773)
2020-09-11 afdx spirv-reduce: Support reducing a specific function (#3774)
2020-09-10 afdx spirv-reduce: Refactoring (#3793)
2020-09-10 afdx Favour 'integrity' over 'coherence' as a replacement for 'sanity'. (#3619)
2020-09-10 antonikarp spirv-fuzz: Fix header guards in transformations/fuzzer passes (#3784)
2020-09-10 paulthomson spirv-fuzz: Add SPIRV_FUZZ_PROTOC_COMMAND (#3789)
2020-09-10 paulthomson Add missing include (#3788)
2020-09-09 paulthomson Improve spirv-fuzz CMake code (#3781)
2020-09-08 stevenperron Allow SPV_KHR_8bit_storage extension. (#3780)
2020-09-08 stefanomil spirv-opt: Add function to compute nesting depth of a block (#3771)

Created with:
  roll-dep third_party/SPIRV-Tools

BUG=dawn:523,dawn:480

Change-Id: I1f424f5fe6d67999412f286e831ea2ea26372b9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-17 19:58:40 +00:00
Austin Eng 4099f65525 Typeify VertexBufferSlot and VertexAttributeLocation
Bug: dawn:442
Change-Id: Ic4c29eed51984d367dc7fd6055e33d26bfc7faed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28041
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-17 19:07:00 +00:00
Hao Li 6419bddd9b Add buffer lazy initialization before resolve queries on D3D12
- Reomve buffer initialization at buffer creation in end2end tests,
and implement lazy initialization when resolving queries to buffer
on D3D12 backend.
- Add buffer lazy zero init tests for resolveQuerySet on D3D12.
- For other backends, buffer lazy initialization will be added when
its resolve method is implemented.

Bug: dawn:434
Change-Id: Ib91c004b37ca912135a1c2fbb53bbd16e2d4eac6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28461
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-09-17 01:59:29 +00:00
Corentin Wallez 19b910d796 Make dawn components support CMake's BUILD_SHARED_LIBS
Convention in CMake land is that libraries default to STATIC or
SHARED based on BUILD_SHARED_LIBS. Do that for Dawn components
that users will link against, but make sure to correctly set
macros used for the export headers.

Bug: None

Change-Id: I6a96cb95706b63c18942424baada11ff81691866
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28503
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-16 19:03:18 +00:00
Corentin Wallez c236769548 Fix CMake build on Mac
Bug: None
Change-Id: I7e5410338707628ac0632e20ba720c3f271a1751
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28502
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-16 17:11:28 +00:00
Corentin Wallez dbd34449af Roll third_party/spirv-cross/ bad9dab8d..bdbef7b1f (3 commits)
bad9dab8df..bdbef7b1f3

$ git log bad9dab8d..bdbef7b1f --date=short --no-merges --format='%ad %ae %s'
2020-09-04 cwallez Fix -Wduplicate-enum and -Wrange-for-analysis.
2020-09-04 post Roll glslang/SPIRV-Tools deps.
2020-09-04 post Handle OpUndef %void.

Created with:
  roll-dep third_party/spirv-cross

TBR=enga@chromium.org
Bug: None

Change-Id: I94afddf93b187bbde37c4e7088231d4f28959403
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28422
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-11 11:12:06 +00:00
Corentin Wallez d05e532c6b Fix typo in README.md
Bug: None
TBR=enga@chromium.org

Change-Id: Ib86da5fca2fb3cf1287cca47be1d739433fd2048
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-11 10:38:46 +00:00
Hidehiko Abe 948b3a0555 Expand is_linux to is_linux || is_chromeos.
Currnetly ,is_linux GN variable is set to true on Chrome OS build,
but it is planned to be set false. This CL is the preparation
to keep the bahavior compatible.

Bug: chromium:1110266
Test: Build locally.
Change-Id: Iffbfafe3ac5b00899804afa7471a04709046610a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28340
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
2020-09-11 02:24:16 +00:00
Bryan Bernhart 9427c97d9c Fix ASSERT in WindowsDebugLogger again
If debugger was already attached, closing
the exit handle would incorrectly assert.

Bug: None
Change-Id: I322591c66a9885a260a87750e066ba2e9d07fe23
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28321
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-10 15:53:47 +00:00
Corentin Wallez 498d5ea20a Rename BC6HRGBSfloat to BC6HRGBFloat
Bug: dawn:22
Change-Id: Ib579e15ff923cbd7c4f523a58c2ef582d39ba7c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-10 08:48:57 +00:00
Jiawei Shao 87f25134a8 Vulkan: Combine all the barriers before dispatch() in one call
This patch combines all the resource barriers added before each
dispatch() into one call to reduce the number of
vkCmdPipelineBarrier() in the Vulkan command buffer.

BUG=dawn:522

Change-Id: I1b5943e62eb0a09db96de12196fcabb3448e9e4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28283
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-10 00:26:07 +00:00
Corentin Wallez 39d1cc9e9c ShaderModule: Add support for multiple entryPoints
Also adds validation tests that reflection data is correctly computed by
entryPoint, and end2end tests that using a shader module with multiple
entryPoints works correctly.

Bug: dawn:216
Change-Id: Id2936bb220d4480872a68624996e4c42452a507d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28244
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 23:11:57 +00:00
Corentin Wallez b8712c01c1 D3D12: Make HLSL generation per-entrypoint.
Also make the CompileShaderDXC/FXC standalone functions because
they don't use ShaderModule except to GetDevice().

Bug: dawn:216
Change-Id: Iaec9abe52ad4422891474086c3b973baf07046a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28243
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:55:17 +00:00
Corentin Wallez 28efed139f OpenGL: Make GLSL generation per-entrypoint.
Bug: dawn:216
Change-Id: I7b4c0e9c210af59711318a744d8055cfb9b82092
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28242
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:51:37 +00:00
Corentin Wallez 676e8f39df Metal: Use ShaderModule reflection when possible.
This change the Metal backend in preparation for supporting multiple
entrypoints:

 - Explicitly set the spirv_cross entry point before compiling.
 - Moves gathering of the local size to the frontend as it will be
   useful for validation in the future.
 - Query spirv-cross for the modified entrypoint name instead of
   duplicating the code in Dawn.
 - Move some conversion helpers from ShaderModule.cpp to their own
   SpirvUtils file.

Bug: dawn:216
Change-Id: I87d4953428e0bfeb97e39ed22f94d86ae7987782
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28241
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:47:07 +00:00
Corentin Wallez 947201da19 Make ShaderModuleBase use its own spirv_cross for reflection.
Bug: dawn:216
Change-Id: Ie79aaeb3a878960606e8c09a4969bf7a1dbe1b13
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28240
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-09-09 22:44:57 +00:00
Aleksi Sapon 97b880e6ff Add missing CMake spirv-cross dependency
Also add a missing SPIRV-Tool link

Change-Id: I0d81b6878f09017147b9ccbe21a5784383535ba9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-09 16:39:00 +00:00
Aleksi Sapon 0a1061da0c Fix CMake build with MSVC
Bug: None

Change-Id: I061984e649f89e92e2769fd8aba141bbfdc0d4bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28144
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-09 07:08:38 +00:00
Jiawei Shao 12e97ed6a7 Transition bind group resource states before dispatch in compute pass
This patch fixes a crash issue in both D3D12 and Vulkan backends.
Previously on D3D12 and Vulkan before a compute pass we transitioned
the states of all the resources used in the pass, and before each
dispatch call we only checked if the states of the storage buffers,
read-only storage textures and write-only storage textures need to
be transitioned. This behavior causes two issues:

1. In a compute pass a buffer or texture can be used as both read-only
and writable usages in different dispatch calls (e.g. as storage
buffer in the first dispatch, and as the uniform buffer in the next
dispatch), while this is invalid state combination on D3D12 and isn't
allowed by D3D12 validation layer.
2. In the above case, the state of the buffer is not transitioned into
UNIFORM, which does not match the required state in the next dispatch.

This patch fixes this issue by transitioning all the states in the
current bind group before each dispatch() instead of the beginning
of the compute pass.

BUG=dawn:522
TEST=dawn_end2end_tests
Change-Id: Ibeb6c41dc493ee1068b43bd89ed5a15f2331ef75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27942
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-09 01:14:38 +00:00
Austin Eng 7b7e098b11 Typeify ColorAttachmentIndex
Also moves BindingNumber, BindGroupIndex, and BindingIndex to
IntegerTypes.h. Future TypedIntegers should be declared here.

Bug: dawn:442
Change-Id: I5ba8de3412fb48b7957b67e7c413a5097f8ec00f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27880
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-09 00:08:38 +00:00
Aleksi Sapon 22e5e179fa Vulkan: unused resolve attachments must be marked as such
Change-Id: I61e1e6469c20149df5c6296ee237efced36a163c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28145
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-09-08 20:24:45 +00:00
Jiawei Shao 62442aceb0 D3D12: Combine all the barriers before dispatch() in one call
This patch combines all the resource barriers added before each
dispatch() into one call to reduce the number of ResourceBarrier() call
in the D3D12 command list.

BUG=dawn:522

Change-Id: I31d1520925e79f6a4ef8168a3713466866b2108c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28100
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-09-04 01:41:17 +00:00
Ryan Harrison 2cdb9f1ed1 Remove SPVC toggles and excise remaining references
BUG=dawn:521

Change-Id: Ib6428ca366a70d73096f9b4442c1b7fb69a539ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28142
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-03 18:39:37 +00:00
Ryan Harrison b44ca92f1c Roll 4 dependencies
Roll third_party/shaderc/ b6c82a149..011139094 (5 commits)

b6c82a149e..011139094e

$ git log b6c82a149..011139094 --date=short --no-merges --format='%ad %ae %s'
2020-09-03 rharrison Adding back non-spvc BUILD.gn that I accidentally nuked (#1136)
2020-09-03 rharrison Remove spvc (#1135)
2020-09-02 rharrison Start SPIRV-Tools v2020.4
2020-09-02 rharrison Finalize SPIRV-Tools v2020.3
2020-09-01 rharrison Roll 3 dependencies and update expectations (#1133)

Created with:
  roll-dep third_party/shaderc

Roll third_party/spirv-cross/ 685f86471..bad9dab8d (4 commits)

685f86471e..bad9dab8df

$ git log 685f86471..bad9dab8d --date=short --no-merges --format='%ad %ae %s'
2020-08-27 cdavis MSL: Support layered input attachments.
2020-09-02 post MSL: Fix OpCompositeInsert and OpVectorInsertDynamic.
2020-08-23 cdavis MSL: Don't set the layer for multiview if the device doesn't support it.
2020-08-07 cdavis MSL: Fix multiview view index calculation with a non-zero base instance.

Created with:
  roll-dep third_party/spirv-cross

Roll third_party/SPIRV-Tools/ 8a0ebd40f..fd05605be (8 commits)

8a0ebd40f8..fd05605bef

$ git log 8a0ebd40f..fd05605be --date=short --no-merges --format='%ad %ae %s'
2020-09-03 stefanomil spirv-fuzz: Transformation to convert OpSelect to conditional branch (#3681)
2020-09-02 46493288+sfricke-samsung spirv-val: Add Vulkan VUID labels to BuiltIn (#3756)
2020-09-02 vasniktel spirv-fuzz: Add support for BuiltIn decoration (#3736)
2020-09-02 stefanomil spirv-fuzz: Fix GetIdEquivalenceClasses (#3767)
2020-09-02 stefanomil spirv-fuzz: Replace id in OpPhi coming from a dead predecessor (#3744)
2020-09-01 stefanomil spirv-fuzz: Transformation to replace the use of an irrelevant id (#3697)
2020-09-01 vasniktel spirv-fuzz: TransformationMutatePointer (#3737)
2020-09-01 stefanomil spirv-fuzz: Compute interprocedural loop nesting depth of blocks (#3753)

Created with:
  roll-dep third_party/SPIRV-Tools

Roll third_party/tint/ 464928ed9..e7ec7f168 (17 commits)

https://dawn.googlesource.com/tint/+log/464928ed913b..e7ec7f16895a

$ git log 464928ed9..e7ec7f168 --date=short --no-merges --format='%ad %ae %s'
2020-09-03 dsinclair [wgsl-writer] Add GenerateEntryPoint
2020-09-03 dsinclair Stub out the method to generate individual entry points.
2020-09-03 dsinclair Add reset method to the generators.
2020-09-03 dsinclair Move generators to unique pointers.
2020-09-02 sarahmashay [validation] Add disabled tests for validating switch statements
2020-09-02 tommek [wgsl-reader] Parsing sampled texture type
2020-09-02 dsinclair [hlsl-writer] Simplify generated logical and/or expressions.
2020-09-02 dsinclair [hlsl-writer] Simplify logical and/or code.
2020-09-02 dsinclair [hlsl-writer] More logical and/or tests.
2020-09-02 dsinclair [hlsl-writer] Emit LogicalAnd and LogicalOr operations
2020-09-02 dsinclair [hlsl-writer] Support pre stream in if/else statements.
2020-09-02 dsinclair [hlsl-writer] Emit pre strings
2020-09-02 dsinclair [hlsl-writer] Update all expressions to take a pre stream.
2020-09-02 tommek [wgsl-reader] Parsing texture sampler types
2020-09-02 dsinclair Fixup doxygen comment
2020-09-02 tommek [wgsl-reader] Parsing depth texture type
2020-09-02 tommek [wgsl-reader] Parsing sampler type

Created with:
  roll-dep third_party/tint

Change-Id: I34e0e77b0f3d1b8050d465fa20e6846ef573c092
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28140
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-03 15:36:37 +00:00
Corentin Wallez 9e261b46a4 Fix compilation with dawn_enable_wgsl=false
Bug: None
TBR=rharrison@chromium.org
TBR=enga@chromium.org
Change-Id: I5376983a0aefbd355a2d2a5da822a34bd6f264dc

Change-Id: I89c8c1e14030f01b76cab0f61cd76526a96ca01e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28120
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-03 08:45:40 +00:00
Ryan Harrison c35e2ba379 Remove usages of SPVC
Remove all usages of SPVC from the code and update the fuzzers. Some
of the include paths and deps came transitively from spvc, so needed
to update build rules.

This patch does NOT remove the flags related to spvc usage, they are
just no-ops as the moment. After this patch lands I will remove the
usage of those flags from the bots, then remove the flags.

BUG=dawn:521

Change-Id: I0d7c3e28f79354c78f00c48b6a383b823094a069
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27900
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-09-02 22:09:08 +00:00
Austin Eng a1758eef07 Cleanup: always clear Vulkan textures with vkCmdClear*Image
Previously, this code path was gated on whether or not the texture
format is renderable. This should not be the case as this Vulkan
command only requires the texture to have TRANSFER_DST.

Bug: dawn:145
Change-Id: Ifd8f75a70477a8d159c04d1180247cd076c767bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27941
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-09-02 21:03:29 +00:00
Austin Eng ea82272fd6 Cleanup: Make TexelBlockInfo a member of Format, not superclass
Bug: dawn:439
Change-Id: I1255086d29e8b85045776f183b3fb563eec0b090
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27940
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-09-02 18:50:09 +00:00
Corentin Wallez 8ec8f31e3b Make ShaderModule reflection go through EntryPointMetadata
PipelineBase now collects the EntryPointMetadata for all its
stages which makes the rest of the code agnostic to the entrypoint
name (except D3D12 and OpenGL that required transition hacks and
will be fixed in follow-up CLs).

Bug: dawn:216

Change-Id: I643da198cb2a20a9d94d805a2dc783d6d4346ae9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27260
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-02 15:57:39 +00:00
Corentin Wallez e9bc506e0a TextureVk: Add a couple TODOs related to barriers.
Bug: None
Change-Id: I2da575ce7b79c92f5a2a320334e51e571f672b46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28003
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-02 12:56:29 +00:00