538 Commits

Author SHA1 Message Date
Chip Davis
a0a93e0cdb MVKPipeline: Don't set blend state for unused attachments.
Some clients always set blend state for all eight attachments, even if
the attachments are unused. Since the attachments are unused, the
expectation is that the corresponding blend states won't matter. But in
Metal, there's no way to tell if an attachment won't be used. So, if you
enable blending on an unused attachment, its pixel format will be
`MTLPixelFormatInvalid`, which doesn't support blending; Metal will
assert on this.
2018-10-03 09:39:42 -05:00
Chip Davis
0171fd46c5 Set the VERTEX_BUFFER feature bit on VK_FORMAT_A2B10G10R10_UNORM_PACK32.
Since we can use it in a vertex buffer now.
2018-10-03 09:37:31 -05:00
Bill Hollings
4fba647123 Optimize scheme configuration and make consistent. 2018-10-03 10:09:47 -04:00
Khronos Group Webmaster
625b33839a
Revert LICENSE to Apache 2.0 2018-10-03 10:06:43 -04:00
Chip Davis
230ec2569e Map VK_FORMAT_A2B10G10R10_UNORM_PACKED to an MTLVertexFormat.
Use `MTLVertexFormatUInt1010102Normalized`. This is the unsigned
equivalent to the signed `MTLVertexFormatInt1010102Normalized`, which we
already use for `VK_FORMAT_A2B10G10R10_SNORM_PACKED`.
2018-10-02 18:24:49 -05:00
Chip Davis
b86e6b2be3 MVKDevice: Correct properties of linear-tiled images.
According to the Vulkan spec, linear-tiled images *may* not be supported
unless certain restrictions are satisfied. That means that
implementations may support features--or restrictions--above and beyond
the restrictions given in the Vulkan spec.

Metal places these limitations on linear textures:
* They must be 2D.
* They may only have one mip level.
* They may only have one array layer.
* They may not be multisampled--sample count must be one.
* On macOS, they may not be used as attachments.
* They may not be depth/stencil textures.
* They may not have a compressed format.

Have `vkGetPhysicalDeviceFormatProperties()` and
`vkGetPhysicalDeviceImageFormatProperties()` return results consistent
with these constraints. Also, allow creation of linear textures with
usages other than `VK_IMAGE_USAGE_TRANSFER_{SRC,DST}_BIT`.
2018-10-02 18:14:33 -05:00
Chip Davis
6da32e55b0 MVKDeviceMemory: Allow dedicated allocations to forget their resources.
Otherwise, if the resource is destroyed first (which it almost always
will be), then when the `VkDeviceMemory` is freed, it will access a
freed resource, at which point it will then proceed to fandango on core.
2018-10-02 18:00:38 -05:00
Chip Davis
9490e96164 MVKPipeline: Fix getting the vertex attribute divisor struct.
Bah. I read the spec wrong. It's hung off the vertex input state, not
the top-level create info.
2018-10-02 18:00:13 -05:00
Bill Hollings
b296f51153 Fix descriptive comments in fetchDependencies script. 2018-10-02 15:14:33 -04:00
Bill Hollings
a3f571e89b Include version number in VK_MVK_moltenvk extension functions that pass structs that might change. 2018-10-02 12:48:51 -04:00
Bill Hollings
70dae8946a
Merge pull request #290 from billhollings/master
Allocate MVKDescriptorSets from a pool within MVKDescriptorPool.
2018-10-01 16:59:57 -04:00
Bill Hollings
05e028084b Update What's New document. 2018-10-01 16:32:50 -04:00
Bill Hollings
c933330406 Allocate MVKDescriptorSets from a pool within MVKDescriptorPool,
keyed by MVKDescriptorSetLayout reference.

