863 Commits

Author SHA1 Message Date
Bill Hollings
8bbbb442b5
Merge pull request #534 from cdavis5e/unneeded-check
vkCmdBlitImage: Remove check for invalid behavior.
2019-03-22 09:38:43 -04:00
Chip Davis
4b0d84e576 vkCmdBlitImage: Remove check for invalid behavior.
According to the Vulkan spec:

> * If either of `srcImage` or `dstImage` was created with a
>   depth/stencil format, the other **must** have exactly the same format

So this should not happen in well-behaved clients.
2019-03-21 15:45:08 -05:00
Bill Hollings
9a14df85af
Merge pull request #532 from billhollings/master
Add correct function entry point handling.
2019-03-21 10:27:34 -04:00
Bill Hollings
bdaf306233 Update VK_KHR_swapchain and VK_KHR_get_surface_capabilities2 extensions.
Add support for VK_KHR_get_surface_capabilities2 extension.
Implement newer VK_KHR_swapchain extension functions.
Fix when the following functions return VK_INCOMPLETE:
    vkGetPhysicalDeviceSurfaceFormatsKHR()
    vkGetSwapchainImagesKHR()
    vkEnumeratePhysicalDevices()
    vkEnumerateInstanceLayerProperties()
    vkGetPhysicalDeviceQueueFamilyProperties()
CTS: Pass supported *.macos.surface.* and *.macos.swapchain.* tests.
Update What's New document.
2019-03-21 08:53:18 -04:00
Bill Hollings
522f3ad0d4 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-03-21 07:07:31 -04:00
Bill Hollings
7dfce32a43
Merge pull request #529 from cdavis5e/ios-no-stg-image-array
MVKDevice: Don't enable the shaderStorageImageArrayDynamicIndexing feature on iOS.
2019-03-20 12:52:22 -04:00
Chip Davis
06babd1cdb Move feature setting into the macOS-specific block. 2019-03-20 10:31:58 -05:00
Chip Davis
0a44de3889 MVKDevice: Don't enable the shaderStorageImageArrayDynamicIndexing feature on iOS.
iOS does not actually support arrays of writable textures. At all.
2019-03-20 09:59:51 -05:00
Bill Hollings
614ac65933 Add correct function entry point handling.
Add MVKEntryPoint struct to track entry points as
instance vs device, and core vs enabled extensions.
Add stubs for newer VK_KHR_swapchain functions.
Pass CTS dEQP-VK.api.version_check.entry_points.
Update What's New document.
2019-03-19 16:43:04 -04:00
Bill Hollings
b97992ffd9
Merge pull request #528 from cdavis5e/host-query-reset
Support the VK_EXT_host_query_reset extension.
2019-03-18 13:41:28 -04:00
Chip Davis
4468f36bc6 Support the VK_EXT_host_query_reset extension.
This allows clients to reset query pools on the host, instead of with a
GPU command.

This updates Vulkan headers to 1.1.104... but, there's a problem. This
change has not been merged to `master` in the `Vulkan-Headers` repo yet,
because of an issue building the C++ binding headers. Luckily, we only
need the core C header.
2019-03-17 19:59:15 -05:00
Bill Hollings
d42d7aac79
Merge pull request #526 from billhollings/master
Update to latest SPIRV-Cross version.
2019-03-16 10:06:34 -04:00
Bill Hollings
19576e031b Update to latest SPIRV-Cross version. 2019-03-16 09:29:17 -04:00
Bill Hollings
26772d5ed7
Merge pull request #525 from billhollings/master
Update to latest SPIRV-Cross version.
2019-03-16 08:41:46 -04:00
Bill Hollings
a2b1e04e8d Update to latest SPIRV-Cross version.
Adapt to API changes resulting from the introduction of the SPIRV-Cross C API.
Update What's New document.
2019-03-15 20:25:55 -04:00
Bill Hollings
0a536b2747
Merge pull request #508 from cdavis5e/tessellation
Add support for tessellation.
2019-03-15 16:39:45 -04:00
Bill Hollings
caba1186e4
Merge branch 'master' into tessellation 2019-03-15 16:11:11 -04:00
Bill Hollings
1b941bf75b
Merge pull request #522 from billhollings/master
Allow zero offset and stride combo in VkVertexInputBindingDescription.
2019-03-14 18:34:31 -04:00
Bill Hollings
e13444e305 Allow zero offset and stride combo in VkVertexInputBindingDescription.
Also fix memory overrun if no VB found with same binding as a VA.
2019-03-14 17:50:20 -04:00
Bill Hollings
e5ebf069ee
Merge pull request #521 from billhollings/master
Fix potential memory leak on synchronous command buffer submission.
2019-03-12 21:19:03 -04:00
Bill Hollings
05b14366da Use autorelease pool for synchronous command buffer submissions also. 2019-03-12 17:36:01 -04:00
Chip Davis
6061614895 Fix case where all attributes are skipped.
If none of the attributes in a buffer is used but still present, then
the offset will be non-zero, leading us to set a non-zero stride for a
vertex buffer that is not used. This is invalid.

