1860 Commits

Author SHA1 Message Date
Bill Hollings
78c58cc026 Add validation policy for MoltenVK development to README.md document.
Remove unnecessary image view format validation.
2020-10-02 12:22:32 -04:00
Bill Hollings
0673e63b18 MVKImage avoid texel buffer for atomics if view format list
exists and does not include either R32_UINT or R32_SINT format.
2020-10-02 10:24:29 -04:00
Bill Hollings
08f14d25e4 Propagate VkImageFormatListCreateInfo from mutable format swapchain to swapchain images. 2020-10-01 17:22:52 -04:00
Bill Hollings
4dee7c288d MVKImageView remove obsolete test for nil image.
Update What's New document.
2020-10-01 15:23:15 -04:00
Bill Hollings
f0029f823f Use VK_KHR_image_format_list to disable MTLTextureUsagePixelFormatView where possible.
MVKImage track VkImageFormatListCreateInfo::pViewFormats
and validate MVKImageView format against them.
Add MVKImage::getMTLTextureUsage() and move tests for dedicated aliasables,
compressed formats, and minimum image usage into it.
Add MVKMTLFormatDesc::mtlPixelFormatLinear and
MVKPixelFormats::compatibleAsLinearOrSRGB()
to track linear counterparts to each Metal sRGB format.
Don't use MTLTextureUsagePixelFormatView if image will only
allow views that use same format or its sRGB/linear variation.
2020-10-01 14:58:36 -04:00
Bill Hollings
a31d87f0b4
Merge pull request #1084 from cdavis5e/fix-1064-2
MVKCmdCopyImage: Fix another copy-pasto.
2020-09-29 12:50:33 -04:00
Chip Davis
23895bd988 MVKCmdCopyImage: Fix another copy-pasto. 2020-09-29 11:17:19 -05:00
Bill Hollings
70bb297b24
Merge pull request #1082 from cdavis5e/fix-1064
MVKCmdCopyImage: Fix a copy-pasto.
2020-09-28 21:00:44 -04:00
Bill Hollings
eb7f5cabc2
Merge pull request #1081 from billhollings/update-ext-libs
Update dependency libraries to match Vulkan SDK 1.2.154.
2020-09-28 20:59:27 -04:00
Chip Davis
7c001fb666 MVKCmdCopyImage: Fix a copy-pasto.
I know I said I wouldn't have any more, but this fixes a problem with
my change #1064 that could trip Metal's validation layer and/or result in
no data being copied.
2020-09-28 18:35:25 -05:00
Bill Hollings
9f2fc8f7d0 Update dependency libraries to match Vulkan SDK 1.2.154. 2020-09-28 19:03:00 -04:00
Bill Hollings
ec7189b3f7
Merge pull request #1080 from cdavis5e/display-timing-use-after-free
MVKSwapchainImage: Retain image and swapchain until presentation is done.
2020-09-28 13:27:25 -04:00
Bill Hollings
ccd9592d61
Merge pull request #1076 from cdavis5e/mux-switch-swapchain
MVKDevice: Only force a mux switch when a swapchain is created.
2020-09-28 12:59:39 -04:00
Chip Davis
9d21231fc2 MVKSwapchainImage: Retain image and swapchain until presentation is done.
Fixes use-after-free bugs in `VK_GOOGLE_display_timing` support.
2020-09-28 11:28:55 -05:00
Bill Hollings
1831eb9f38
Merge pull request #1079 from cdavis5e/indexed-non-indexed-tess-draw
MVKPipeline: Don't rely on the index buffer to tell apart indexed draws.
2020-09-28 12:02:52 -04:00
Bill Hollings
442f586007
Merge pull request #1078 from cdavis5e/fill-buffer-round-down
MVKCmdFillBuffer: Round size down, not up.
2020-09-28 12:01:18 -04:00
Bill Hollings
3dad0c6a04
Merge pull request #1077 from cdavis5e/end-query-outside-rp
MVKQueryPool: Fix ending a query outside a render pass.
2020-09-28 11:56:32 -04:00
Bill Hollings
cff0b6bc7a
Merge pull request #1075 from cdavis5e/shader-subgroup-extended-types
Advertise the VK_KHR_shader_subgroup_extended_types extension.
2020-09-28 11:54:45 -04:00
Bill Hollings
299a937887
Merge pull request #1073 from cdavis5e/aliasable-dedicated-alloc
Allow multiple images for dedicated allocs of aliasabled images.
2020-09-28 11:50:04 -04:00
Chip Davis
481fe3553d MVKPipeline: Don't rely on the index buffer to tell apart indexed draws.
This was a good heuristic, because the index buffer must be bound for
indexed draws. However, it may also be bound for non-indexed draws--for
example, if an indexed draw were immediately followed by a non-indexed
draw, as happens in some `dEQP-VK.synchronization.*` tests. Therefore,
we can't tell from the presence or absence of the index buffer what kind
of draw we're in. We'll have to keep track of this state in the command
encoder.
2020-09-28 00:43:53 -05:00
Chip Davis
5794503876 MVKCmdFillBuffer: Round size down, not up.
According to the Vulkan spec:

> If `VK_WHOLE_SIZE` is used and the remaining size of the buffer is not
> a multiple of 4, then the nearest **smaller** multiple is used.
> [emphasis added]

Therefore, we should round down when calculating the number of words to
write.
2020-09-26 01:20:57 -05:00
Chip Davis
bbe45e4a8a MVKQueryPool: Fix ending a query outside a render pass.
I missed this when I fixed occlusion queries begun outside a render
pass.
2020-09-25 15:24:50 -05:00
Chip Davis
ee59948ed8 MVKDevice: Only force a mux switch when a swapchain is created.
We only want the window server to use the high-performance GPU if we
will use it to present to the display. If we won't use it to present, we
can save some battery life by not using the display. I had hoped this
would help window server stability in case something goes horribly
wrong while using the GPU, but my experience has sadly not borne this
out.

My testing shows that the device returned by
`MTLCreateSystemDefaultDevice()` is exactly equal (i.e. has the same
pointer value) to one of the devices returned by `MTLCopyAllDevices()`,
so we should see no problems from doing this at swapchain create time
instead of device create time.
2020-09-25 15:16:01 -05:00
Chip Davis
0a7d2af989 Advertise the VK_KHR_shader_subgroup_extended_types extension.
I anticipated this, and I tried to design the support in SPIRV-Cross so
that this would just work. And they do... well, they work as well as
32-bit types currently do, which is to say, there's plenty of room for
improvement.
2020-09-25 15:13:12 -05:00
Chip Davis
9321b5553f Allow multiple images for dedicated allocs of aliasable images.
Believe it or not, this is valid usage. If an image is aliasable and it
has a dedicated alloc, it is valid for multiple images to bind to the
dedicated memory. Some tests actually try this--for example, the
`dEQP-VK.device_group.afr_dedicated` test.
2020-09-25 15:11:36 -05:00
Bill Hollings
f319e9bd68
Merge pull request #1074 from cdavis5e/layered-subpass-input
MVKPipeline: Use arrayed textures for layered subpass input.
2020-09-25 14:20:17 -04:00
Chip Davis
f1cbac1629 MVKPipeline: Use arrayed textures for layered subpass input.
Normally, we would have to check the framebuffer, but we don't know its
contents until draw time. To avoid yet another situation where we must
compile multiple pipelines, I've used a simple heuristic: if the vertex
pipeline writes to `BuiltInLayer`, this is likely for a layered
framebuffer, and we should use `texture_2darray` for subpass input.
Hopefully this is good enough for all intents and purposes. If not, then
we really will have to wait until draw time. And God help us if someone
try to do this with a 3D texture!
2020-09-25 10:30:42 -05:00
Bill Hollings
655b15a609
Merge pull request #1072 from cdavis5e/subgroup-size-vendor
MVKPhysicalDevice: Get the vendor ID before setting the subgroup size.
2020-09-25 10:52:21 -04:00
Bill Hollings
4e6930d9d9
Merge pull request #1069 from cdavis5e/2d-attachment-view
MVKImageView: Use a 2D non-arrayed view for 2D non-arrayed attachments.
2020-09-25 10:19:50 -04:00
Chip Davis
ce0c107317 MVKPhysicalDevice: Get the vendor ID before setting the subgroup size.
At this point in device initialization, the device properties have not
yet been initialized. Unfortunately, this includes the vendor ID, on
which the maximum SIMD-group size depends. Initialize that property so
we can use it to set the subgroup size correctly.
2020-09-24 21:58:40 -05:00
Chip Davis
832213b0e3 MVKImageView: Use a 2D non-arrayed view for 2D non-arrayed attachments.
If a shader uses an input attachment and doesn't do layered rendering,
but the image view is of type `MTLTextureType2DArray`, Metal's
validation layer will complain about the texture type mismatching what
the shader expects. This change makes the texture types line up.
2020-09-24 19:56:01 -05:00
Bill Hollings
6588ac8fd5
Merge pull request #1071 from cdavis5e/render-area-size-min
Ensure there is at least one pixel in the render area.
2020-09-24 17:50:09 -04:00
Bill Hollings
9f0a9ebcda
Merge pull request #1070 from billhollings/master
Fix memory overrun when enabling VkPhysicalDevicePortabilitySubsetFeaturesKHR features.
2020-09-24 17:49:00 -04:00
Bill Hollings
18dd6fa7aa
Merge pull request #1068 from cdavis5e/zero-divisor-base-instance
Offset vertex buffers for attribute bindings with zero divisors.
2020-09-24 17:37:19 -04:00
Chip Davis
86d5310736 Ensure there is at least one pixel in the render area.
If there are no attachments and `renderTargetWidth` and
`renderTargetHeight` are zero, the Metal validation layer complains. To
prevent this, ensure both are at least 1.
2020-09-24 15:45:22 -05:00
Bill Hollings
fa963bfd91 Fix memory overrun when enabling VkPhysicalDevicePortabilitySubsetFeaturesKHR features.
Update MoltenVK_icd.json to tell Vulkan Loader and Layers to use Vulkan 1.1.
2020-09-24 16:28:32 -04:00
Chip Davis
c377de9748 Offset vertex buffers for attribute bindings with zero divisors.
One aspect of the `VK_EXT_vertex_attribute_divisor` spec that I
apparently missed is that, for a vertex buffer binding with a divisor of
0, the base instance determines where the attributes are read from. This
cannot be expressed in Metal, but we can emulate it by offseting the
buffer by `firstInstance * stride`.