Add MVKObjectPool subclass MVKDeviceObjectPool.
Enlarge window dimensions on macOS Cube demo.
2018-09-30 18:07:13 -04:00
Bill Hollings
26c7b69a3f
Merge pull request #288 from billhollings/master
Update glslang version and What's New document.
2018-09-27 22:36:08 -04:00
Bill Hollings
cded63b008 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-09-27 18:21:05 -04:00
Bill Hollings
9f28854a2a Update glslang version and What's New document. 2018-09-27 18:20:20 -04:00
Bill Hollings
dc0da2ceb6
Merge pull request #287 from cdavis5e/render-area
Use the passed render area to set the render target extent.
2018-09-27 18:17:25 -04:00
Chip Davis
6f1c97966c Use the passed render area to set the render target extent.
Use the smaller of the render area and the framebuffer area.
2018-09-27 16:29:37 -05:00
Bill Hollings
7ffc5bd806
Merge pull request #286 from cdavis5e/resource-array-dynamic-indexing
Support the shader{Sampled,Storage}ImageArrayDynamicIndexing feature.
2018-09-27 17:27:11 -04:00
Bill Hollings
dfcc815c82
Merge pull request #285 from cdavis5e/tsan-build
Build the dylib with -fsanitize=thread when tsan is enabled.
2018-09-27 17:25:50 -04:00
Khronos Group Webmaster
7953a73016
Update LICENSE
Change Apache 2.0 to Khronos Apache 2.0 CLA
2018-09-27 17:09:36 -04:00
Bill Hollings
8c58c0bf72
Merge pull request #284 from cdavis5e/no-attachments
Add a dummy attachment in case no attachments were specified.
2018-09-27 16:29:06 -04:00
Chip Davis
fcbbdc1948 Support the shader{Sampled,Storage}ImageArrayDynamicIndexing feature.
Update SPIRV-Cross to support dynamic indexing on iOS 10... and to
actually support arrays of input buffers (which should've been present
before I flipped the `shader{Uniform,Storage}BufferArrayDynamicIndexing`
switch).

Bump patch version.

Fixes #96.
2018-09-27 13:11:55 -05:00
Chip Davis
522793e680 Build the dylib with -fsanitize=thread when tsan is enabled. 2018-09-27 11:27:36 -05:00
Chip Davis
f9022614bb Add a dummy attachment in case no attachments were specified.
Metal currently requires at least one attachment, in order to define the
size of the render target area (and thus, how many times to run the
fragment shader). Vulkan, however, allows specifying no attachments. In
that case, the size of the render target area comes from the extent and
layer count of the framebuffer object. Since Metal doesn't let you (at
least on macOS) define the render target area without an attachment, we
have to supply a dummy attachment that will be discarded once rendering
is complete.

