Commit Graph

541 Commits

Author SHA1 Message Date
Corentin Wallez f1ded9bea2 Rename CMakeLists variables NXT_* to DAWN_* 2018-07-18 22:54:06 +02:00
Corentin Wallez 54e58c20b2 Rename nxt:: to dawn:: in tests 2018-07-18 22:54:06 +02:00
Corentin Wallez 83a9c9d6d9 Rename src/common macros NXT_* to DAWN_* 2018-07-18 22:54:06 +02:00
Corentin Wallez 33ca49614d Rename Error.h macros from NXT to DAWN 2018-07-18 22:54:06 +02:00
Corentin Wallez 226110f958 Rename nxt:: to dawn:: in the backends 2018-07-18 22:54:06 +02:00
Corentin Wallez 4a9ef4ee21 Rename the copyright authors from NXT to Dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez 021c9504d0 Make CommandBufferValidation use Error.h 2018-07-17 22:34:10 +02:00
Corentin Wallez 52f2383bb8 DeviceBase: Add helper to consume errors
This adds DeviceBase::ConsumedError which is a helper method intended to
be the main place where Error.h errors are consumed.

To test this mechanism, object creation using descriptors is changed to
use ConsumedError, which finally gets their validation errors go
somewhere. This mechanism isn't final though because we have yet to
implement WebGPU error handling.
2018-07-17 22:34:10 +02:00
Corentin Wallez 629c11baad Add windows_with_undefs.h to fix conflicts with windows.h
windows.h adds macros such as `#define GetMessage GetMessageA` which
cause conflicts in naming when for example a class definition is before
windows.h and a use is after windows.h

