2059 Commits

Author SHA1 Message Date
Malcolm Bechard
526779ad66 fix incorrect behavior for MVKCmdResolveImage
fix incorrectly changing first resolve layer's src/dst base layer,
as well and out of bounds access to the mtlResolveSlices array
2021-01-18 22:58:07 -05:00
Bill Hollings
aab7c01a17
Merge pull request #1202 from markreidvfx/master
Support immmutableSamplers with sampler arrays, fixes #1181
2021-01-10 11:19:13 -05:00
Mark Reid
40cd45d4d7 Support immmutableSamplers with sampler arrays, fixes #1181 2021-01-09 19:57:39 -08:00
Bill Hollings
15bf3d45c5
Merge pull request #1198 from cdavis5e/memoryless-build-fix
MVKRenderPass: Only use MTLStorageModeMemoryless where available.
2021-01-06 09:46:33 -05:00
Chip Davis
2eb0fe6947 MVKRenderPass: Only use MTLStorageModeMemoryless where available.
Fixes #1197.
2021-01-05 22:44:55 -06:00
Bill Hollings
1ad099883d
Merge pull request #1194 from cdavis5e/apple-gpu-render-granularity
MVKRenderPass: Use a non-trivial granularity for TBDR GPUs.
2021-01-04 10:57:55 -05:00
Chip Davis
930525f289 MVKRenderPass: Use a non-trivial granularity for TBDR GPUs.
This parameter is intended to indicate the optimal granularity for the
render area. For TBDR GPUs, this will be the tile size. IMR GPUs
continue to use 1x1.

Apple GPUs support tile sizes of 16x16, 32x16, and 32x32. But, we can't
read the tile size used for a Metal render pass until a render command
encoder has been created. So for now, hardcode 32x32 for TBDR GPUs.
2020-12-31 13:18:11 -06:00
Bill Hollings
34dc378371
Merge pull request #1191 from cdavis5e/apple-gpu-barriers
Don't use barriers in render passes on Apple GPUs.
2020-12-31 09:40:17 -05:00
Chip Davis
d22d9e3d17 Don't use barriers in render passes on Apple GPUs.
Apple GPUs don't support them, and in fact Metal's validation layer will
complain if you try to use them.
2020-12-30 15:09:53 -06:00
Bill Hollings
e9bc3b3c62
Merge pull request #1193 from cdavis5e/memoryless-host-accessibility
MVKDeviceMemory: Don't consider Memoryless host-accessible on macOS/tvOS.
2020-12-30 10:11:24 -05:00
Bill Hollings
c985bbf4c3
Merge pull request #1192 from cdavis5e/memoryless-rt-actions
MVKRenderPass: Don't use Load/Store actions for memoryless.
2020-12-30 10:06:09 -05:00
Bill Hollings
4f0d370166
Merge pull request #1190 from cdavis5e/render-rgb9e5-mask
MVKGraphicsPipeline: Fix color write mask with RGB9E5 RTs.
2020-12-30 09:52:29 -05:00
Bill Hollings
326e872a65
Merge pull request #1189 from cdavis5e/sync-create-texture
MVKImagePlane: When sync'ing, create the texture if it doesn't exist.
2020-12-30 09:48:34 -05:00
Bill Hollings
8dce95b8e2
Merge pull request #1188 from cdavis5e/apple-gpu-linear-rt
MVKPixelFormats: Enable RenderTarget usage for linear textures on Apple GPUs.
2020-12-30 09:47:32 -05:00
Chip Davis
4d6b92bb9c MVKDeviceMemory: Don't consider Memoryless host-accessible on macOS/tvOS.
I missed this when I added support for memoryless on macOS.
2020-12-29 21:21:02 -06:00
Chip Davis
aa65392027 MVKRenderPass: Don't use Load/Store actions for memoryless.
Memoryless textures cannot use `Load`/`Store` actions, because there is
no memory to load from or store to. So don't use these actions, even if
we're not rendering to the whole thing.

Multiple subpasses might be a problem. Tessellation and indirect
multiview *will* be problems, because these require us to interrupt the
render pass in order to do compute--and that causes us to use `Store`
unconditionally.

One option, which I've mentioned before, is using tile shaders for these
cases. But I haven't looked seriously into that yet. The other involves
a subtle distinction between Metal's `MTLStorageModeMemoryless` and
Vulkan's `VK_MEMORY_TYPE_LAZILY_ALLOCATED_BIT`: the former *never*
commits memory; while the latter doesn't commit memory *at first*, but
may do so later. If we find that we're going to need to `Store` to a
`LAZILY_ALLOCATED` image, then what we can do is replace the
`Memoryless` texture with one with a real backing store in `Private`
memory. This change does not do that yet. It'll require some more
thought.

