Merge branch 'master' into Metal-3.0

This commit is contained in:
Bill Hollings 2019-06-14 12:11:02 -04:00
commit e4466ef8db
12 changed files with 2352 additions and 2307 deletions

View File

@ -16,7 +16,7 @@ For best results, use a Markdown reader.*
MoltenVK 1.0.35
---------------
Released TBD
Released 2019/06/13
- Add support for extensions:
- `VK_EXT_debug_report`
@ -33,25 +33,61 @@ Released TBD
- Fix tessellated indirect draws using wrong kernels to map parameters.
- Work around potential Metal bug with stage-in indirect buffers.
- Fix zero local threadgroup size in indirect tessellated rendering.
- Fix [[attribute]] assignment for tessellation evaluation shaders.
- `VkSemaphore` optionally uses `MTLEvent`, if available and
`MVK_ALLOW_METAL_EVENTS` environment variable is enabled.
- Add `vkSetWorkgroupSizeMVK()` to set compute kernel workgroup size
when using MSL source code or MSL compiled code.
- Allow zero count of viewports and scissors.
- Report image layer limits for attachments in `vkGetPhysicalDeviceImageFormatProperties()`.
- Change log indication of error in logs from `[***MoltenVK ERROR***]` to
`[mvk-error]`, for consistency with other log level indications.
`[mvk-error]`, for consistency with other log level indications.
- Allow `mvkMTLRenderStagesFromVkPipelineStageFlags()` to map to all Vulkan stages,
by indicating whether the pipeline barrier should come before or after the stages.
- Automatically update `VkPhysicalDeviceProperties::pipelineCacheUUID` when SPIRV-Cross revision changes.
- Fix crash when clearing attachments using layered rendering on older macOS devices.
- Fixes to Metal renderpass layered rendering settings.
- `vkCmdClearAttachments()` returns encoder to previous pipeline, depth-stencil & resource state after execution.
- Fix issue clearing stencil attachment via renderpass when depth attachment is not being cleared.
- Fix sporadic crash on `vkDestroySwapchainKHR()`.
- `MoltenVKShaderConverter` tool: Add MSL version and platform command-line options.
- Fix crash on pipeline cache merge after `VkShaderModule` destroyed.
- Fix case where viewport/scissor doesn't get set properly when mixing dynamic and
static-configured pipelines in the same command buffer.
- Fix a race condition between sync objects and queries.
- Fix unused attachments terminating loop early.
- Fix offset of buffer view relative to buffer offset within device memory.
- Guard against missing Metal pipeline states when pipeline compilation fails.
- MVKBuffer: Force managed storage for linear textures on shared buffers.
- Use device address space when decompressing DXT image data.
- Added missing `texelBufferTextureWidth` setting in `MVKComputePipeline::getMTLFunction()`.
- Fixes and consolidation of external library header references.
- Allow building external dependency libraries in `Debug` mode.
- Enable AMD and NV GLSL extensions when building `glslang` for `MoltenVKGLSLToSPIRVConverter`.
- Make external library header references consistent and add `MVK_EXCLUDE_SPIRV_TOOLS` option.
- MVKVector improvements.
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to 20.
- Update to latest SPIRV-Cross version:
- MSL: Add support for subgroup operations.
- MSL: Support argument buffers and image swizzling.
- MSL: Add support for `OpArrayLength`.
- MSL: Only use constant address space for tessellation control shader.
- MSL: Support native texture_buffer type, throw error on atomics.
- MSL: Add native texture buffer support.
- MSL: Deal with texture swizzle on arrays of images.
- MSL: Fix complex type alias declaration order.
- MSL: Fix declaration of unused input variables.
- MSL: Use correct address space when passing array-of-buffers.
- MSL: Deal correctly with nonuniformEXT qualifier.
- MSL: Cast texture_buffer index to uint.
- MSL: Fix nonuniform test.
- MSL: Fix regression with Private parameter declaration.
- MSL: Support remapping constexpr samplers by set/binding.
- MSL: Support Invariant qualifier on position.
- MSL: Support stencil export.
- Deal with case where a block is somehow emitted in a duplicated fashion.
- Fix infinite loop when OpAtomic* temporaries are used in other blocks.
- Fix tests for device->constant address space change in MSL tessellation control shader generation.
- Accept SPIR-V 1.4 version.

File diff suppressed because it is too large Load Diff

View File

@ -187,7 +187,10 @@ the *SPIRV-Tools* library to the `ExternalDependencies` *Xcode* project as follo
that opens, select the _**Create groups**_ option, add the files to *both* the `SPIRV-Tools-macOS`
and `SPIRV-Tools-iOS` targets, and click the ***Finish*** button.
3. In the *Project Navigator* panel, select the `ExternalDependencies` *Xcode* project, then
3. Remove the *Group* named `fuzz` from under the *Group* named `External/SPIRV-Tools/source`.
4. In the *Project Navigator* panel, select the `ExternalDependencies` *Xcode* project, then
select the `SPIRV-Tools-macOS` target, and open the *Build Settings* tab. Locate the build
setting entry **Header Search Paths** (`HEADER_SEARCH_PATHS`) and add the following paths:

View File

@ -1 +1 @@
cb686a5dba9a7086a778fe21900383beed9ea5d3
4104e363005a079acc215f0920743a8affb31278

View File

@ -1 +1 @@
08cbb5458f692d4778806775f65eb3dc642ddbbf
097a1045098213919fd56442f52c716fc78eeb27

View File

@ -1 +1 @@
2abb69904b9ad017d39d3da1e7fc3dec1a584cd8
d2de4ac0a28766c6fb10968fdcc4d75566eef8d7