Add a header that can be used both to include windows.h and remove
defines, and to only remove defines (when windows.h is included by)
external dependencies.
2018-07-17 22:34:10 +02:00
Kai Ninomiya 6aaa10fa60
Skip ComputeCopyStorageBufferTests.SizedArrayOfStruct on D3D12 (#225) 2018-07-17 11:14:47 -07:00
Kai Ninomiya b7ecfaa347
Partially fix ComputeCopyStorageBufferTests.DISABLED_UnsizedArray (#220)
And update test names + comments on several ComputeCopyStorageBufferTests cases.
2018-07-16 13:44:59 -07:00
Corentin Wallez d8c068fb4f Remove explicit usage transition from the API and validation
This removes the following for both Buffer and Texture:
 - The builder's SetInitialUsage
 - The object's FreezeUsage and TransitionUsage methods
 - The CommandBuffer Transition<Object>Usage methods

All samples and tests are simplified as a result. This also obsoletes
the UsageValidationTest which is removed.

Some validation was dependent on "current usage" and hasn't been
reintroduced for implicit transitions yet:
 - Buffers can be used while mapped
 - Swapchain textures can be used after they have been presented.

Validation for these will involve collecting all the resources used by a
command buffer and will be done in a follow-up patch.
2018-07-16 14:44:20 +02:00
Corentin Wallez d2312e8138 Fix D3D12 compute bindgroups 2018-07-16 14:44:20 +02:00
Corentin Wallez 27388434d6 D3D12: Fix SetDescriptorHeap when we only have a sampler heap 2018-07-13 13:31:14 +02:00
Corentin Wallez a430a9a0aa Make the D3D12 backend support implicit barriers
With this the backend ignores explicit usage transition hints from the
frontent and generates all the barriers automatically based on resource
usage.

The current implementation is very naive and encodes a barrier
immediately just before a resource is used in a new state.
2018-07-13 13:31:14 +02:00
Corentin Wallez 2beeae3ad3 CommandBufferD3D12: Iterate per pass 2018-07-13 13:31:14 +02:00
Corentin Wallez aa13be96e8 Make the Vulkan backend support implicit barriers.
With this commit the Vulkan backend completely ignores the explicit
barrier commands passed from the frontend, and generates its own
pipeline barriers.

Right now it encodes each barrier just before the resources are used,
which is quite bad but will be optimized later.

This commit also makes the frontend command buffer validation perform
the checks necessary for implicit barriers (although they are redundant
with checks for explicit barriers) because the tracking can pre-compute
pass usage information that's useful for the Vulkan backend.

Tests for usage validation inside passes will be added once the concept
of transition is removed from the API.
2018-07-11 17:17:21 +02:00
Corentin Wallez 117f2f0ad6 Make EnumClassBitmask operations constexpr
This allows declaring combinations of bits as constants in header.
kReadOnlyBufferUsages is added using this feature.

Also reformat the file.
2018-07-11 17:17:21 +02:00
Kai Ninomiya 23bec15f4c
ComputeCopyStorageBufferTests (#216)
These should hopefully subsume the ComputeBoids demo for testing purposes. Not all of these tests pass currently:

* ComputeCopyStorageBufferTests.StructTest/D3D12 fails due to "Reading structs from ByteAddressBuffer not yet supported."
* The disabled tests fail for various reasons on various backends.
2018-07-10 17:26:35 -07:00
Kai Ninomiya 0582bfdfda
Fix D3D12 descriptor renumbering (#218)
Previously, the renumbering loop would sometimes iterate in the wrong order. To fix this, instead use the binding info already correctly extracted by `ExtractSpirvInfo`.

Fixes ComputeCopyStorageBufferTests.BasicTest/D3D12.
2018-07-10 17:25:48 -07:00
Kai Ninomiya 21006bbe6f Assert HandleCommands succeeds 2018-07-10 14:00:52 -07:00
Kai Ninomiya 234becf175
Use a descriptor for BindGroupLayout (#211)
* Use a descriptor for BindGroupLayout
* Fix MatchesLambda
* Add WireTests.StructureOfStructureArrayArgument
* Add BindGroupValidationTests.BindGroupLayoutCache
2018-07-10 12:23:50 -07:00
Corentin Wallez 976430c097 CommandBufferMTL: Iterate per-pass
This introduces a small amount of code duplication in the code that
handles push constants. On the plus side it removes the need for all the
asserts around which Metal encoder is active.
2018-07-10 10:59:44 +02:00
Corentin Wallez c9f0348bfe CommandBufferVk: Iterate per-pass 2018-07-10 10:59:44 +02:00
Corentin Wallez 47fe5c52b5 CommandBufferGL: Iterate per pass 2018-07-10 10:59:44 +02:00
Corentin Wallez b3bd35ed88 CommandBufferBuilder::Validate: Iterate per pass
This changes the validation to have one iteration loop for the main
buffer that calls to pass-specific iteration loops for compute passes
and render passes. This is done to simplify code a bit and will help
implement implicit transitions that are "precomputed" per pass in the
command buffer validation and re-used in the backends.

A number of code simplifications were made to CommandBufferStateTracker
since it doesn't need to know if we are in a pass anymore. Further
simplifications will happen when implicit barriers are implemented.
2018-07-10 10:59:44 +02:00
Corentin Wallez e909d4efe1 Move FreeCommands and SkipCommand to their own file 2018-07-10 10:59:44 +02:00
Stephen White bcd2e8559e
Remove extra copy of Queue in GL backend. (#213) 2018-07-06 15:39:11 -04:00
Kai Ninomiya 11fc210487 Move mDevice from PipelineLayoutVk to PipelineLayoutBase 2018-07-03 14:54:40 -07:00
Kai Ninomiya c5711ecd93 Rename GetBindGroupsLayoutMask -> GetBindGroupLayoutsMask 2018-07-03 14:54:40 -07:00
Kai Ninomiya 311e2a44b9 Allow bind group layouts to be sparse in pipeline layout
Instead of initializing all of the bind group layouts in the pipeline
layout to default values, let them be nullptr and allow this elsewhere.

Follow-up on some changes in #206
2018-07-03 14:54:40 -07:00
Kai Ninomiya 66c06f42f4
Manually retain/release mPendingCommands (#208)
Fixes a crash for me on macOS+Metal
2018-07-03 12:19:28 -07:00
Kai Ninomiya f53f98bf86
Use a descriptor for PipelineLayout (#206)
Adds support for structures inside descriptors.
2018-06-27 16:21:39 -07:00
Corentin Wallez a2f9277dac D3D12: Split D3D12Backend in Forward.h and DeviceD3D12 2018-06-19 13:51:26 -04:00
Corentin Wallez 1f51263672 Metal: Split off QueueMTL 2018-06-19 13:51:26 -04:00
Corentin Wallez 0f2e7b67c1 Metal: Split MetalBackend in Forward.h and DeviceMTL 2018-06-19 13:51:26 -04:00
Corentin Wallez a714f5b459 OpenGL: Split off QueueGL 2018-06-19 13:51:26 -04:00
Corentin Wallez 77d1f10493 OpenGL: Split OpenGLBackend in Forward.h and DeviceGL 2018-06-19 13:51:26 -04:00
Corentin Wallez 30f7ddbb6b Vulkan: Split VulkanBackend in Forward.h and DeviceVk 2018-06-19 13:51:26 -04:00
Corentin Wallez a4cb35cdbc Vulkan: Split off QueueVk 2018-06-19 13:51:26 -04:00
Corentin Wallez b703def640 Add Device::CreateQueue() instead of the builder
We are changing all object creation to use descriptors but there is no
creation argument to pass for queue, so instead Device::CreateQueue
takes no argument.
2018-06-18 13:33:40 -04:00
Corentin Wallez 82565b340f Add NXT_UNUSED to silence unused warnings 2018-06-12 14:26:32 -04:00
Corentin Wallez 5ab96e0d40 Wire: Implement MapWriteAsync
The flow of commands is a bit more involved than for MapReadAsync and
goes like this:
 - C->S MapAsync isWrite = true
 - S: Call MapWriteAsync
 - S: MapWriteAsync callback fired
 - S->C: MapWriteAsyncCallback (no data compared to the read case)
 - C: Call the MapWriteAsync callback with a zeroed out buffer
 - C: Application calls unmap.
 - C->S: UpdateMappedData with the content of the mapped pointer
 - S: Copy the data in the mapped pointer
 - C->S: Regular unmap command
 - S: Call unmap

Makes nxt_end2end_tests -w pass all tests.

Also duplicates the MapRead wire tests for the write cases
2018-06-09 13:52:45 +02:00
Corentin Wallez 88fb8fa353 Wire: Move the logic of [de]serialization in WireCmd.
This will help with follow-up changes that add support for a more
complete grammer of types, including structures containing pointers
to objects or other structures.

Instead of having the wire::Client and wire::Server directly act on
buffer memory, a couple interfaces are introduced so that WireCmd can do
things like get the object<->id mapping and temporary allocations.

While the serialization and deserialization of most commands was moved
into WireCmd, the commands that don't directly correspond to NXT methods
have their logic moved inside Client and Server and will be made to
expose the new interface in a follow-up commit.
2018-06-08 13:58:55 +02:00
Corentin Wallez 419e9841a8 NXTTest: add -w to run the end2end tests through the wire
This will be useful to provide additional coverage of the wire in
addition to the very focused WireTests unittests. All tests pass except
the MapWriteAsync ones that aren't implemented in the wire yet. They can
be skipped with --gtest_filter=-*MapWrite*
2018-06-08 13:58:55 +02:00
Corentin Wallez 79d9e16d3c Make Device::CreateSamplerImpl to return a ResultOrError
This will allow backends to do error-handling internally for things like
allocation failures though non of them take advantage of it yet.
2018-05-31 15:00:28 -04:00
Corentin Wallez 50e0986e0e Use Error in Sampler and autogenerated validation functions 2018-05-31 15:00:28 -04:00
Corentin Wallez 1fda980fa6 Add an Error and ResultOrError<T> type and tests
These types are meant to be used for computations that might but are not
expected to fail in backend/, such that the error case can be much
slower than the success case.

The NXT_TRY and NXT_TRY_RESULT macros are added to help write more
concise code that uses Error and ResultOrError.
2018-05-31 15:00:28 -04:00
Corentin Wallez 44b5ca4aa1 Add a functional-y Result<T, E> class and tests for it.
Implements two optimized versions of Result, one for Result<void, E*> as
a nullable pointer, and one for Result<T*, E*> as a tagged pointer.
2018-05-31 15:00:28 -04:00
Corentin Wallez 2141e960b7 Add NXT_(UN)?LIKELY macros to help with branch prediction 2018-05-31 15:00:28 -04:00
Corentin Wallez b1341db700 Add a NXT_NO_DISCARD that is C++17 [[nodiscard]] where available 2018-05-31 15:00:28 -04:00
Corentin Wallez b711b9b2c9 Add a GetDefaultSamplerDescriptor helper. 2018-05-23 14:03:51 -04:00
Corentin Wallez 5101d57972 WireTests: Add a test for sending structs of non-object values 2018-05-23 14:03:51 -04:00
Corentin Wallez 99c6fa2f55 WireTests: introduce a MatchesLambda GMock helper 2018-05-23 14:03:51 -04:00
Corentin Wallez 1ae19e8276 Change Sampler creation to use a descriptor instead of a builder 2018-05-23 14:03:51 -04:00
Corentin Wallez 2ee315ca64 Make WireTests not rely on SamplerBuilder
The sampler builder will be removed as the first builder being converted
to a descriptor. Use CommandBufferBuilder instead as it is not expected
to change soon.
2018-05-23 14:03:51 -04:00
Corentin Wallez e8c8f020fb Factor autogen validation utilities out of ProcTable 2018-05-23 14:03:51 -04:00
Corentin Wallez 7d95c40163 Factor CMakeLists backend ProcTable generation 2018-05-23 14:03:51 -04:00
Corentin Wallez 8d6b5d2337 Rename RenderPassInfo to RenderPassDescriptor 2018-05-16 11:18:14 -04:00
Corentin Wallez 6f7749cce9 Change render passes from multi to single pass.
This as an API change to get closer to the direction in which WebGPU is
headed. The API change in next.json caused a ton of files to be changed
in the same commit to keep things compiling.

API: the Framebuffer and RenderPass objects are now merged in a single
RenderPassInfo that contains the attachments, loadOps and clear values
for a BeginRenderPass command. The concept of subpass is removed.
The RenderPass creation argument to RenderPipelines is replaced by
explicitly setting the format of attachments for RenderPipeline.

Validation: SetPipeline checks are changed to check that the attachments
info set on a RenderPipeline matches the attachments of the render pass.

Backends: Most changes are simplifications of the backends that no
longer require and indirection to query the current subpass out of the
render pass in BeginSubpass, and don't need to get the attachment info
from a RenderPass when creating RenderPipelines. In the Vulkan backend,
a VkRenderPass cache is added to reuse VkRenderPasses between
RenderPassInfos and RenderPipelines.

Tests and examples: they are updated with the simplified API. Tests
specific to the Framebuffer and RenderPass objects were removed and
validation tests for RenderPassInfo were added.

Tested by running CppHelloTriangle on all backends, end2end tests on all
platforms and all examples on the GL backend.
2018-05-16 11:18:14 -04:00
Corentin Wallez 87ec361cc2 Use the binding mask for BGL hashing and comparison 2018-05-16 11:18:14 -04:00
Stephen White f77e3cc648 Don't release things which will be autoreleased. 2018-05-09 11:37:09 -04:00
Corentin Wallez ae27c7a4bc Move HashCombine to HashUtils and make it work better on 64bits
HashCombine will be used in more than just BindGroupLayout caching so we
extract it to a separate header. Add a better mixing constant for 64bit
systems.
2018-05-08 16:51:06 -04:00
Corentin Wallez 60ffbfc071 Add word size detection to Platform.h 2018-05-08 16:51:06 -04:00
Stephen White 8f2050540d Fix a memory leak in metal ShaderModule.
Make the MetalFunctionData object returned by GetFunction() own a
reference to the MTLFunction and release it on destruction.
2018-04-28 00:06:20 -04:00
Stephen White c71cbf7721 Fix leak in Metal's Device::GetPendingCommandBuffer().
GetPendingCommandBuffer() doesn't need to retain the metal
command buffer; it's created with a ref.
2018-04-28 00:03:53 -04:00
Stephen White cce393e0d4 Fix some more memory leaks in the Metal backend. 2018-04-27 11:37:45 -04:00
Stephen White 22b862e052 Fix some leaking builder objects in common backend.
Delete the TextureBuilder created in SwapChainBase::GetNextTexture().
Delete the InputStateBuilder and DepthStencilStateBuilder created in
RenderPipelineBuilder::GetResultImpl().
2018-04-26 13:50:14 -04:00
Corentin Wallez 46d5441557 Vulkan: Implement compute CommandBuffer operations 2018-04-19 13:22:56 -04:00
Corentin Wallez 186a5cba87 CommandBufferVk: Lazily set bindgroups in preparation for compute
Also fix PipelineLayoutBase::InheritedGroupsMask
2018-04-19 13:22:56 -04:00
Corentin Wallez 20aa6b9759 Vulkan: Implement ComputePipeline 2018-04-19 13:22:56 -04:00
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 e44b900861 Vulkan: Implement samplers 2018-04-18 15:31:24 -04:00
Corentin Wallez 32cb6fbca0 RenderPassVk: Set the correct number of color attachments 2018-04-17 18:10:57 -04:00
Corentin Wallez 4977fa66a3 VulkanDevice: Request indenpendentBlend.
This is a core NXT feature but wasn't enabled, causing the Vulkan
validation layers to produce an error.
2018-04-17 18:10:57 -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
Corentin Wallez df5a18d883 Fix BindGroupLayout caused by caching.
When a BGL was first created in the cache, it started with an external
refcount of 1 and we then referenced again in
BindGroupLayoutBuilder::GetResultImpl, causing a leak.

Fix this by referencing in the cache lookup only if the BGL already
exists.
2018-04-17 18:10:57 -04:00
Stephen White 51f9987298 Update CommandBufferGL.cpp 2018-04-16 15:31:02 -04:00
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