Commit Graph

781 Commits

Author SHA1 Message Date
Corentin Wallez 857a1cdb0e Enable IndexFormatTests on D3D12 2018-04-18 15:31:24 -04:00
Corentin Wallez 5ec9683800 Vulkan: Implement textures in bindgroups
Also enable the sampler tests on the Vulkan backend
2018-04-18 15:31:24 -04:00
Corentin Wallez bfeb285dcf Fix BindGroupLayout leak in PipelineLayout default.
PipelineLayout was re-entering in NXT to create the default empty BGLs,
but forgot to remove the initial external refcount for them.

Fixing this showed an issue where it was impossible to externally
reference a RefCounted that had only internal references, fix this as
well and add a test.
2018-04-17 18:10:57 -04:00
Stephen White 8c231b6990 Fix a DrawElements bug in the Metal backend.
The indexOffset of the draw was not being used. It must be
included in the indexBufferOffset.
Renamed indexBufferOffset -> indexBufferBaseOffset.
Add a DrawElements test which exercises zero and non-zero index offsets.
2018-04-12 10:32:33 -04:00
Stephen White a5aacc9cad Fix color write mask on GL backend.
Set the color mask even if blending is disabled.
2018-04-10 14:37:06 -04:00
Stephen White e5ae3274a3 Make SetSubData take size in uint8_t not uint32_t.
Also change data pointer to uint8_t*.
Add a test for a non-aligned SetSubData().
Implemented on all backends.
2018-04-10 14:34:24 -04:00
Stephen White 1c24abc672 Implement SamplerTests AddressModeTest.
Exercise both U and V, but not W.
2018-04-09 13:42:24 -04:00
Stephen White 8d742d1375 Implement unorm_rgba8 and unorm_rg8 vertex formats.
Backend support implemented in GL, Metal and D3D12.
Support for unorm values in the GL backend requires a
utility function to indicate if the format's components
are normalized.

Note that unorm_r8 is only supported on more recent MacOS SDKs (10.13),
so it's omitted for now.
2018-04-09 11:25:31 -04:00
Corentin Wallez cc0a54dbdb Implement MapWrite except in the wire.
Also this MapWrite doesn't zero out memory yet.
2018-04-06 16:03:57 -04:00
Corentin Wallez 8565e0056a Rename "buffer map read status" to "buffer map async status"
This is in preparation of MapWriteAsync that will use the same status
enum.
2018-04-06 16:03:57 -04:00
Corentin Wallez 2da19d5d6b Fix double MapReadCallback trigger when Unmapping in it.
When calling unmap on a mapped buffer for which the callback hasn't
fired yet, the callback should be called with UNKNOWN. The code marked
the callback as called only after calling it, causing problems with
re-entrancy where the callback would be called twice.

This could also get triggered by destroying the buffer inside the
callback.

Fix this in backend::Buffer and the WireClient and add test for both.
2018-04-06 16:03:57 -04:00
Corentin Wallez 32c0caab61 Enable BasicTests on the Vulkan backend 2018-03-02 15:26:19 -05:00
Corentin Wallez 8d541f3de9 Enable PrimitiveTopologyTests on Vulkan 2018-03-02 15:26:19 -05:00
Corentin Wallez abcf982e09 Enable IndexFormatTests on Vulkan
This adds translation of the index format in the Vulkan backend. A test
is also added for an issue currently present in the Vulkan backend.
2018-03-02 15:26:19 -05:00
Corentin Wallez 57f7bc750a Add an end2end test for SetScissorRect 2018-03-02 14:22:50 -05:00
Corentin Wallez 3a2d9b9a13 Add validation test for dynamic state
This includes:
 - SetScissorRect
 - SetBlendColor
 - SetStencilReference
2018-03-02 14:22:50 -05:00
Corentin Wallez 54ab71b5ce Add ViewportOrientation test 2018-02-12 15:19:11 -05:00
Corentin Wallez a88ec74e60 Factor simple framebuffer creation in end2end tests 2018-02-12 15:19:11 -05:00
Corentin Wallez eba7c027f9 Enable DepthStencilStateTests on Vulkan 2018-02-06 09:15:01 -05:00
Corentin Wallez 5000ee68d2 Enable BlendStateTest on the Vulkan backend 2018-02-05 13:27:47 -05:00
Corentin Wallez 7648217f15 NXTTest: destroy the swapchain before the device 2018-01-29 14:35:58 -05:00
Corentin Wallez 395bf15599 Enable the InputState tests on Vulkan 2018-01-15 19:13:01 -05:00
Corentin Wallez 47155a3555 Make gl_Position(-1, -1) map to texel (0, 0) of the render target
There was a lot of missing around with viewports and flip the Y
coordinate in vertex shaders before. Turns out things are simpler than
we thought: *all* APIs have gl_Position(-1, -1) map to texel (0, 0). It
is just the present coordinate system that changes.

Remove some of the hacks we had to work around non-existent viewport
issues and fix tests.
2018-01-15 19:13:01 -05:00
Corentin Wallez 348fb1b223 Enable T<->B CopyTests on Vulkan 2018-01-08 04:07:41 -08:00
Corentin Wallez 77a1d908b6 Vulkan: Handle CopyBufferToBuffer commands
This as this is the first command handled by the Vulkan backend, this
commit also introduces the b:✌️:CommandBUffer class and implements
b:✌️:Queue::Submit.

Also enables the BufferSetSubData tests that are now passing on Vulkan
even though the buffer transitions are unimplemented.
2017-12-12 12:31:20 -05:00
Corentin Wallez b6fb5f3149 Roll shaderc 2017-12-12 01:02:35 -05:00
Corentin Wallez d5d77af5b6 Member rename: src/tests 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 f40d8c545c Fix warnings in IndexFormatTests 2017-11-21 17:34:16 -05:00
Corentin Wallez 6225a72fb7 Add index format tests. 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 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 720a5d9366 d3d12: add implicit transition for subpass attachments 2017-09-15 14:02:02 -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 8846433ae7 end2end: Clear attachments in tests 2017-08-23 09:49:35 -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
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 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 18163f1223 end2end: Add blend state tests 2017-08-07 18:51:48 -04:00
Ben Constable ea507ddf77 Code review feedback 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 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 439d963ccd Point,Line,Triangle -> PointList,LineList,TriangleList 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 c275f7cf9f end2end: Add depth stencil state tests 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
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 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
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 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 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 c5f8e7ae77 Update usage of CopyBufferToTexture and CopyTextureToBuffer to include row pitch 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 8867e5d8df Rename Align to AlignPtr 2017-07-17 17:16:45 -04:00
Corentin Wallez e20c5ee9ff Split Pipeline in Render and Compute, test part 2017-07-17 15:25:16 -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 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 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 275817a93a Add proper defines for backend enablement 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
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 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 98c90d4faa Fix clang/GCC warnings 2017-07-10 19:35:21 -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
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
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 4cd65f03b7 Add a readpixel test 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 492cbe4a43 ValidationTests: add B->T copy tests 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 702186e169 Add restrictions on usages allowed with MapRead/Write 2017-06-22 09:56:30 -07:00
Austin Eng e480a0724c add test for SerialQueue::FirstSerial 2017-06-19 17:32:26 -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 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 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 eca89c2989 WireTests for buffer read mapping 2017-06-13 08:30:01 -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
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
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
Corentin Wallez 7815d78044 Fix RefCountedTest not initializing deleted. 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
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 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