Commit Graph

803 Commits

Author SHA1 Message Date
Austin Eng fd4688e8d0 Separate WireServer.cpp into multiple files.
This patch copies methods and classes from WireServer.cpp and
distributes them over multiple files. Headers and forward declarations
are added as necessary, but no functional changes are made.

Bug: dawn:88
Change-Id: I471b8c27804916257eff266a51d087ba1ddbfeb6
Reviewed-on: https://dawn-review.googlesource.com/c/4000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-01-30 02:20:58 +00:00
Bryan Bernhart 74e95fff4a Memory manager: buffer uploads (D3D) - Part 1
Manages a single persistently mapped GPU heap which is sub-allocated
inside of ring-buffer for uploads. To handle larger buffers without additional
unused heaps, ring buffers are created on-demand.

BUG=dawn:28
TEST=dawn_unittests

Change-Id: Ifc5a1b06baf8633f1e133245ac1ee76275431cc5
Reviewed-on: https://dawn-review.googlesource.com/c/3160
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-29 00:10:07 +00:00
Frank Henigman 79ff8bead9 DEPS: Roll SPIRV-Headers and SPIRV-Tools.
Roll SPIRV-Headers and SPIRV-Tools so we can roll shaderc so we can use
libshaderc_spvc in the SPIRV-Cross fuzzers.

BUG=dawn:95

Change-Id: I02f8dd4788e3094b1b59a99a27fdeba94d3aa47f
Reviewed-on: https://dawn-review.googlesource.com/c/4220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
2019-01-28 19:47:07 +00:00
Corentin Wallez 1c0b0474c1 [commit-queue.cfg] Remove old cq.cfg
Bug=chromium:916292