Unfortunately, we can't do this for indirect draws. If a program tries
this, we're hosed.
2020-09-24 10:21:05 -05:00
Bill Hollings
dea8fd4fd1
Merge pull request #1066 from billhollings/kill-opts
fetchDependencies builds serially by default.
2020-09-23 15:34:22 -04:00
Bill Hollings
92336c597a
Merge pull request #1067 from billhollings/setmtltex
vkSetMTLTextureMVK() Fix crash if incoming MTLTexture does not have an IOSurface.
2020-09-23 15:34:01 -04:00
Bill Hollings
eb706ea40c Update What's New document. 2020-09-23 15:04:52 -04:00
Bill Hollings
00f7535f32 fetchDependencies builds serially by default.
Building in parallel does not significantly improve performance, and makes it
more difficult to integrate calling fetchDependencies from a larger build script,
because of the need to trap and kill child processes on an error.
2020-09-23 14:55:13 -04:00
Bill Hollings
f58da7675c
Merge pull request #1054 from billhollings/master
Merge xcode12 branch into master.
2020-09-23 14:40:18 -04:00
Bill Hollings
6ebb20ebf5
Merge pull request #1064 from cdavis5e/layered-copies
MVKCmdCopyImage: Use the method to copy multiple slices when possible.
2020-09-23 13:54:43 -04:00
Chip Davis
4b7111d650
Merge pull request #1065 from cdavis5e/tvos-fixes
Really fix tvOS build.
2020-09-23 12:44:53 -05:00
Chip Davis
ef6848165a Really fix tvOS build. 2020-09-23 12:15:25 -05:00
Bill Hollings
4097089f1c vkSetMTLTextureMVK() Fix crash if incoming MTLTexture does not have an IOSurface. 2020-09-23 13:06:25 -04:00
Chip Davis
9334fe8f15 MVKCmdCopyImage: Use the method to copy multiple slices when possible.
When the extent covers both the source and destination images
completely, we can use the copy method on `MTLBlitCommandEncoder` which
can copy multiple slices at once. This should hopefully reduce CPU
overhead and command buffer memory usage.
2020-09-23 12:02:35 -05:00
Bill Hollings
37fb85f1d7 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2020-09-23 12:40:39 -04:00
Bill Hollings
cf3379fea9
Merge pull request #1062 from cdavis5e/layered-resolve
MVKCmdResolveImage: Use layered rendering where possible.
2020-09-23 12:36:56 -04:00
Chip Davis
a56cfd7fb1
Merge pull request #1063 from cdavis5e/tvos-fixes
Fix build errors on tvOS.
2020-09-23 11:25:28 -05:00