Commit Graph

414 Commits

Author SHA1 Message Date
Corentin Wallez 903c563b43 Member rename: src/backend/null 2017-11-23 17:04:10 -05:00
Corentin Wallez fbecc28ac4 Member rename: src/backend 2017-11-23 17:04:10 -05:00
Corentin Wallez b325f4d0af Fix compilation of Vulkan backend on Windows 2017-11-23 17:04:10 -05:00
Corentin Wallez 98013d7866 Enable first tests on Vulkan! 2017-11-23 09:26:26 -05:00
Corentin Wallez bdde209ed9 VulkanBinding: make a dummy Vulkan swapchain impl 2017-11-23 09:26:26 -05:00
Corentin Wallez eee5171c39 Vulkan: Add uploader for BufferSetSubData 2017-11-23 09:26:26 -05:00
Corentin Wallez a8ec80ba57 Vulkan: Add some simple command pool / buffer management 2017-11-23 09:26:26 -05:00
Corentin Wallez 9018236b38 Vulkan: Keep track of finished operations with fences 2017-11-23 09:26:26 -05:00
Corentin Wallez 315e9268bb Vulkan: Start buffers, hack SetSubData and MapRead 2017-11-22 18:25:20 -05:00
Corentin Wallez b8387a62a6 RefCounted: make copy constructor arg const 2017-11-22 18:25:20 -05:00
Corentin Wallez 0216233a83 Vulkan: Create device and load all entry points 2017-11-22 18:25:20 -05:00
Corentin Wallez f40d8c545c Fix warnings in IndexFormatTests 2017-11-21 17:34:16 -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 6d9a3b82c6 Vulkan: Create VkInstance and register debug report 2017-11-21 16:09:15 -05:00
Corentin Wallez f2adf6d5bd Vulkan: Load Vulkan library and gather global info 2017-11-21 16:09:15 -05:00
Corentin Wallez 86e1ca2230 Add a DynamicLib loading class 2017-11-21 16:09:15 -05:00
Corentin Wallez 2eb113d690 Noop d3d12_platform.h cleanup 2017-11-21 16:09:15 -05:00
Corentin Wallez 6225a72fb7 Add index format tests. 2017-11-20 09:59:03 -05:00
Corentin Wallez a43b1566e6 Make MetalBackend require BGRA8 swapchain 2017-11-20 09:59:03 -05:00
Corentin Wallez e862a33dac Add TextureFormat::B8G8R8A8Unorm 2017-11-20 09:59:03 -05:00
Corentin Wallez 2e31e8f0bf Make binding expose the preferred format 2017-11-20 09:59:03 -05:00
Corentin Wallez 405dcd636a Make the index format part of the pipeline state. 2017-11-20 09:59:03 -05:00
Corentin Wallez ff57ccbcf1 OpenGL: Fix rendered textures being flipped.
This was because the clip space of OpenGL has an inverted Y compared to
other APIs. This commit:
 - Updates SPIRV-Cross to the latest version
 - Uses the new vertex.flip_vert_y option in ShaderModuleGL
 - Enables tests that are now passing in GL.
2017-11-16 11:42:38 -05:00
Kai Ninomiya 921fb5e1ce remove initialUsage from SwapChain::Configure 2017-09-15 14:02:02 -07:00
Kai Ninomiya 169809c458 use TransitionUsageImpl 2017-09-15 14:02:02 -07:00
Kai Ninomiya 720a5d9366 d3d12: add implicit transition for subpass attachments 2017-09-15 14:02:02 -07:00
Kai Ninomiya ee7b6b1b62 Update SwapChain to configure texture usage
Explicitly configure swap chain usage in bindings and examples

Fix missing case in switch

Make swap chain Present usage implicit