When possible, the render target uses the memoryless storage mode,
falling back to private when that isn't supported. It is marked as
volatile, and its load and store actions are set to "don't care." The
texture is retained for the lifetime of the subpass.
2018-09-26 21:00:07 -05:00
Bill Hollings
99a242e167 Allocate MVKCommandBuffers from a pool within MVKCommandPool.
Add support for trimming command pools.
2018-09-26 18:31:31 -04:00
Bill Hollings
4c5f7b8b0d
Merge pull request #281 from billhollings/master
Update What's New document.
2018-09-25 14:22:36 -04:00
Bill Hollings
dfa27ecc61 Update SPRIV-Cross version. 2018-09-25 13:47:43 -04:00
Bill Hollings
166ff6adf5 Update What's New document. 2018-09-25 13:09:36 -04:00
Bill Hollings
1f7bd607d1
Merge pull request #280 from cdavis5e/fix-dedicated-alloc-segfault
MVKResource: Check that a VkDeviceMemory is nonnull before using it.
2018-09-25 12:01:26 -04:00
Bill Hollings
c89d22fc31
Merge pull request #279 from cdavis5e/vertex-attribute-divisor
Support the VK_EXT_vertex_attribute_divisor extension.
2018-09-25 11:59:49 -04:00
Chip Davis
f1888dff95 MVKResource: Check that a VkDeviceMemory is nonnull before using it. 2018-09-25 10:21:08 -05:00
Chip Davis
d667f570f6 Support the VK_EXT_vertex_attribute_divisor extension. 2018-09-25 10:19:05 -05:00
Bill Hollings
1533fdda39
Merge pull request #278 from cdavis5e/fix-query-deadlock
MVKQueryPool: Shunt copying results off to another thread.
2018-09-25 10:56:29 -04:00
Bill Hollings
ec32a16971
Merge pull request #276 from cdavis5e/fence-sitter-race
MVKFenceSitter: Put a hash table read behind the lock.
2018-09-25 10:51:07 -04:00
Bill Hollings
873bceabe5
Merge pull request #275 from cdavis5e/3d-subviews
Better support subviews of 3D textures.
2018-09-25 10:48:11 -04:00
Bill Hollings
21cb79df09
Merge pull request #274 from cdavis5e/render-target-size
vkRenderPass: Set renderTargetWidth and renderTargetHeight when possible.
2018-09-25 10:47:48 -04:00
Bill Hollings
6b18bd2e40
Merge pull request #273 from cdavis5e/sampler-mirror-clamp-to-edge
Advertise the VK_KHR_sampler_mirror_clamp_to_edge extension.
2018-09-25 10:47:31 -04:00
Chip Davis
6ec39da6b2 MVKQueryPool: Shunt copying results off to another thread.
Copying the results could block if the client said to wait. If this
completion handler runs before the one that actually finishes the
queries--and it will if it's scheduled first--it will block
indefinitely, causing a deadlock. Instead, run this on a different
dispatch queue; then the query will be allowed to finish.
2018-09-25 08:55:13 -05:00
Chip Davis
dd367fea0c MVKFenceSitter: Put a hash table read behind the lock.
To avoid a data race. Caught this with `ThreadSanitizer`.
2018-09-24 17:12:23 -05:00
Chip Davis
5f5f2243c2 Better support subviews of 3D textures.
Now when we set up the `MTLRenderPassAttachmentDescriptor` for the 3D
texture, we set the `depthPlane` property instead of the `slice`
property. Combined with an appropriate setting for
`renderTargetArrayLength` in the base descriptor, this allows rendering
to a subset of a 3D texture.
2018-09-24 16:35:19 -05:00
Chip Davis
74e0ce8962 vkRenderPass: Set renderTargetWidth and renderTargetHeight when possible.
These properties were introduced in Metal 2.0 on iOS. (They don't exist
yet on Mac.) Currently, they are only used to constrain the size of the
render target area. Perhaps someday, they may be used to support render
passes with no render target attachments. For now, though, Metal doesn't
support that.
2018-09-24 16:30:34 -05:00
Chip Davis
7e050d0584 Advertise the VK_KHR_sampler_mirror_clamp_to_edge extension.
We already support this extension. The enumerant added by this extension
is already mapped to its Metal equivalent. Only advertise the extension
on macOS, though. iOS doesn't support this.
2018-09-24 16:27:37 -05:00
Bill Hollings
ac10059a6b
Merge pull request #272 from cdavis5e/khr-maintenance2
Support the VK_KHR_maintenance2 extension.
2018-09-24 17:24:20 -04:00
Chip Davis
3b65e20936 Validate the image view config after setting the usage.
It's not convenient to get the usage out of the `pCreateInfo`, since
it's tucked away in an extension struct. (Unfortunately, I had assumed
we were already doing this...)
2018-09-24 15:50:03 -05:00
Chip Davis
32d4702265 Support the VK_KHR_maintenance2 extension.
We don't really restrict which usages you can request on an image, so
the `VK_IMAGE_CREATE_EXTENDED_USAGE_BIT` doesn't really apply to us.
Since we don't yet support tessellation, we don't support
`VkPipelineTessellationDomainOriginStateCreateInfo`, either. Finally,
as near as I can tell, we don't really do anything with input
attachments, so any `VkRenderPassInputAttachmentAspectCreateInfo` will
be ignored.

I'm not sure if creating image views of compressed images using an
uncompressed format will work. Metal's docs say texture views between
any two color formats of the same size will work, but they also
specifically call out converting between sRGB and non-sRGB compressed
formats, which implies that, say, creating an `RG32Uint` view on a
`BC1_RGBA` texture may not work. Thus, I've logged any uses of the
`VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT`.
2018-09-24 15:15:07 -05:00
Bill Hollings
aab8b9a798
Merge pull request #271 from cdavis5e/image-format-list
Advertise the VK_KHR_image_format_list extension.
2018-09-21 18:50:05 -04:00
Chip Davis
876ceeb269 Advertise the VK_KHR_image_format_list extension.
We don't actually do anything with the extension struct, but that's OK;
it's just an optimization hint anyway. I'm not sure what we'd do with
this information. It's intended to enable implementations to better
optimize image layouts, but that's under Metal's control in MoltenVK.
2018-09-20 21:24:55 -05:00
Bill Hollings
dd9408fa50
Merge pull request #270 from billhollings/master
Update library dependencies for Vulkan SDK.
2018-09-20 22:02:10 -04:00
Bill Hollings
7051582859 Update library dependencies for Vulkan SDK. 2018-09-20 21:02:39 -04:00