Commit Graph

512 Commits

Author SHA1 Message Date
Corentin Wallez 9ce29d1104 Fixup comment 2018-04-16 15:31:02 -04:00
Stephen White ac49ed0779 Use a memcpy to avoid strict-aliasing warnings. 2018-04-16 15:31:02 -04:00
Stephen White 6d90e01858 Expand allowable formats for color attachments.
Don't assert on color formats which can be cleared with a
floating-point clear value.
So far, these are { unorm } x { r, rg, rgba, bgra }.
Fix linter error when no files to check.
2018-04-13 11:53:12 -04:00
Stephen White d0771f8dd5 Metal backend: do a Tick() on queue submit. 2018-04-12 13:14:19 -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 10a659ad91 Implement support for all Int32 vertex formats. (#179) 2018-04-10 14:35:17 -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 ee66f25c4f Add support for R16G16B16A16 ushort.
Also implement both new formats in Vulkan.
2018-04-10 11:37:35 -04:00
Stephen White 0b1fbd9322 Add support for ushort2 vertex format.
Also fix some vertex format computations.
2018-04-10 11:37:35 -04:00
Stephen White ceec97978e Implement recent vertex and texture formats on Vk.
Implement unorm_rgba8 and unorm_rg8 vertex formats and
{uint8, unorm8} x {r, rg} texture formats on Vulkan backend.
2018-04-09 16:15:59 -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 a9e3d7fd00 Implement sampler address modes (API, D3D, MTL, GL). 2018-04-09 13:42:24 -04:00
Stephen White cd4f8a2e2f Add 1- and 2-component texture formats.
Implemented {uint8, unorm8} x {r, rg} texture formats.
Backend support added for Metal, D3D12 and OpenGL.
2018-04-09 11:26:17 -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
Stephen White c25d376ac3 Use GL_RGBA8 as the internal format for GL_BGRA. 2018-04-06 15:05:05 -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 cf0ac7570d D3D12: Keep a reference to pipelines until unused
Previously we would remove the reference to pipelines in the destructor
of the d3d12::*Pipeline objects which could cause the D3D12 pipeline
state to be destroyed while still used by in-flight commands. Add a
global queue of ComPtrs to keep alive in the d3d12::Device to fix this.
2018-03-02 14:25:30 -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 a3c89cc27a Add and Implement CommandBuffer::SetScissorRect 2018-03-02 14:22:50 -05:00
Corentin Wallez 1090a10d4f Invert final blit in the OpenGL bindings
We want all of NXT to have the origin in the top left. OpenGL's origin
is the bottom left instead. We are doing a blit already to decouple
the NXT render targets from the OpenGL default framebuffer. Take
advantage of this and invert the blit to make the OpenGL's backend
origin be top left.
2018-02-12 15:19:11 -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
msiglreith adb152bff1 dx12: Handle present texture in a specially
PRESENT is an exclusive flag in NXT and can't be combined with other flags. The existing implementation treats the D3D12_RESOURCE_STATE_PRESENT as flag which is confusing due to being 0.
2018-02-08 16:12:06 -05:00
Corentin Wallez 6569f9f0a4 D3D12: Move initialization of the device in the backend 2018-02-07 14:37:51 -05:00
Corentin Wallez 9b491437b1 D3D12: Move the NativeSwapChainImpl in the backend 2018-02-07 00:31:17 -05:00
Corentin Wallez 02d24d3c5e D3D12: Add back flip_vert_y.
This fixes the InputStateTests and PrimitiveTopologyTests
2018-02-07 00:31:17 -05:00
Corentin Wallez 099656dc7a D3D12: Fix swapchains after 921fb5e1ce
The Swapchain::Configure was changed to not require an initial usage
anymore. Previously the code was doing a transition to this usage
causing the code to now transition to <uninitialized data> usage.
Fix this by deleting code. Also make TextureD3D12 responsible for the
transition to PRESENT.
2018-02-07 00:31:17 -05:00
Corentin Wallez eba7c027f9 Enable DepthStencilStateTests on Vulkan 2018-02-06 09:15:01 -05:00
Corentin Wallez 53604a11a5 Vulkan: Implement SetStencilReference 2018-02-06 09:15:01 -05:00
Corentin Wallez 08b3cbf5bf Vulkan: Implement DepthStencilState 2018-02-06 09:15:01 -05:00
Corentin Wallez 6e01758dcd TextureVk: Don't release swapchain-owned images 2018-02-06 09:15:01 -05:00
Corentin Wallez 27570bd5b4 Vulkan: Implement RenderPass LoadOp 2018-02-06 09:15:01 -05:00
Corentin Wallez 8b7564fb54 Vulkan: Remove stencil masks from dynamic state
In NXT the stencil read and write masks are part of the pipeline state
so they should be set by the pipeline and not dynamically.
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 54c11a8a55 Vulkan: Implement SetBindGroup 2018-02-05 13:27:47 -05:00
Corentin Wallez 14e0687f94 Vulkan: Implement BindGroups
For now only StorageBuffer and UniformBuffer bindings are supported as
we don't have samplers yet.
2018-02-05 13:27:47 -05:00
Corentin Wallez e7362d0b1b Vulkan: Implement BindGroupLayout 2018-02-05 13:27:47 -05:00
Corentin Wallez 8df4142870 Vulkan: Implement SetBlendColor 2018-02-05 13:27:47 -05:00
Corentin Wallez 5842c71e17 Vulkan: Implement BlendState 2018-02-05 13:27:47 -05:00
Corentin Wallez b0ae792954 Vulkan: Don't implicitly transition texture already in output attachment 2018-02-05 13:27:47 -05:00
Corentin Wallez 9e59b4ddf1 Fixup some include guards to match the filename 2018-02-05 13:27:47 -05:00
Corentin Wallez 92baafc7a0 Vulkan: Initial implementation of a swapchain.
This is currently hardcoded to work on one specific HW/OS/driver
version. It also assumes that the graphics queue is the same as the
present queue.
2018-01-29 19:50:28 -05:00
Corentin Wallez 672d7f26e1 TextureVk: Fix not transitioning between queues 2018-01-29 19:50:28 -05:00
Corentin Wallez 75f5b8039b Vulkan: Fix texture synchronization for present 2018-01-29 19:50:28 -05:00
Corentin Wallez dd5ff104ec Vulkan: support fenced deletion of swapchain objects 2018-01-29 19:50:28 -05:00
Corentin Wallez eb45309722 vulkan_platform: Add a method to get the uint64_t handle 2018-01-29 19:50:28 -05:00
Corentin Wallez 37bead6fa5 Vulkan: transition attachments implicitly 2018-01-29 19:50:28 -05:00
Corentin Wallez 407233390b Vulkan: support vktrace and renderdoc 2018-01-29 14:35:58 -05:00
Corentin Wallez 04d8567d31 VulkanInfo: Implement gathering of VkSurfaceKHR related info 2018-01-29 14:35:58 -05:00
Corentin Wallez 7648217f15 NXTTest: destroy the swapchain before the device 2018-01-29 14:35:58 -05:00
Corentin Wallez 49588b0b8d Vulkan: Split off and implement SwapChain 2018-01-18 16:17:28 -05:00
Corentin Wallez 0887236c81 nxtSwapChainNextTexture: make texture a union of ptr, u32, u64
Making all textures represented by pointers is a problem for Vulkan
where VkImage is a 64bit type and wouldn't fit in a pointer on 32bit
builds. Make texture contain on of each useful type so that each backend
can choose which one it wants to receive.
2018-01-18 16:17:28 -05:00
Corentin Wallez c0f5ca1f5a Move vulkan_platform.h to common/
This file changes the non-dispatchable Vulkan handle types. We want to
use some of these handles in utils/VulkanSwapChain.cpp so it needs to
have access to it. The file could include
backend/vulkan/vulkan_platform.h but it seems a bit cleaner to move the
header in common/ instead with a warning if the Vulkan backend isn't
enabled.
2018-01-18 16:17:28 -05:00
Corentin Wallez cc407ae787 Make SwapChainImpl a function and move it to common/
For the Vulkan backend it will make sense to have the SwapChain be
implemented inside the backend as it will need to interact with a lot of
things there. It will need SwapChainImpl and cannot see utils/ so
SwapChainImpl has to be moved in common/

Also makes SwapChainImpl a function called CreateSwapChainImplementation
as the inheritance was only used to share a static method.
2018-01-18 16:17:28 -05:00
Corentin Wallez 395bf15599 Enable the InputState tests on Vulkan 2018-01-15 19:13:01 -05:00
Corentin Wallez a00a5d3d8b TextureVk: Transition to the first usage if needed
In Vulkan images are created in no particular layout and must be
transitioned before they can be used. This didn't appear before because
the test were creating the textures with not initial usage and then
transitioned them. This isn't the case with InputStateTest, which is
what uncovered this issue.
2018-01-15 19:13:01 -05:00
Corentin Wallez 2b391dac74 Vulkan: Implement RenderPipeline 2018-01-15 19:13:01 -05:00
Corentin Wallez eb135f6fc0 Vulkan: Implement render pass commands 2018-01-15 19:13:01 -05:00
Corentin Wallez 35fcfc737b Vulkan: Implement TextureView and Framebuffer 2018-01-15 19:13:01 -05:00
Corentin Wallez 49450b5644 Vulkan: Implement Draw* commands 2018-01-15 19:13:01 -05:00
Corentin Wallez 88d85fbaac Vulkan: Implement Set[Index|Vertex]Buffers 2018-01-15 19:13:01 -05:00
Corentin Wallez 2bd6143061 Vulkan: Implement InputState 2018-01-15 19:13:01 -05:00
Corentin Wallez 3a11684e05 Vulkan: Implement 1-subpass renderpasses
Also adds some missing asserts for empty serial queues in the fenced
deleter service.
2018-01-15 19:13:01 -05:00
Corentin Wallez aeaffcf8fc Vulkan: Create dummy pipeline layouts 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 d15177d84e Don't leak default created objects
Sometimes NXT provides default objects for parts of the pipelines, for
example a default pipeline layout. This objects were create with code
like: device->CreateFooBuilder()->GetResult(); and stored in a Ref<>.
This caused the object to have on external reference and two internal
references and not get destroyed when the Ref<> goes out. Call Release
on these objects to remove the external reference and fix the leak.

Was found via the Vulkan validation layers that were complaining that a
VkPipelineLayout was leaked.
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 6b986732d5 Vulkan: implement T<->B copies 2018-01-08 04:07:41 -08:00
Corentin Wallez f1d56f3094 Vulkan: Implement texture transitions 2018-01-08 04:07:41 -08:00
Corentin Wallez aa43d162ec Vulkan: Implement texture creation.
This commit only implements the creation and destruction of VkImage as
well as the allocation and freeing of its memory.
2018-01-08 04:07:41 -08:00
Corentin Wallez f11396767f Make nxt::TextureBase::GetDevice const
Because it is.
2018-01-08 04:07:41 -08:00
Corentin Wallez 160abad592 Vulkan: Implement buffer transitions 2017-12-12 12:31:20 -05: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 a9b98af710 Vulkan: Centralized deferred deletion, use it for BufferVk's handle
This introduce a new FencedDeleter service as part of the Device
objects that tracks when resources are no longer used and deletes them.
BufferVk takes advantage of this to defer the deletion of its handle
that was previously incorrectly delete directly in ~BufferVk.
2017-12-12 12:31:20 -05:00
Corentin Wallez c34aa3abe7 Vulkan: Make non-dispatchable handles always opaque
On 32 bit Vulkan typedefs these handles to uint64_t which breaks
function overload resolution. Replace the
VK_DEFINE_NON_DISPATCHABLE_HANDLE and VK_NULL_HANDLE defines to be
opaque C++ types with the same capabilities.
2017-12-12 12:31:20 -05:00
Corentin Wallez 00935daffc Use shaderc_shared and don't build unnecessary targets
This should speed up compilation on Travis a little bit.
2017-12-12 01:02:35 -05:00
Corentin Wallez b6fb5f3149 Roll shaderc 2017-12-12 01:02:35 -05:00
Corentin Wallez b36b501f5e Build the Vulkan backend on CI 2017-12-04 21:39:16 -05:00
Corentin Wallez 23b27a27e2 Format: src/backend/vulkan 2017-11-28 16:18:39 -05:00
Corentin Wallez c7807abf04 Format: src/backend/opengl 2017-11-28 16:18:39 -05:00
Corentin Wallez 1aa4d5604f Format: src/backend/null 2017-11-28 16:18:39 -05:00
Corentin Wallez f58d84d488 Format: src/backend/metal 2017-11-28 16:18:39 -05:00
Corentin Wallez 2d62a371ee Format: src/backend/d3d12 2017-11-28 16:18:39 -05:00
Corentin Wallez c1400f0d14 Format: src/backend 2017-11-28 16:18:39 -05:00
Corentin Wallez 9d01c6c26d Format: src/{common, utils, wire} 2017-11-28 16:18:39 -05:00
Corentin Wallez d5d77af5b6 Member rename: src/tests 2017-11-23 17:04:10 -05:00
Corentin Wallez ad6470466c Member rename: src/{common/utils/wire} 2017-11-23 17:04:10 -05:00
Corentin Wallez 8d75e5b4ae Member rename: src/backend/vulkan 2017-11-23 17:04:10 -05:00
Corentin Wallez 7ee1610f38 Member rename: src/backend/opengl 2017-11-23 17:04:10 -05:00
Corentin Wallez b0c75a5b68 Member rename: src/backend/metal 2017-11-23 17:04:10 -05:00
Corentin Wallez e00385af73 Member rename: src/backend/d3d12 2017-11-23 17:04:10 -05:00
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