56 Commits

Author SHA1 Message Date
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
cce6b01b6d Remove dual source blending
It is not supported on many mobile GPUS on Vulkan
http://vulkan.gpuinfo.org/listreports.php?feature=dualSrcBlend&option=not
and is optional on Metal
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
Austin Eng
94bebe517d Add BlendState to NXT API 2017-08-07 18:51:48 -04:00
Kai Ninomiya
4526368263 Remove outdated backbuffer hack + reduce GL version to 4.4 (#100) 2017-07-31 11:25:06 -07:00
Kai Ninomiya
c16a67ae52 Swap chains, part 2 (#94) 2017-07-27 18:30:57 -07:00
Austin Eng
439d963ccd Point,Line,Triangle -> PointList,LineList,TriangleList 2017-07-27 10:19:30 -04:00
Austin Eng
d81fd82bde Implement primitive topology in OpenGL, Metal, and D3D12 backends 2017-07-27 10:19:30 -04:00
Austin Eng
ccf1fa2330 Remove DepthTestEnabled() and fix depth writes for depth function Always 2017-07-25 10:16:08 -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
Kai Ninomiya
35bf424035 Swap chains, part 1 (#87)
Adds the swap chain interfaces to the API without changing the behavior
of anything else. This includes the C APIs for applications to provide
swap chain implementations. Also adds stub implementations on every
backend.
2017-07-19 15:41:17 -07: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
0f9f747c8a OpenGL: implement a synchronous MapReadAsync
Mapping OpenGL buffers persistently and unsynchronized isn't supported
on OSX's OpenGL version where we want to run tests.
2017-07-17 13:48:17 -04:00
Corentin Wallez
dab0638177 Fix using NXT_PLATFORM without including Platform.h 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
Corentin Wallez
0b186b1fda Use feature detection macros everywhere 2017-07-13 14:55:23 -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
8fca4a21b7 Use UNREACHABLE in more places 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
Austin Eng
f9c39d021e Add device reference counting 2017-07-10 16:45:28 -04: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
Corentin Wallez
0ba5550874 Metal: split non-trivial objects in their own file.
No functional changes intended, but there are a couple additional
cleanups:
 - Use anonymous namespaces instead of static functions
 - Don't store an extra Device pointer in objects
2017-06-22 09:56:30 -07:00
Corentin Wallez
dbb5729e64 Add Device::Tick for periodic work 2017-06-15 13:27:50 -07:00
Austin Eng
459537491b Refactor TransitionUsage to use abstract TransitionUsageImpl 2017-06-14 13:53:52 -04:00
Corentin Wallez
d84d107076 Add buffer to buffer copies 2017-06-13 13:15:30 -07:00
Corentin Wallez
c863b1c26f ToBackend: Add support for Device 2017-06-13 08:30:01 -07:00
Corentin Wallez
b1c19eeb4f Add Buffer::MapReadAsync state-tracking 2017-06-13 08:30:01 -07:00
Corentin Wallez
72725eebf9 CommandBufferGL: Advance iterator for unimplemented commands 2017-06-06 10:03:46 -07:00
Corentin Wallez
001c2ea98f Fix some nits from depth-stencil PR 2017-06-05 14:43:06 -07:00
Austin Eng
58c76b3fe4 Simplify PersistentPipelineState and application of stencil states. Fix
stencil mask usage. D3D12 does not support separate front/back masks.
All APIs support separate read/write masks.
2017-06-02 12:13:39 -07:00
Austin Eng
1063439d5d Refactor DepthStencilState. TODO: add validation tests
- defaults to depth and stencil tests off
- whether or not depth and stencil tests are enabled is inferred from the comparison functions and stencil operations
- only one stencil reference. D3D12 does not support separate references
- change SetDepthWriteMode to SetDepthWriteEnabled and use a bool instead of enum
- Create PersistentPipelineState class for OpenGL backend with simple state tracking
- Add validation so DepthStencilState properties are only set once
- Update API usage in HelloDepthStencil
- refactor tracking of the DepthStencilState in the Metal backend
- validate that compute pipeline does not have a depth stencil state
2017-06-02 12:13:39 -07:00
Austin Eng
f51be34864 Use explicit front and back stencil state.
Previously stencil states were stored in array. This commit changes the
DepthStencilState to explicitly store a front and back stencil.
2017-06-02 12:13:39 -07:00
Austin Eng
376f1c6a8e fix formatting 2017-06-02 12:13:39 -07:00
Austin Eng
084346bd5f Fix OpenGL stencil clear hack. Improve example stencil reflection 2017-06-02 12:13:39 -07:00