Commit Graph

36 Commits

Author SHA1 Message Date
Corentin Wallez aa7109c148 Add copy constructors to the C++ Dawn interface
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>
2018-10-25 10:42:49 +00:00
Corentin Wallez 82fbccbd78 Introduce [Render|Compute]PassEncoder.
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>
2018-09-21 00:24:37 +00:00
Corentin Wallez 8e335a5585 Descriptorize ComputePipeline
Change-Id: Ic9d7014ba44d927d7f9ddf81a8870432c68941e8
2018-09-05 08:32:53 -04:00
Corentin Wallez 82b6573d54 Descriptorize Buffer
We still keep a dummy BufferBuilder object around so that it can be used
for the builder error callback tests of the wire.

Change-Id: If0c502bb8b62ee3ed61815e34e9b6ee6c03a65ef
2018-08-23 08:23:06 -04:00
Corentin Wallez f35eff3fde Remove BindGroupBuilder::SetUsage
BindGroup usage isn't something that's part of WebGPU's sketch.idl and
it might never exist. Remove it to simplify the migration of bindgroup
to descriptor.

Change-Id: I21e0a98eb60434d4009e748cd9afcbf89edd7e6a
2018-08-21 02:27:12 -04:00
Corentin Wallez 39039fa317 Rename CreateCppNXTDevice to CreateCppDawnDevice 2018-07-18 22:54:06 +02:00
Corentin Wallez f684040e0a Rename NXTHelpers to DawnHelpers 2018-07-18 22:54:06 +02:00
Corentin Wallez 4828d92df3 Rename nxt:: to dawn:: in examples 2018-07-18 22:54:06 +02:00
Corentin Wallez 4a9ef4ee21 Rename the copyright authors from NXT to Dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez d8c068fb4f Remove explicit usage transition from the API and validation
This removes the following for both Buffer and Texture:
 - The builder's SetInitialUsage
 - The object's FreezeUsage and TransitionUsage methods
 - The CommandBuffer Transition<Object>Usage methods

All samples and tests are simplified as a result. This also obsoletes
the UsageValidationTest which is removed.

Some validation was dependent on "current usage" and hasn't been
reintroduced for implicit transitions yet:
 - Buffers can be used while mapped
 - Swapchain textures can be used after they have been presented.