Author: Austin Eng <enga@google.com>
2017-09-15 14:02:02 -07:00
Kai Ninomiya 08a0081c13 Change SetPipelineCommon to return void (#124)
This is to avoid a potential future problem if SetPipelineCommon were to
ever return false (which is currently not possible), some state might
have been modified incorrectly.
2017-08-31 10:56:15 -07:00
Kai Ninomiya da42198478 Remove the last few null=backbuffer hacks (#125)
I missed these in #94.
2017-08-31 10:47:54 -07:00
Corentin Wallez 916046c956 Add stub Vulkan backend 2017-08-29 13:37:24 -07:00
Corentin Wallez 7218ed19a1 end2end: Add push constant tests 2017-08-23 09:49:35 -04:00
Corentin Wallez ab4aa2af3e NXTTest: Configure the swapchain
Otherwise when trying to use SwapBuffersForCapture a device error is
generated.
2017-08-23 09:49:35 -04:00
Corentin Wallez 9a72ea09a9 Metal: Recreate the compiler everytime we use it. 2017-08-23 09:49:35 -04:00
Corentin Wallez 2f96e129ef Metal: Fix SetBindGroup assert 2017-08-23 09:49:35 -04:00
Corentin Wallez 91b475f369 OpenGL: Allow separate VS and FS push constants 2017-08-23 09:49:35 -04: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
Corentin Wallez 3ef4121d4e Metal: Free pipeline descriptor on error. 2017-08-23 09:49:35 -04:00
Corentin Wallez 8846433ae7 end2end: Clear attachments in tests 2017-08-23 09:49:35 -04:00
Corentin Wallez 770f25f335 Fix XCode Analyse false positive 2017-08-23 09:49:35 -04:00
Austin Eng a384c61f7a Fix indexing error 2017-08-18 12:49:45 -04:00
Austin Eng 4086effec0 Validate buffer view offset on bind groups 2017-08-17 15:36:02 -04:00
Austin Eng ae48c95306 Add IsAligned helper for values 2017-08-17 15:36:02 -04:00
Austin Eng d37ec9af92 unittests: Test inheritance of vertex inputs between pipelines and no inheritance between subpasses 2017-08-15 19:40:10 -04:00
Austin Eng 9b4150d5fd Fix RecomputeHaveAspectVertexBuffers check 2017-08-15 19:40:10 -04:00
Austin Eng dd37e5017f Fix bug with EnsureTextureUsage 2017-08-15 19:40:10 -04:00
Austin Eng d9568e2ca9 Reset vertex buffers aspect when pipelines change and fix bug where inputsSet is not cleared 2017-08-15 19:40:10 -04:00
Kai Ninomiya b476abd915 RenderPassLoadOpTests.ClearsOnlyOnFirstUsePerRenderPass (#117)
Tests that an attachment is cleared only on the first subpass that uses
it in a renderpass
2017-08-15 13:58:48 -07: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
Austin Eng 37d11539a4 Add compute to D3D12 backend 2017-08-14 17:39:36 -04:00
Austin Eng fb19c3606b Add RGBA8Uint texture format 2017-08-14 17:38:56 -04:00
Kai Ninomiya ba7a3224ea fix accidentally lost from #105 (#109) 2017-08-11 18:06:25 -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 e69a2893b3 Add BlendState validation tests 2017-08-07 18:51:48 -04: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 6366a019db Validate render subpass for SetBlendColor and SetStencilReference 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 18163f1223 end2end: Add blend state tests 2017-08-07 18:51:48 -04:00
Austin Eng fb4265387c Add SetBlendColor command 2017-08-07 18:51:48 -04:00
Austin Eng 476e5cbe30 Metal: Apply BlendState to RenderPipeline 2017-08-07 18:51:48 -04:00
Austin Eng 4820dbd7ee D3D12: Apply blend state to render pipeline 2017-08-07 18:51:48 -04:00
Austin Eng 31fc0d234c D3D12 & Metal: Blend state conversions 2017-08-07 18:51:48 -04:00
Austin Eng 94bebe517d Add BlendState to NXT API 2017-08-07 18:51:48 -04:00
Ben Constable 2c05f4d8fc Remove comment per code review feedback 2017-08-01 18:45:33 -04:00
Ben Constable ea507ddf77 Code review feedback 2017-08-01 18:45:33 -04:00
Ben Constable d54a5239a6 Fix missing depth stencil format and reference value setting 2017-08-01 18:45:33 -04:00
Ben Constable a015ad3399 Initial changes for depth stencil, some tests not passing 2017-08-01 18:45:33 -04:00
Kai Ninomiya 4526368263 Remove outdated backbuffer hack + reduce GL version to 4.4 (#100) 2017-07-31 11:25:06 -07:00
Corentin Wallez 4122b2e3f9 Metal: Implement push constants 2017-07-28 17:11:07 -04:00
Corentin Wallez 30beb65a7b Metal: Make the MSL indices match the ones of PipelineLayout
Previously didn't tell SPIRV-Cross at which MSL resource indices the
different SPIRV binding should be, and were lucky that it's giving
indices in increasing order matched the PipelineLayout in all our
samples.

Fix this by making SPIRV->MSL compilation depend on the PipelineLayout
so we can tell SPIRV-Cross which binding goes where.

We should do the same for vertex attributes eventually as they are
hardcoded to start at kMaxBindingsPerGroup currently.

Also a couple unrelated cleanups (unused function, usage of
IterateBitSet).
2017-07-28 17:11:07 -04:00
Kai Ninomiya c16a67ae52 Swap chains, part 2 (#94) 2017-07-27 18:30:57 -07:00
Corentin Wallez 3818e18c5c Forward unhandled builder errors to the device 2017-07-27 21:08:12 -04:00
Austin Eng ba6a36c974 D3D12: Enable better live object reporting and cleanup resources on device destruction 2017-07-27 15:15:28 -04:00
Austin Eng 439d963ccd Point,Line,Triangle -> PointList,LineList,TriangleList 2017-07-27 10:19:30 -04:00
Austin Eng c2def461a1 Add input primitive topology to D3D12 and Metal pipeline states 2017-07-27 10:19:30 -04:00
Austin Eng 2a0792b5f0 Add RenderPipeline validation tests 2017-07-27 10:19:30 -04:00
Austin Eng d568bdad99 Add primitive topology tests 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 3e9e315636 Add primitive topology to NXT API 2017-07-27 10:19:30 -04:00
Austin Eng c275f7cf9f end2end: Add depth stencil state tests 2017-07-25 10:16:08 -04:00
Austin Eng ccf1fa2330 Remove DepthTestEnabled() and fix depth writes for depth function Always 2017-07-25 10:16:08 -04:00
Austin Eng cc8d2d529d D3D12: Enabled copy tests with non-aligned buffer offsets 2017-07-25 09:40:54 -04:00
Austin Eng 04499576d9 D3D12: Add copy splitter unit tests 2017-07-25 09:40:54 -04:00
Austin Eng 0506138567 D3D12: Add copy splitting for texture copies not 512-byte aligned 2017-07-25 09:40:54 -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
Kai Ninomiya 159bade5f5 x_DISABLED -> DISABLED_x 2017-07-20 16:33:02 -04:00
Kai Ninomiya d9af452ceb refactorign -> refactoring 2017-07-20 16:33:02 -04:00
Corentin Wallez a18200e6af unittests: Add tests for push constants 2017-07-20 16:33:02 -04:00
Corentin Wallez 86b2894103 ShaderModule: Validate the push_constant block size 2017-07-20 16:33:02 -04:00
Corentin Wallez c8377da79b Validate SetPushConstants is done inside subpass and compute passes 2017-07-20 16:33:02 -04:00
Corentin Wallez 2dfea9961a ValidationTest: Add helper to create a dummy renderpass 2017-07-20 16:33:02 -04:00
Austin Eng b343e8d920 Add texture copy tests 2017-07-20 13:07:36 -04:00
Austin Eng e5bd3e0ece Add Texture expectation macro and mip level parameter 2017-07-20 13:07:36 -04:00
Austin Eng 1b8c64d3e2 Print small buffers on test expectation failure 2017-07-20 13:07:36 -04:00
Austin Eng 4234c39a09 Add output string streams to NXT test expectation helpers 2017-07-20 13:07:36 -04:00
Kai Ninomiya 59dc03f101 Correctly configure NXT_ENABLE_ASSERTS on multiconfiguration generators (#88)
And also set a default build type for single-configuration generators
2017-07-20 07:28:00 -07: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
Corentin Wallez 1e66ab93fe end2end: Add BufferSetSubData tests
The test doing many small SetSubData freezes the Metal driver on a
MTLBuffer allocation. This is because we don't use a ringbuffer for
SetSubData and instead create one small upload buffer per call.

The same test is skipped on D3D12 as it is bound to have the same issue.

Also adds comments that were forgotten before every MapReadAsync test.
2017-07-18 17:24:54 -04:00
Corentin Wallez e1f16a25bf NXTTest: add other Is<Backend> methods 2017-07-18 17:24:54 -04:00
Austin Eng 3835edde10 Add validation for buffer offset 2017-07-18 16:03:51 -04:00
Corentin Wallez 8668fbacdd end2end: Add BufferMapReadAsync tests 2017-07-18 11:06:54 -04:00
Corentin Wallez ea1241af80 D3D12: Handle MapReadAsync offset 2017-07-18 11:06:54 -04:00
Corentin Wallez d8e1a25cbc Metal: Wait for GPU on device destruction 2017-07-18 11:06:54 -04:00
Corentin Wallez 134e08005a Move USleep to utils/ 2017-07-18 11:06:54 -04:00
Austin Eng 2fbda87caf D3D12: Enable PureInstance test 2017-07-17 17:16:45 -04:00
Austin Eng 33560ef015 Implement backend texture->buffer and buffer->texture copies with row pitch 2017-07-17 17:16:45 -04:00
Austin Eng 51ff013ee2 Add automatic readback alignment and packing for texture expectations
Texture expectations copy into a buffer with a 256-byte aligned row
pitch. Then, the rows are packed into an array to check expectations
against.
2017-07-17 17:16:45 -04:00
Austin Eng 36d82645c3 Add row pitch validation tests 2017-07-17 17:16:45 -04:00
Austin Eng 5ed02ee648 update existing unit tests with proper row pitch 2017-07-17 17:16:45 -04:00
Austin Eng 972a1e59a7 Update tests and examples to follow copy row pitch alignment constraints 2017-07-17 17:16:45 -04:00
Austin Eng 3f47729df6 Add row pitch validation and default computation 2017-07-17 17:16:45 -04:00
Austin Eng c5f8e7ae77 Update usage of CopyBufferToTexture and CopyTextureToBuffer to include row pitch 2017-07-17 17:16:45 -04:00
Austin Eng 359acd6e95 Add row pitch to Texture->Buffer and Buffer->Texture copy commands 2017-07-17 17:16:45 -04:00
Austin Eng c100ca7b3f Update BufferD3D12 to use Align helper 2017-07-17 17:16:45 -04:00
Austin Eng deba8a4ea6 Add value type Align tests 2017-07-17 17:16:45 -04:00
Austin Eng 98b781527f Add kTextureRowPitchAlignment and Align helper 2017-07-17 17:16:45 -04:00
Austin Eng 8867e5d8df Rename Align to AlignPtr 2017-07-17 17:16:45 -04:00
Corentin Wallez 0bcf0e8e74 Factor computation of inherited bindgroups in PipelineLayoutBase 2017-07-17 15:25:16 -04:00
Corentin Wallez 136cae5ee2 Split Pipeline in Render and Compute, D3D12 part 2017-07-17 15:25:16 -04:00
Corentin Wallez b085eecb31 Split Pipeline in Render and Compute, OpenGL part 2017-07-17 15:25:16 -04:00
Corentin Wallez 494a157f66 Split Pipeline in Render and Compute, Metal part 2017-07-17 15:25:16 -04:00
Corentin Wallez e20c5ee9ff Split Pipeline in Render and Compute, test part 2017-07-17 15:25:16 -04:00
Corentin Wallez 29ced285d4 Split Pipeline in Render and Compute, common part 2017-07-17 15:25:16 -04:00
Kai Ninomiya 00349e6e36 Default-initialize descriptor heaps to null (#82) 2017-07-17 15:14:01 -04:00
Corentin Wallez 55ebc25c0f NXTTest: Make GTest print the name of the backend 2017-07-17 13:48:17 -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 bcee1e5981 NXTTest: expose SwapBuffers to test to make it easy to RenderDoc
RenderDoc uses presents as the points to start and end a capture, so to
debug test we have to do the following:

TEST_F(...)
    while(true) {
    	// All the test code
    	SwapBuffers();
    }
}
2017-07-13 15:41:43 -04:00
Corentin Wallez 11ce310de3 D3D12: make texture transition barrier on all subresources
This doesn't fix anything in particular and is just a drive-by
change.
2017-07-13 15:41:43 -04:00
Corentin Wallez de4a3c4c3b Fix framebuffer dimensions in InputStateTest
Also add validation that the framebuffer size matches its attachement
size and make a test for it.
2017-07-13 15:41:43 -04:00
Corentin Wallez 0b186b1fda Use feature detection macros everywhere 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 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 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
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