View File

@ -1 +1 @@
37e808988e758ec4f6f689012fb425bab1398ecf
c6df494e270b5afad6bf5aaca725a037abe10501

View File

@ -1 +1 @@
e06c7e9a515b716c731bda13f507546f107775d1
21eebe74214488264bbf0d19323a03c13a9e53a7

View File

@ -962,6 +962,12 @@ void MVKCmdClearAttachments::encode(MVKCommandEncoder* cmdEncoder) {
cmdEncoder->setVertexBytes(mtlRendEnc, _vertices.data(), vtxCnt * sizeof(_vertices[0]), vtxBuffIdx);
[mtlRendEnc drawPrimitives: MTLPrimitiveTypeTriangle vertexStart: 0 vertexCount: vtxCnt];
[mtlRendEnc popDebugGroup];
// Return to the previous rendering state on the next render activity
cmdEncoder->_graphicsPipelineState.markDirty();
cmdEncoder->_depthStencilState.markDirty();
cmdEncoder->_stencilReferenceValueState.markDirty();
cmdEncoder->_graphicsResourcesState.beginMetalRenderPass();
}

View File

@ -103,9 +103,10 @@ void MVKDescriptorSetLayoutBinding::bind(MVKCommandEncoder* cmdEncoder,
(*pDynamicOffsetIndex)++; // Move on to next dynamic offset (and feedback to caller)
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: {
MVKBuffer* mvkBuff = (MVKBuffer*)descBinding._bufferBindings[rezIdx].buffer;
bb.mtlBuffer = descBinding._mtlBuffers[rezIdx];
bb.offset = descBinding._mtlBufferOffsets[rezIdx] + bufferDynamicOffset;
bb.size = (uint32_t)((MVKBuffer*)descBinding._bufferBindings[rezIdx].buffer)->getByteCount();
bb.size = mvkBuff ? (uint32_t)mvkBuff->getByteCount() : 0;
for (uint32_t i = kMVKShaderStageVertex; i < kMVKShaderStageMax; i++) {
if (_applyToStage[i]) {
bb.index = mtlIdxs.stages[i].bufferIndex + rezIdx;

View File

@ -221,21 +221,25 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
bool hasAttachmentUsage = mvkIsAnyFlagEnabled(usage, (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT |
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT));
VkPhysicalDeviceLimits* pLimits = &_properties.limits;
VkExtent3D maxExt;
uint32_t maxLayers;
uint32_t maxLevels;
uint32_t maxLayers = hasAttachmentUsage ? pLimits->maxFramebufferLayers : pLimits->maxImageArrayLayers;
VkSampleCountFlags sampleCounts = _metalFeatures.supportedSampleCounts;
switch (type) {
case VK_IMAGE_TYPE_1D:
// Metal does not allow 1D textures to be used as attachments
if (mvkIsAnyFlagEnabled(usage, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
if (hasAttachmentUsage) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
// Metal does not allow linear tiling on 1D textures
if (tiling == VK_IMAGE_TILING_LINEAR) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
if (tiling == VK_IMAGE_TILING_LINEAR) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
// Metal does not allow compressed or depth/stencil formats on 1D textures
if (mvkFormatTypeFromVkFormat(format) == kMVKFormatDepthStencil ||
mvkFormatTypeFromVkFormat(format) == kMVKFormatCompressed) {
@ -245,7 +249,6 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
maxExt.height = 1;
maxExt.depth = 1;
maxLevels = 1;
maxLayers = pLimits->maxImageArrayLayers;
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
break;
case VK_IMAGE_TYPE_2D:
@ -265,16 +268,12 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
#if MVK_MACOS
// - On macOS, they may not be used as framebuffer attachments.
if (mvkIsAnyFlagEnabled(usage, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT|VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) ) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
// - On macOS, Linear textures may not be used as framebuffer attachments.
if (hasAttachmentUsage) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
#endif
// - They may only have one mip level.
// Linear textures may only have one mip level. layer & sample
maxLevels = 1;
// - They may only have one layer.
maxLayers = 1;
// - They may not be multisampled.
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
} else {
VkFormatProperties fmtProps;
@ -288,7 +287,6 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
sampleCounts = VK_SAMPLE_COUNT_1_BIT;
}
maxLevels = mvkMipmapLevels3D(maxExt);
maxLayers = pLimits->maxImageArrayLayers;
}
break;
case VK_IMAGE_TYPE_3D:
@ -320,9 +318,8 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
break;
default:
// Metal does not allow linear tiling on anything but 2D textures
if (tiling == VK_IMAGE_TILING_LINEAR) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
if (tiling == VK_IMAGE_TILING_LINEAR) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
// Metal does not allow compressed or depth/stencil formats on anything but 2D textures
if (mvkFormatTypeFromVkFormat(format) == kMVKFormatDepthStencil ||
mvkFormatTypeFromVkFormat(format) == kMVKFormatCompressed) {

View File

@ -276,7 +276,7 @@ bool MVKRenderPassAttachment::populateMTLRenderPassAttachmentDescriptor(MTLRende
} else if ( isRenderingEntireAttachment && (subpass->_subpassIndex == _firstUseSubpassIdx) ) {
VkAttachmentLoadOp loadOp = isStencil ? _info.stencilLoadOp : _info.loadOp;
mtlAttDesc.loadAction = mvkMTLLoadActionFromVkAttachmentLoadOp(loadOp);
willClear = (_info.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR);
willClear = (loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR);
} else {
mtlAttDesc.loadAction = MTLLoadActionLoad;
}