61 Commits

Author SHA1 Message Date
Corentin Wallez
9fc65344f4 Rename NXT -> Dawn in the comments 2018-07-18 22:54:06 +02:00
Corentin Wallez
226110f958 Rename nxt:: to dawn:: in the backends 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
Corentin Wallez
47fe5c52b5 CommandBufferGL: Iterate per pass 2018-07-10 10:59:44 +02:00
Corentin Wallez
77d1f10493 OpenGL: Split OpenGLBackend in Forward.h and DeviceGL 2018-06-19 13:51:26 -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
51f9987298 Update CommandBufferGL.cpp 2018-04-16 15:31:02 -04:00
Corentin Wallez
9ce29d1104 Fixup comment 2018-04-16 15:31:02 -04:00
Stephen White
ac49ed0779 Use a memcpy to avoid strict-aliasing warnings. 2018-04-16 15:31:02 -04:00
Stephen White
6d90e01858 Expand allowable formats for color attachments.
Don't assert on color formats which can be cleared with a
floating-point clear value.
So far, these are { unorm } x { r, rg, rgba, bgra }.
Fix linter error when no files to check.
2018-04-13 11:53:12 -04:00
Stephen White
8c231b6990 Fix a DrawElements bug in the Metal backend.
The indexOffset of the draw was not being used. It must be
included in the indexBufferOffset.
Renamed indexBufferOffset -> indexBufferBaseOffset.
Add a DrawElements test which exercises zero and non-zero index offsets.
2018-04-12 10:32:33 -04:00
Stephen White
10a659ad91 Implement support for all Int32 vertex formats. (#179) 2018-04-10 14:35:17 -04:00
Stephen White
ee66f25c4f Add support for R16G16B16A16 ushort.
Also implement both new formats in Vulkan.
2018-04-10 11:37:35 -04:00
Stephen White
0b1fbd9322 Add support for ushort2 vertex format.
Also fix some vertex format computations.
2018-04-10 11:37:35 -04:00
Stephen White
8d742d1375 Implement unorm_rgba8 and unorm_rg8 vertex formats.
Backend support implemented in GL, Metal and D3D12.
Support for unorm values in the GL backend requires a
utility function to indicate if the format's components
are normalized.

Note that unorm_r8 is only supported on more recent MacOS SDKs (10.13),
so it's omitted for now.
2018-04-09 11:25:31 -04:00
Corentin Wallez
a3c89cc27a Add and Implement CommandBuffer::SetScissorRect 2018-03-02 14:22:50 -05:00
Corentin Wallez
c7807abf04 Format: src/backend/opengl 2017-11-28 16:18:39 -05:00
Corentin Wallez
7ee1610f38 Member rename: src/backend/opengl 2017-11-23 17:04:10 -05:00
Corentin Wallez
33f7bfe322 OpenGL: Apply vertex/index buffers just before draw.
Previously we would modify the GL state as soon as we saw
SetIndex/VertexBuffers. This GL state is owned by the VAOs in the
InputState and was disappearing on a Pipeline change. Fix this by
applying the index / vertex buffers lazily.
2017-11-21 17:34:16 -05:00
Corentin Wallez
405dcd636a Make the index format part of the pipeline state. 2017-11-20 09:59:03 -05:00
Corentin Wallez
1b6f7535aa OpenGL: Reset viewport to FB size at each subpass 2017-08-23 09:49:35 -04:00
Corentin Wallez
a214b7f12d OpenGL: Fix push constants disappearing on pipeline change 2017-08-23 09:49:35 -04:00
Kai Ninomiya
afa45a9176 Add tests for clears, render passes, framebuffers (#107)
* Add tests for clears, render passes, framebuffers

* Test load with a draw in it
2017-08-14 16:32:26 -07:00
Kai Ninomiya
b985431c82 Load operations (#105)
* load ops: design + implementation (all backends)

* Animometer/glTFViewer: use just one subpass per frame
2017-08-11 14:36:20 -07:00
Austin Eng
12a00ba3d1 Reset blend color to (0,0,0,0) at the start of render subpass 2017-08-07 18:51:48 -04:00
Austin Eng
3a8f48504d opengl: Fix multiple render target setup with glDrawBuffers 2017-08-07 18:51:48 -04:00
Austin Eng
8dc3bd1808 opengl: Implement blend state 2017-08-07 18:51:48 -04:00
Austin Eng
fb4265387c Add SetBlendColor command 2017-08-07 18:51:48 -04:00
Kai Ninomiya
c16a67ae52 Swap chains, part 2 (#94) 2017-07-27 18:30:57 -07:00
Austin Eng
d81fd82bde Implement primitive topology in OpenGL, Metal, and D3D12 backends 2017-07-27 10:19:30 -04: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
c8377da79b Validate SetPushConstants is done inside subpass and compute passes 2017-07-20 16:33:02 -04:00
Austin Eng
33560ef015 Implement backend texture->buffer and buffer->texture copies with row pitch 2017-07-17 17:16:45 -04:00
Corentin Wallez
b085eecb31 Split Pipeline in Render and Compute, OpenGL part 2017-07-17 15:25:16 -04:00
Corentin Wallez
23620b0dc7 OpenGL: Implement T->B copies
Also enable the basic end2end tests that are now passing.
InputStateTests isn't passing yet, for some reason the ReadPixels
returns pure black.
2017-07-17 13:48:17 -04:00
Corentin Wallez
9d4b9ab313 OpenGL: move buffer to its own file 2017-07-17 13:48:17 -04:00
Kai Ninomiya
fec8c58a97 Add depth-stencil textures and attachments (#77)
Related: #29
2017-07-17 12:03:16 -04:00
Kai Ninomiya
e66fcd8b0e OpenGL backend: implement render passes (#73)
Probably not the most efficient implementation, but works.

Issues:

* Doesn't seem to render until the second frame. No clue why, yet.
* Hardcoded 640x480 in more places.
* Creates new FBOs for every subpass every frame. Should be done at Framebuffer build or CommandBuffer build time.
2017-07-11 17:49:20 -07:00
Corentin Wallez
83e779d8f2 Fix all Windows warnings 2017-07-11 13:59:15 -04:00
Corentin Wallez
96acaef95e Fix MSVC warnings on enum class switches 2017-07-11 13:59:15 -04:00
Corentin Wallez
98c90d4faa Fix clang/GCC warnings 2017-07-10 19:35:21 -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
fffe6dfa16 Split backend/common in backend/ and common/
This directory used to contain both the state tracking code for the
backends, and the common utilities that could be used both by the
backends and the rest of the code. Things are now:

 - src/common is utility code for the whole repo
 - src/backend contains libNXT's code
 - src/utils is utility code that we don't want in libNXT

This commit also changes all includes to use global paths from src/
bacause it had to touch a bunch of #include statements anyway.
2017-07-06 17:54:52 -04:00
Corentin Wallez
2dd73fbc1d Remove unnecessary Device forwarding. 2017-07-06 16:30:20 -04:00
Corentin Wallez
8859178703 Add nxt::VertexFormat::FloatR32 2017-07-06 11:34:31 -04:00
Corentin Wallez
e9d347e89e Add T->B copies.
This implements T->B copies on the Metal backend only and while it adds
validation tests, end2end tests will be done in a follow-up commit.
2017-06-27 13:25:42 -04:00
Corentin Wallez
b6d52b4ad1 Refactor copy validation to add helper functions useful for T->B too.
Also fixes validation not taking the mip-level into account when
checking if the copy would fit in the texture.
2017-06-27 13:25:42 -04:00