It currently is a tagged pair instead of a tagged union because it was
much easier to write and the optimization can come later.
BUG=dawn:19
Change-Id: Idbfd86d559655b38871c2d1768bdd758e797dfbd
Reviewed-on: https://dawn-review.googlesource.com/c/2701
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Becuase CGDisplayIOServicePort is deprecated in OSX >= 10.9, we create
an alternative function which manually finding a service port with
matching vendor and product IDs.
BUG=dawn:10
TEST=dawn_end2end_tests
Change-Id: I94ff65911e159c2b7075209d8902c1551560ed47
Reviewed-on: https://dawn-review.googlesource.com/c/2541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Cosmetic changes to copyBufferToTexture and copyTextureToBuffer to
match WebGPU IDL. Introduces BufferCopyView, TextureCopyView,
TextureAspect, and Origin3D types.
Bug: dawn:17
Change-Id: Ic0e7f472a9dc1353d3fc3839ff02f348bb6067e8
Reviewed-on: https://dawn-review.googlesource.com/c/2520
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This change moves most of SerialQueue into SerialStorage
and factors it to make SerialMap and SerialQueue. SerialMap
does not enforce that items are Enqueue'd in monotonically
increasing order. This is useful for implement timeline fences
because OnCompletion callbacks may be added in an arbitrary order.
Bug: dawn:26
Change-Id: I03376117311112b0b94ed887a31974f36c4a5464
Reviewed-on: https://dawn-review.googlesource.com/c/2720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
In preparation for the descriptorization of BindGroup, support was added
to treat wire ID 0 as nullptr for a bunch of objects. Now that we have a
fuzzer for the wire+frontend, we need to validate when we have a 0 id.
Either the wire needs to reject the ID or the frontend needs to validate
against nullptrs. Since only few entrypoints will have a use for
nullptrs (bind groups, render pass resolve textures), we require an
opt-in in the JSON file for a structure member or an argument to be
optional.
This disables the tests related to ID 0 = nullptr, because we don't yet
have optional argument/members in dawn.json.
BUG=chromium:905273
BUG=chromium:906418
BUG=chromium:908678
Change-Id: If9a3c4857db43ca26a90abff2437e1cebb0ab79b
Reviewed-on: https://dawn-review.googlesource.com/c/2704
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
New additions to the validation for the WebGPU execution environment
broke all the tests that use shaders because tests don't produce valid
SPIR-V for WebGPU and also backends don't know how to lower
WebGPU-flavored SPIR-V to target languages.
Also rolls SPIRV-Headers to a version compatible with SPIRV-Tools
TBR=kainino@chromium.org
BUG=dawn:57
Change-Id: Icd9a199efc39cf143e38d64841eb4b122c9f54a9
Reviewed-on: https://dawn-review.googlesource.com/c/2706
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch adds checks when we set a texture view as color or depth
stencil attachments:
1. The mipmap level of the texture view must be 1 as it is limited in
D3D12, Metal and Vulkan.
2. The array layer count of the texture view must be 1 as currently we
do not plan to support layered rendering in WebGPU.
3. The format of the texture view must be color renderable when it is
used as a color attachment.
4. The format of the texture view must be a depth stencil format when it
is used as a depth stencil attachment.
BUG=dawn:16
TEST=dawn_unittests
Change-Id: Ibce3bda20d49a725c26796aa627c5067532761ad
Reviewed-on: https://dawn-review.googlesource.com/c/2661
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Currently this suppresses them for all GPUs on Metal because
we there are no facilities to get the GPU vendor ID yet.
TBR=kainino@chromium.org
BUG=dawn:39
Change-Id: I8377016466da765a18f20ade5b277fa9cf1305c5
Reviewed-on: https://dawn-review.googlesource.com/c/2600
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch adds checks that we can only create cube map and cube
map array texture views on textures with width == height as is
required in Vulkan.
This patch enables the imageCubeArray feature on Vulkan back-ends
to ensure we can create cube map array image views on all Vulkan
back-ends.
This patch also adds a missing VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
flag when creating Vulkan images with arrayLayer >= 6. Without this
flag we cannot create cube map or cube map array views.
This patch fixes all the cube map end2end tests on Linux using
Vulkan back-ends.
BUG=dawn:16
TEST=dawn_end2end_tests
Change-Id: Id9386b9ee509d18a5ba8ae1ca085134486b242d7
Reviewed-on: https://dawn-review.googlesource.com/c/2522
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
When generating the proc tables for dawn_native and dawn_wire (for the
client), we were casting between function pointers with the C types and
function pointers with the internal types. This is UB and was caught by
UBSan.
Replace casts between function pointers by casts between types inside
the functions themselves.
BUG=chromium:906349
Change-Id: Icd8f6eedfa729e767ae3bacb2d6951f5ad5c4c82
Reviewed-on: https://dawn-review.googlesource.com/c/2400
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
SetImplementation takes a pointer and would be shimmed by browsers so we
skip the call in the fuzzer, otherwise we'd dereference arbitrary
pointers.
BUG=chromium:906391
Change-Id: I61d8d729d3fb242e8ddf7452a88a653e05a82cc2
Reviewed-on: https://dawn-review.googlesource.com/c/2562
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
The dawn::Device(dawnDevice) constructor was adding a reference which
caused the device to leak. Fix this by using dawn::Device::Acquire
instead.
BUG=chromium:904734
Change-Id: Id641459f9285c9da51a0d2a1f88126197bfd79a5
Reviewed-on: https://dawn-review.googlesource.com/c/2561
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Due the jump within the signal trap used in these fuzzers, local scope
allocations cannot occur while the signal trap is on, otherwise there
is a possibility of leaks. This CL rewrites how the code under test is
run, so that the potentially aborting code is tightly wrapped by
signal trap without any local scope allocations.
BUG=chromium:906416
Change-Id: Ie52647433dcac57e3ea065d5bdcb6e14c5929494
Reviewed-on: https://dawn-review.googlesource.com/c/2521
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
build/win_toolchain.json was updated out of band so we need to roll all
Chromium's build support repos to pick up the respective change to
build/vs_toolchain.py
In the meantime, LASTCHANGE-related functionality changed and requires a
new hook to run before we can call `gn gen`.
TBR=kainino@chromium.orgTBR=senorblanco@chromium.org
BUG=chromium:906559
Change-Id: Ic5d297b5700193ca72b02874073e6c553f06e04f
Reviewed-on: https://dawn-review.googlesource.com/c/2560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch implements cube map and cube map array texture views on
all back-ends and adds related end2end tests.
BUG=dawn:16
TEST=dawn_end2end_tests
Change-Id: I3ac3f493eb92ac551371041039bd5cf39df53050
Reviewed-on: https://dawn-review.googlesource.com/c/2220
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Otherwise UBSan complains that C++ types are different between the
shared libraries because libc++ is linked statically.
BUG=chromium:904736
Change-Id: I51ef40d1f7910fd693a4585c74ff404812472d2e
Reviewed-on: https://dawn-review.googlesource.com/c/2380
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
These fuzzers currently depend on being able to change the signal
handler at runtime, but the default flags being used forbid this. This
CL overrides the upstream default to allow changing the handler.
BUG=chromium:904725,chromium:904712
Change-Id: I68423564981b7f2e39f7c00744b92da982cf19e9
Reviewed-on: https://dawn-review.googlesource.com/c/2361
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This will avoid compilation to break, and adds standalone reproducers
for the fuzzer_tests.
BUG=chromium:903380
BUG=dawn:34
Change-Id: I9995a852076d9f6d1ebdee5b999989c2d74d4709
Reviewed-on: https://dawn-review.googlesource.com/c/2321
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
This CL adds in fuzzers for SPIRV-Cross for HLSL, GLSL, and MSL
outputs. These fuzzers live in Dawn because there is not appropriate
location in the Chromium source repo for them and it is unlikely they
would be land-able in the SPIRV-Cross repo, because it is not coupled
with Chromium's build system and thus Clusterfuzz so would be
effectively dead code. Dawn depends on this code, but it is also
integrated into the Chromium build system, so this was the best place
I could find for them
The code under fuzz unfortunately uses exceptions/aborting as its
error reporting mechanism. This is an acknowledge short coming and
there are efforts to remove this behaviour. To work around this and
reduce the number of false positives found by the fuzzers, a signal
trap has been implemented which will be removed once the code under
fuzz has been updated.
The trap replaces the existing signal handler and silencing signals
while running the code under test. This allows the code under test to
call abort() and not crash the fuzzing process. Theoretically, only
SIGABRT should need to be trapped, but something is causing the signal
from abort() to be converted to SIGSEGV when running under ASAN.
This signal trap has been tested with the fuzzing/sanitizers by
intentionally inserting bad calls that will occur after a few thousand
test cases. It was confirmed that the fuzzer detected the issue and
stops fuzzing.
The alternate to implementing this signal trap would be to turn on
exceptions for the fuzzer. This was attempted, but proved to be
fruitless due to what was reported as an ODR issue, but couldn't
couldn't be silenced. The likely underlying issue was a pre-built
library or other object being built without exceptions was causing
different versions of symbols or the exception version of the standard
library not being instrumented by ASAN. Given the majority of Chromium
eco-system turns off exceptions, fixing this issue would not be
helpful to the larger community and was looking like it would require
significant effort.
BUG=chromium:903380
Change-Id: I63a5595383f99b7a0e150d72bb04c89b8d722631
Reviewed-on: https://dawn-review.googlesource.com/c/2260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
BindGroupTests.ReusedUBO and BindGroupTests.UBOSamplerAndTexture fail on
Metal so we have to skip them temporarily.
BUG=dawn:33
Change-Id: I2875dab6d856eb207ee5b785ddf160df2cb9fd5b
Reviewed-on: https://dawn-review.googlesource.com/c/2240
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Likewise "presented" textures won't be available for use in submits so
this sets up state-tracking and validation for textures too.
Command buffer resource usage is now stored in the frontend instead of
done per-backend because it is used to validate resources are allowed in
the submits.
Also adds a test.
BUG=dawn:9
Change-Id: I0537c5113bb33a089509b4f2af4ddf4eff8051ea
Reviewed-on: https://dawn-review.googlesource.com/c/2142
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch adds the entry points for creating cube map and cube map
array texture views. This patch also adds validations that the array
layer in the texture view descriptor must be 6 when the texture view
dimension is cube map, and a multiple of 6 when the texture view
dimension is cube map array.
BUG=dawn:16
TEST=dawn_unittests
Change-Id: I86a66c3753a7678351f65b43f6cd54b96d1b762c
Reviewed-on: https://dawn-review.googlesource.com/c/2200
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
MSC doesn't like the use of sizeof(member) inside the same struct.
So hardcode the padding, and assert that the offset is 256.
Change-Id: I78bbca6871cf8227c90d00a03ccf8e3d955b7d21
Reviewed-on: https://dawn-review.googlesource.com/c/2160
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
When both the vert and frag shaders have a UBO binding, the D3D12
backend was using register offset 0 for both, causing a collision,
and the wrong constant value used in one of the shaders.
The fix is to use the binding offsets computed by the BindGroupLayout,
since they know about all of the bindings, not just the ones computed
for each shader. This made it necessary to defer shader compilation
until pipeline layout creation time (as is done in the Metal backend
for similar reasons).
Finally, those bindings offsets computed by the BGL include an offset
for the CBV, UAV and SRV subgroups, so we must add the same register
offset when assigning the BaseShaderRegister to the descriptor ranges
in the PipelineLayout constructor so that they match.
Bug: dawn:20
Change-Id: I18287bf1c06f06dd61288e12da64752f54634466
Reviewed-on: https://dawn-review.googlesource.com/c/1960
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This also removes support for Travis and AppVeyor, as well as git
submodules for dependencies.
It also adjusts .gitignore to include dependencies (submodules are
implicitly ignored but are removed in this commit).
Finally, removes some CMake-specific code from the code generator.
BUG=
Change-Id: I4ebc04e530a574b412ef0ca81e4672db01f0ed92
Reviewed-on: https://dawn-review.googlesource.com/c/2040
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch renames the field "mipLevel" of TextureDescriptor to
"levelCount" to align with the WebGPU idl.
BUG=dawn:16
Change-Id: I36b30d78831786e4c21ffd641f820375e95a1be5
Reviewed-on: https://dawn-review.googlesource.com/c/2100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Running test in a Chromium build requires using their gtest and gmock
targets as well as a harness that is in //base. Since we want to run
Dawn tests on the Chromium GPU bots, we need to support two
configurations both building tests standalone and in Chromium.
BUG=chromium:870747
Change-Id: I862e62a607e193a27562ece0f1f6d46d8728e446
Reviewed-on: https://dawn-review.googlesource.com/c/2080
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch implements creating texture view with texture view descriptor
with glTextureView, which is supported on OpenGL version >= 4.3. As is
required by glTextureView, we allocate storage for a texture by
glTexStorage*D instead of glTexImage*D.
BUG=dawn:16
TEST=dawn_end2end_tests
Change-Id: I29bcf6d538a70b4d6d1e5a21276b9e8d6e93ca51
Reviewed-on: https://dawn-review.googlesource.com/c/1980
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
d3d12::Buffer::UnmapImpl() was passing an empty range to
ID3D12Resource::Unmap(). This causes it to be a no-op when writing a
buffer. The fix is to store the entire mapped range in the Buffer,
and use it during Unmap().
Note: this doesn't seem to actually cause an issue on the D3D12 drivers I
have, so I have been unable to write a test for it. However, it does cause
an issue in RenderDoc: the buffer data appears unmodifed after the
Map/memcpy/Unmap calls. The hypothesis is that RenderDoc notices the empty
range at the API level, and leaves its shadow buffer contents unmodified.
Because I feel this change is correct regardless, I'm landing it without
a test.
Bug: dawn:25
Change-Id: Ie5dd5fcfedbe1d80c75a3d8094c97af27653ee00
Reviewed-on: https://dawn-review.googlesource.com/c/1920
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Most of names in dawn.json are in lower case, and we leave a blank space
between words. This tiny patch revises a few names, in order to conform
to the rule.
BUG=
Change-Id: I8f3f706bd48ce04fcca207a28f1b8725d7e0a7bc
Reviewed-on: https://dawn-review.googlesource.com/c/2000
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>