Validation for these will involve collecting all the resources used by a
command buffer and will be done in a follow-up patch.
2018-07-16 14:44:20 +02:00
Kai Ninomiya 234becf175
Use a descriptor for BindGroupLayout (#211)
* Use a descriptor for BindGroupLayout
* Fix MatchesLambda
* Add WireTests.StructureOfStructureArrayArgument
* Add BindGroupValidationTests.BindGroupLayoutCache
2018-07-10 12:23:50 -07:00
Kai Ninomiya 7883e7e59c
Fix ComputeBoids (#214)
I know there was some churn on which version of this shader was correct - but right now, this goes from broken on all 4 backends to working on all 4 backends. So this seems better.

The old code (accidentally?) uses descriptor arrays (I think), which are not trivial to support on all backends, so we won't use them for now.
2018-07-10 11:01:28 -07:00
Kai Ninomiya f53f98bf86
Use a descriptor for PipelineLayout (#206)
Adds support for structures inside descriptors.
2018-06-27 16:21:39 -07:00
Corentin Wallez b703def640 Add Device::CreateQueue() instead of the builder
We are changing all object creation to use descriptors but there is no
creation argument to pass for queue, so instead Device::CreateQueue
takes no argument.
2018-06-18 13:33:40 -04:00
Corentin Wallez 8d6b5d2337 Rename RenderPassInfo to RenderPassDescriptor 2018-05-16 11:18:14 -04:00
Corentin Wallez 6f7749cce9 Change render passes from multi to single pass.
This as an API change to get closer to the direction in which WebGPU is
headed. The API change in next.json caused a ton of files to be changed
in the same commit to keep things compiling.

API: the Framebuffer and RenderPass objects are now merged in a single
RenderPassInfo that contains the attachments, loadOps and clear values
for a BeginRenderPass command. The concept of subpass is removed.
The RenderPass creation argument to RenderPipelines is replaced by
explicitly setting the format of attachments for RenderPipeline.

Validation: SetPipeline checks are changed to check that the attachments
info set on a RenderPipeline matches the attachments of the render pass.

Backends: Most changes are simplifications of the backends that no
longer require and indirection to query the current subpass out of the
render pass in BeginSubpass, and don't need to get the attachment info
from a RenderPass when creating RenderPipelines. In the Vulkan backend,
a VkRenderPass cache is added to reuse VkRenderPasses between
RenderPassInfos and RenderPipelines.

Tests and examples: they are updated with the simplified API. Tests
specific to the Framebuffer and RenderPass objects were removed and
validation tests for RenderPassInfo were added.

Tested by running CppHelloTriangle on all backends, end2end tests on all
platforms and all examples on the GL backend.
2018-05-16 11:18:14 -04:00
Stephen White e5ae3274a3 Make SetSubData take size in uint8_t not uint32_t.
Also change data pointer to uint8_t*.
Add a test for a non-aligned SetSubData().
Implemented on all backends.
2018-04-10 14:34:24 -04:00
Corentin Wallez b6fb5f3149 Roll shaderc 2017-12-12 01:02:35 -05:00
Corentin Wallez 2e31e8f0bf Make binding expose the preferred format 2017-11-20 09:59:03 -05:00
Kai Ninomiya 921fb5e1ce remove initialUsage from SwapChain::Configure 2017-09-15 14:02:02 -07:00
Kai Ninomiya ee7b6b1b62 Update SwapChain to configure texture usage
Explicitly configure swap chain usage in bindings and examples

Fix missing case in switch

Make swap chain Present usage implicit

Author: Austin Eng <enga@google.com>
2017-09-15 14:02:02 -07:00
Austin Eng dc6bb4a16c Update ComputeBoids to use SSBOs as arrays
This is due to restrictions in HLSL. The size of RWStructuredBuffer<T> elements in Shader
Model 5.1 cannot be larger than 2048 bytes so we cannot use a
RWStructuredBuffer<Arr>, where Arr is a struct containing a large array.
2017-08-14 17:39:36 -04:00
Kai Ninomiya c16a67ae52 Swap chains, part 2 (#94) 2017-07-27 18:30:57 -07:00
Kai Ninomiya 78c8b837ea clang/gcc: enable a bunch more warnings (#91)
* clang/gcc: enable -pedantic warnings

* suppress a GCC-specific warning in stb_image

* And some clang-specific warnings

* -Wconversion (clang) -Wold-style-cast (clang+gcc)

and fix a few warnings that show up with these (and a few more with
-Wconversion on gcc, even though that's not enabled by default)

* bunch more warnings

* fixes

* remove merge error
2017-07-21 17:00:22 -07:00
Corentin Wallez 134e08005a Move USleep to utils/ 2017-07-18 11:06:54 -04:00
Corentin Wallez 66ff447216 Split Pipeline in Render and Compute, examples part 2017-07-17 15:25:16 -04:00
Corentin Wallez 83e779d8f2 Fix all Windows warnings 2017-07-11 13:59:15 -04:00
Kai Ninomiya 296951df60 Introduce Begin/EndComputePass (#70) 2017-07-10 14:07:24 -07:00
Kai Ninomiya fa37f2239c replace AdvanceSubpass with Begin/EndRenderSubpass
and replace subpassActive with VALIDATION_ASPECT_RENDER_SUBPASS
2017-07-07 11:19:42 -04:00
Corentin Wallez 9347e8fcd1 Rename example/Utils to example/SampleUtils 2017-06-20 07:40:17 -07:00
Corentin Wallez 5ee7afdfbe Split NXT helpers from example/Utils into src/utils
This will make it possible to use them in the test suites
2017-06-20 07:40:17 -07:00
Austin Eng 39c901d3dc Change usage requirements for Buffer::SetSubData to require TransferDst
instead of MapWrite bit
2017-06-14 13:53:52 -04:00
Corentin Wallez f45bdb89c6 Split Mapped usage in MapWrite and MapRead
Also make use of CreateFrozenBufferFromData where possible in the
example to make the renaming easier.
2017-06-09 15:26:26 -07:00
Corentin Wallez 583e9a8f3c Avoid name conflicts between Util and Windows function
GetWindow and SwapBuffers are function of Windows.h and using the same
name causes a compile error.

This commit also changes Util's GetProcTableAndDevice to CreateNXTDevice
because we might need to call NXT procs when creating the C++ device.
2017-05-30 10:48:32 -07:00
Kai Ninomiya 68df8b0a3a Introduce render passes
* First API design (many features missing, including input attachments)
* Metal implementation (no OpenGL yet)
* Render-to-texture demo (a little broken until we have depth buffers)
* Update examples to use render passes
2017-05-22 10:53:19 -07:00
Corentin Wallez f07e3bd4c9 Initial commit of all the NXT integration.
More like squashed history, contributors were:
 - Kai Ninomiya
 - Corentin Wallez
2017-04-20 14:38:20 -04:00