Commit Graph

8189 Commits

Author SHA1 Message Date
Austin Eng cd13691783 Update SPRIV-Cross for HLSL SM5.1 register name support 2017-07-04 14:30:34 -04:00
Austin Eng 036f76f51f D3D12: Refactor bind group descriptor tracking and descriptor heap allocation
Extract descriptor offset computation and CPU descriptor recording to
BindGroupLayout and BindGroup. Refactor descriptor heap allocation to
copy from a large CPU heap to a GPU heap.
2017-07-04 14:30:34 -04:00
Austin Eng aecf0b130e Add D3D12 buffer, texture, and sampler binding 2017-07-04 14:30:34 -04:00
Austin Eng 29477375a6 fix bind group state tracking on pipeline switch 2017-07-04 14:30:34 -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 492cbe4a43 ValidationTests: add B->T copy tests 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 4b4922cdce Allow empty B->T copies
This adds a test that empty copies are valid for B->B copies too. Tests
for B->T will come in a follow up commit.
2017-06-27 13:25:42 -04:00
Corentin Wallez eaae746433 Introduce end2end tests.
This commit adds a test harness that handles instantiating tests on
multiple backends, and have deferred expectations on the content of
resources.
2017-06-22 09:56:30 -07:00
Corentin Wallez ef199c0310 Metal: Implement BufferMapRead 2017-06-22 09:56:30 -07:00
Corentin Wallez 6cb33ef24e Metal: Introduce a proper BufferUploader and PendingCommands
Previously the Metal backend used a manual mutex system to make sure the
BufferSetSubData didn't have data races with reads from the GPU. Replace
this with a non-hacky version
 - Make the Buffer objects allocated on the GPU
 - Make SetSubData use a ResourceUploader that allocates a CPU buffer
   and schedules a CPU->GPU copy.
 - Have a list of pending commands and a finished command serial to
   order operations and track when resource become unused.