As for multiple subpasses, I eventually want to look into optimizing
render passes by shuffling the subpasses around to minimize the need to
load and store attachments from/to memory, which TBDR GPUs absolutely
hate. That should help with this problem, too.
2020-12-29 21:19:18 -06:00
Chip Davis
e6a8409b31 MVKGraphicsPipeline: Fix color write mask with RGB9E5 RTs.
Metal does not allow color write masks with this format where some but
not all of the channels are disabled. Either all must be enabled or none
must be enabled. Presumably, this is because of the shared exponent.

This is just good enough to stop the validation layer from violently
terminating the program. To implement this properly requires using
framebuffer fetch, with a change to SPIRV-Cross. Luckily, the only GPUs
that support `RGB9E5` rendering also support framebuffer fetch.
Honestly, I don't understand why Apple's drivers don't do this.
2020-12-29 21:15:14 -06:00
Chip Davis
f875055ecd MVKImagePlane: When sync'ing, create the texture if it doesn't exist.
Before we can upload the texture, we need to make sure there is a
texture to upload to.
2020-12-29 21:13:43 -06:00
Chip Davis
1bbab6151a MVKPixelFormats: Enable RenderTarget usage for linear textures on Apple GPUs.
I forgot to do this when I added the `renderLinearTexture` feature.
2020-12-29 21:12:14 -06:00
Bill Hollings
a55cf399b5
Merge pull request #1184 from billhollings/update-1.1.2
Update MoltenVK to version 1.1.2.
2020-12-26 14:38:37 -05:00
Bill Hollings
94a81177cb Update MoltenVK to version 1.1.2.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 30.
Update What's New document.
2020-12-26 13:45:10 -05:00
Bill Hollings
b8f044eaaf
Merge pull request #1179 from js6i/no_fast_math
Config: Added setting for fastMathEnabled Metal Compiler option.
2020-12-14 13:11:33 -05:00
Jan Sikorski
4440a64d83 Config: Added setting for fastMathEnabled Metal Compiler option.
Set it to false by default, as it creates visual glitches in at least one game,
caused by depth fighting between a depth and a color render pass.
2020-12-14 17:41:28 +01:00
Bill Hollings
e8e4218969
Merge pull request #1175 from past-due/github_actions_1
Add GitHub Actions CI
2020-12-09 17:33:33 -05:00
past-due
12981c063a GitHub Actions: Remove explicit --no-parallel-build parameter 2020-12-09 15:19:17 -05:00
past-due
41cfcdbac0 Remove .travis.yml 2020-12-09 15:15:33 -05:00
past-due
c676480e5f GitHub Actions: Output full dependency build logs (on failure) 2020-12-09 15:15:33 -05:00
past-due
7a92c39a77 GitHub Actions: Skip building Demos 2020-12-09 15:15:33 -05:00
past-due
c81b666bae fetchDependencies: Support xcpretty (if available) 2020-12-09 15:15:33 -05:00
past-due
2657ee59a5 GitHub Actions: Use Makefile 2020-12-09 11:20:19 -05:00
past-due
32abeab722 Makefile: Support xcpretty (if available), falling back to xcodebuild -quiet parameter 2020-12-09 11:20:19 -05:00
past-due
3443a94407 GitHub Actions: Cache dependencies 2020-12-09 11:20:19 -05:00
past-due
aa46313ae6 GitHub Actions: Upload artifacts 2020-12-09 11:20:19 -05:00
past-due
c39f156ed9 GitHub Actions: Use xcpretty 2020-12-09 11:20:19 -05:00
past-due
b93d60f9ee Add GitHub Actions CI 2020-12-09 11:20:19 -05:00
Bill Hollings
49de6604b0
Merge pull request #1177 from billhollings/sdk-1.2.162
Update dependency libraries to match Vulkan SDK 1.2.162.
2020-12-09 10:12:20 -05:00
Bill Hollings
1ccc0ab7b5 Update dependency libraries to match Vulkan SDK 1.2.162.
Fix Mac Catalyst build failure, plus several build warnings on other platforms.
Update What's New document.
2020-12-08 21:31:39 -05:00
Bill Hollings
33b0e4fc55
Merge pull request #1172 from cdavis5e/fix-xc11-compilation
MVKImage: Fix compilation with Xcode 11.
2020-12-04 11:07:45 -05:00
Chip Davis
13b1840ad0 MVKImage: Fix compilation with Xcode 11.
We can't rely on those enums not being re-`#define`d, because they're
only re-`#define`d like that in MVKPixelFormats.mm.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
2020-12-04 02:35:13 -06:00
Bill Hollings
75e0b5f5b1
Merge pull request #1171 from cdavis5e/swapchain-any-image-size
MVKSwapchain: Allow images whose size doesn't match the CAMetalLayer.
2020-12-03 15:42:42 -05:00
Chip Davis
891654d5d0 MVKSwapchain: Allow images whose size doesn't match the CAMetalLayer.
The game NieR: Automata (via DXVK) attempts to create a 1680x1050
swapchain on a 1600x900 window. It then attempts to render to this
swapchain with a 1680x1050 framebuffer. But we created the textures at
1600x900, matching the window. The render area is thus too big, which
triggers a Metal validation failure. Apparently, DXVK doesn't check the
surface caps before creating the Vulkan swapchain.