Change-Id: I3b55d17aee849228d4db73c82bb3746df9eb6060
Reviewed-on: https://dawn-review.googlesource.com/c/4200
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-28 09:03:26 +00:00
Andrii Shyshkalov b92cee8987 [commit-queue.cfg] Create new project-scoped CQ config.
Autogenerated from ref-scoped cq.cfg located at:
  https://dawn.googlesource.com/dawn/+/refs/heads/master/infra/config/branch/cq.cfg
  (pinned https://dawn.googlesource.com/dawn/+/b59d04f79ee3bdc173beba9256c266e009321ffb/infra/config/branch/cq.cfg)

The new config is functionally equivalent to the old one. Upon landing, the new
config will take effect once LUCI config service picks it up. If you see
'commit-queue.cfg' in https://luci-config.appspot.com/#/projects/dawn ,
then it has been picked up.

New commit-queue.cfg takes precedence over old cq.cfg, and once picked up makes
it safe to remove old cq.cfg.

See also internal PSA go/psa-migrate-to-commit-queue-cfg.

Generated-by: https://crrev.com/i/815809
Bug: chromium:916292
Change-Id: I3d6a3dcf916fce35dca43ed3497d53eb6334d8f9
Reviewed-on: https://dawn-review.googlesource.com/c/4180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-28 07:18:32 +00:00
Corentin Wallez da8ee83ee7 BUILD.gn: Change the static/shared library template to component
This changes the dawn_static_and_shared_library template to be a
dawn_component template that mimics the behavior of Chromium's
components.

This helps avoid issues where on non-component builds on Windows the CRT
would get linked statically in both the Dawn shared libraries and the
test executables, causing alloc/deallocs across library boundaries to
crash.

BUG=dawn:29

Change-Id: I69287a523cc0bf5f2e921982ea9c26dcfed82f11
Reviewed-on: https://dawn-review.googlesource.com/c/4040
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-25 03:20:20 +00:00
Corentin Wallez fe92685bfc Roll third_party/shaderc/ 909f0d3d3..ce7d92182 (28 commits)
909f0d3d31..ce7d92182b

$ git log 909f0d3d3..ce7d92182 --date=short --no-merges --format='%ad %ae %s'
2019-01-22 fjhenigman Use the full spirv-cross dependency. (#550)
2019-01-22 corentin BUILD.gn: fix build error on is_component_build=true (#549)
2019-01-21 corentin BUILD.gn: Make libraries Chromium-style "components" (#548)
2019-01-17 fjhenigman Disable spvc build by default.  (#542) (#547)
2019-01-16 fjhenigman Fix build with exceptions off. (#546)
2019-01-16 dneto Fix MinGW: Format %lu must be unsigned long. (#544)
2019-01-16 dneto Fix leaks in tests (#545)
2019-01-15 fjhenigman Fix ASAN build. (#543)
2019-01-15 fjhenigman Add libshaderc_spvc interface to SPIRV-Cross. (#524)
2019-01-15 fjhenigman Fix NDK build. (#540)
2019-01-11 dneto Android.mk: better fallback for SPIRV-Tools dir (#538)
2019-01-09 dj2 Roll RE2 Dep (#537)
2019-01-07 dj2 Fixup source matching test (#534)
2019-01-03 fjhenigman Fix Windows test script return value. (#533)
2019-01-02 dj2 Switch GLSLang to upstream (#515)
2018-12-28 alex Generate source text debug info if requested (#455) (#532)
2018-12-27 ehsann [kokoro] Stop running tests on VS 2013 builds. (#531)
2018-12-21 fjhenigman Update Android NDK. (#530)
2018-12-17 dneto Test shader uniforms need descriptor set and binding (#523)
2018-12-17 kknb1056 Add git clone of re2 and effcee to the Dockerfile (#527)
2018-11-28 dj2 Update to use Android.mk from glslang (#520)
2018-11-22 dneto Add unit tests for mesh and task shaders
2018-11-21 arseny.kapoulkine Add support for NV_EXTENSIONS in #pragma shader_stage()
2018-11-19 dj2 Build file updates. (#514)
2018-11-15 dj2 Fixup shadowed variables (#513)
2018-10-11 dneto Unpin googletest. It has been fixed upstream
2018-11-13 dj2 Add effcee and re2 when building spirv-tools tests (#510)
2018-10-24 dj2 Only include third_party directories if needed. (#507)

Created with:
  roll-dep third_party/shaderc

TBR=kainino@chromium.org
BUG=dawn:29

Change-Id: I30df4fe9423465d5db135874f6dec2687391e505
Reviewed-on: https://dawn-review.googlesource.com/c/4160
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-24 19:52:46 +00:00
Yunchao He c0f31e73e4 Use const*const* to annotate a sequence of descriptors
BUG=dawn:77

Change-Id: I2a523e54a06173c157730e043c25e9629887fd1f
Reviewed-on: https://dawn-review.googlesource.com/c/3820
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-21 08:29:01 +00:00
Jiawei Shao 850c0d9aec Fix a bug in computing bind group index in GroupsInheritUpTo()
This patch fixes a crash issue on D3D12 backends that are caused by
a bug in computing bind group index in function GroupsInheritUpTo().
The return value of this function should be kMaxBindGroups instead of
(kMaxBindGroups + 1) as the maximum number of bind group sets is
kMaxBindGroups.

This patch also adds a regression test on this bug.

BUG=dawn:78
TEST=dawn_end2end_tests

Change-Id: Ie060a52f987803ed6a325b337ff678e6b73e2897
Reviewed-on: https://dawn-review.googlesource.com/c/4080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-18 04:41:20 +00:00
Brandon Jones 799cddcb83 Trigger GC Sweeps on Vulkan
Vulkan backend wasn't making a call to Tick(), meaning that
vkDestroy* operations were being enqueued, but never executed.

Change-Id: I597f59d6a17ea4247a1a042a2b5a7997d2e95612
Bug: dawn:94
Reviewed-on: https://dawn-review.googlesource.com/c/4020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2019-01-17 00:15:14 +00:00
Yunchao He 63b59cfdf3 Remove annoying warnings in dawn_unittests
There are a lot of annoying warnings about uninteresting mock
function calls when running dawn_unittests because object release
function calls are not included into the gtest EXPECT_CALL.

BUG=dawn:93

Change-Id: I49f772bc1b9da9eaa86a51ca3a754886e8f0bcdc
Reviewed-on: https://dawn-review.googlesource.com/c/3960
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-16 23:56:16 +00:00
Austin Eng acd8b7d937 Separate WireClient.cpp into multiple files.
This patch copies methods and classes from WireClient.cpp and
distributes them over multiple files. Headers and forward declarations
are added as necessary, but no logical changes are made.

Bug: dawn:88
Change-Id: I9d0fcaeb67e789c3ad0597eaa3839adefc3ac5f9
Reviewed-on: https://dawn-review.googlesource.com/c/3980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-01-16 02:18:06 +00:00
Austin Eng c7f416c0c9 Add wire_cmd.py and dawn_wire.json to autogenerate all wire commands.
Unify code generation for Client->Server and Server->Client commands.
Methods in dawn.json are converted into command records and additional
commands are specified in dawn_wire.json. This can then be used to
completely generate the command handlers and command struct definitions.

Bug: dawn:88
Change-Id: Ic796796ede0aafe02e14f1f96790324dad92f4c0
Reviewed-on: https://dawn-review.googlesource.com/c/3800
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-15 20:49:53 +00:00
Austin Eng a483fac90d d3d12: Lazily apply IASetVertexBuffers before draw
This fixes a bug where D3D12 SetVertexBuffers was using the input info
from the last set pipeline's InputState. IASetVertexBuffers needs to be
reapplied if the input state changes.

Bug: dawn:91
Change-Id: I7d0b308ea20cee6d595f6b29548f57d82c8e47a4
Reviewed-on: https://dawn-review.googlesource.com/c/3860
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-15 04:10:48 +00:00
Corentin Wallez 1a99f42c7d WireServer: Wrap userdata in unique_ptr in callbacks
This fixes a leak that was introduced in
https://dawn-review.googlesource.com/c/dawn/+/3622 where the early
return doesn't delete the userdata.

BUG=chromium:921360

Change-Id: I500dd2b4fa02121e5c0278c5f6f83a30861815e4
Reviewed-on: https://dawn-review.googlesource.com/c/3942
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-01-14 18:41:13 +00:00
Corentin Wallez 03f64292ad dawn_features.gni: add an option to complete static libraries
This is useful for people using Dawn's standalone build to compile
static libraries to use in other projects. Without this static libraries
will act as source sets as is GN's default.

BUG=dawn:85

Change-Id: I4d99cbbbe67c73f226717651cb12ed0a172409b2
Reviewed-on: https://dawn-review.googlesource.com/c/3840
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-12 17:26:49 +00:00
Raul Tambre 392b4a95c6 Fix missing include for std::unique_ptr in NullBinding.cpp
Bug: dawn:92
Change-Id: I9e179bfc7afb92c42d4111676a1c852d6eeae5cb
Reviewed-on: https://dawn-review.googlesource.com/c/3920
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-12 17:13:45 +00:00
Corentin Wallez ec18f9683c Gather PCI device info through the adapter when possible
This will help migrate PCI info collection from the device to the
adapter where it belongs.

BUG=dawn:29

Change-Id: Ifa7d167249c97f1934f7c10d420f864f59babd37
Reviewed-on: https://dawn-review.googlesource.com/c/3843
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-10 10:50:54 +00:00
Corentin Wallez 7aae840a22 Add missing ToBackend implementation for Adapter
BUG=dawn:29

Change-Id: I00926dd201c7a8f24d769078540c75c25f210515
Reviewed-on: https://dawn-review.googlesource.com/c/3842
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-10 10:12:24 +00:00
Corentin Wallez 0d03b09623 Remove non-adapter way to create null devices
BUG=dawn:29

Change-Id: I2153aa30afd096a3f27c8b8b2ba23a10c0ade50a
Reviewed-on: https://dawn-review.googlesource.com/c/3841
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-10 10:07:04 +00:00
Corentin Wallez bd48385d50 Add static library versions of libdawn*
Chromium will want to have both static and shared library versions of
Dawn to use in non-component and component builds respectively.

The *_export.h files are modified to noop when *_SHARED_LIBRARY is not
defined so that the static library doesn't export symbols that aren't
imported in dependents (this would break compilation on Windows).

A dawn_library_combo is introduced in BUILD.gn that factors out all the
logic needed to produce shared libraries and handle the _EXPORT macros.

Also contains a fix to dawncpp to export only the methods that aren't
defined in the header (otherwise they get defined multiple times)

BUG=dawn:85

Change-Id: Ib747deb9308e1165dd66002487147ba279d3eac0
Reviewed-on: https://dawn-review.googlesource.com/c/3761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-09 09:05:18 +00:00
Corentin Wallez 97d2a71684 dawn_native: define exported functions in their own files.
This adds a new FooBackend.cpp file for each backend that defines
exactly the symbols that are exported by libdawn_native's headers. THis
will allow factoring most of the compilation of dawn_native between the
shared and static library variants.

BUG=dawn:85

Change-Id: I69c808dac2fe5e8bb08356117e3997677787b08a
Reviewed-on: https://dawn-review.googlesource.com/c/3760
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-09 08:35:16 +00:00
Austin Eng 5236eb2057 Specialize WireServer objects
This removes unnecessary builder and buffer info from server objects that
do not need them.

Bug: dawn:86
Change-Id: I97b11615da763725281495f05c70a4ee7a9c9e5a
Reviewed-on: https://dawn-review.googlesource.com/c/3780
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-08 17:58:38 +00:00
Kai Ninomiya 17be9deed6 Fix samples on null backend (add swapchain impl)
BUG=
Change-Id: I96e6c58b4ec46af58f7c0a97c88308075efe68dd
Reviewed-on: https://dawn-review.googlesource.com/c/3700
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-07 19:54:36 +00:00
Austin Eng 9dc1250d3e Use single DestroyObject command in the wire
Bug: dawn:83
Change-Id: Ic875d5111f59e7166d2decb3dc6a84973d9babdf
Reviewed-on: https://dawn-review.googlesource.com/c/3680
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-07 17:52:56 +00:00
Corentin Wallez 7c0f0fbf91 Vulkan: Always request all VkSurfaceKHR-related extensions
The backend had a "requiredInstanceExtensions" parameter to device
creation so that we could request the right instance extensions to
support swapchains. When we have dawn_native::Instance we don't want to
require this information before we can use the Vulkan backend. Instead
we make the backend always require all VkSurfaceKHR extensions. This
should be safe because these extensions basically enable copying a
struct into an opaque VkSurfaceKHR object and not much else.

BUG=dawn:29

Change-Id: I7fc5426f5770b65bb35f02793a1319eb0653782c
Reviewed-on: https://dawn-review.googlesource.com/c/3662
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 12:04:46 +00:00
Corentin Wallez 95fd2821c2 MetalBinding: query the MTLDevice instead of creating it.
With adapters the Metal backend will be in charge of creating the
MTLDevice so we remove this responsibility from the bindings.

BUG=dawn:29

Change-Id: Id7b9e5f6249963e2b87a91242a18119ba8d11c13
Reviewed-on: https://dawn-review.googlesource.com/c/3661
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 10:01:11 +00:00
Corentin Wallez 9506d53938 Remove unused SwapChainImplVulkan
BUG=dawn:29

Change-Id: Ic36bdd83b2351e3ef9d6825dee64469405e840a3
Reviewed-on: https://dawn-review.googlesource.com/c/3660
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 09:56:51 +00:00
Corentin Wallez 90e594ee8b OpenGL: Implement the backend connection and adapter.
The OpenGL backend can't gather discover default adapters because it
needs getProc to do anything so we add DiscoverAdapters method to
Instance that takes backend-specific options.

dawn_native::opengl::CreateDevice is removed in favor of the adapter
path so OpenGLBinding is modified to create an instance locally. This is
only temporary until all backends support adapters, at which point a lot
of *Binding code will be factored.

Also contains a small fix for Result<T, E> with movable types.

BUG=dawn:29

Change-Id: I4eb3d4a14a871af73e1872132aff72b45e5fe566
Reviewed-on: https://dawn-review.googlesource.com/c/3663
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-07 09:48:03 +00:00
Raul Tambre ab8eb2d6ed Fix missing include for unique_ptr in BackendConnection.h
Bug: dawn:84
Change-Id: I8a878c02fdee777e6a7aeb7fabde8ffbf8eafb0e
Reviewed-on: https://dawn-review.googlesource.com/c/3740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 09:34:20 +00:00
Corentin Wallez 110bc7918f Validate EndPass isn't called more than once.
BUG=chromium:918254

Change-Id: I24db2f459bae7c0644a54472e56159ff8f5ab955
Reviewed-on: https://dawn-review.googlesource.com/c/3621
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 12:01:44 +00:00
Corentin Wallez ac67fec1c9 dawn_native: Add Instance and Adapters
New objects are introduced to control what happens before device
creation in dawn_native:
 - Instance: a connection from the application to dawn_native that is
used for dependency injection and to discover adapters.
 - Adapters: represents the possibility of device creation for a specific
(GPU, backend) pair.
 - BackendConnection: an internal object that standardizes the interface
between the frontend and backends.

The BackendConnection interface is implemented for the Null backend and
stubbed out in other backends. This allows this change to port the
ValidationTests to use the new Instance and Adapters concept and deal
with other backends later.

BUG=dawn:29

Change-Id: I19719a9342b4af091accc0c02fb6b9697eadde7b
Reviewed-on: https://dawn-review.googlesource.com/c/3500
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 10:30:40 +00:00
Corentin Wallez e9212dfe30 Vulkan: Print the VkResult value on device creation failure.
This adds a CheckVkSuccess utility function that adds the VkResult value
to the context lost error message.

Also adds a small fix to dawn_native/Error.h interoperability between
MaybeError and ResultOrError<NonPointer> with tests.

BUG=chromium:917555
BUG=dawn:79

Change-Id: Icc01122d62d83693fc0ea3f26b272f2372fd3087
Reviewed-on: https://dawn-review.googlesource.com/c/3623
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-04 10:18:40 +00:00
Corentin Wallez 1e37db5350 WireServer: check buffer exists before sending the map callback
The client might have asked for the buffer to be destroyed, but the
reference to the buffer is still alive because it is internally
referenced by Dawn.

BUG=chromium:918254

Change-Id: Id7d2de891eba98e3cf15e77730f66f64d9a3b9f9
Reviewed-on: https://dawn-review.googlesource.com/c/3622
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 09:54:40 +00:00
Corentin Wallez a19c759bc4 WireCmd: guard against overflows when computing array sizes
BUG=chromium:918094
BUG=chromium:918348
BUG=chromium:918260

Change-Id: Ia2ee8930592e436e8d0d76837b70e726e8d87ea7
Reviewed-on: https://dawn-review.googlesource.com/c/3620
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 09:54:10 +00:00
Yunchao He 6e308846c2 Unify the compare function for sampler and depth stencil
Both sampler and depth stencil include compare function, and we
need to change it to appropriate functions for different backends.
In order to avoid code duplication, we put it into a util file
for every backend, then include that file and call the function
from where we need it.

We can put similar functions which can be shared among different
objects into the util file in future.

Shaobo's patch has already created such a util function for compare
function for sampler. This patch removes the duplicated compare
function in RenderPipeline for depth stencil descriptor, and call
the function in util file instead.

BUG=dawn:31, dawn:47

Change-Id: Ia645b48e026b5a372d1023aa7e8ecdf1e4ed7c6d
Reviewed-on: https://dawn-review.googlesource.com/c/3641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 09:53:50 +00:00
Yan, Shaobo 93158ebede Complete the sampler object to match WebGPU
WebGPUSampler is much more complete than Dawn's Sampler.
This patch implement the missing part.

BUG=dawn:47

Change-Id: Ief45cb9710493e9d79ddab60fe3be5a123b76ebd
Reviewed-on: https://dawn-review.googlesource.com/c/3540
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-04 04:56:08 +00:00
Yunchao He ea56333c1e Replace DepthStencilState builder via DepthStencilState descriptor.
This change also removes DepthStencilState object.

Bug=dawn:31

Change-Id: I7bb54ef4da527184bb2726c77d93d411d44c3956
Reviewed-on: https://dawn-review.googlesource.com/c/3541
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-01-04 04:28:37 +00:00
Corentin Wallez 0b364067d0 MetalBackend.h: Remove dead declarations
BUG=

Change-Id: Iaa19701a9fd0299db027917f7053fc50e18c6bf8
Reviewed-on: https://dawn-review.googlesource.com/c/3340
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-03 17:59:08 +00:00
Yunchao He 74ec15010f Assigning nullptr to descriptor's nextInChain in C++ is unneeded
It has already been initialized to nullptr by C++ autogen code.

BUG=dawn:82

Change-Id: I2c1cad003a7a12227cb3d17a90e12c16739ee9a0
Reviewed-on: https://dawn-review.googlesource.com/c/3600
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-03 10:33:55 +00:00
Yunchao He 2b9d702c09 Fix a bug for depth test on Vulkan backend
The default value for maxDepthBound should be 1.0.

BUG=dawn:81

Change-Id: I337aac884456c739222bc31f8003267aa6de96af
Reviewed-on: https://dawn-review.googlesource.com/c/3580
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-01-03 09:00:34 +00:00
Jiawei Shao d238bb67a5 Support using a layer of a texture as a color attachment on OpenGL
This patch implements using a layer of a texture as a color attachment
on OpenGL by using glFramebufferTextureLayer. As WebGPU won't support
rendering into a texture view whose format is different from the
original texture, it is correct to use glFramebufferTexture on the
OpenGL backends.

BUG=dawn:16

Change-Id: Iab6d905ee119bb9bb2d1bb212134cf757483c4d4
Reviewed-on: https://dawn-review.googlesource.com/c/3560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-01-03 00:07:44 +00:00
Jiawei Shao 5dee56f39c Fix crash when creating texture view on textures from Metal swap chain
For the textures got from Metal swap chain, their "framebufferOnly" may
be true, which means they can only be used as attachments in a render
pass, and they are not allowed to be used in MTLRenderCommandEncoder,
MTLBlitCommandEncoder or MTLComputeCommandEncoder. So currently Dawn
examples all crash when METAL_DEVICE_WRAPPER_TYPE = 1 is set into
environmental variables.

This patch adds checks on the situations that we do not need to create
a Metal texture view:
1. We create Metal texture only when the usage of the texture includes
   Sampled or Storage.
2. We won't create Metal texture view if the view uses the same format
   as the original texture, the whole mipmap levels and array slices.
3. We use the original MTLTexture and set the slice and level in
   MTLRenderPassDescriptor.

Furthermore, with this patch, "setFramebufferOnly" is set to true only
when the usage passed to configure is a subset of (OutputAttachment |
Present).

BUG=dawn:69

Change-Id: Ie2670f383c16eafa3b1c6f99126922e940721174
Reviewed-on: https://dawn-review.googlesource.com/c/3400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-12-29 10:47:28 +00:00
Yunchao He 92700bfccd Replace BlendState builder via BlendState descriptor.
This change also removes BlendState object.

Bug=dawn:32

Change-Id: I8bf4ff7531e7504efb17b6bae3ca01f1f2b4131e
Reviewed-on: https://dawn-review.googlesource.com/c/3042
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2018-12-27 06:32:31 +00:00
Kai Ninomiya cb71ba7b3a Don't use ConsumedError on device initialization errors
If there's an error during device initialization, it's too early to use
ConsumedError (SetErrorCallback can't possibly have been called).
In this case, manually handle the error from initialization.

This will help us diagnose issue chromium:917555, where device
initialization is failing but the error is not printed.

TBR: cwallez@chromium.org
Bug: chromium:917555
Change-Id: I63ba3983688f508550afe2815ca1dda36130fed1
Reviewed-on: https://dawn-review.googlesource.com/c/3520
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2018-12-22 05:40:11 +00:00
Yan, Shaobo 300eec0f82 Rename SetRenderPipeline and SetComputePipeline to SetPipeline
To match the WebGPU idl, SetRenderPipeline and SetComputePipeline need to change
the name to SetPipeline.

This patch just rename these two APIs

BUG=dawn:52

Change-Id: I2545c94158ebd051027a018650bf760a25845d73
Reviewed-on: https://dawn-review.googlesource.com/c/3480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2018-12-21 10:40:26 +00:00
Yan, Shaobo 21ed12045b Guard header files in utils with #ifdef and #endif
Some header files in utils missing #ifdef and #endif and this caused including
header files multiple times.

This patch fix it.

BUG=dawn:72

Change-Id: Ib28b1a1cef91e49a5754ec6b3d66327076070d99
Reviewed-on: https://dawn-review.googlesource.com/c/3461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-12-20 11:21:04 +00:00
Yan, Shaobo c8bf89ddf0 Remove "Builders" related with pipeline
RenderPipeline and ComputePipeline has been created with descriptors and PipelineBuilder
is not needed anymore.

This patch remove these remain "Builders" in dawn.

BUG=dawn:52

Change-Id: I8b119c540952beb3386913197f25b9c441f53ba4
Reviewed-on: https://dawn-review.googlesource.com/c/3460
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-12-20 11:00:32 +00:00
Corentin Wallez 2745f37875 Suppress more failure on GPU FYI Linux AMD Release (R7 240)
Tests are run in this order: 1, 2, 3

After suppressing test 2, test 3 started failing on the builder, this
seems to point out that test 1 is leaving the driver in a bad state.

We add suppressions both 1 and 3 just to be safe.

TBR=senorblanco@chromium.org
BUG=chromium:915430

Change-Id: Ie601b03f9e5038c623d8b7e009d2a9fb8086d181
Reviewed-on: https://dawn-review.googlesource.com/c/3420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-12-19 13:36:53 +00:00
Jiawei Shao 5e811aeee5 Add render pass color and depth stencil attachment descriptor
This patch is the first one of the descriptorization of render pass. In
this patch we add support of RenderPassColorAttachmentDescriptor
and RenderPassDepthStencilAttachmentDescriptor to
RenderPassDescriptorBuilder.

This patch also adds StoreOp to render pass color and depth stencil
attachment descriptor.

RenderPassDescriptorBuilder will be completely removed in the next
patch.

BUG=dawn:6, dawn:49
TEST=dawn_end2end_tests, dawn_unittests

Change-Id: If623b41d04016425efa53932ae1648daf2263675
Reviewed-on: https://dawn-review.googlesource.com/c/3300
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2018-12-19 08:21:13 +00:00