2017-06-22 09:56:30 -07: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 702186e169 Add restrictions on usages allowed with MapRead/Write 2017-06-22 09:56:30 -07:00
Corentin Wallez 76707f9ac9 SerialQueue: add const version of the iterators.
Unfortunately you can't template on const-ness in C++ so we have to
duplicate all the iterator code for SerialQueue (that, or introduce very
heavy templating).
2017-06-22 09:56:30 -07:00
Corentin Wallez e64dec7a3d Move Serial declaration to Forward.h
This is a bit ugly but avoids having to include all of SerialQueue.h
just to get this typedef.
2017-06-22 09:56:30 -07:00
Corentin Wallez fbf53ac773 Remove SpirvTest 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
Corentin Wallez 1bd219d8a8 Split BackendBinding from example/Utils into src/utils
This will make it possible to reuse the backend bindings for test suites
2017-06-20 07:40:17 -07:00
Austin Eng 6aef6833b7 assert vector is nonempty in SerialQueue::Enqueue 2017-06-19 17:32:26 -04:00
Austin Eng e480a0724c add test for SerialQueue::FirstSerial 2017-06-19 17:32:26 -04:00
Austin Eng e44179ae4d Move command list creation to the Device and indirectly reserve command allocators 2017-06-19 15:08:53 -04:00
Austin Eng a4dcde9cf3 forward declare allocator classes 2017-06-19 15:08:53 -04:00
Austin Eng f96ce23628 Add ResourceAllocationManager to create and track lifetimes of d3d12 resources 2017-06-19 15:08:53 -04:00
Austin Eng 78f1619446 Use CommandAllocatorManager to create and track lifetimes of ID3D12CommandAllocators 2017-06-19 15:08:53 -04:00
Austin Eng 2157002570 refactor ResourceUploader to use SerialQueue 2017-06-19 15:08:53 -04:00
Corentin Wallez 38246eb51c Introduce SerialQueue to track in flight resources 2017-06-15 15:37:48 -07:00
Corentin Wallez dbb5729e64 Add Device::Tick for periodic work 2017-06-15 13:27:50 -07:00
Austin Eng b947993e1a Add d3d12 resource uploader to create and manage uploading resource lifetimes 2017-06-14 13:53:52 -04:00
Austin Eng d251356783 D3D12 vertex and index buffers with resource transitions 2017-06-14 13:53:52 -04:00
Austin Eng 459537491b Refactor TransitionUsage to use abstract TransitionUsageImpl 2017-06-14 13:53:52 -04: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 5c92537418 Add validation tests for B2B commands 2017-06-13 13:15:30 -07:00
Corentin Wallez d84d107076 Add buffer to buffer copies 2017-06-13 13:15:30 -07:00
Corentin Wallez 367cb3515c Fix MapRead error callback being called with a valid pointer
This happened when a request resulted in an error while the buffer was
already mapped. Adds a test that catches the error.
2017-06-13 08:30:01 -07:00
Corentin Wallez 68358b5c23 Add Buffer::MapReadAsync validation tests.
This also expands the Buffer validation tests to cover more creation
code paths and SetSubData. It also introduces a mechanism for
ValidationTests to check for device errors.
2017-06-13 08:30:01 -07:00
Corentin Wallez 43bfaae340 Null: implement fake async BufferMapRead
We want to test BufferMapRead validation using the null backend. To get
closer to conditions on a real backend, we call the callback only on the
next Queue::Submit. This is because on real backends, we would have to
wait for the GPU to be finished with the buffer, to be sure the correct
data is read.
2017-06-13 08:30:01 -07:00
Corentin Wallez c863b1c26f ToBackend: Add support for Device 2017-06-13 08:30:01 -07:00
Corentin Wallez eca89c2989 WireTests for buffer read mapping 2017-06-13 08:30:01 -07:00
Corentin Wallez 9388b23212 Implement Buffer::MapReadAsync in the wire 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 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
Kai Ninomiya 613eee30c3 Add validation for some null arguments and dangling render passes
And add tests for both
2017-06-09 12:11:06 -07:00
Austin Eng 2b055c38fd add fences to prevent resetting a ID3D12CommandAllocator before commands have completed 2017-06-09 07:26:31 -07:00
Austin Eng 81bc3ad23b move frame resource transitions to D3D12Binding 2017-06-09 07:26:31 -07:00
Kai Ninomiya 468dafde9d Create a command buffer builder state tracker object (#19) 2017-06-08 17:25:57 -07:00
Austin Eng cfeda4d9f2 CHelloTriangle working 2017-06-07 16:23:10 -04:00
Austin Eng eb6d22242a add D3D12Binding with swap chain 2017-06-07 16:23:10 -04:00
Austin Eng fc2bac7e45 add null D3D12 backend 2017-06-07 16:23:10 -04:00
Corentin Wallez fbab31bada Roll spirv-cross bd7c47a0 -> 3ab17000 2017-06-06 10:03:46 -07:00
Corentin Wallez 72725eebf9 CommandBufferGL: Advance iterator for unimplemented commands 2017-06-06 10:03:46 -07:00
Corentin Wallez ca9af201b5 Fix validation errors in Animometer's shader 2017-06-06 10:03:46 -07:00
Corentin Wallez 4efaf32d1b Don't check for vertex buffers in dispatch aspects
Recently started causing a crash because we stopped creating an empty
InputState for compute pipelines
2017-06-06 10:03:46 -07:00
Corentin Wallez 181e22b482 Rename validation tests to end in Tests 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 00176858b5 Add DepthStencilState validation unit tests 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
Austin Eng 76e64a985d Add MTL backend for DepthStencilState. Completely untested. 2017-06-02 12:13:39 -07:00
Austin Eng 4f5521e440 Remove StencilReferenceMode. Add SetStencilReference.
This moves the application of the stencil reference from the
DepthStencilState to Command::SetStencilReference
2017-06-02 12:13:39 -07:00
Austin Eng 3efcf2172d Add DepthStencilState
Add depth and stencil tests. This is currently only implemented for the
OpenGL API. HelloDepthStencil is a test using the depth and stencil
buffers to do reflections. Currently clearing / stencil clearing is not
working properly.
2017-06-02 12:13:39 -07:00
Corentin Wallez b38ff68b88 Make wire_autogen have all symbols defined internally
Previously WireCmd.h/cpp that is used in wire_autogen wasn't included in
the sources, causing a link error on some platforms.

With WireCmd.* moved in the EXTRA_SOURCES, the nxt_wire target didn't
contain any non-header file and caused a link error on OSX. Fix it by
properly splitting the declaration and implementation of
TerribleCommandBuffer in a .h and .cpp file.
2017-05-30 15:55:34 -07:00
Corentin Wallez 40fb17dddc Only include intrin.h on Windows 2017-05-30 15:55:34 -07:00
Corentin Wallez 76dbbd54a0 Use sized integer type for BitSetIterator
This makes sure it works correctly with the ScanForward Math type.
However this isn't a very good fix, the right solution would be to
detect whether we are compiling in 32bit or 64bit and use one of
ScanForward32 or ScanForward64.
2017-05-30 15:55:34 -07:00
Corentin Wallez 7815d78044 Fix RefCountedTest not initializing deleted. 2017-05-30 10:48:32 -07:00
Corentin Wallez 944b60fb75 Fix compilation on Windows
There are still a bunch of warning that we should remove.
2017-05-30 10:48:32 -07:00
Corentin Wallez 26275d0a16 Make all libraries STATIC for now
For shared library to work on Windows to work, we need to add
declspec(export) and declspec(import) annotations to the symbols to
export. This fixes the problem by making all libraries static on
Windows, but we'll need to revisit and do proper symbol exports.
2017-05-30 10:48:32 -07:00
Corentin Wallez 5fbdff6888 Add ValidationTest and an example validation test.
Validation tests are tests of the backend state-tracking and validation
code that don't require a GPU as they are running on the null backend.
This commit adds a very simple (and almost useless) BufferValidationTest
as an example of a validation test.
2017-05-30 10:40:43 -07:00
Corentin Wallez 230daf56ad Misc, noop cleanups 2017-05-30 10:40:43 -07:00
Corentin Wallez 2d641142b0 Add tests for ObjectBase's refcounting 2017-05-30 10:40:43 -07:00
Kai Ninomiya b2b495b5aa Forbid explicit transitions to/from attachment usages (#18) 2017-05-24 13:07:30 -07:00
Corentin Wallez 79a62bf6e3 Create a Null backend.
This will be useful to run validation unittests without using the GPU.
2017-05-24 15:23:53 -04: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 ca309db58a Add wire tests for unknown and success error status 2017-05-19 10:41:36 +02:00
Corentin Wallez 75bbcec543 Add wire test for the maybe monad 2017-05-19 10:41:36 +02:00
Corentin Wallez 42f2d3c5f2 Add wire tests for *SetErrorCallback 2017-05-19 10:41:36 +02:00
Corentin Wallez c85b5c0640 Add wire tests for passing arguments around
- Add test for passing value arguments as well as aarrays of them
- Add test for passing C string
- Rework Object array argument test to pass multiple objects
2017-05-19 10:41:36 +02:00
Corentin Wallez 1b7c5e3f70 Mock API: special case the SetErrorCallback procs.
Also add a suppression for these procs in wiretests, unless we are
specifically testing them.
2017-05-19 10:41:36 +02:00
Corentin Wallez 0a58812f34 Consolidate unittests in one binary 2017-05-19 10:41:36 +02:00
Corentin Wallez 36cf2dd54b Make autogenerated validation produce device or builder errors 2017-05-11 11:31:54 +02:00
Corentin Wallez 7f96177289 Implement the builder error callback in the backends
This makes the Builder base class retain the error status, if any, and
call the callback on GetResult (or ~Builder, whichever comes first).
2017-05-11 11:31:54 +02:00
Corentin Wallez 5dc7915d38 Introduce a base class for Builder objects.
All builder objects will depend from this "Builder" base class. This
will allow having the builder callback logic in only one place.
2017-05-11 11:31:54 +02:00
Corentin Wallez 4b410a33ca Implement the device error callback.
This adds support for "natively defined" API types like callbacks that
will have to be implemented manually for each target language. Also this
splits the concept of "native method" into a set of native methods per
language.

Removes the "Synchronous error" concept that was used to make builders
work in the maybe Monad, this will have to be reinroduced with builder
callbacks.
2017-05-11 11:31:54 +02:00
Corentin Wallez 682a8250b3 Plumb the server->client wire 2017-05-11 11:31:54 +02:00
Corentin Wallez 7f433a5b52 Add bufferOffset to CopyBufferToTexture. 2017-05-10 19:49:52 +02:00
Corentin Wallez 0fba0b4811 Fix usage of C++14 constexpr in HasZeroOrOneBit 2017-04-26 15:17:03 -04: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