Rather than expecting the swapchain to be the same size as the layer, we
can actually support any swapchain size, up to the maximum size of a
texture supported by the device. The system will just scale the texture
when rendering it if it doesn't match the layer size. If the sizes don't
match up, we return `VK_SUBOPTIMAL_KHR`, instead of
`VK_ERROR_OUT_OF_DATE_KHR`, indicating that presentation is still
possible, but performance may suffer. This is good enough to let the
game continue under the validation layers.

This really needs a corresponding change to the CTS, because it
currently assumes that we can't do this.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
2020-12-03 10:18:03 -06:00
Bill Hollings
b01fe1c41e
Merge pull request #1170 from cdavis5e/mtlevent-semaphores
Re-enable MTLEvent-based binary semaphores.
2020-12-03 09:56:15 -05:00
Chip Davis
f74356e51c Re-enable MTLEvent-based binary semaphores.
I haven't seen any problems yet. It passes all the tests--even the
`signal_order` tests. I have tried it with some games, and it seems OK
there, too.
2020-12-02 20:13:43 -06:00
Bill Hollings
6110c349ce
Merge pull request #1168 from billhollings/mac-catalyst
Support Mac Catalyst on macOS 11.0+
2020-12-02 19:51:52 -05:00
Bill Hollings
7f62362db3 Fixes from review for Mac Catalyst on macOS 11.0+.
MVKPixelFormats revert testing for stencil feedback and add Mac Catalyst test.
Revert mvkOSVersionIsAtLeast(mac, ios) to remove test for Mac Catalyst version.
MVKRenderPass revert testing for MTLStorageModeMemoryless for iOS.
2020-12-02 16:22:38 -05:00
Bill Hollings
796ca4514e
Merge pull request #1169 from cdavis5e/device-loss
Handle device loss.
2020-12-02 16:07:02 -05:00
Chip Davis
cbc2443ce4 Handle device loss.
If a command buffer fails in Metal, its `status` becomes
`MTLCommandBufferStatusError`, and its `error` property is populated. In
Vulkan, command buffer failure usually triggers device loss. This is
because most drivers can't guarantee that resources weren't affected in
an undefined fashion. We can't make that guarantee, either, so when a
Metal command buffer has an error, mark the device lost. The error is
also logged. All waits are immediately signaled; those that were client
requests instead of internal implementation details immediately return
`VK_ERROR_DEVICE_LOST`.

The app may be able to recreate the logical device and reconstruct its
state. However, some Metal errors are severe enough that all subsequent
command buffers will fail--in those cases, the physical device becomes
lost as well, indicating that the device cannot be recreated.

Only certain commands are allowed to report device loss. These commands
test for device loss before continuing, and will immediately return if
the device is lost.
2020-12-02 11:57:39 -06:00
Bill Hollings
f8d82620c0 Update Travis CI to use Xcode 12.2 to support macOS 11.0 builds. 2020-12-02 11:34:44 -05:00
Bill Hollings
36e0a712cf
Merge pull request #1167 from cdavis5e/subgroup-size-control
Support the VK_EXT_subgroup_size_control extension.
2020-12-02 11:25:22 -05:00
Chip Davis
e0e5d3ce28 Support the VK_EXT_subgroup_size_control extension.
This extension allows the subgroup size to vary between draw/dispatch
calls, and even allows clients to declare that full subgroups must
always be dispatched. It corresponds better to how Metal actually works.

No support for declaring a required subgroup size, unfortunately.
2020-12-02 09:38:58 -06:00