364 Commits

Author SHA1 Message Date
Bill Hollings
4049518683
Merge pull request #411 from cdavis5e/copy-image-compat-format-2
vkCmdCopyImage: Cast source image to the destination format.
2018-12-19 12:05:10 -05:00
Bill Hollings
7b0630290f
Merge pull request #410 from cdavis5e/format-props-2-match-core
MVKDevice: Make result of extended getFormatProperties() match the core API.
2018-12-19 11:49:45 -05:00
Chip Davis
79f0b175fc vkCmdCopyImage: Cast source image to the destination format.
In which I am proved wrong again. While Metal indeed won't assert if the
pixel formats don't match, the results of attempting such a copy are...
mixed, to say the least. Sometimes, nothing is copied at all. Other
times, pixels are copied in weird ways that don't seem to conform at all
to expectation. (This is most apparent in the output of the CTS's image
copying tests.) It's best, then, to ensure that the source and
destination have the same format.

Unfortunately, in the process of writing this, my fears regarding not
being able to make uncompressed views of compressed images were
confirmed. So we can't do this for compressed images.
2018-12-17 09:29:27 -06:00
Chip Davis
9f58016c35 MVKDevice: Make result of extended getFormatProperties() match the core API. 2018-12-17 09:25:31 -06:00
Chip Davis
2bfa7b47d6 vkCmdPushDescriptorSetWithTemplate: Initialize data pointer to null.
The command object assumes it is null if it hasn't been used yet. Let's
ensure this is so.
2018-12-17 09:23:46 -06:00
aerofly
febeb9d738 Merge fork with master MoltenVK again 2018-12-15 18:59:58 +01:00
aerofly
ef21f2488a Merge fork with master MoltenVK again 2018-12-15 18:36:07 +01:00
aerofly
fba2eefa5e Modify MVKVector with feedback from cdavis5e 2018-12-14 14:19:30 +01:00
aerofly
6aad9dc0ba fix conflicts 2018-12-12 20:57:11 +01:00
aerofly
2b19954d11
Merge branch 'master' into master 2018-12-12 20:11:18 +01:00
aerofly
5811ae5811 fix conflicts 2018-12-12 20:09:24 +01:00
aerofly
8c1581f247 Update fork to latest MoltenVK 2018-12-12 16:08:22 +01:00
Bill Hollings
da598c0061
Merge pull request #392 from billhollings/master
MSL don't emit memory_scope after MSL 2.0.
2018-12-12 08:33:41 -05:00
Bill Hollings
b804fd536c
Merge pull request #391 from cdavis5e/format-features
Add new formats and fix existing ones
2018-12-12 08:33:12 -05:00
Chip Davis
3d424679f3 Add support for VK_FORMAT_A2R10G10B10_UNORM_PACK32.
This format was added in Metal 2 (iOS 11, macOS 10.13), and is intended
for rendering to wide-color (10bpc) displays.
2018-12-11 17:40:21 -06:00
Chip Davis
e9158463a6 On macOS, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 can only be filtered. 2018-12-11 17:40:21 -06:00
Chip Davis
15b67b4311 On macOS, linear textures cannot be blitted to.
Since they cannot be render targets.

I wonder if we could work around that using a shader.
2018-12-11 17:40:21 -06:00
Chip Davis
35573832dc Give every image format we support the BLIT_SRC feature.
All that is required is that we can either read the format
(`TRANSFER_SRC`) or sample from it (`SAMPLED_IMAGE`). Every image format
that Metal supports supports those two features.

This marks the depth/stencil formats as able to be the source of a
blit. The spec requires in particular that `D16_UNORM` and `D32_SFLOAT`
support that.
2018-12-11 17:40:21 -06:00
Chip Davis
282699d755 Depth formats cannot be used for a VkBufferView.
It is not possible to create a linear texture from a depth/stencil
format. Therefore, we can't support buffer views in these formats.
2018-12-11 17:40:21 -06:00
Chip Davis
a1d8de5da2 Correct supported features of compressed formats.
Compressed formats only support reading and filtering. They also can't
be used to create linear textures, so they can't be used for buffer
views, either.
2018-12-11 17:40:21 -06:00
Chip Davis
5c65330e50 Add some more vertex formats.
Use `MTLVertexFormatChar`, `UChar`, `Short`, `UShort`, and `Half` when
available. Add `MTLVertexFormatUChar4Normalized_BGRA` for
`VK_FORMAT_B8G8R8A8_UNORM`.