Fixes tessellation in Final Fantasy XIV.
2019-03-11 14:19:49 -05:00
Chip Davis
d50e654acd Fix a possible race condition around MVKMTLBufferAllocation.
I don't think a race is actually possible here, but this makes Thread
Sanitizer happy.
2019-03-11 14:19:49 -05:00
Chip Davis
a1be5a37d3 Fix broken indirect non-tessellated draws. 2019-03-11 14:19:49 -05:00
Chip Davis
d7e0167b43 Fix more brokenness. 2019-03-11 14:19:49 -05:00
Chip Davis
1069786f25 Fix a broken change from the last commit. 2019-03-11 14:19:49 -05:00
Chip Davis
34047f83f9 Only compile in tessellation support kernels on Metal 1.2+.
And set the stage-in indirect params on 2.1+. I missed this when I added
setting the stage-in region.
2019-03-11 14:19:49 -05:00
Chip Davis
4fa4941551 Update SPIRV-Cross yet again. 2019-03-11 14:19:49 -05:00
Chip Davis
cb8a678c28 Fix stride of stage input arrays to tessellation shaders.
These should be set to the alignment of the first member of the output
struct. This fixes the `dEQP-VK.tessellation.common_edge.*` tests.
2019-03-11 14:19:49 -05:00
Chip Davis
069ee53ac5 Exclude the PointSize builtin when we're not rendering points.
And fix a silly mistake I made setting up the tess. control stage
pipeline.
2019-03-11 14:19:49 -05:00
Chip Davis
403d52d9fa Correct passing the tessellation level builtins around. 2019-03-11 14:19:49 -05:00
Chip Davis
075792e436 Reverse tessellation windings from SPIR-V.
Because we flip the direction of `y`, we need to reverse the windings.
2019-03-11 14:19:49 -05:00
Chip Davis
bfdf0c4233 Set the stage in region for tess. control invocations.
Otherwise, Metal won't fetch any stage input.
2019-03-11 14:19:49 -05:00
Chip Davis
ccc1a32426 Update SPIRV-Cross again to pull in some fixes. 2019-03-11 14:19:49 -05:00
Chip Davis
b78235045c Fix a reversed condition.
I have to stop doing that...
2019-03-11 14:19:49 -05:00
Chip Davis
58dbdcdab4 Make sure there's enough space in the tess ctl output buffer. 2019-03-11 14:19:49 -05:00
Chip Davis
79d434553c Add support for tessellation.
At long last, tessellation comes to MoltenVK! With this change, clients
will now be able to specify tessellation shaders when creating
pipelines, and then draw tessellated patches with them.

Unfortunately, there seem to be a few gotchas with tessellation in
Metal. For one thing, tessellation pipelines in Metal are structured
very differently from Vulkan. There is no tessellation control or even
vertex stage. Instead, the tessellation evaluation shader takes the
place of the vertex function as a "post-tessellation vertex function."
The tessellation levels are supplied in a buffer to the tessellator,
which you are expected to populate. The most common way to do this is by
running a compute shader. MoltenVK thus runs the vertex shader and
tessellation control shader by themselves; a single `VkPipeline` object
then requires at least *three* `MTLPipelineState` objects.

