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>
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>
This patch is the first part to implement creating a texture view
with a texture view descriptor on D3D12 and Metal back-ends. With
this patch the texture views created with descriptor can be bound
as sampledTextures on D3D12 and Metal back-ends.
Note that the support of rendering into a layer or a mipmap level of
a texture on D3D12 and Metal back-ends is not included in this patch.
BUG=dawn:16
TEST=dawn_end2end_tests
Change-Id: I62473ec5a4bb6b84d797ef7fd9cb98689ff763f4
Reviewed-on: https://dawn-review.googlesource.com/c/1940
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This removes the need for Clone() so it is removed and also adds tests
for the new constructors.
BUG=dawn:11
Change-Id: Ia45c765c2d30e40b0e036427793a62327b2008fc
Reviewed-on: https://dawn-review.googlesource.com/c/1901
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch implements creating a texture view with given texture
view descriptor on Vulkan back-ends.
This patch also updates TextureViewTests to test various mipmap
levels and adds several tests to cover all added features.
BUG=dawn:16
TEST=dawn_end2end_tests
Change-Id: I602e5a076e4f717f555cb9a9ef98d5dfceadbe81
Reviewed-on: https://dawn-review.googlesource.com/c/1880
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This patch removes CreateDefaultTextureView in all the back-ends of
class Device and implements this function by CreateTextureView using
a TextureViewDescriptor created from the original texture.
Note that this patch only refactors the original implementation of
creating default texture. The support of creating texture views from
a texture view descriptor will be added in the next several patches.
BUG=dawn:16
Change-Id: Iadfc1e17e1cf23a4c1fa8ff44b1fb1a765d21e3f
Reviewed-on: https://dawn-review.googlesource.com/c/1840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
ObjectBase will contain data that all WebGPU objects have such as a
pointer back to the device, a refcount (via inheriting from RefCounted),
a name, an error status etc.
BUG=dawn:24
Change-Id: I919e1a6d4a68811ceb6e503b2a793815c92f2528
Reviewed-on: https://dawn-review.googlesource.com/c/1620
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This patch adds the entry point creating texture view with a
TextureViewDescriptor and all the validations on the parameters
according to https://github.com/gpuweb/gpuweb/issues/79.
BUG=dawn:16
TEST=dawn_unittests
Change-Id: Ibc04a0f7b9f334c57da191606313ab156e18af1f
Reviewed-on: https://dawn-review.googlesource.com/c/1800
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
If a bindgroup was re-used in multiple command buffers in a single call
to queue.Submit(), it was skipping the creation of the corresponding
descriptor heap for that bind group in the second command buffer.
The fix is to use the command buffer's index into the submit command as
part of the key for the bind group's descriptor heap.
Change-Id: Ie66a0e772b10cc72bf040f090dac4c4a10f24266
Reviewed-on: https://dawn-review.googlesource.com/c/1740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This splits off part of CommandBufferBuilder in separate
RenderPassEncoder and ComputePassEncoder objects. To match the WebGPU
IDL and factor some code, both these encoders inherit from
ProgrammablePassEncoder.
These encoders are pure frontend objects and record into the
CommandBufferBuilder command allocator objects, so no changes to the
backends were needed.
Error handling is still ew, because the "builder" mechanism we had
doesn't allow for "split builders". Nicer error handling will have to
wait on Dawn matching WebGPU.
All the tests and samples were updated to the new structure.
BUG=dawn:5
Change-Id: I5f5d4ad866e2c07fedd1ba7a122258c6610941f1
Reviewed-on: https://dawn-review.googlesource.com/1543
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This patch is the first one to support inspecting GPU information for
dawn_end2end_tests.
In this patch, we support collecting the device name, device id and
vendor id on D3D12 and Vulkan. We also support collecting the device
name on OpenGL. The collection on Metal will be supported in the next
patch. Using this information we implement a series of APIs to inspect
the information of both OS and GPU vendor.
We also skip two failed tests on Windows Intel Vulkan backends.
BUG=dawn:10
Change-Id: If52a960c0bae3922a0b5650500218eff1400d77a
Reviewed-on: https://dawn-review.googlesource.com/1460
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This matches WebGPU and is a good test of having structures include
other structures by value.
BUG=dawn:13
Change-Id: Ibd5ea1340338e5aa16069499c498ac5a455fc2cd
Reviewed-on: https://dawn-review.googlesource.com/1500
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch is the first one to descriptorze texture view. In this
patch, we completely remove TextureViewBuilder and add the entry
point CreateDefaultTextureView for creating a texture view on a
non-array 2D texture using the same type and format.
Texture view descriptors and 2D array texture views will be supported
in the next patch.
BUG=dawn:1, dawn:16
Change-Id: Ibd2a0bcf02cbb567a98d2faaaaa897eff2c062e5
Reviewed-on: https://dawn-review.googlesource.com/1440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
BUG=dawn:13
Change-Id: I7a224503d0a33ef148e63b8327a6a53df1b3868a
Reviewed-on: https://dawn-review.googlesource.com/1520
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
The error type will help distinguish between validation errors, context
losts and others which should be handled differently.
Take advantage of advantage of this to change DAWN_RETURN_ERROR to
"return DAWN_FOO_ERROR" to have the return be more explicit. Also
removes usage of DAWN_TRY_ASSERT for more explicit checks.
Change-Id: Icbce16b0c8d8eb084b0af2fc132acee776909a36
This integrates spirv-val in dawn_native so that regular and
WebGPU-specific validation of shaders is done.
Also adds tests to check OpUndef is correctly rejected so we know
WebGPU-specific validation is working.
Change-Id: If49d276c98bca8cd3c6c1a420903fe34923a2942
This patch implements the creation of 2D array textures and copying
between a buffer and a layer of a 2D array texture on D3D12, Metal
and OpenGL back-ends.
TEST=dawn_end2end_tests
Linking against their .lib makes loading Dawn fail on systems that don't
have the DLLs. This happens for example on Windows7 that doesn't have
d3d12.dll. Instead we dynamically load functions pointers from these
DLLs at d3d12::Device startup.
Change-Id: I4d01a12d0f91bec45bf125450d2c08aaa9ff9fac
This patch implements a micro DAWN_SKIP_TEST_IF in DawnTest.h which
can be used to skip running a test in dawn_end2end_tests when the
given condition is satisfied.
Implement copying between a buffer and a texture 2D array on Vulkan
This patch implements the creation of a 2D array texture and data
copying between a buffer and a layer of a 2D array texture on
Vulkan back-ends.
TEST=dawn_end2end_tests
This patch introduces texture descriptor for texture creation instead
of texture builders.
This patch also adds "arrayLayer" to texture descriptor and removes
mDevice in TextureD3D12.