These are only available on Metal 2.0 (iOS 11, macOS 10.13) and up, so
this adds what MoltenVK was using before as a fallback, similar to how
some `MTLPixelFormat`s have substitutes.
2018-12-11 17:40:21 -06:00
Chip Davis
4bbbbbd783 MVKImage: Round up byte alignment to the nearest power of 2. 2018-12-11 17:38:47 -06:00
Bill Hollings
98dd858d82 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2018-12-11 18:27:40 -05:00
Bill Hollings
e6dfdca6c0 MSL don't emit memory_scope after MSL 2.0.
For each GPU, log MSL version and updated list of feature sets.
Add SPIRVToMSLConverterOptions::printMSLVersion() function.
Update to latest SPIRV-Cross version.
Update MoltenVK version to 1.0.29.
2018-12-11 18:27:01 -05:00
Bill Hollings
03086fbd86
Merge pull request #388 from cdavis5e/fix-khr-maintenance3
Use MVKDevice::getMVKDevice() to get the real underlying device.
2018-12-11 18:24:27 -05:00
Bill Hollings
5633cc58e3
Merge pull request #387 from cdavis5e/all-unused-attachments-3
MVKGraphicsPipeline: Add dummy attachments even when rasterization is off.
2018-12-11 18:20:42 -05:00
Bill Hollings
aad5ba63a3
Merge pull request #386 from cdavis5e/cmd-transfer-8bit-format
Don't use char/uchar for clearing/copying 8-bit formats.
2018-12-11 18:19:42 -05:00
Bill Hollings
c9475cb464
Merge pull request #384 from cdavis5e/a8b8g8r8-pack32
Support A8B8G8R8_PACK32 formats.
2018-12-11 18:14:48 -05:00
Chip Davis
39afc5d553 Use MVKDevice::getMVKDevice() to get the real underlying device.
Mea culpa.
2018-12-11 15:28:03 -06:00
Chip Davis
cb583fa8e3 MVKGraphicsPipeline: Add dummy attachments even when rasterization is off.
Turns out I was wrong. Metal expects at least one attachment to define
the size of the framebuffer, whether or not rasterization is on.
2018-12-11 15:25:54 -06:00
Chip Davis
569879a10e Don't use char/uchar for clearing/copying 8-bit formats.
Metal doesn't allow using that as a texture's sampled data type or as a
fragment shader's output type.
2018-12-11 15:24:48 -06:00
Chip Davis
b413ec1676 MVKImage: Don't set MTLTextureUsageRenderTarget for non-blittable formats.
Setting that usage bit on a non-renderable format, especially a
compressed one, will cause Metal to crash. (And I mean crash, without
raising an assertion failure.)
2018-12-11 15:23:36 -06:00
Chip Davis
c80c42dedd Support A8B8G8R8_PACK32 formats.
Because they're packed formats, they correspond to
`MTLPixelFormatRGBA8`. In fact, these formats would only be distinct on
a big endian system, and no current Apple hardware is big endian
anymore.
2018-12-11 15:21:30 -06:00
Bill Hollings
0764843898
Merge pull request #383 from cdavis5e/memory-bind-after-map
MVKDeviceMemory: Try creating an MTLBuffer before allocating heap memory.
2018-12-11 16:09:20 -05:00
Bill Hollings
570c67c5dc
Merge pull request #382 from cdavis5e/sparse-props
Explicitly set number of sparse image property/requirement info sets to 0.
2018-12-11 15:50:45 -05:00
Bill Hollings
a98d1a989c
Merge pull request #381 from cdavis5e/asan-build
Build the dylib with -fsanitize=address when asan is enabled.
2018-12-11 15:50:03 -05:00
Bill Hollings
7c03db9e4f
Merge pull request #380 from cdavis5e/debug-dsym-file-2
Fix name of generated dSYM file.
2018-12-11 15:49:09 -05:00
Bill Hollings
c6cca34510
Merge pull request #379 from cdavis5e/2dms-array-image-2
MVKImage: Support image views of 2D multisample array images.
2018-12-11 15:48:17 -05:00
Bill Hollings
15a52437f2
Merge pull request #378 from cdavis5e/pack16-formats
Correct mapping of packed 16-bit formats.
2018-12-11 15:47:05 -05:00
Chip Davis
b64485bf2a MVKDeviceMemory: Try creating an MTLBuffer before allocating heap memory.
If the device memory is subsequently bound to a `VkBuffer` after it has
been mapped, the heap memory will be freed, leaving dangling pointers in
the client. Instead, create an `MTLBuffer` right away--it is *device*
memory after all--and use its memory.

Another option might be to use `-[MTLDevice
newBufferWithBytesNoCopy:length:options:deallocator:]`, but that
requires that the entire allocation come from a single contiguous
virtual memory mapping, a requirement that is not necessarily satisfied
by `malloc(3)` memory.

Fixes #377.
2018-12-10 14:55:49 -06:00
Chip Davis
1d2da75eb5 Explicit set number of sparse image property/requirement info sets to 0.
Since these functions return void, there's no indication of an error
from them.
2018-12-10 14:54:23 -06:00
Chip Davis
aec492cfca Build the dylib with -fsanitize=address when asan is enabled. 2018-12-10 14:53:23 -06:00
Chip Davis
63b291a6c1 Fix name of generated dSYM file. 2018-12-10 14:52:24 -06:00
Chip Davis
8b0ea361f1 MVKImage: Support image views of 2D multisample array images.
A bit that I missed in my initial change to add this.
2018-12-10 14:50:47 -06:00
Chip Davis
46c1081456 Correct mapping of packed 16-bit formats.
Metal always gives the components in little endian order, while Vulkan
always lists them in big endian order. This also brings us more in line
with the spec, which says that the formats
`VK_FORMAT_R5G6B5_UNORM_PACK16` and `VK_FORMAT_A1R5G5B5_UNORM_PACK16`
must be supported.

Fixes #353.
2018-12-10 14:48:22 -06:00
aerofly
b8d12f58a5 Add MVKVector a std::vector compatible container with configurable stack space 2018-12-09 17:24:29 +01:00
aerofly
3587bcf02f mvk_vector 2018-12-09 17:18:40 +01:00
aerofly
8d868926bf mvk_vector 2018-12-09 16:58:15 +01:00
aerofly
0c0afd4c68 mvk_vector 2018-12-09 16:41:48 +01:00
aerofly
f2bac60be4 mvk_vector 2018-12-09 16:34:30 +01:00