But wait, there's more! The tessellation-control-as-compute stage uses
Metal's support for vertex-style stage input to a compute shader. But,
this support requires one to declare indexing *ahead of time*, when the
pipeline state is created. So a single `VkPipeline` object could have as
many as *five* `MTLPipelineState` objects.

Further, if there are more output than input control points for the
tessellation control stage, then later invocations may end up fetching
the wrong attributes! To get around this, this change uses index buffers
to ensure that all tessellation control shaders see the correct input.
Unfortunately, in the indexed draw case, this means that the incoming
index buffer needs to be munged.

Instancing is another pain point here. In Vulkan, as in OpenGL and
Direct3D, instancing is done in the vertex shader; but in Metal, it is
done at the tessellation evaluation stage. For this reason, only the
vertex stage of a tessellated draw supports instancing. Additional
memory is required to hold data for the extra vertices generated by
instancing. This also requires still more munging of index buffers for
indexed draws.

Indirect draws are even more painful. Because the number of vertices and
instances is unknown, storage for the maximum possible number of
vertices must be allocated. This change imposes a totally arbitrary
limit of 131072 vertices from a single draw, including all vertices
generated by instancing. On a Mac, this requires about 194-256 MB of
VRAM for all the temporary buffers.

There are some possible optimizations here. If we could prove that the
vertex shader's output doesn't depend on the instance ID, either
directly or through a per-instance attribute, then we could avoid
running the vertex and tess. control stages per instance, and take
advantage of Metal's support for tess. eval instancing. If we could
also prove that the vertex shader simply passes instance attributes
through (similarly with the tess. control shader), we could do this for
many more instanced draws as well. It should also be possible to cache
the output from the tess. control stage; if the draw comes up again, we
can then skip the vertex and tess. control stages entirely!

Fixes #56 and #501.
2019-03-11 14:19:49 -05:00
Bill Hollings
f10150a9fe Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-03-08 11:36:28 -05:00
Bill Hollings
309efa7068
Merge pull request #519 from alexey-lysiuk/deps_error_stop
Stop on the first error in fetch dependencies script
2019-03-08 11:18:54 -05:00
alexey.lysiuk
d015381fa3 Stop on the first error in fetch dependencies script 2019-03-08 10:58:06 +02:00
Bill Hollings
ae0db194c5 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-03-06 16:28:38 -05:00
Bill Hollings
2a2072294b MoltenVKShaderConverterTool support cs & csh for compute shader file extensions. 2019-03-06 16:27:52 -05:00
Bill Hollings
40097d79b5
Merge pull request #518 from billhollings/master
Increase shader float constant accuracy beyond 6 digits of precision.
2019-03-06 09:53:01 -05:00
Bill Hollings
3b1e53002e Increase shader float constant accuracy beyond 6 digits of precision. 2019-03-06 08:58:27 -05:00
Bill Hollings
e4f79af39c
Merge pull request #515 from billhollings/master
Update What's New document.
2019-02-27 19:39:20 -05:00
Bill Hollings
d8ee4873b6 Update What's New document. 2019-02-27 18:04:42 -05:00
Bill Hollings
1fbc1333f8 Update What's New document.
Fix issue loading from Vulkan-Portability_repo_revision in fetchDependencies.
2019-02-27 17:47:15 -05:00
Bill Hollings
7bdd12ea4f
Merge pull request #513 from billhollings/master
Update to latest dependency libraries to support SDK 1.1.101.
2019-02-27 14:34:24 -05:00
Bill Hollings
fd8aa3c412 Update to latest dependency libraries to support SDK 1.1.101.
Remove SPRIV-Cross source files erroneously compiling into libglslang.a.
2019-02-27 11:56:31 -05:00
Bill Hollings
e54e21dbca
Merge pull request #512 from billhollings/master
Set MSL version for shader compiling from Metal feature set.
2019-02-25 22:14:05 -05:00