Commit Graph

11590 Commits

Author SHA1 Message Date
Corentin Wallez f30dffa75f Roll STB to fix a warning 2017-07-10 19:35:21 -04:00
Corentin Wallez a52c23c553 Make one missed #include start from src/ 2017-07-10 19:35:21 -04:00
Corentin Wallez 98614a02d3 Fix EnsureTextureUsage not using usage 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 afdcf7d828 D3D12: Wait for GPU on device destruction 2017-07-10 16:45:28 -04:00
Austin Eng f9c39d021e Add device reference counting 2017-07-10 16:45:28 -04:00
Kai Ninomiya 563e9e253e Remove prints added in #67 and fix test broken in #64 (#69) 2017-07-10 10:23:27 -07:00
Kai Ninomiya cb2d6d8553 Freeze texture transitions while attached; consolidate OutputAttachment usage (#67)
* lock usages for attachments during subpasses
* refactor IsTextureTransitionPossible
* change attachment usages to OutputAttachment
* make SetBindGroup validation lazier
2017-07-07 16:06:14 -07:00
Kai Ninomiya 794d4faece null backend: fix resource usage after cmdbuf transition (#63)
and test it.
2017-07-07 11:47:40 -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
Austin Eng a9b2a9871c Add Buffer->Texture->Buffer copy test
This does a Buffer->Buffer copy using a Texture as an intermediate
resource and checks if the resulting buffer data is the same
2017-07-06 16:57:54 -04:00
Austin Eng 49fe566d05 Add Buffer range expectation 2017-07-06 16:57:54 -04:00
Austin Eng 4502441604 Enable basic tests for D3D12 2017-07-06 16:57:54 -04:00
Austin Eng 47261d4ecb Implement MapReadAsync on D3D12 backend
Buffers with MapRead allowed are created on the READBACK heap and always
add the D3D12_RESOURCE_STATE_COPY_DEST state (required by D3D12).
Likewise MapWrite adds the D3D12_RESOURCE_STATE_GENERIC_READ state and
places resources on the UPLOAD heap. Because these states are
required, transitions for mapped buffers do nothing.
2017-07-06 16:57:54 -04:00
Austin Eng 8fa550c015 Add D3D12 buffer/buffer buffer/texture and texture/buffer copies
Right now, this only works if textures are 256-byte aligned
2017-07-06 16:57:54 -04:00
Austin Eng 6774bce06e Remove unused Device member in D3D12 TextureView and BufferView 2017-07-06 16:57:54 -04:00
Austin Eng beb76d06db Rename d3d12 Device tick functions to Tick 2017-07-06 16:57:54 -04:00
Austin Eng 6103c62489 Rename backend::d3d12::ResourceUploader::UploadToBuffer to BufferSubData 2017-07-06 16:57:54 -04:00
Corentin Wallez 5e03aec75a Remove some unused variables 2017-07-06 16:30:20 -04:00
Corentin Wallez 2dd73fbc1d Remove unnecessary Device forwarding. 2017-07-06 16:30:20 -04:00
Corentin Wallez 59d55dc3ac unittests: Add validation tests for InputState. 2017-07-06 11:34:31 -04:00
Corentin Wallez 0230a8dea0 end2end: Add InputStateTests
They test aspects of the input state but don't try all combinations of
formats like dEQP would do.
2017-07-06 11:34:31 -04:00
Corentin Wallez 8308b1c1b3 Metal: Don't hardcode the texture usage or dimension 2017-07-06 11:34:31 -04:00
Corentin Wallez c6f9006b02 Metal: Use RGBA instead of BGRA and clear render targets by default
This makes rendering of the samples have the wrong colors on the Metal
backend, but using BGRA made end2end tests fail. The rendering color
will be fixed when the WSI is introduced.
2017-07-06 11:34:31 -04:00
Corentin Wallez 8859178703 Add nxt::VertexFormat::FloatR32 2017-07-06 11:34:31 -04:00
Corentin Wallez 4cd65f03b7 Add a readpixel test 2017-07-06 11:34:31 -04:00
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
Austin Eng ed54ec0c71 update spirv-cross version for HLSL register declaration support 2017-07-04 14:30:34 -04:00
Corentin Wallez ac06ef34e4 Fix shaderc not finding python when inside VS
Visual Studio 2017 is able to build CMake-based projects directly be
opening the folder containing the CMakeLists.txt. However when doing
this shaderc is not able to find the Python executable (it uses
find_program instead of the special Python CMake module). Help shaderc
by setting the PYTHON_EXE variable before including its CMakeLists.txt
2017-07-04 12:54:39 -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 769b00fc23 Fix MapRead and MapWrite being the same bit 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 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
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
Corentin Wallez 931e6e82fd Make CHelloTriangle in C++ to simplify Utils
The point of CHelloTriangle is to use the C version of NXT, so having
the code C++ is still ok.
2017-06-20 07:40:17 -07:00