Commit Graph

9155 Commits

Author SHA1 Message Date
Corentin Wallez 4db6327f78 Use WIN32_LEAN_AND_MEAN on Windows
This makes Windows.h includes less headers that we don't want and will
help with compilation.
2017-07-13 14:55:23 -04:00
Corentin Wallez 275817a93a Add proper defines for backend enablement 2017-07-13 14:55:23 -04:00
Corentin Wallez a7bfc9d2ac Metal: Fix Device::pendingCommands being freed under us 2017-07-13 14:55:23 -04:00
Austin Eng 77a29986b0 D3D12 Render Targets (#72)
Implements BeginRenderSubpass on the D3D12 backend. Descriptors for render target and depth stencil views are recorded in a descriptor heap for each framebuffer. For now, we still have the hack where no attachment renders to the backbuffer, so the CommandBuffer records those when necessary when it is submitted.

This PR also enables input states for D3D12 which are mostly working. One failure seems to be happening because our texture copies are not yet correct.
2017-07-12 17:36:36 -07: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 3df6441a8c Group the target sources for the VS solution explorer 2017-07-11 13:59:15 -04:00
Corentin Wallez 0f833f30ed Enable warnings on Windows 2017-07-11 13:59:15 -04: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 6fb3aebf0c Better namespace CMake folders for Visual Studio
This helps Visual Studio users have less clutter in their solution
explorer. This also updates spirv-tools to a newer version that folders
itself. This also updates spirv-headers so that spirv-tools compiles.
2017-07-11 13:59:15 -04:00
Corentin Wallez fd589f3919 Add an internal ASSERT macro
This macro has some advantages over the standard library one:
 - It prints the place where the macro was triggered
 - It "references" the condition even in Release to avoid warnings
 - In release, if possible, it gives compiler hints

It is basically is stripped down version of the ASSERT macros I wrote
for the Daemon engine in src/common/Assert.h

This commit also removes the stray "backend" namespaces for common/
code.
2017-07-10 19:35:21 -04:00
Corentin Wallez bd0594bab8 Enable warnings on non-MSVC 2017-07-10 19:35:21 -04:00
Corentin Wallez 228ba88fe6 Remove unused Device::CopyBindGroup 2017-07-10 19:35:21 -04:00
Corentin Wallez 98c90d4faa Fix clang/GCC warnings 2017-07-10 19:35:21 -04:00
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