Merge branch 'master' of https://github.com/billhollings/MoltenVK into desc-set-cleanups
This commit is contained in:
commit
163e8e5b20
@ -311,7 +311,7 @@ In addition to core *Vulkan* functionality, **MoltenVK** also supports the foll
|
||||
- `VK_EXT_inline_uniform_block`
|
||||
- `VK_EXT_memory_budget` *(requires Metal 2.0)*
|
||||
- `VK_EXT_metal_surface`
|
||||
- `VK_EXT_post_depth_coverage` *(iOS, requires GPU family 4)*
|
||||
- `VK_EXT_post_depth_coverage` *(iOS and macOS, requires family 4 (A11) or better Apple GPU)*
|
||||
- `VK_EXT_private_data `
|
||||
- `VK_EXT_robustness2`
|
||||
- `VK_EXT_scalar_block_layout`
|
||||
@ -320,12 +320,13 @@ In addition to core *Vulkan* functionality, **MoltenVK** also supports the foll
|
||||
- `VK_EXT_swapchain_colorspace`
|
||||
- `VK_EXT_vertex_attribute_divisor`
|
||||
- `VK_EXT_texel_buffer_alignment` *(requires Metal 2.0)*
|
||||
- `VK_EXT_texture_compression_astc_hdr` *(iOS and macOS, requires family 6 (A13) or better Apple GPU)*
|
||||
- `VK_MVK_ios_surface` *(iOS) (Obsolete. Use `VK_EXT_metal_surface` instead.)*
|
||||
- `VK_MVK_macos_surface` *(macOS) (Obsolete. Use `VK_EXT_metal_surface` instead.)*
|
||||
- `VK_MVK_moltenvk`
|
||||
- `VK_AMD_gpu_shader_half_float`
|
||||
- `VK_AMD_negative_viewport_height`
|
||||
- `VK_AMD_shader_image_load_store_lod` *(iOS and tvOS)*
|
||||
- `VK_AMD_shader_image_load_store_lod` *(requires Apple GPU)*
|
||||
- `VK_AMD_shader_trinary_minmax` *(requires Metal 2.1)*
|
||||
- `VK_IMG_format_pvrtc` *(requires Apple GPU)*
|
||||
- `VK_INTEL_shader_integer_functions2`
|
||||
|
@ -21,7 +21,10 @@ Released TBD
|
||||
- Add support for extensions:
|
||||
- `VK_KHR_timeline_semaphore`
|
||||
- `VK_EXT_descriptor_indexing` (initial release limited to Metal Tier 1: 96/128 textures, 16 samplers)
|
||||
- `VK_EXT_post_depth_coverage` (macOS)
|
||||
- `VK_EXT_private_data`
|
||||
- `VK_EXT_texture_compression_astc_hdr`
|
||||
- `VK_AMD_shader_image_load_store` (macOS)
|
||||
- `VK_IMG_format_pvrtc` (macOS)
|
||||
- Use `VK_KHR_image_format_list` to disable `MTLTextureUsagePixelFormatView`
|
||||
if only swizzles or `sRGB` conversion will be used for image views, improving
|
||||
|
@ -627,6 +627,7 @@ typedef struct {
|
||||
VkBool32 stencilResolve; /**< If true, resolving stencil textures with filters other than Sample0 is supported. */
|
||||
uint32_t maxPerStageDynamicMTLBufferCount; /**< The maximum number of inline buffers that can be set on a command buffer. */
|
||||
uint32_t maxPerStageStorageTextureCount; /**< The total number of per-stage Metal textures with read-write access available for writing to from a shader. */
|
||||
VkBool32 astcHDRTextures; /**< If true, ASTC HDR pixel formats are supported. */
|
||||
} MVKPhysicalDeviceMetalFeatures;
|
||||
|
||||
/** MoltenVK performance of a particular type of activity. */
|
||||
|
@ -485,18 +485,34 @@ void MVKCmdBlitImage<N>::encode(MVKCommandEncoder* cmdEncoder, MVKCommandUse com
|
||||
mtlColorAttDesc.level = mvkIBR.region.dstSubresource.mipLevel;
|
||||
mtlDepthAttDesc.level = mvkIBR.region.dstSubresource.mipLevel;
|
||||
mtlStencilAttDesc.level = mvkIBR.region.dstSubresource.mipLevel;
|
||||
|
||||
bool isLayeredBlit = blitKey.dstSampleCount > 1 ? cmdEncoder->getDevice()->_pMetalFeatures->multisampleLayeredRendering : cmdEncoder->getDevice()->_pMetalFeatures->layeredRendering;
|
||||
|
||||
uint32_t layCnt = mvkIBR.region.srcSubresource.layerCount;
|
||||
if (_dstImage->getMTLTextureType() == MTLTextureType3D) {
|
||||
layCnt = mvkAbsDiff(mvkIBR.region.dstOffsets[1].z, mvkIBR.region.dstOffsets[0].z);
|
||||
}
|
||||
if (isLayeredBlit) {
|
||||
// In this case, I can blit all layers at once with a layered draw.
|
||||
mtlRPD.renderTargetArrayLengthMVK = layCnt;
|
||||
layCnt = 1; // Only need to run the loop once.
|
||||
}
|
||||
for (uint32_t layIdx = 0; layIdx < layCnt; layIdx++) {
|
||||
// Update the render pass descriptor for the texture level and slice, and create a render encoder.
|
||||
if (_dstImage->getMTLTextureType() == MTLTextureType3D) {
|
||||
uint32_t depthPlane = mvkIBR.region.dstOffsets[0].z + (mvkIBR.region.dstOffsets[1].z > mvkIBR.region.dstOffsets[0].z ? layIdx : -(layIdx + 1));
|
||||
mtlColorAttDesc.depthPlane = depthPlane;
|
||||
mtlDepthAttDesc.depthPlane = depthPlane;
|
||||
mtlStencilAttDesc.depthPlane = depthPlane;
|
||||
if (isLayeredBlit) {
|
||||
// For layered blits, the layers are always in ascending order. I'll reverse the order
|
||||
// of the 'r' coordinates if the destination is mirrored.
|
||||
uint32_t depthPlane = std::min(mvkIBR.region.dstOffsets[0].z, mvkIBR.region.dstOffsets[1].z);
|
||||
mtlColorAttDesc.depthPlane = depthPlane;
|
||||
mtlDepthAttDesc.depthPlane = depthPlane;
|
||||
mtlStencilAttDesc.depthPlane = depthPlane;
|
||||
} else {
|
||||
uint32_t depthPlane = mvkIBR.region.dstOffsets[0].z + (mvkIBR.region.dstOffsets[1].z > mvkIBR.region.dstOffsets[0].z ? layIdx : -(layIdx + 1));
|
||||
mtlColorAttDesc.depthPlane = depthPlane;
|
||||
mtlDepthAttDesc.depthPlane = depthPlane;
|
||||
mtlStencilAttDesc.depthPlane = depthPlane;
|
||||
}
|
||||
} else {
|
||||
mtlColorAttDesc.slice = mvkIBR.region.dstSubresource.baseArrayLayer + layIdx;
|
||||
mtlDepthAttDesc.slice = mvkIBR.region.dstSubresource.baseArrayLayer + layIdx;
|
||||
@ -505,6 +521,7 @@ void MVKCmdBlitImage<N>::encode(MVKCommandEncoder* cmdEncoder, MVKCommandUse com
|
||||
id<MTLRenderCommandEncoder> mtlRendEnc = [cmdEncoder->_mtlCmdBuffer renderCommandEncoderWithDescriptor: mtlRPD];
|
||||
setLabelIfNotNil(mtlRendEnc, mvkMTLRenderCommandEncoderLabel(commandUse));
|
||||
|
||||
float zIncr;
|
||||
if (blitKey.srcMTLTextureType == MTLTextureType3D) {
|
||||
// In this case, I need to interpolate along the third dimension manually.
|
||||
VkExtent3D srcExtent = _srcImage->getExtent3D(srcPlaneIndex, mvkIBR.region.dstSubresource.mipLevel);
|
||||
@ -512,7 +529,12 @@ void MVKCmdBlitImage<N>::encode(MVKCommandEncoder* cmdEncoder, MVKCommandUse com
|
||||
VkOffset3D do0 = mvkIBR.region.dstOffsets[0], do1 = mvkIBR.region.dstOffsets[1];
|
||||
float startZ = (float)so0.z / (float)srcExtent.depth;
|
||||
float endZ = (float)so1.z / (float)srcExtent.depth;
|
||||
float z = startZ + (endZ - startZ) * (layIdx + 0.5) / mvkAbsDiff(do1.z, do0.z);
|
||||
if (isLayeredBlit && do0.z > do1.z) {
|
||||
// Swap start and end points so interpolation moves in the right direction.
|
||||
std::swap(startZ, endZ);
|
||||
}
|
||||
zIncr = (endZ - startZ) / mvkAbsDiff(do1.z, do0.z);
|
||||
float z = startZ + (isLayeredBlit ? 0.0 : (layIdx + 0.5)) * zIncr;
|
||||
for (uint32_t i = 0; i < kMVKBlitVertexCount; ++i) {
|
||||
mvkIBR.vertices[i].texCoord.z = z;
|
||||
}
|
||||
@ -521,6 +543,9 @@ void MVKCmdBlitImage<N>::encode(MVKCommandEncoder* cmdEncoder, MVKCommandUse com
|
||||
[mtlRendEnc setRenderPipelineState: mtlRPS];
|
||||
[mtlRendEnc setDepthStencilState: mtlDSS];
|
||||
cmdEncoder->setVertexBytes(mtlRendEnc, mvkIBR.vertices, sizeof(mvkIBR.vertices), vtxBuffIdx);
|
||||
if (isLayeredBlit) {
|
||||
cmdEncoder->setVertexBytes(mtlRendEnc, &zIncr, sizeof(zIncr), 0);
|
||||
}
|
||||
if (!mvkIsOnlyAnyFlagEnabled(blitKey.srcAspect, (VK_IMAGE_ASPECT_STENCIL_BIT))) {
|
||||
[mtlRendEnc setFragmentTexture: srcMTLTex atIndex: 0];
|
||||
}
|
||||
@ -556,7 +581,8 @@ void MVKCmdBlitImage<N>::encode(MVKCommandEncoder* cmdEncoder, MVKCommandUse com
|
||||
texSubRez.lod = mvkIBR.region.srcSubresource.mipLevel;
|
||||
cmdEncoder->setFragmentBytes(mtlRendEnc, &texSubRez, sizeof(texSubRez), 0);
|
||||
|
||||
[mtlRendEnc drawPrimitives: MTLPrimitiveTypeTriangleStrip vertexStart: 0 vertexCount: kMVKBlitVertexCount];
|
||||
NSUInteger instanceCount = isLayeredBlit ? mtlRPD.renderTargetArrayLengthMVK : 1;
|
||||
[mtlRendEnc drawPrimitives: MTLPrimitiveTypeTriangleStrip vertexStart: 0 vertexCount: kMVKBlitVertexCount instanceCount: instanceCount];
|
||||
[mtlRendEnc popDebugGroup];
|
||||
[mtlRendEnc endEncoding];
|
||||
}
|
||||
|
@ -37,6 +37,12 @@ typedef struct {
|
||||
float3 v_texCoord; \n\
|
||||
} VaryingsPosTex; \n\
|
||||
\n\
|
||||
typedef struct { \n\
|
||||
float4 v_position [[position]]; \n\
|
||||
float3 v_texCoord; \n\
|
||||
uint v_layer [[render_target_array_index]]; \n\
|
||||
} VaryingsPosTexLayer; \n\
|
||||
\n\
|
||||
typedef size_t VkDeviceSize; \n\
|
||||
\n\
|
||||
typedef enum : uint32_t { \n\
|
||||
@ -79,6 +85,16 @@ vertex VaryingsPosTex vtxCmdBlitImage(AttributesPosTex attributes [[stage_in]])
|
||||
return varyings; \n\
|
||||
} \n\
|
||||
\n\
|
||||
vertex VaryingsPosTexLayer vtxCmdBlitImageLayered(AttributesPosTex attributes [[stage_in]], \n\
|
||||
uint instanceID [[instance_id]], \n\
|
||||
constant float &zIncr [[buffer(0)]]) { \n\
|
||||
VaryingsPosTexLayer varyings; \n\
|
||||
varyings.v_position = float4(attributes.a_position, 0.0, 1.0); \n\
|
||||
varyings.v_texCoord = float3(attributes.a_texCoord.xy, attributes.a_texCoord.z + (instanceID + 0.5) * zIncr);\n\
|
||||
varyings.v_layer = instanceID; \n\
|
||||
return varyings; \n\
|
||||
} \n\
|
||||
\n\
|
||||
typedef struct { \n\
|
||||
uint32_t srcOffset; \n\
|
||||
uint32_t dstOffset; \n\
|
||||
|
@ -33,14 +33,18 @@ using namespace std;
|
||||
|
||||
id<MTLRenderPipelineState> MVKCommandResourceFactory::newCmdBlitImageMTLRenderPipelineState(MVKRPSKeyBlitImg& blitKey,
|
||||
MVKVulkanAPIDeviceObject* owner) {
|
||||
id<MTLFunction> vtxFunc = newFunctionNamed("vtxCmdBlitImage"); // temp retain
|
||||
id<MTLFunction> fragFunc = newBlitFragFunction(blitKey); // temp retain
|
||||
MTLRenderPipelineDescriptor* plDesc = [MTLRenderPipelineDescriptor new]; // temp retain
|
||||
bool isLayeredBlit = blitKey.dstSampleCount > 1 ? _device->_pMetalFeatures->multisampleLayeredRendering : _device->_pMetalFeatures->layeredRendering;
|
||||
id<MTLFunction> vtxFunc = newFunctionNamed(isLayeredBlit ? "vtxCmdBlitImageLayered" : "vtxCmdBlitImage"); // temp retain
|
||||
id<MTLFunction> fragFunc = newBlitFragFunction(blitKey); // temp retain
|
||||
MTLRenderPipelineDescriptor* plDesc = [MTLRenderPipelineDescriptor new]; // temp retain
|
||||
plDesc.label = @"CmdBlitImage";
|
||||
|
||||
plDesc.vertexFunction = vtxFunc;
|
||||
plDesc.fragmentFunction = fragFunc;
|
||||
plDesc.sampleCount = blitKey.dstSampleCount;
|
||||
if (isLayeredBlit) {
|
||||
plDesc.inputPrimitiveTopologyMVK = MTLPrimitiveTopologyClassTriangle;
|
||||
}
|
||||
|
||||
if (mvkIsAnyFlagEnabled(blitKey.srcAspect, (VK_IMAGE_ASPECT_DEPTH_BIT))) {
|
||||
plDesc.depthAttachmentPixelFormat = blitKey.getDstMTLPixelFormat();
|
||||
@ -162,6 +166,7 @@ id<MTLRenderPipelineState> MVKCommandResourceFactory::newCmdClearMTLRenderPipeli
|
||||
|
||||
id<MTLFunction> MVKCommandResourceFactory::newBlitFragFunction(MVKRPSKeyBlitImg& blitKey) {
|
||||
@autoreleasepool {
|
||||
bool isLayeredBlit = blitKey.dstSampleCount > 1 ? _device->_pMetalFeatures->multisampleLayeredRendering : _device->_pMetalFeatures->layeredRendering;
|
||||
NSString* typeStr = getMTLFormatTypeString(blitKey.getSrcMTLPixelFormat());
|
||||
|
||||
bool isArrayType = blitKey.isSrcArrayType();
|
||||
@ -198,7 +203,7 @@ id<MTLFunction> MVKCommandResourceFactory::newBlitFragFunction(MVKRPSKeyBlitImg&
|
||||
coordArg = @"";
|
||||
break;
|
||||
}
|
||||
NSString* sliceArg = isArrayType ? @", subRez.slice" : @"";
|
||||
NSString* sliceArg = isArrayType ? (isLayeredBlit ? @", subRez.slice + varyings.v_layer" : @", subRez.slice") : @"";
|
||||
NSString* srcFilter = isLinearFilter ? @"linear" : @"nearest";
|
||||
|
||||
NSMutableString* msl = [NSMutableString stringWithCapacity: (2 * KIBI) ];
|
||||
@ -208,6 +213,9 @@ id<MTLFunction> MVKCommandResourceFactory::newBlitFragFunction(MVKRPSKeyBlitImg&
|
||||
[msl appendLineMVK: @"typedef struct {"];
|
||||
[msl appendLineMVK: @" float4 v_position [[position]];"];
|
||||
[msl appendLineMVK: @" float3 v_texCoord;"];
|
||||
if (isLayeredBlit && isArrayType) {
|
||||
[msl appendLineMVK: @" uint v_layer [[render_target_array_index]];"];
|
||||
}
|
||||
[msl appendLineMVK: @"} VaryingsPosTex;"];
|
||||
[msl appendLineMVK];
|
||||
[msl appendLineMVK: @"typedef struct {"];
|
||||
|
@ -30,7 +30,7 @@ void MVKDescriptorSetLayout::bindDescriptorSet(MVKCommandEncoder* cmdEncoder,
|
||||
MVKShaderResourceBinding& dslMTLRezIdxOffsets,
|
||||
MVKArrayRef<uint32_t> dynamicOffsets,
|
||||
uint32_t& dynamicOffsetIndex) {
|
||||
clearConfigurationResult();
|
||||
if (!cmdEncoder) { clearConfigurationResult(); }
|
||||
if ( !_isPushDescriptorLayout ) {
|
||||
for (auto& dslBind : _bindings) {
|
||||
dslBind.bind(cmdEncoder, descSet, dslMTLRezIdxOffsets, dynamicOffsets, dynamicOffsetIndex);
|
||||
@ -86,7 +86,7 @@ void MVKDescriptorSetLayout::pushDescriptorSet(MVKCommandEncoder* cmdEncoder,
|
||||
|
||||
if (!_isPushDescriptorLayout) return;
|
||||
|
||||
clearConfigurationResult();
|
||||
if (!cmdEncoder) { clearConfigurationResult(); }
|
||||
for (const VkWriteDescriptorSet& descWrite : descriptorWrites) {
|
||||
uint32_t dstBinding = descWrite.dstBinding;
|
||||
uint32_t dstArrayElement = descWrite.dstArrayElement;
|
||||
@ -137,7 +137,7 @@ void MVKDescriptorSetLayout::pushDescriptorSet(MVKCommandEncoder* cmdEncoder,
|
||||
descUpdateTemplate->getType() != VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR)
|
||||
return;
|
||||
|
||||
clearConfigurationResult();
|
||||
if (!cmdEncoder) { clearConfigurationResult(); }
|
||||
for (uint32_t i = 0; i < descUpdateTemplate->getNumberOfEntries(); i++) {
|
||||
const VkDescriptorUpdateTemplateEntryKHR* pEntry = descUpdateTemplate->getEntry(i);
|
||||
uint32_t dstBinding = pEntry->dstBinding;
|
||||
|
@ -197,6 +197,11 @@ void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) {
|
||||
texelBuffAlignFeatures->texelBufferAlignment = _metalFeatures.texelBuffers && [_mtlDevice respondsToSelector: @selector(minimumLinearTextureAlignmentForPixelFormat:)];
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT: {
|
||||
auto* astcHDRFeatures = (VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT*)next;
|
||||
astcHDRFeatures->textureCompressionASTC_HDR = _metalFeatures.astcHDRTextures;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: {
|
||||
auto* divisorFeatures = (VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT*)next;
|
||||
divisorFeatures->vertexAttributeInstanceRateDivisor = true;
|
||||
@ -1261,6 +1266,9 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
if (supportsMTLGPUFamily(Apple4)) {
|
||||
_metalFeatures.nativeTextureSwizzle = true;
|
||||
}
|
||||
if (supportsMTLGPUFamily(Apple6) ) {
|
||||
_metalFeatures.astcHDRTextures = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (supportsMTLGPUFamily(Apple4)) {
|
||||
@ -1272,6 +1280,9 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
#if MVK_XCODE_12
|
||||
if ( mvkOSVersionIsAtLeast(14.0) ) {
|
||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_3;
|
||||
if ( supportsMTLGPUFamily(Apple7) ) {
|
||||
_metalFeatures.maxQueryBufferSize = (256 * KIBI);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1328,6 +1339,7 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
|
||||
if ( mvkOSVersionIsAtLeast(10.15) ) {
|
||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
|
||||
_metalFeatures.maxQueryBufferSize = (256 * KIBI);
|
||||
_metalFeatures.native3DCompressedTextures = true;
|
||||
_metalFeatures.renderWithoutAttachments = true;
|
||||
if ( mvkOSVersionIsAtLeast(mvkMakeOSVersion(10, 15, 6)) ) {
|
||||
@ -1346,8 +1358,14 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
// This is an Apple GPU--treat it accordingly.
|
||||
_metalFeatures.mtlCopyBufferAlignment = 1;
|
||||
_metalFeatures.mtlBufferAlignment = 16;
|
||||
_metalFeatures.maxQueryBufferSize = (64 * KIBI);
|
||||
_metalFeatures.maxPerStageDynamicMTLBufferCount = _metalFeatures.maxPerStageBufferCount;
|
||||
_metalFeatures.postDepthCoverage = true;
|
||||
}
|
||||
if (supportsMTLGPUFamily(Apple6)) {
|
||||
_metalFeatures.astcHDRTextures = true;
|
||||
}
|
||||
// TODO: When Apple7 is added, set max query buffer size back to 256 kiB.
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2497,8 +2515,12 @@ void MVKPhysicalDevice::initExtensions() {
|
||||
if (!_metalFeatures.stencilFeedback) {
|
||||
pWritableExtns->vk_EXT_shader_stencil_export.enabled = false;
|
||||
}
|
||||
if (!_metalFeatures.astcHDRTextures) {
|
||||
pWritableExtns->vk_EXT_texture_compression_astc_hdr.enabled = false;
|
||||
}
|
||||
#if MVK_MACOS
|
||||
if (!supportsMTLGPUFamily(Apple5)) {
|
||||
pWritableExtns->vk_AMD_shader_image_load_store_lod.enabled = false;
|
||||
pWritableExtns->vk_IMG_format_pvrtc.enabled = false;
|
||||
}
|
||||
#endif
|
||||
|
@ -41,7 +41,7 @@ void MVKPipelineLayout::bindDescriptorSets(MVKCommandEncoder* cmdEncoder,
|
||||
MVKArrayRef<MVKDescriptorSet*> descriptorSets,
|
||||
uint32_t firstSet,
|
||||
MVKArrayRef<uint32_t> dynamicOffsets) {
|
||||
clearConfigurationResult();
|
||||
if (!cmdEncoder) { clearConfigurationResult(); }
|
||||
uint32_t dynamicOffsetIndex = 0;
|
||||
size_t dsCnt = descriptorSets.size;
|
||||
for (uint32_t dsIdx = 0; dsIdx < dsCnt; dsIdx++) {
|
||||
@ -50,7 +50,7 @@ void MVKPipelineLayout::bindDescriptorSets(MVKCommandEncoder* cmdEncoder,
|
||||
MVKDescriptorSetLayout* dsl = _descriptorSetLayouts[dslIdx];
|
||||
dsl->bindDescriptorSet(cmdEncoder, descSet, _dslMTLResourceIndexOffsets[dslIdx],
|
||||
dynamicOffsets, dynamicOffsetIndex);
|
||||
setConfigurationResult(dsl->getConfigurationResult());
|
||||
if (!cmdEncoder) { setConfigurationResult(dsl->getConfigurationResult()); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,10 +58,10 @@ void MVKPipelineLayout::bindDescriptorSets(MVKCommandEncoder* cmdEncoder,
|
||||
void MVKPipelineLayout::pushDescriptorSet(MVKCommandEncoder* cmdEncoder,
|
||||
MVKArrayRef<VkWriteDescriptorSet> descriptorWrites,
|
||||
uint32_t set) {
|
||||
clearConfigurationResult();
|
||||
if (!cmdEncoder) { clearConfigurationResult(); }
|
||||
MVKDescriptorSetLayout* dsl = _descriptorSetLayouts[set];
|
||||
dsl->pushDescriptorSet(cmdEncoder, descriptorWrites, _dslMTLResourceIndexOffsets[set]);
|
||||
setConfigurationResult(dsl->getConfigurationResult());
|
||||
if (!cmdEncoder) { setConfigurationResult(dsl->getConfigurationResult()); }
|
||||
}
|
||||
|
||||
// A null cmdEncoder can be passed to perform a validation pass
|
||||
@ -69,10 +69,10 @@ void MVKPipelineLayout::pushDescriptorSet(MVKCommandEncoder* cmdEncoder,
|
||||
MVKDescriptorUpdateTemplate* descUpdateTemplate,
|
||||
uint32_t set,
|
||||
const void* pData) {
|
||||
clearConfigurationResult();
|
||||
if (!cmdEncoder) { clearConfigurationResult(); }
|
||||
MVKDescriptorSetLayout* dsl = _descriptorSetLayouts[set];
|
||||
dsl->pushDescriptorSet(cmdEncoder, descUpdateTemplate, pData, _dslMTLResourceIndexOffsets[set]);
|
||||
setConfigurationResult(dsl->getConfigurationResult());
|
||||
if (!cmdEncoder) { setConfigurationResult(dsl->getConfigurationResult()); }
|
||||
}
|
||||
|
||||
void MVKPipelineLayout::populateShaderConverterContext(SPIRVToMSLConversionConfiguration& context) {
|
||||
|
@ -33,7 +33,7 @@ class MVKPhysicalDevice;
|
||||
// Validate these values periodically as new formats are added over time.
|
||||
static const uint32_t _vkFormatCount = 256;
|
||||
static const uint32_t _vkFormatCoreCount = VK_FORMAT_ASTC_12x12_SRGB_BLOCK + 1;
|
||||
static const uint32_t _mtlPixelFormatCount = 128;
|
||||
static const uint32_t _mtlPixelFormatCount = 256;
|
||||
static const uint32_t _mtlPixelFormatCoreCount = MTLPixelFormatX32_Stencil8 + 2; // The actual last enum value is not available on iOS
|
||||
static const uint32_t _mtlVertexFormatCount = MTLVertexFormatHalf + 1;
|
||||
|
||||
|
@ -46,32 +46,46 @@ using namespace std;
|
||||
# define MTLPixelFormatEAC_RG11Unorm MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatEAC_RG11Snorm MTLPixelFormatInvalid
|
||||
|
||||
# define MTLPixelFormatASTC_4x4_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_4x4_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_4x4_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x4_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x4_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x4_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x5_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x5_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x5_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x5_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x6_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x6_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x6_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x5_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x5_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x6_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x6_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x6_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x8_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x8_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x8_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x5_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x5_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x6_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x6_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x6_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x8_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x8_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x8_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x10_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x10_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x10_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x10_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x10_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x10_sRGB MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x12_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x12_LDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x12_sRGB MTLPixelFormatInvalid
|
||||
|
||||
@ -114,6 +128,23 @@ using namespace std;
|
||||
# define MTLPixelFormatDepth16Unorm_Stencil8 MTLPixelFormatDepth32Float_Stencil8
|
||||
#endif
|
||||
|
||||
#if MVK_TVOS
|
||||
# define MTLPixelFormatASTC_4x4_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x4_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_5x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_6x6_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x6_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_8x8_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x5_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x6_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x8_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_10x10_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x10_HDR MTLPixelFormatInvalid
|
||||
# define MTLPixelFormatASTC_12x12_HDR MTLPixelFormatInvalid
|
||||
#endif
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark MVKPixelFormats
|
||||
@ -928,32 +959,46 @@ void MVKPixelFormats::initVkFormatCapabilities() {
|
||||
addVkFormatDesc( EAC_R11G11_SNORM_BLOCK, EAC_RG11Snorm, Invalid, Invalid, Invalid, 4, 4, 16, Compressed );
|
||||
|
||||
addVkFormatDesc( ASTC_4x4_UNORM_BLOCK, ASTC_4x4_LDR, Invalid, Invalid, Invalid, 4, 4, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_4x4_SFLOAT_BLOCK_EXT, ASTC_4x4_HDR, Invalid, Invalid, Invalid, 4, 4, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_4x4_SRGB_BLOCK, ASTC_4x4_sRGB, Invalid, Invalid, Invalid, 4, 4, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_5x4_UNORM_BLOCK, ASTC_5x4_LDR, Invalid, Invalid, Invalid, 5, 4, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_5x4_SFLOAT_BLOCK_EXT, ASTC_5x4_HDR, Invalid, Invalid, Invalid, 5, 4, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_5x4_SRGB_BLOCK, ASTC_5x4_sRGB, Invalid, Invalid, Invalid, 5, 4, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_5x5_UNORM_BLOCK, ASTC_5x5_LDR, Invalid, Invalid, Invalid, 5, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_5x5_SFLOAT_BLOCK_EXT, ASTC_5x5_HDR, Invalid, Invalid, Invalid, 5, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_5x5_SRGB_BLOCK, ASTC_5x5_sRGB, Invalid, Invalid, Invalid, 5, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_6x5_UNORM_BLOCK, ASTC_6x5_LDR, Invalid, Invalid, Invalid, 6, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_6x5_SFLOAT_BLOCK_EXT, ASTC_6x5_HDR, Invalid, Invalid, Invalid, 6, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_6x5_SRGB_BLOCK, ASTC_6x5_sRGB, Invalid, Invalid, Invalid, 6, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_6x6_UNORM_BLOCK, ASTC_6x6_LDR, Invalid, Invalid, Invalid, 6, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_6x6_SFLOAT_BLOCK_EXT, ASTC_6x6_HDR, Invalid, Invalid, Invalid, 6, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_6x6_SRGB_BLOCK, ASTC_6x6_sRGB, Invalid, Invalid, Invalid, 6, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x5_UNORM_BLOCK, ASTC_8x5_LDR, Invalid, Invalid, Invalid, 8, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x5_SFLOAT_BLOCK_EXT, ASTC_8x5_HDR, Invalid, Invalid, Invalid, 8, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x5_SRGB_BLOCK, ASTC_8x5_sRGB, Invalid, Invalid, Invalid, 8, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x6_UNORM_BLOCK, ASTC_8x6_LDR, Invalid, Invalid, Invalid, 8, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x6_SFLOAT_BLOCK_EXT, ASTC_8x6_HDR, Invalid, Invalid, Invalid, 8, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x6_SRGB_BLOCK, ASTC_8x6_sRGB, Invalid, Invalid, Invalid, 8, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x8_UNORM_BLOCK, ASTC_8x8_LDR, Invalid, Invalid, Invalid, 8, 8, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x8_SFLOAT_BLOCK_EXT, ASTC_8x8_HDR, Invalid, Invalid, Invalid, 8, 8, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_8x8_SRGB_BLOCK, ASTC_8x8_sRGB, Invalid, Invalid, Invalid, 8, 8, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x5_UNORM_BLOCK, ASTC_10x5_LDR, Invalid, Invalid, Invalid, 10, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x5_SFLOAT_BLOCK_EXT, ASTC_10x5_HDR, Invalid, Invalid, Invalid, 10, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x5_SRGB_BLOCK, ASTC_10x5_sRGB, Invalid, Invalid, Invalid, 10, 5, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x6_UNORM_BLOCK, ASTC_10x6_LDR, Invalid, Invalid, Invalid, 10, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x6_SFLOAT_BLOCK_EXT, ASTC_10x6_HDR, Invalid, Invalid, Invalid, 10, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x6_SRGB_BLOCK, ASTC_10x6_sRGB, Invalid, Invalid, Invalid, 10, 6, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x8_UNORM_BLOCK, ASTC_10x8_LDR, Invalid, Invalid, Invalid, 10, 8, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x8_SFLOAT_BLOCK_EXT, ASTC_10x8_HDR, Invalid, Invalid, Invalid, 10, 8, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x8_SRGB_BLOCK, ASTC_10x8_sRGB, Invalid, Invalid, Invalid, 10, 8, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x10_UNORM_BLOCK, ASTC_10x10_LDR, Invalid, Invalid, Invalid, 10, 10, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x10_SFLOAT_BLOCK_EXT, ASTC_10x10_HDR, Invalid, Invalid, Invalid, 10, 10, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_10x10_SRGB_BLOCK, ASTC_10x10_sRGB, Invalid, Invalid, Invalid, 10, 10, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_12x10_UNORM_BLOCK, ASTC_12x10_LDR, Invalid, Invalid, Invalid, 12, 10, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_12x10_SFLOAT_BLOCK_EXT, ASTC_12x10_HDR, Invalid, Invalid, Invalid, 12, 10, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_12x10_SRGB_BLOCK, ASTC_12x10_sRGB, Invalid, Invalid, Invalid, 12, 10, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_12x12_UNORM_BLOCK, ASTC_12x12_LDR, Invalid, Invalid, Invalid, 12, 12, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_12x12_SFLOAT_BLOCK_EXT, ASTC_12x12_HDR, Invalid, Invalid, Invalid, 12, 12, 16, Compressed );
|
||||
addVkFormatDesc( ASTC_12x12_SRGB_BLOCK, ASTC_12x12_sRGB, Invalid, Invalid, Invalid, 12, 12, 16, Compressed );
|
||||
|
||||
// Extension VK_IMG_format_pvrtc
|
||||
@ -1118,32 +1163,46 @@ void MVKPixelFormats::initMTLPixelFormatCapabilities() {
|
||||
|
||||
addMTLPixelFormatDesc ( ASTC_4x4_LDR, ASTC_4x4, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_4x4_sRGB, ASTC_4x4, None, None, ASTC_4x4_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_4x4_HDR, ASTC_4x4, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_5x4_LDR, ASTC_5x4, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_5x4_sRGB, ASTC_5x4, None, None, ASTC_5x4_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_5x4_HDR, ASTC_5x4, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_5x5_LDR, ASTC_5x5, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_5x5_sRGB, ASTC_5x5, None, None, ASTC_5x5_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_5x5_HDR, ASTC_5x5, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_6x5_LDR, ASTC_6x5, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_6x5_sRGB, ASTC_6x5, None, None, ASTC_6x5_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_6x5_HDR, ASTC_6x5, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_6x6_LDR, ASTC_6x6, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_6x6_sRGB, ASTC_6x6, None, None, ASTC_6x6_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_6x6_HDR, ASTC_6x6, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_8x5_LDR, ASTC_8x5, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_8x5_sRGB, ASTC_8x5, None, None, ASTC_8x5_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_8x5_HDR, ASTC_8x5, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_8x6_LDR, ASTC_8x6, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_8x6_sRGB, ASTC_8x6, None, None, ASTC_8x6_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_8x6_HDR, ASTC_8x6, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_8x8_LDR, ASTC_8x8, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_8x8_sRGB, ASTC_8x8, None, None, ASTC_8x8_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_8x8_HDR, ASTC_8x8, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_10x5_LDR, ASTC_10x5, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_10x5_sRGB, ASTC_10x5, None, None, ASTC_10x5_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_10x5_HDR, ASTC_10x5, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_10x6_LDR, ASTC_10x6, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_10x6_sRGB, ASTC_10x6, None, None, ASTC_10x6_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_10x6_HDR, ASTC_10x6, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_10x8_LDR, ASTC_10x8, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_10x8_sRGB, ASTC_10x8, None, None, ASTC_10x8_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_10x8_HDR, ASTC_10x8, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_10x10_LDR, ASTC_10x10, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_10x10_sRGB, ASTC_10x10, None, None, ASTC_10x10_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_10x10_HDR, ASTC_10x10, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_12x10_LDR, ASTC_12x10, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_12x10_sRGB, ASTC_12x10, None, None, ASTC_12x10_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_12x10_HDR, ASTC_12x10, None, None );
|
||||
addMTLPixelFormatDesc ( ASTC_12x12_LDR, ASTC_12x12, None, None );
|
||||
addMTLPixelFormatDescSRGB( ASTC_12x12_sRGB, ASTC_12x12, None, None, ASTC_12x12_LDR );
|
||||
addMTLPixelFormatDesc ( ASTC_12x12_HDR, ASTC_12x12, None, None );
|
||||
|
||||
addMTLPixelFormatDesc ( BC1_RGBA, BC1_RGBA, None, RF );
|
||||
addMTLPixelFormatDescSRGB( BC1_RGBA_sRGB, BC1_RGBA, None, RF, BC1_RGBA );
|
||||
@ -1491,32 +1550,46 @@ void MVKPixelFormats::modifyMTLFormatCapabilities(id<MTLDevice> mtlDevice) {
|
||||
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_4x4_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_4x4_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_4x4_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_5x4_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_5x4_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_5x4_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_5x5_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_5x5_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_5x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_6x5_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_6x5_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_6x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_6x6_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_6x6_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_6x6_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_8x5_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_8x5_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_8x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_8x6_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_8x6_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_8x6_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_8x8_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_8x8_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_8x8_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x5_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x5_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_10x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x6_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x6_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_10x6_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x8_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x8_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_10x8_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x10_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_10x10_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_10x10_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_12x10_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_12x10_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_12x10_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_12x12_LDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, ASTC_12x12_sRGB, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 10.16, ASTC_12x12_HDR, RF );
|
||||
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, BGRA10_XR, All );
|
||||
addGPUOSMTLPixFmtCaps( Apple5, 10.16, BGRA10_XR_sRGB, All );
|
||||
@ -1759,6 +1832,21 @@ void MVKPixelFormats::modifyMTLFormatCapabilities(id<MTLDevice> mtlDevice) {
|
||||
|
||||
addFeatSetMTLPixFmtCaps( iOS_GPUFamily1_v4, BGR10A2Unorm, All );
|
||||
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_4x4_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_5x4_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_5x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_6x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_6x6_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_8x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_8x6_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_8x8_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_10x5_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_10x6_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_10x8_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_10x10_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_12x10_HDR, RF );
|
||||
addGPUOSMTLPixFmtCaps( Apple6, 13.0, ASTC_12x12_HDR, RF );
|
||||
|
||||
addGPUOSMTLPixFmtCaps( Apple1, 13.0, Depth16Unorm, DRFM );
|
||||
addGPUOSMTLPixFmtCaps( Apple3, 13.0, Depth16Unorm, DRFMR );
|
||||
|
||||
@ -1944,7 +2032,9 @@ void MVKPixelFormats::setFormatProperties(MVKVkFormatDesc& vkDesc) {
|
||||
enableFormatFeatures(DSAtt, Tex, mtlPixFmtCaps, vkProps.optimalTilingFeatures);
|
||||
enableFormatFeatures(Blend, Tex, mtlPixFmtCaps, vkProps.optimalTilingFeatures);
|
||||
|
||||
#if MVK_MACOS_OR_IOS
|
||||
id<MTLDevice> mtlDev = _physicalDevice ? _physicalDevice->getMTLDevice() : nil;
|
||||
#endif
|
||||
if ( chromaSubsamplingComponentBits > 0 ||
|
||||
// XXX We really want to use the device's Metal features instead of duplicating the
|
||||
// logic from MVKPhysicalDevice, but those may not have been initialized yet.
|
||||
@ -1975,7 +2065,7 @@ void MVKPixelFormats::setFormatProperties(MVKVkFormatDesc& vkDesc) {
|
||||
|
||||
#if MVK_MACOS
|
||||
// On IMR GPUs, linear textures cannot be used as attachments, so disable those features.
|
||||
if (![mtlDev respondsToSelector: @selector(supportsGPUFamily:)] || ![mtlDev supportsGPUFamily: MTLGPUFamilyApple5]) {
|
||||
if (![mtlDev respondsToSelector: @selector(supportsFamily:)] || ![mtlDev supportsFamily: MTLGPUFamilyApple5]) {
|
||||
mvkDisableFlags(vkProps.linearTilingFeatures, (kMVKVkFormatFeatureFlagsTexColorAtt |
|
||||
kMVKVkFormatFeatureFlagsTexDSAtt |
|
||||
kMVKVkFormatFeatureFlagsTexBlend));
|
||||
|
@ -97,6 +97,7 @@ MVK_EXTENSION(EXT_shader_stencil_export, EXT_SHADER_STENCIL_EXPORT, DEVICE)
|
||||
MVK_EXTENSION(EXT_shader_viewport_index_layer, EXT_SHADER_VIEWPORT_INDEX_LAYER, DEVICE)
|
||||
MVK_EXTENSION(EXT_swapchain_colorspace, EXT_SWAPCHAIN_COLOR_SPACE, INSTANCE)
|
||||
MVK_EXTENSION(EXT_texel_buffer_alignment, EXT_TEXEL_BUFFER_ALIGNMENT, DEVICE)
|
||||
MVK_EXTENSION(EXT_texture_compression_astc_hdr, EXT_TEXTURE_COMPRESSION_ASTC_HDR, DEVICE)
|
||||
MVK_EXTENSION(EXT_vertex_attribute_divisor, EXT_VERTEX_ATTRIBUTE_DIVISOR, DEVICE)
|
||||
MVK_EXTENSION(AMD_gpu_shader_half_float, AMD_GPU_SHADER_HALF_FLOAT, DEVICE)
|
||||
MVK_EXTENSION(AMD_negative_viewport_height, AMD_NEGATIVE_VIEWPORT_HEIGHT, DEVICE)
|
||||
|
@ -48,15 +48,16 @@ static VkExtensionProperties kVkExtProps_ ##EXT = mvkMakeExtProps(VK_ ##EXT ##_E
|
||||
static bool mvkIsSupportedOnPlatform(VkExtensionProperties* pProperties) {
|
||||
#if MVK_MACOS
|
||||
if (pProperties == &kVkExtProps_MVK_IOS_SURFACE) { return false; }
|
||||
if (pProperties == &kVkExtProps_EXT_POST_DEPTH_COVERAGE) { return false; }
|
||||
if (pProperties == &kVkExtProps_AMD_SHADER_IMAGE_LOAD_STORE_LOD) { return false; }
|
||||
|
||||
if (pProperties == &kVkExtProps_KHR_SHADER_SUBGROUP_EXTENDED_TYPES) { return mvkOSVersionIsAtLeast(10.14); }
|
||||
if (pProperties == &kVkExtProps_EXT_HDR_METADATA) { return mvkOSVersionIsAtLeast(10.15); }
|
||||
if (pProperties == &kVkExtProps_EXT_FRAGMENT_SHADER_INTERLOCK) { return mvkOSVersionIsAtLeast(10.13); }
|
||||
if (pProperties == &kVkExtProps_EXT_MEMORY_BUDGET) { return mvkOSVersionIsAtLeast(10.13); }
|
||||
if (pProperties == &kVkExtProps_EXT_POST_DEPTH_COVERAGE) { return mvkOSVersionIsAtLeast(10.16); }
|
||||
if (pProperties == &kVkExtProps_EXT_SHADER_STENCIL_EXPORT) { return mvkOSVersionIsAtLeast(10.14); }
|
||||
if (pProperties == &kVkExtProps_EXT_TEXEL_BUFFER_ALIGNMENT) { return mvkOSVersionIsAtLeast(10.13); }
|
||||
if (pProperties == &kVkExtProps_EXT_TEXTURE_COMPRESSION_ASTC_HDR) { return mvkOSVersionIsAtLeast(10.16); }
|
||||
if (pProperties == &kVkExtProps_AMD_SHADER_IMAGE_LOAD_STORE_LOD) { return mvkOSVersionIsAtLeast(10.16); }
|
||||
if (pProperties == &kVkExtProps_AMD_SHADER_TRINARY_MINMAX) { return mvkOSVersionIsAtLeast(10.14); }
|
||||
if (pProperties == &kVkExtProps_IMG_FORMAT_PVRTC) { return mvkOSVersionIsAtLeast(10.16); }
|
||||
#endif
|
||||
@ -72,6 +73,7 @@ static bool mvkIsSupportedOnPlatform(VkExtensionProperties* pProperties) {
|
||||
if (pProperties == &kVkExtProps_EXT_SHADER_STENCIL_EXPORT) { return mvkOSVersionIsAtLeast(12.0); }
|
||||
if (pProperties == &kVkExtProps_EXT_SWAPCHAIN_COLOR_SPACE) { return mvkOSVersionIsAtLeast(9.0); }
|
||||
if (pProperties == &kVkExtProps_EXT_TEXEL_BUFFER_ALIGNMENT) { return mvkOSVersionIsAtLeast(11.0); }
|
||||
if (pProperties == &kVkExtProps_EXT_TEXTURE_COMPRESSION_ASTC_HDR) { return mvkOSVersionIsAtLeast(13.0); }
|
||||
if (pProperties == &kVkExtProps_AMD_SHADER_TRINARY_MINMAX) { return mvkOSVersionIsAtLeast(12.0); }
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user