Rename most MVKPixelFormats member functions to eliminate naming redundancy.
Many of the names of the MVKPixelFormats member functions where inherited from
function names in mvk_datatypes.h, which is a C API, therefore must have unique
function names, and uses parameter types as part of the names to distinguish.
Since MVKPixelFormats is a C++ class, we can do away with that and make use
of function overloading to simplify the function names.
I forgot to to this when creating MVKPixelFormats in the first place.
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm
index 604887d..37dfa34 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm
@@ -91,14 +91,14 @@
_srcSampleCount = mvkSampleCountFromVkSampleCountFlagBits(_srcImage->getSampleCount());
_isSrcCompressed = _srcImage->getIsCompressed();
MTLPixelFormat srcMTLPixFmt = _srcImage->getMTLPixelFormat();
- uint32_t srcBytesPerBlock = pixFmts->getMTLPixelFormatBytesPerBlock(srcMTLPixFmt);
+ uint32_t srcBytesPerBlock = pixFmts->getBytesPerBlock(srcMTLPixFmt);
_dstImage = (MVKImage*)dstImage;
_dstLayout = dstImageLayout;
_dstSampleCount = mvkSampleCountFromVkSampleCountFlagBits(_dstImage->getSampleCount());
_isDstCompressed = _dstImage->getIsCompressed();
MTLPixelFormat dstMTLPixFmt = _dstImage->getMTLPixelFormat();
- uint32_t dstBytesPerBlock = pixFmts->getMTLPixelFormatBytesPerBlock(dstMTLPixFmt);
+ uint32_t dstBytesPerBlock = pixFmts->getBytesPerBlock(dstMTLPixFmt);
_canCopyFormats = (_dstSampleCount == _srcSampleCount) && (formatsMustMatch
? (dstMTLPixFmt == srcMTLPixFmt)
@@ -144,7 +144,7 @@
MTLPixelFormat srcMTLPixFmt = _srcImage->getMTLPixelFormat();
VkExtent3D dstExtent = region.extent;
if (_isSrcCompressed && !_isDstCompressed) {
- VkExtent2D srcBlockExtent = pixFmts->getMTLPixelFormatBlockTexelSize(srcMTLPixFmt);
+ VkExtent2D srcBlockExtent = pixFmts->getBlockTexelSize(srcMTLPixFmt);
dstExtent.width /= srcBlockExtent.width;
dstExtent.height /= srcBlockExtent.height;
}
@@ -156,8 +156,8 @@
buffImgCpy.imageExtent = dstExtent;
_dstTmpBuffImgCopies.push_back(buffImgCpy);
- NSUInteger bytesPerRow = pixFmts->getMTLPixelFormatBytesPerRow(srcMTLPixFmt, region.extent.width);
- NSUInteger bytesPerRegion = pixFmts->getMTLPixelFormatBytesPerLayer(srcMTLPixFmt, bytesPerRow, region.extent.height);
+ NSUInteger bytesPerRow = pixFmts->getBytesPerRow(srcMTLPixFmt, region.extent.width);
+ NSUInteger bytesPerRegion = pixFmts->getBytesPerLayer(srcMTLPixFmt, bytesPerRow, region.extent.height);
_tmpBuffSize += bytesPerRegion;
}
@@ -268,8 +268,7 @@
// Validate
MTLPixelFormat srcMTLPixFmt = _srcImage->getMTLPixelFormat();
if ( !_mvkImageBlitRenders.empty() &&
- (pixFmts->mtlPixelFormatIsDepthFormat(srcMTLPixFmt) ||
- pixFmts->mtlPixelFormatIsStencilFormat(srcMTLPixFmt)) ) {
+ (pixFmts->isDepthFormat(srcMTLPixFmt) || pixFmts->isStencilFormat(srcMTLPixFmt)) ) {
_mvkImageBlitRenders.clear();
return reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdBlitImage(): Scaling or inverting depth/stencil images is not supported.");
@@ -490,8 +489,8 @@
_transferImageData.samples = _srcImage->getSampleCount();
// Validate
- if ( !mvkAreAllFlagsEnabled(cmdBuff->getPixelFormats()->getMTLPixelFormatCapabilities(_dstImage->getMTLPixelFormat()), kMVKMTLFmtCapsResolve) ) {
- return reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdResolveImage(): %s cannot be used as a resolve destination on this device.", cmdBuff->getPixelFormats()->getVkFormatName(_dstImage->getVkFormat()));
+ if ( !mvkAreAllFlagsEnabled(cmdBuff->getPixelFormats()->getCapabilities(_dstImage->getMTLPixelFormat()), kMVKMTLFmtCapsResolve) ) {
+ return reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdResolveImage(): %s cannot be used as a resolve destination on this device.", cmdBuff->getPixelFormats()->getName(_dstImage->getVkFormat()));
}
return VK_SUCCESS;
@@ -755,7 +754,7 @@
// Validate
if ( !_image->hasExpectedTexelSize() ) {
const char* cmdName = _toImage ? "vkCmdCopyBufferToImage" : "vkCmdCopyImageToBuffer";
- return reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "%s(): The image is using Metal format %s as a substitute for Vulkan format %s. Since the pixel size is different, content for the image cannot be copied to or from a buffer.", cmdName, cmdBuff->getPixelFormats()->getMTLPixelFormatName(_image->getMTLPixelFormat()), cmdBuff->getPixelFormats()->getVkFormatName(_image->getVkFormat()));
+ return reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "%s(): The image is using Metal format %s as a substitute for Vulkan format %s. Since the pixel size is different, content for the image cannot be copied to or from a buffer.", cmdName, cmdBuff->getPixelFormats()->getName(_image->getMTLPixelFormat()), cmdBuff->getPixelFormats()->getName(_image->getVkFormat()));
}
return VK_SUCCESS;
@@ -786,14 +785,13 @@
uint32_t buffImgHt = cpyRgn.bufferImageHeight;
if (buffImgHt == 0) { buffImgHt = cpyRgn.imageExtent.height; }
- NSUInteger bytesPerRow = pixFmts->getMTLPixelFormatBytesPerRow(mtlPixFmt, buffImgWd);
- NSUInteger bytesPerImg = pixFmts->getMTLPixelFormatBytesPerLayer(mtlPixFmt, bytesPerRow, buffImgHt);
+ NSUInteger bytesPerRow = pixFmts->getBytesPerRow(mtlPixFmt, buffImgWd);
+ NSUInteger bytesPerImg = pixFmts->getBytesPerLayer(mtlPixFmt, bytesPerRow, buffImgHt);
// If the format combines BOTH depth and stencil, determine whether one or both
// components are to be copied, and adjust the byte counts and copy options accordingly.
MTLBlitOption blitOptions = MTLBlitOptionNone;
- if (pixFmts->mtlPixelFormatIsDepthFormat(mtlPixFmt) &&
- pixFmts->mtlPixelFormatIsStencilFormat(mtlPixFmt)) {
+ if (pixFmts->isDepthFormat(mtlPixFmt) && pixFmts->isStencilFormat(mtlPixFmt)) {
VkImageAspectFlags imgFlags = cpyRgn.imageSubresource.aspectMask;
bool wantDepth = mvkAreAllFlagsEnabled(imgFlags, VK_IMAGE_ASPECT_DEPTH_BIT);
@@ -802,7 +800,7 @@
// The stencil component is always 1 byte per pixel.
// Don't reduce depths of 32-bit depth/stencil formats.
if (wantDepth && !wantStencil) {
- if (pixFmts->getMTLPixelFormatBytesPerTexel(mtlPixFmt) != 4) {
+ if (pixFmts->getBytesPerTexel(mtlPixFmt) != 4) {
bytesPerRow -= buffImgWd;
bytesPerImg -= buffImgWd * buffImgHt;
}
@@ -815,7 +813,7 @@
}
#if MVK_IOS
- if (pixFmts->mtlPixelFormatIsPVRTCFormat(mtlPixFmt)) {
+ if (pixFmts->isPVRTCFormat(mtlPixFmt)) {
blitOptions |= MTLBlitOptionRowLinearPVRTC;
}
#endif
@@ -845,8 +843,8 @@
[mtlComputeEnc setBuffer: mtlBuffer offset: mtlBuffOffset atIndex: 0];
MVKBuffer* tempBuff;
if (needsTempBuff) {
- NSUInteger bytesPerDestRow = pixFmts->getMTLPixelFormatBytesPerRow(mtlTexture.pixelFormat, info.extent.width);
- NSUInteger bytesPerDestImg = pixFmts->getMTLPixelFormatBytesPerLayer(mtlTexture.pixelFormat, bytesPerDestRow, info.extent.height);
+ NSUInteger bytesPerDestRow = pixFmts->getBytesPerRow(mtlTexture.pixelFormat, info.extent.width);
+ NSUInteger bytesPerDestImg = pixFmts->getBytesPerLayer(mtlTexture.pixelFormat, bytesPerDestRow, info.extent.height);
// We're going to copy from the temporary buffer now, so use the
// temp buffer parameters in the copy below.
bytesPerRow = bytesPerDestRow;
@@ -870,7 +868,7 @@
// Now work out how big to make the grid, and from there, the size and number of threadgroups.
// One thread is run per block. Each block decompresses to an m x n array of texels.
// So the size of the grid is (ceil(width/m), ceil(height/n), depth).
- VkExtent2D blockExtent = pixFmts->getMTLPixelFormatBlockTexelSize(mtlPixFmt);
+ VkExtent2D blockExtent = pixFmts->getBlockTexelSize(mtlPixFmt);
MTLSize mtlGridSize = MTLSizeMake(mvkCeilingDivide<NSUInteger>(mtlTxtSize.width, blockExtent.width),
mvkCeilingDivide<NSUInteger>(mtlTxtSize.height, blockExtent.height),
mtlTxtSize.depth);
@@ -970,13 +968,13 @@
if (mvkIsAnyFlagEnabled(clrAtt.aspectMask, VK_IMAGE_ASPECT_DEPTH_BIT)) {
_isClearingDepth = true;
_rpsKey.enableAttachment(kMVKClearAttachmentDepthStencilIndex);
- mtlDepthVal = pixFmts->getMTLClearDepthFromVkClearValue(clrAtt.clearValue);
+ mtlDepthVal = pixFmts->getMTLClearDepthValue(clrAtt.clearValue);
}
if (mvkIsAnyFlagEnabled(clrAtt.aspectMask, VK_IMAGE_ASPECT_STENCIL_BIT)) {
_isClearingStencil = true;
_rpsKey.enableAttachment(kMVKClearAttachmentDepthStencilIndex);
- _mtlStencilValue = pixFmts->getMTLClearStencilFromVkClearValue(clrAtt.clearValue);
+ _mtlStencilValue = pixFmts->getMTLClearStencilValue(clrAtt.clearValue);
}
}
@@ -1072,17 +1070,17 @@
uint32_t caCnt = subpass->getColorAttachmentCount();
for (uint32_t caIdx = 0; caIdx < caCnt; caIdx++) {
VkFormat vkAttFmt = subpass->getColorAttachmentFormat(caIdx);
- _rpsKey.attachmentMTLPixelFormats[caIdx] = pixFmts->getMTLPixelFormatFromVkFormat(vkAttFmt);
- MTLClearColor mtlCC = pixFmts->getMTLClearColorFromVkClearValue(_vkClearValues[caIdx], vkAttFmt);
+ _rpsKey.attachmentMTLPixelFormats[caIdx] = pixFmts->getMTLPixelFormat(vkAttFmt);
+ MTLClearColor mtlCC = pixFmts->getMTLClearColor(_vkClearValues[caIdx], vkAttFmt);
_clearColors[caIdx] = { (float)mtlCC.red, (float)mtlCC.green, (float)mtlCC.blue, (float)mtlCC.alpha};
}
VkFormat vkAttFmt = subpass->getDepthStencilFormat();
- MTLPixelFormat mtlAttFmt = pixFmts->getMTLPixelFormatFromVkFormat(vkAttFmt);
+ MTLPixelFormat mtlAttFmt = pixFmts->getMTLPixelFormat(vkAttFmt);
_rpsKey.attachmentMTLPixelFormats[kMVKClearAttachmentDepthStencilIndex] = mtlAttFmt;
- bool isClearingDepth = _isClearingDepth && pixFmts->mtlPixelFormatIsDepthFormat(mtlAttFmt);
- bool isClearingStencil = _isClearingStencil && pixFmts->mtlPixelFormatIsStencilFormat(mtlAttFmt);
+ bool isClearingDepth = _isClearingDepth && pixFmts->isDepthFormat(mtlAttFmt);
+ bool isClearingStencil = _isClearingStencil && pixFmts->isStencilFormat(mtlAttFmt);
// Render the clear colors to the attachments
MVKCommandEncodingPool* cmdEncPool = cmdEncoder->getCommandEncodingPool();
@@ -1134,10 +1132,10 @@
if (_image->getImageType() == VK_IMAGE_TYPE_1D) {
return reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdClearImage(): Native 1D images cannot be cleared on this device. Consider enabling MVK_CONFIG_TEXTURE_1D_AS_2D.");
}
- MVKMTLFmtCaps mtlFmtCaps = cmdBuff->getPixelFormats()->getMTLPixelFormatCapabilities(_image->getMTLPixelFormat());
+ MVKMTLFmtCaps mtlFmtCaps = cmdBuff->getPixelFormats()->getCapabilities(_image->getMTLPixelFormat());
if ((_isDepthStencilClear && !mvkAreAllFlagsEnabled(mtlFmtCaps, kMVKMTLFmtCapsDSAtt)) ||
( !_isDepthStencilClear && !mvkAreAllFlagsEnabled(mtlFmtCaps, kMVKMTLFmtCapsColorAtt))) {
- return reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdClearImage(): Format %s cannot be cleared on this device.", cmdBuff->getPixelFormats()->getVkFormatName(_image->getVkFormat()));
+ return reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdClearImage(): Format %s cannot be cleared on this device.", cmdBuff->getPixelFormats()->getName(_image->getVkFormat()));
}
return VK_SUCCESS;
@@ -1170,7 +1168,7 @@
mtlRPCADesc.texture = imgMTLTex;
mtlRPCADesc.loadAction = MTLLoadActionClear;
mtlRPCADesc.storeAction = MTLStoreActionStore;
- mtlRPCADesc.clearColor = pixFmts->getMTLClearColorFromVkClearValue(_clearValue, _image->getVkFormat());
+ mtlRPCADesc.clearColor = pixFmts->getMTLClearColor(_clearValue, _image->getVkFormat());
}
if (isClearingDepth) {
@@ -1178,7 +1176,7 @@
mtlRPDADesc.texture = imgMTLTex;
mtlRPDADesc.loadAction = MTLLoadActionClear;
mtlRPDADesc.storeAction = MTLStoreActionStore;
- mtlRPDADesc.clearDepth = pixFmts->getMTLClearDepthFromVkClearValue(_clearValue);
+ mtlRPDADesc.clearDepth = pixFmts->getMTLClearDepthValue(_clearValue);
}
if (isClearingStencil) {
@@ -1186,7 +1184,7 @@
mtlRPSADesc.texture = imgMTLTex;
mtlRPSADesc.loadAction = MTLLoadActionClear;
mtlRPSADesc.storeAction = MTLStoreActionStore;
- mtlRPSADesc.clearStencil = pixFmts->getMTLClearStencilFromVkClearValue(_clearValue);
+ mtlRPSADesc.clearStencil = pixFmts->getMTLClearStencilValue(_clearValue);
}
// Extract the mipmap levels that are to be updated
diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm b/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm
index 2940c9a..8920101 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm
@@ -328,14 +328,14 @@
void MVKDepthStencilCommandEncoderState::beginMetalRenderPass() {
MVKRenderSubpass* mvkSubpass = _cmdEncoder->getSubpass();
MVKPixelFormats* pixFmts = _cmdEncoder->getPixelFormats();
- MTLPixelFormat mtlDSFormat = pixFmts->getMTLPixelFormatFromVkFormat(mvkSubpass->getDepthStencilFormat());
+ MTLPixelFormat mtlDSFormat = pixFmts->getMTLPixelFormat(mvkSubpass->getDepthStencilFormat());
bool prevHasDepthAttachment = _hasDepthAttachment;
- _hasDepthAttachment = pixFmts->mtlPixelFormatIsDepthFormat(mtlDSFormat);
+ _hasDepthAttachment = pixFmts->isDepthFormat(mtlDSFormat);
if (_hasDepthAttachment != prevHasDepthAttachment) { markDirty(); }
bool prevHasStencilAttachment = _hasStencilAttachment;
- _hasStencilAttachment = pixFmts->mtlPixelFormatIsStencilFormat(mtlDSFormat);
+ _hasStencilAttachment = pixFmts->isStencilFormat(mtlDSFormat);
if (_hasStencilAttachment != prevHasStencilAttachment) { markDirty(); }
}
diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandResourceFactory.mm b/MoltenVK/MoltenVK/Commands/MVKCommandResourceFactory.mm
index bc4daf9..07a2dcf 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCommandResourceFactory.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCommandResourceFactory.mm
@@ -118,8 +118,8 @@
}
MVKPixelFormats* pixFmts = getPixelFormats();
MTLPixelFormat mtlDSFormat = (MTLPixelFormat)attKey.attachmentMTLPixelFormats[kMVKClearAttachmentDepthStencilIndex];
- if (pixFmts->mtlPixelFormatIsDepthFormat(mtlDSFormat)) { plDesc.depthAttachmentPixelFormat = mtlDSFormat; }
- if (pixFmts->mtlPixelFormatIsStencilFormat(mtlDSFormat)) { plDesc.stencilAttachmentPixelFormat = mtlDSFormat; }
+ if (pixFmts->isDepthFormat(mtlDSFormat)) { plDesc.depthAttachmentPixelFormat = mtlDSFormat; }
+ if (pixFmts->isStencilFormat(mtlDSFormat)) { plDesc.stencilAttachmentPixelFormat = mtlDSFormat; }
MTLVertexDescriptor* vtxDesc = plDesc.vertexDescriptor;
@@ -277,7 +277,7 @@
}
NSString* MVKCommandResourceFactory::getMTLFormatTypeString(MTLPixelFormat mtlPixFmt) {
- switch (getPixelFormats()->getFormatTypeFromMTLPixelFormat(mtlPixFmt)) {
+ switch (getPixelFormats()->getFormatType(mtlPixFmt)) {
case kMVKFormatColorHalf: return @"half";
case kMVKFormatColorFloat: return @"float";
case kMVKFormatColorInt8:
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKBuffer.mm b/MoltenVK/MoltenVK/GPUObjects/MVKBuffer.mm
index 728fa61..ed74605 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKBuffer.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKBuffer.mm
@@ -251,9 +251,9 @@
MVKPixelFormats* pixFmts = getPixelFormats();
_buffer = (MVKBuffer*)pCreateInfo->buffer;
_mtlBufferOffset = _buffer->getMTLBufferOffset() + pCreateInfo->offset;
- _mtlPixelFormat = pixFmts->getMTLPixelFormatFromVkFormat(pCreateInfo->format);
- VkExtent2D fmtBlockSize = pixFmts->getVkFormatBlockTexelSize(pCreateInfo->format); // Pixel size of format
- size_t bytesPerBlock = pixFmts->getVkFormatBytesPerBlock(pCreateInfo->format);
+ _mtlPixelFormat = pixFmts->getMTLPixelFormat(pCreateInfo->format);
+ VkExtent2D fmtBlockSize = pixFmts->getBlockTexelSize(pCreateInfo->format); // Pixel size of format
+ size_t bytesPerBlock = pixFmts->getBytesPerBlock(pCreateInfo->format);
_mtlTexture = nil;
// Layout texture as a 1D array of texel blocks (which are texels for non-compressed textures) that covers the bytes
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
index cddf4b5..442f23c 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
@@ -231,7 +231,7 @@
VkImageCreateFlags flags,
VkImageFormatProperties* pImageFormatProperties) {
- if ( !_pixelFormats.vkFormatIsSupported(format) ) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
+ if ( !_pixelFormats.isSupported(format) ) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
if ( !pImageFormatProperties ) { return VK_SUCCESS; }
@@ -241,7 +241,7 @@
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
- MVKFormatType mvkFmt = _pixelFormats.getFormatTypeFromVkFormat(format);
+ MVKFormatType mvkFmt = _pixelFormats.getFormatType(format);
bool hasAttachmentUsage = mvkIsAnyFlagEnabled(usage, (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT |
@@ -252,7 +252,7 @@
uint32_t maxLevels = 1;
uint32_t maxLayers = hasAttachmentUsage ? pLimits->maxFramebufferLayers : pLimits->maxImageArrayLayers;
- bool supportsMSAA = mvkAreAllFlagsEnabled(_pixelFormats.getVkFormatCapabilities(format), kMVKMTLFmtCapsMSAA);
+ bool supportsMSAA = mvkAreAllFlagsEnabled(_pixelFormats.getCapabilities(format), kMVKMTLFmtCapsMSAA);
VkSampleCountFlags sampleCounts = supportsMSAA ? _metalFeatures.supportedSampleCounts : VK_SAMPLE_COUNT_1_BIT;
switch (type) {
@@ -364,7 +364,7 @@
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
- if ( !_pixelFormats.vkFormatIsSupported(pImageFormatInfo->format) ) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
+ if ( !_pixelFormats.isSupported(pImageFormatInfo->format) ) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
if ( !getImageViewIsSupported(pImageFormatInfo) ) { return VK_ERROR_FORMAT_NOT_SUPPORTED; }
@@ -528,7 +528,7 @@
}
uint mtlFmtsCnt = sizeof(mtlFormats) / sizeof(MTLPixelFormat);
- if ( !_pixelFormats.mtlPixelFormatIsSupported(MTLPixelFormatBGR10A2Unorm) ) { mtlFmtsCnt--; }
+ if ( !_pixelFormats.isSupported(MTLPixelFormatBGR10A2Unorm) ) { mtlFmtsCnt--; }
const uint vkFmtsCnt = mtlFmtsCnt * (uint)colorSpaces.size();
@@ -545,7 +545,7 @@
// Now populate the supplied array
for (uint csIdx = 0, idx = 0; idx < *pCount && csIdx < colorSpaces.size(); csIdx++) {
for (uint fmtIdx = 0; idx < *pCount && fmtIdx < mtlFmtsCnt; fmtIdx++, idx++) {
- pSurfaceFormats[idx].format = _pixelFormats.getVkFormatFromMTLPixelFormat(mtlFormats[fmtIdx]);
+ pSurfaceFormats[idx].format = _pixelFormats.getVkFormat(mtlFormats[fmtIdx]);
pSurfaceFormats[idx].colorSpace = colorSpaces[csIdx];
}
}
@@ -1222,7 +1222,7 @@
uint32_t maxStorage = 0, maxUniform = 0;
bool singleTexelStorage = true, singleTexelUniform = true;
_pixelFormats.enumerateSupportedFormats({0, 0, VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT}, true, [&](VkFormat vk) {
- MTLPixelFormat mtlFmt = _pixelFormats.getMTLPixelFormatFromVkFormat(vk);
+ MTLPixelFormat mtlFmt = _pixelFormats.getMTLPixelFormat(vk);
if ( !mtlFmt ) { return false; } // If format is invalid, avoid validation errors on MTLDevice format alignment calls
NSUInteger alignment;
@@ -1236,12 +1236,12 @@
// Note that no implementations of Metal support compressed formats
// in a linear texture (including texture buffers). It's likely that even
// if they did, this would be the absolute minimum alignment.
- uint32_t texelSize = _pixelFormats.getVkFormatBytesPerBlock(vk);
+ uint32_t texelSize = _pixelFormats.getBytesPerBlock(vk);
// From the spec:
// "If the size of a single texel is a multiple of three bytes, then
// the size of a single component of the format is used instead."
if (texelSize % 3 == 0) {
- switch (_pixelFormats.getFormatTypeFromVkFormat(vk)) {
+ switch (_pixelFormats.getFormatType(vk)) {
case kMVKFormatColorInt8:
case kMVKFormatColorUInt8:
texelSize = 1;
@@ -2547,7 +2547,7 @@
VkDeviceSize deviceAlignment = 0;
id<MTLDevice> mtlDev = getMTLDevice();
if ([mtlDev respondsToSelector: @selector(minimumLinearTextureAlignmentForPixelFormat:)]) {
- deviceAlignment = [mtlDev minimumLinearTextureAlignmentForPixelFormat: getPixelFormats()->getMTLPixelFormatFromVkFormat(format)];
+ deviceAlignment = [mtlDev minimumLinearTextureAlignmentForPixelFormat: getPixelFormats()->getMTLPixelFormat(format)];
}
return deviceAlignment ? deviceAlignment : _pProperties->limits.minTexelBufferOffsetAlignment;
}
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
index 97c52e7..89fb6dd 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
@@ -39,23 +39,23 @@
VkImageType MVKImage::getImageType() { return mvkVkImageTypeFromMTLTextureType(_mtlTextureType); }
-VkFormat MVKImage::getVkFormat() { return getPixelFormats()->getVkFormatFromMTLPixelFormat(_mtlPixelFormat); }
+VkFormat MVKImage::getVkFormat() { return getPixelFormats()->getVkFormat(_mtlPixelFormat); }
-bool MVKImage::getIsDepthStencil() { return getPixelFormats()->getFormatTypeFromMTLPixelFormat(_mtlPixelFormat) == kMVKFormatDepthStencil; }
+bool MVKImage::getIsDepthStencil() { return getPixelFormats()->getFormatType(_mtlPixelFormat) == kMVKFormatDepthStencil; }
-bool MVKImage::getIsCompressed() { return getPixelFormats()->getFormatTypeFromMTLPixelFormat(_mtlPixelFormat) == kMVKFormatCompressed; }
+bool MVKImage::getIsCompressed() { return getPixelFormats()->getFormatType(_mtlPixelFormat) == kMVKFormatCompressed; }
VkExtent3D MVKImage::getExtent3D(uint32_t mipLevel) {
return mvkMipmapLevelSizeFromBaseSize3D(_extent, mipLevel);
}
VkDeviceSize MVKImage::getBytesPerRow(uint32_t mipLevel) {
- size_t bytesPerRow = getPixelFormats()->getMTLPixelFormatBytesPerRow(_mtlPixelFormat, getExtent3D(mipLevel).width);
+ size_t bytesPerRow = getPixelFormats()->getBytesPerRow(_mtlPixelFormat, getExtent3D(mipLevel).width);
return mvkAlignByteCount(bytesPerRow, _rowByteAlignment);
}
VkDeviceSize MVKImage::getBytesPerLayer(uint32_t mipLevel) {
- return getPixelFormats()->getMTLPixelFormatBytesPerLayer(_mtlPixelFormat, getBytesPerRow(mipLevel), getExtent3D(mipLevel).height);
+ return getPixelFormats()->getBytesPerLayer(_mtlPixelFormat, getBytesPerRow(mipLevel), getExtent3D(mipLevel).height);
}
VkResult MVKImage::getSubresourceLayout(const VkImageSubresource* pSubresource,
@@ -207,7 +207,7 @@
}
bool MVKImage::validateUseTexelBuffer() {
- VkExtent2D blockExt = getPixelFormats()->getMTLPixelFormatBlockTexelSize(_mtlPixelFormat);
+ VkExtent2D blockExt = getPixelFormats()->getBlockTexelSize(_mtlPixelFormat);
bool isUncompressed = blockExt.width == 1 && blockExt.height == 1;
bool useTexelBuffer = _device->_pMetalFeatures->texelBuffers; // Texel buffers available
@@ -336,7 +336,7 @@
_mipLevels = uint32_t(mtlTexture.mipmapLevelCount);
_samples = mvkVkSampleCountFlagBitsFromSampleCount(mtlTexture.sampleCount);
_arrayLayers = uint32_t(mtlTexture.arrayLength);
- _usage = getPixelFormats()->getVkImageUsageFlagsFromMTLTextureUsage(mtlTexture.usage, _mtlPixelFormat);
+ _usage = getPixelFormats()->getVkImageUsageFlags(mtlTexture.usage, _mtlPixelFormat);
if (_device->_pMetalFeatures->ioSurfaces) {
_ioSurface = mtlTexture.iosurface;
@@ -378,9 +378,9 @@
if (ioSurface) {
if (IOSurfaceGetWidth(ioSurface) != _extent.width) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface width %zu does not match VkImage width %d.", IOSurfaceGetWidth(ioSurface), _extent.width); }
if (IOSurfaceGetHeight(ioSurface) != _extent.height) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface height %zu does not match VkImage height %d.", IOSurfaceGetHeight(ioSurface), _extent.height); }
- if (IOSurfaceGetBytesPerElement(ioSurface) != pixFmts->getMTLPixelFormatBytesPerBlock(_mtlPixelFormat)) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface bytes per element %zu does not match VkImage bytes per element %d.", IOSurfaceGetBytesPerElement(ioSurface), pixFmts->getMTLPixelFormatBytesPerBlock(_mtlPixelFormat)); }
- if (IOSurfaceGetElementWidth(ioSurface) != pixFmts->getMTLPixelFormatBlockTexelSize(_mtlPixelFormat).width) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element width %zu does not match VkImage element width %d.", IOSurfaceGetElementWidth(ioSurface), pixFmts->getMTLPixelFormatBlockTexelSize(_mtlPixelFormat).width); }
- if (IOSurfaceGetElementHeight(ioSurface) != pixFmts->getMTLPixelFormatBlockTexelSize(_mtlPixelFormat).height) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element height %zu does not match VkImage element height %d.", IOSurfaceGetElementHeight(ioSurface), pixFmts->getMTLPixelFormatBlockTexelSize(_mtlPixelFormat).height); }
+ if (IOSurfaceGetBytesPerElement(ioSurface) != pixFmts->getBytesPerBlock(_mtlPixelFormat)) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface bytes per element %zu does not match VkImage bytes per element %d.", IOSurfaceGetBytesPerElement(ioSurface), pixFmts->getBytesPerBlock(_mtlPixelFormat)); }
+ if (IOSurfaceGetElementWidth(ioSurface) != pixFmts->getBlockTexelSize(_mtlPixelFormat).width) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element width %zu does not match VkImage element width %d.", IOSurfaceGetElementWidth(ioSurface), pixFmts->getBlockTexelSize(_mtlPixelFormat).width); }
+ if (IOSurfaceGetElementHeight(ioSurface) != pixFmts->getBlockTexelSize(_mtlPixelFormat).height) { return reportError(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element height %zu does not match VkImage element height %d.", IOSurfaceGetElementHeight(ioSurface), pixFmts->getBlockTexelSize(_mtlPixelFormat).height); }
_ioSurface = ioSurface;
CFRetain(_ioSurface);
@@ -391,9 +391,9 @@
_ioSurface = IOSurfaceCreate((CFDictionaryRef)@{
(id)kIOSurfaceWidth: @(_extent.width),
(id)kIOSurfaceHeight: @(_extent.height),
- (id)kIOSurfaceBytesPerElement: @(pixFmts->getMTLPixelFormatBytesPerBlock(_mtlPixelFormat)),
- (id)kIOSurfaceElementWidth: @(pixFmts->getMTLPixelFormatBlockTexelSize(_mtlPixelFormat).width),
- (id)kIOSurfaceElementHeight: @(pixFmts->getMTLPixelFormatBlockTexelSize(_mtlPixelFormat).height),
+ (id)kIOSurfaceBytesPerElement: @(pixFmts->getBytesPerBlock(_mtlPixelFormat)),
+ (id)kIOSurfaceElementWidth: @(pixFmts->getBlockTexelSize(_mtlPixelFormat).width),
+ (id)kIOSurfaceElementHeight: @(pixFmts->getBlockTexelSize(_mtlPixelFormat).height),
(id)kIOSurfaceIsGlobal: @(true), // Deprecated but needed for interprocess transfers
});
}
@@ -429,7 +429,7 @@
mtlTexDesc.mipmapLevelCount = _mipLevels;
mtlTexDesc.sampleCount = mvkSampleCountFromVkSampleCountFlagBits(_samples);
mtlTexDesc.arrayLength = _arrayLayers;
- mtlTexDesc.usageMVK = getPixelFormats()->getMTLTextureUsageFromVkImageUsageFlags(_usage, mtlPixFmt, minUsage);
+ mtlTexDesc.usageMVK = getPixelFormats()->getMTLTextureUsage(_usage, mtlPixFmt, minUsage);
mtlTexDesc.storageModeMVK = getMTLStorageMode();
mtlTexDesc.cpuCacheMode = getMTLCPUCacheMode();
@@ -510,7 +510,7 @@
VkDeviceSize bytesPerImage = (imgType == VK_IMAGE_TYPE_3D) ? imgLayout.depthPitch : 0;
id<MTLTexture> mtlTex = getMTLTexture();
- if (getPixelFormats()->mtlPixelFormatIsPVRTCFormat(mtlTex.pixelFormat)) {
+ if (getPixelFormats()->isPVRTCFormat(mtlTex.pixelFormat)) {
bytesPerRow = 0;
bytesPerImage = 0;
}
@@ -589,16 +589,16 @@
_isLinear = validateLinear(pCreateInfo, isAttachment);
MVKPixelFormats* pixFmts = getPixelFormats();
- _mtlPixelFormat = pixFmts->getMTLPixelFormatFromVkFormat(pCreateInfo->format);
+ _mtlPixelFormat = pixFmts->getMTLPixelFormat(pCreateInfo->format);
_usage = pCreateInfo->usage;
- _is3DCompressed = (getImageType() == VK_IMAGE_TYPE_3D) && (pixFmts->getFormatTypeFromVkFormat(pCreateInfo->format) == kMVKFormatCompressed) && !_device->_pMetalFeatures->native3DCompressedTextures;
+ _is3DCompressed = (getImageType() == VK_IMAGE_TYPE_3D) && (pixFmts->getFormatType(pCreateInfo->format) == kMVKFormatCompressed) && !_device->_pMetalFeatures->native3DCompressedTextures;
_isDepthStencilAttachment = (mvkAreAllFlagsEnabled(pCreateInfo->usage, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ||
mvkAreAllFlagsEnabled(pixFmts->getVkFormatProperties(pCreateInfo->format).optimalTilingFeatures, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT));
_canSupportMTLTextureView = !_isDepthStencilAttachment || _device->_pMetalFeatures->stencilViews;
- _hasExpectedTexelSize = (pixFmts->getMTLPixelFormatBytesPerBlock(_mtlPixelFormat) == pixFmts->getVkFormatBytesPerBlock(pCreateInfo->format));
+ _hasExpectedTexelSize = (pixFmts->getBytesPerBlock(_mtlPixelFormat) == pixFmts->getBytesPerBlock(pCreateInfo->format));
- _rowByteAlignment = _isLinear ? _device->getVkFormatTexelBufferAlignment(pCreateInfo->format, this) : mvkEnsurePowerOfTwo(pixFmts->getVkFormatBytesPerBlock(pCreateInfo->format));
+ _rowByteAlignment = _isLinear ? _device->getVkFormatTexelBufferAlignment(pCreateInfo->format, this) : mvkEnsurePowerOfTwo(pixFmts->getBytesPerBlock(pCreateInfo->format));
if (!_isLinear && _device->_pMetalFeatures->placementHeaps) {
MTLTextureDescriptor *mtlTexDesc = newMTLTextureDescriptor(); // temp retain
MTLSizeAndAlign sizeAndAlign = [_device->getMTLDevice() heapTextureSizeAndAlignWithDescriptor: mtlTexDesc];
@@ -629,7 +629,7 @@
validSamples = VK_SAMPLE_COUNT_1_BIT;
}
- if (getPixelFormats()->getFormatTypeFromVkFormat(pCreateInfo->format) == kMVKFormatCompressed) {
+ if (getPixelFormats()->getFormatType(pCreateInfo->format) == kMVKFormatCompressed) {
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, multisampling cannot be used with compressed images. Setting sample count to 1."));
validSamples = VK_SAMPLE_COUNT_1_BIT;
}
@@ -652,7 +652,7 @@
MVKPixelFormats* pixFmts = getPixelFormats();
bool is2D = (getImageType() == VK_IMAGE_TYPE_2D);
- bool isCompressed = pixFmts->getFormatTypeFromVkFormat(pCreateInfo->format) == kMVKFormatCompressed;
+ bool isCompressed = pixFmts->getFormatType(pCreateInfo->format) == kMVKFormatCompressed;
#if MVK_IOS
if (isCompressed && !is2D) {
@@ -664,12 +664,12 @@
if (getImageType() != VK_IMAGE_TYPE_3D) {
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, compressed formats may only be used with 2D or 3D images."));
} else if (!_device->_pMetalFeatures->native3DCompressedTextures && !mvkCanDecodeFormat(pCreateInfo->format)) {
- setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, the %s compressed format may only be used with 2D images.", getPixelFormats()->getVkFormatName(pCreateInfo->format)));
+ setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, the %s compressed format may only be used with 2D images.", getPixelFormats()->getName(pCreateInfo->format)));
}
}
#endif
- if ((pixFmts->getFormatTypeFromVkFormat(pCreateInfo->format) == kMVKFormatDepthStencil) && !is2D ) {
+ if ((pixFmts->getFormatType(pCreateInfo->format) == kMVKFormatDepthStencil) && !is2D ) {
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Under Metal, depth/stencil formats may only be used with 2D images."));
}
if (isAttachment && (pCreateInfo->arrayLayers > 1) && !_device->_pMetalFeatures->layeredRendering) {
@@ -711,7 +711,7 @@
isLin = false;
}
- if (getPixelFormats()->getFormatTypeFromVkFormat(pCreateInfo->format) == kMVKFormatDepthStencil) {
+ if (getPixelFormats()->getFormatType(pCreateInfo->format) == kMVKFormatDepthStencil) {
setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : If tiling is VK_IMAGE_TILING_LINEAR, format must not be a depth/stencil format."));
isLin = false;
}
@@ -1183,7 +1183,7 @@
MTLPixelFormat& mtlPixFmt,
bool& useSwizzle) {
useSwizzle = false;
- mtlPixFmt = mvkPixFmts->getMTLPixelFormatFromVkFormat(pCreateInfo->format);
+ mtlPixFmt = mvkPixFmts->getMTLPixelFormat(pCreateInfo->format);
VkComponentMapping components = pCreateInfo->components;
#define SWIZZLE_MATCHES(R, G, B, A) mvkVkComponentMappingsMatch(components, {VK_COMPONENT_SWIZZLE_ ##R, VK_COMPONENT_SWIZZLE_ ##G, VK_COMPONENT_SWIZZLE_ ##B, VK_COMPONENT_SWIZZLE_ ##A} )
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
index ab6f1e8..727f02b 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
@@ -628,7 +628,7 @@
offset = (uint32_t)mvkAlignByteCount(offset, sizeOfOutput(output));
if (shaderContext.isVertexAttributeLocationUsed(output.location)) {
plDesc.stageInputDescriptor.attributes[output.location].bufferIndex = kMVKTessCtlInputBufferIndex;
- plDesc.stageInputDescriptor.attributes[output.location].format = (MTLAttributeFormat)getPixelFormats()->getMTLVertexFormatFromVkFormat(mvkFormatFromOutput(output));
+ plDesc.stageInputDescriptor.attributes[output.location].format = (MTLAttributeFormat)getPixelFormats()->getMTLVertexFormat(mvkFormatFromOutput(output));
plDesc.stageInputDescriptor.attributes[output.location].offset = offset;
}
offset += sizeOfOutput(output);
@@ -720,7 +720,7 @@
} else if (output.perPatch) {
patchOffset = (uint32_t)mvkAlignByteCount(patchOffset, sizeOfOutput(output));
plDesc.vertexDescriptor.attributes[output.location].bufferIndex = kMVKTessEvalPatchInputBufferIndex;
- plDesc.vertexDescriptor.attributes[output.location].format = getPixelFormats()->getMTLVertexFormatFromVkFormat(mvkFormatFromOutput(output));
+ plDesc.vertexDescriptor.attributes[output.location].format = getPixelFormats()->getMTLVertexFormat(mvkFormatFromOutput(output));
plDesc.vertexDescriptor.attributes[output.location].offset = patchOffset;
patchOffset += sizeOfOutput(output);
if (!firstPatch) { firstPatch = &output; }
@@ -728,7 +728,7 @@
} else {
offset = (uint32_t)mvkAlignByteCount(offset, sizeOfOutput(output));
plDesc.vertexDescriptor.attributes[output.location].bufferIndex = kMVKTessEvalInputBufferIndex;
- plDesc.vertexDescriptor.attributes[output.location].format = getPixelFormats()->getMTLVertexFormatFromVkFormat(mvkFormatFromOutput(output));
+ plDesc.vertexDescriptor.attributes[output.location].format = getPixelFormats()->getMTLVertexFormat(mvkFormatFromOutput(output));
plDesc.vertexDescriptor.attributes[output.location].offset = offset;
offset += sizeOfOutput(output);
if (!firstVertex) { firstVertex = &output; }
@@ -980,7 +980,7 @@
}
MTLVertexAttributeDescriptor* vaDesc = plDesc.vertexDescriptor.attributes[pVKVA->location];
- vaDesc.format = getPixelFormats()->getMTLVertexFormatFromVkFormat(pVKVA->format);
+ vaDesc.format = getPixelFormats()->getMTLVertexFormat(pVKVA->format);
vaDesc.bufferIndex = _device->getMetalBufferIndexForVertexAttributeBinding(pVKVA->binding);
vaDesc.offset = pVKVA->offset;
}
@@ -1084,7 +1084,7 @@
const VkPipelineColorBlendAttachmentState* pCA = &pCreateInfo->pColorBlendState->pAttachments[caIdx];
MTLRenderPipelineColorAttachmentDescriptor* colorDesc = plDesc.colorAttachments[caIdx];
- colorDesc.pixelFormat = getPixelFormats()->getMTLPixelFormatFromVkFormat(mvkRenderSubpass->getColorAttachmentFormat(caIdx));
+ colorDesc.pixelFormat = getPixelFormats()->getMTLPixelFormat(mvkRenderSubpass->getColorAttachmentFormat(caIdx));
colorDesc.writeMask = mvkMTLColorWriteMaskFromVkChannelFlags(pCA->colorWriteMask);
// Don't set the blend state if we're not using this attachment.
// The pixel format will be MTLPixelFormatInvalid in that case, and
@@ -1104,13 +1104,13 @@
// Depth & stencil attachments
MVKPixelFormats* pixFmts = getPixelFormats();
- MTLPixelFormat mtlDSFormat = pixFmts->getMTLPixelFormatFromVkFormat(mvkRenderSubpass->getDepthStencilFormat());
- if (pixFmts->mtlPixelFormatIsDepthFormat(mtlDSFormat)) { plDesc.depthAttachmentPixelFormat = mtlDSFormat; }
- if (pixFmts->mtlPixelFormatIsStencilFormat(mtlDSFormat)) { plDesc.stencilAttachmentPixelFormat = mtlDSFormat; }
+ MTLPixelFormat mtlDSFormat = pixFmts->getMTLPixelFormat(mvkRenderSubpass->getDepthStencilFormat());
+ if (pixFmts->isDepthFormat(mtlDSFormat)) { plDesc.depthAttachmentPixelFormat = mtlDSFormat; }
+ if (pixFmts->isStencilFormat(mtlDSFormat)) { plDesc.stencilAttachmentPixelFormat = mtlDSFormat; }
// In Vulkan, it's perfectly valid to render with no attachments. Not so in Metal.
// If we have no attachments, then we'll have to add a dummy attachment.
- if (!caCnt && !pixFmts->mtlPixelFormatIsDepthFormat(mtlDSFormat) && !pixFmts->mtlPixelFormatIsStencilFormat(mtlDSFormat)) {
+ if (!caCnt && !pixFmts->isDepthFormat(mtlDSFormat) && !pixFmts->isStencilFormat(mtlDSFormat)) {
MTLRenderPipelineColorAttachmentDescriptor* colorDesc = plDesc.colorAttachments[0];
colorDesc.pixelFormat = MTLPixelFormatR8Unorm;
colorDesc.writeMask = MTLColorWriteMaskNone;
@@ -1161,7 +1161,7 @@
MVKRenderPass* mvkRendPass = (MVKRenderPass*)pCreateInfo->renderPass;
MVKRenderSubpass* mvkRenderSubpass = mvkRendPass->getSubpass(pCreateInfo->subpass);
MVKPixelFormats* pixFmts = getPixelFormats();
- MTLPixelFormat mtlDSFormat = pixFmts->getMTLPixelFormatFromVkFormat(mvkRenderSubpass->getDepthStencilFormat());
+ MTLPixelFormat mtlDSFormat = pixFmts->getMTLPixelFormat(mvkRenderSubpass->getDepthStencilFormat());
shaderContext.options.mslOptions.enable_frag_output_mask = 0;
if (pCreateInfo->pColorBlendState) {
@@ -1174,8 +1174,8 @@
shaderContext.options.mslOptions.texture_1D_as_2D = mvkTreatTexture1DAs2D();
shaderContext.options.mslOptions.enable_point_size_builtin = isRenderingPoints(pCreateInfo, reflectData);
- shaderContext.options.mslOptions.enable_frag_depth_builtin = pixFmts->mtlPixelFormatIsDepthFormat(mtlDSFormat);
- shaderContext.options.mslOptions.enable_frag_stencil_ref_builtin = pixFmts->mtlPixelFormatIsStencilFormat(mtlDSFormat);
+ shaderContext.options.mslOptions.enable_frag_depth_builtin = pixFmts->isDepthFormat(mtlDSFormat);
+ shaderContext.options.mslOptions.enable_frag_stencil_ref_builtin = pixFmts->isStencilFormat(mtlDSFormat);
shaderContext.options.shouldFlipVertexY = _device->_pMVKConfig->shaderConversionFlipVertexY;
shaderContext.options.mslOptions.swizzle_texture_samples = _fullImageViewSwizzle && !getDevice()->_pMetalFeatures->nativeTextureSwizzle;
shaderContext.options.mslOptions.tess_domain_origin_lower_left = pTessDomainOriginState && pTessDomainOriginState->domainOrigin == VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT;
@@ -1204,7 +1204,7 @@
// to match the vertex attribute. So tell SPIRV-Cross if we're expecting an unsigned format.
// Only do this if the attribute could be reasonably expected to fit in the shader's
// declared type. Programs that try to invoke undefined behavior are on their own.
- switch (getPixelFormats()->getFormatTypeFromVkFormat(pVKVA->format) ) {
+ switch (getPixelFormats()->getFormatType(pVKVA->format) ) {
case kMVKFormatColorUInt8:
va.vertexAttribute.format = MSL_VERTEX_FORMAT_UINT8;
break;
@@ -1259,7 +1259,7 @@
va.vertexAttribute.location = shaderOutputs[vaIdx].location;
va.vertexAttribute.builtin = shaderOutputs[vaIdx].builtin;
- switch (getPixelFormats()->getFormatTypeFromVkFormat(mvkFormatFromOutput(shaderOutputs[vaIdx]) ) ) {
+ switch (getPixelFormats()->getFormatType(mvkFormatFromOutput(shaderOutputs[vaIdx]) ) ) {
case kMVKFormatColorUInt8:
va.vertexAttribute.format = MSL_VERTEX_FORMAT_UINT8;
break;
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h
index a1cba32..9e2c4a1 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h
@@ -126,76 +126,76 @@
MVKVulkanAPIObject* getVulkanAPIObject() override;
/** Returns whether the VkFormat is supported by this implementation. */
- bool vkFormatIsSupported(VkFormat vkFormat);
+ bool isSupported(VkFormat vkFormat);
/** Returns whether the VkFormat is supported by this implementation, or can be substituted by one that is. */
- bool vkFormatIsSupportedOrSubstitutable(VkFormat vkFormat);
+ bool isSupportedOrSubstitutable(VkFormat vkFormat);
/** Returns whether the MTLPixelFormat is supported by this implementation. */
- bool mtlPixelFormatIsSupported(MTLPixelFormat mtlFormat);
+ bool isSupported(MTLPixelFormat mtlFormat);
/** Returns whether the specified Metal MTLPixelFormat can be used as a depth format. */
- bool mtlPixelFormatIsDepthFormat(MTLPixelFormat mtlFormat);
+ bool isDepthFormat(MTLPixelFormat mtlFormat);
/** Returns whether the specified Metal MTLPixelFormat can be used as a stencil format. */
- bool mtlPixelFormatIsStencilFormat(MTLPixelFormat mtlFormat);
+ bool isStencilFormat(MTLPixelFormat mtlFormat);
/** Returns whether the specified Metal MTLPixelFormat is a PVRTC format. */
- bool mtlPixelFormatIsPVRTCFormat(MTLPixelFormat mtlFormat);
+ bool isPVRTCFormat(MTLPixelFormat mtlFormat);
/** Returns the format type corresponding to the specified Vulkan VkFormat, */
- MVKFormatType getFormatTypeFromVkFormat(VkFormat vkFormat);
+ MVKFormatType getFormatType(VkFormat vkFormat);
/** Returns the format type corresponding to the specified Metal MTLPixelFormat, */
- MVKFormatType getFormatTypeFromMTLPixelFormat(MTLPixelFormat mtlFormat);
+ MVKFormatType getFormatType(MTLPixelFormat mtlFormat);
/**
* Returns the Metal MTLPixelFormat corresponding to the specified Vulkan VkFormat,
* or returns MTLPixelFormatInvalid if no corresponding MTLPixelFormat exists.
*/
- MTLPixelFormat getMTLPixelFormatFromVkFormat(VkFormat vkFormat);
+ MTLPixelFormat getMTLPixelFormat(VkFormat vkFormat);
/**
* Returns the Vulkan VkFormat corresponding to the specified Metal MTLPixelFormat,
* or returns VK_FORMAT_UNDEFINED if no corresponding VkFormat exists.
*/
- VkFormat getVkFormatFromMTLPixelFormat(MTLPixelFormat mtlFormat);
+ VkFormat getVkFormat(MTLPixelFormat mtlFormat);
/**
* Returns the size, in bytes, of a texel block of the specified Vulkan format.
* For uncompressed formats, the returned value corresponds to the size in bytes of a single texel.
*/
- uint32_t getVkFormatBytesPerBlock(VkFormat vkFormat);
+ uint32_t getBytesPerBlock(VkFormat vkFormat);
/**
* Returns the size, in bytes, of a texel block of the specified Metal format.
* For uncompressed formats, the returned value corresponds to the size in bytes of a single texel.
*/
- uint32_t getMTLPixelFormatBytesPerBlock(MTLPixelFormat mtlFormat);
+ uint32_t getBytesPerBlock(MTLPixelFormat mtlFormat);
/**
* Returns the size of the compression block, measured in texels for a Vulkan format.
* The returned value will be {1, 1} for non-compressed formats.
*/
- VkExtent2D getVkFormatBlockTexelSize(VkFormat vkFormat);
+ VkExtent2D getBlockTexelSize(VkFormat vkFormat);
/**
* Returns the size of the compression block, measured in texels for a Metal format.
* The returned value will be {1, 1} for non-compressed formats.
*/
- VkExtent2D getMTLPixelFormatBlockTexelSize(MTLPixelFormat mtlFormat);
+ VkExtent2D getBlockTexelSize(MTLPixelFormat mtlFormat);
/**
* Returns the size, in bytes, of a texel of the specified Vulkan format.
* The returned value may be fractional for certain compressed formats.
*/
- float getVkFormatBytesPerTexel(VkFormat vkFormat);
+ float getBytesPerTexel(VkFormat vkFormat);
/**
* Returns the size, in bytes, of a texel of the specified Metal format.
* The returned value may be fractional for certain compressed formats.
*/
- float getMTLPixelFormatBytesPerTexel(MTLPixelFormat mtlFormat);
+ float getBytesPerTexel(MTLPixelFormat mtlFormat);
/**
* Returns the size, in bytes, of a row of texels of the specified Vulkan format.
@@ -204,7 +204,7 @@
* and texelsPerRow should specify the width in texels, not blocks. The result is rounded
* up if texelsPerRow is not an integer multiple of the compression block width.
*/
- size_t getVkFormatBytesPerRow(VkFormat vkFormat, uint32_t texelsPerRow);
+ size_t getBytesPerRow(VkFormat vkFormat, uint32_t texelsPerRow);
/**
* Returns the size, in bytes, of a row of texels of the specified Metal format.
@@ -213,7 +213,7 @@
* and texelsPerRow should specify the width in texels, not blocks. The result is rounded
* up if texelsPerRow is not an integer multiple of the compression block width.
*/
- size_t getMTLPixelFormatBytesPerRow(MTLPixelFormat mtlFormat, uint32_t texelsPerRow);
+ size_t getBytesPerRow(MTLPixelFormat mtlFormat, uint32_t texelsPerRow);
/**
* Returns the size, in bytes, of a texture layer of the specified Vulkan format.
@@ -222,7 +222,7 @@
* and texelRowsPerLayer should specify the height in texels, not blocks. The result is
* rounded up if texelRowsPerLayer is not an integer multiple of the compression block height.
*/
- size_t getVkFormatBytesPerLayer(VkFormat vkFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer);
+ size_t getBytesPerLayer(VkFormat vkFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer);
/**
* Returns the size, in bytes, of a texture layer of the specified Metal format.
@@ -230,46 +230,45 @@
* and texelRowsPerLayer should specify the height in texels, not blocks. The result is
* rounded up if texelRowsPerLayer is not an integer multiple of the compression block height.
*/
- size_t getMTLPixelFormatBytesPerLayer(MTLPixelFormat mtlFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer);
+ size_t getBytesPerLayer(MTLPixelFormat mtlFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer);
/** Returns the default properties for the specified Vulkan format. */
VkFormatProperties getVkFormatProperties(VkFormat vkFormat);
/** Returns the Metal format capabilities supported by the specified Vulkan format. */
- MVKMTLFmtCaps getVkFormatCapabilities(VkFormat vkFormat);
+ MVKMTLFmtCaps getCapabilities(VkFormat vkFormat);
/** Returns the Metal format capabilities supported by the specified Metal format. */
- MVKMTLFmtCaps getMTLPixelFormatCapabilities(MTLPixelFormat mtlFormat);
+ MVKMTLFmtCaps getCapabilities(MTLPixelFormat mtlFormat);
/** Returns the name of the specified Vulkan format. */
- const char* getVkFormatName(VkFormat vkFormat);
+ const char* getName(VkFormat vkFormat);
/** Returns the name of the specified Metal pixel format. */
- const char* getMTLPixelFormatName(MTLPixelFormat mtlFormat);
+ const char* getName(MTLPixelFormat mtlFormat);
/**
* Returns the MTLClearColor value corresponding to the color value in the VkClearValue,
* extracting the color value that is VkFormat for the VkFormat.
*/
- MTLClearColor getMTLClearColorFromVkClearValue(VkClearValue vkClearValue,
- VkFormat vkFormat);
+ MTLClearColor getMTLClearColor(VkClearValue vkClearValue, VkFormat vkFormat);
/** Returns the Metal depth value corresponding to the depth value in the specified VkClearValue. */
- double getMTLClearDepthFromVkClearValue(VkClearValue vkClearValue);
+ double getMTLClearDepthValue(VkClearValue vkClearValue);
/** Returns the Metal stencil value corresponding to the stencil value in the specified VkClearValue. */
- uint32_t getMTLClearStencilFromVkClearValue(VkClearValue vkClearValue);
+ uint32_t getMTLClearStencilValue(VkClearValue vkClearValue);
/** Returns the Vulkan image usage from the Metal texture usage and format. */
- VkImageUsageFlags getVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsage mtlUsage, MTLPixelFormat mtlFormat);
+ VkImageUsageFlags getVkImageUsageFlags(MTLTextureUsage mtlUsage, MTLPixelFormat mtlFormat);
/**
* Returns the Metal texture usage from the Vulkan image usage and Metal format, ensuring that at least the
* usages in minUsage are included, even if they wouldn't naturally be included based on the other two parameters.
*/
- MTLTextureUsage getMTLTextureUsageFromVkImageUsageFlags(VkImageUsageFlags vkImageUsageFlags,
- MTLPixelFormat mtlFormat,
- MTLTextureUsage minUsage = MTLTextureUsageUnknown);
+ MTLTextureUsage getMTLTextureUsage(VkImageUsageFlags vkImageUsageFlags,
+ MTLPixelFormat mtlFormat,
+ MTLTextureUsage minUsage = MTLTextureUsageUnknown);
/** Enumerates all formats that support the given features, calling a specified function for each one. */
void enumerateSupportedFormats(VkFormatProperties properties, bool any, std::function<bool(VkFormat)> func);
@@ -278,7 +277,7 @@
* Returns the Metal MTLVertexFormat corresponding to the specified
* Vulkan VkFormat as used as a vertex attribute format.
*/
- MTLVertexFormat getMTLVertexFormatFromVkFormat(VkFormat vkFormat);
+ MTLVertexFormat getMTLVertexFormat(VkFormat vkFormat);
#pragma mark Construction
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm
index 5197c4d..c307579 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.mm
@@ -118,19 +118,19 @@
MVKVulkanAPIObject* MVKPixelFormats::getVulkanAPIObject() { return _physicalDevice; };
-bool MVKPixelFormats::vkFormatIsSupported(VkFormat vkFormat) {
+bool MVKPixelFormats::isSupported(VkFormat vkFormat) {
return getVkFormatDesc(vkFormat).isSupported();
}
-bool MVKPixelFormats::vkFormatIsSupportedOrSubstitutable(VkFormat vkFormat) {
+bool MVKPixelFormats::isSupportedOrSubstitutable(VkFormat vkFormat) {
return getVkFormatDesc(vkFormat).isSupportedOrSubstitutable();
}
-bool MVKPixelFormats::mtlPixelFormatIsSupported(MTLPixelFormat mtlFormat) {
+bool MVKPixelFormats::isSupported(MTLPixelFormat mtlFormat) {
return getMTLPixelFormatDesc(mtlFormat).isSupported();
}
-bool MVKPixelFormats::mtlPixelFormatIsDepthFormat(MTLPixelFormat mtlFormat) {
+bool MVKPixelFormats::isDepthFormat(MTLPixelFormat mtlFormat) {
switch (mtlFormat) {
case MTLPixelFormatDepth32Float:
#if MVK_MACOS
@@ -144,7 +144,7 @@
}
}
-bool MVKPixelFormats::mtlPixelFormatIsStencilFormat(MTLPixelFormat mtlFormat) {
+bool MVKPixelFormats::isStencilFormat(MTLPixelFormat mtlFormat) {
switch (mtlFormat) {
case MTLPixelFormatStencil8:
#if MVK_MACOS
@@ -159,7 +159,7 @@
}
}
-bool MVKPixelFormats::mtlPixelFormatIsPVRTCFormat(MTLPixelFormat mtlFormat) {
+bool MVKPixelFormats::isPVRTCFormat(MTLPixelFormat mtlFormat) {
switch (mtlFormat) {
#if MVK_IOS
case MTLPixelFormatPVRTC_RGBA_2BPP:
@@ -177,15 +177,15 @@
}
}
-MVKFormatType MVKPixelFormats::getFormatTypeFromVkFormat(VkFormat vkFormat) {
+MVKFormatType MVKPixelFormats::getFormatType(VkFormat vkFormat) {
return getVkFormatDesc(vkFormat).formatType;
}
-MVKFormatType MVKPixelFormats::getFormatTypeFromMTLPixelFormat(MTLPixelFormat mtlFormat) {
+MVKFormatType MVKPixelFormats::getFormatType(MTLPixelFormat mtlFormat) {
return getVkFormatDesc(mtlFormat).formatType;
}
-MTLPixelFormat MVKPixelFormats::getMTLPixelFormatFromVkFormat(VkFormat vkFormat) {
+MTLPixelFormat MVKPixelFormats::getMTLPixelFormat(VkFormat vkFormat) {
auto& vkDesc = getVkFormatDesc(vkFormat);
MTLPixelFormat mtlPixFmt = vkDesc.mtlPixelFormat;
@@ -216,49 +216,49 @@
return mtlPixFmt;
}
-VkFormat MVKPixelFormats::getVkFormatFromMTLPixelFormat(MTLPixelFormat mtlFormat) {
+VkFormat MVKPixelFormats::getVkFormat(MTLPixelFormat mtlFormat) {
return getMTLPixelFormatDesc(mtlFormat).vkFormat;
}
-uint32_t MVKPixelFormats::getVkFormatBytesPerBlock(VkFormat vkFormat) {
+uint32_t MVKPixelFormats::getBytesPerBlock(VkFormat vkFormat) {
return getVkFormatDesc(vkFormat).bytesPerBlock;
}
-uint32_t MVKPixelFormats::getMTLPixelFormatBytesPerBlock(MTLPixelFormat mtlFormat) {
+uint32_t MVKPixelFormats::getBytesPerBlock(MTLPixelFormat mtlFormat) {
return getVkFormatDesc(mtlFormat).bytesPerBlock;
}
-VkExtent2D MVKPixelFormats::getVkFormatBlockTexelSize(VkFormat vkFormat) {
+VkExtent2D MVKPixelFormats::getBlockTexelSize(VkFormat vkFormat) {
return getVkFormatDesc(vkFormat).blockTexelSize;
}
-VkExtent2D MVKPixelFormats::getMTLPixelFormatBlockTexelSize(MTLPixelFormat mtlFormat) {
+VkExtent2D MVKPixelFormats::getBlockTexelSize(MTLPixelFormat mtlFormat) {
return getVkFormatDesc(mtlFormat).blockTexelSize;
}
-float MVKPixelFormats::getVkFormatBytesPerTexel(VkFormat vkFormat) {
+float MVKPixelFormats::getBytesPerTexel(VkFormat vkFormat) {
return getVkFormatDesc(vkFormat).bytesPerTexel();
}
-float MVKPixelFormats::getMTLPixelFormatBytesPerTexel(MTLPixelFormat mtlFormat) {
+float MVKPixelFormats::getBytesPerTexel(MTLPixelFormat mtlFormat) {
return getVkFormatDesc(mtlFormat).bytesPerTexel();
}
-size_t MVKPixelFormats::getVkFormatBytesPerRow(VkFormat vkFormat, uint32_t texelsPerRow) {
+size_t MVKPixelFormats::getBytesPerRow(VkFormat vkFormat, uint32_t texelsPerRow) {
auto& vkDesc = getVkFormatDesc(vkFormat);
return mvkCeilingDivide(texelsPerRow, vkDesc.blockTexelSize.width) * vkDesc.bytesPerBlock;
}
-size_t MVKPixelFormats::getMTLPixelFormatBytesPerRow(MTLPixelFormat mtlFormat, uint32_t texelsPerRow) {
+size_t MVKPixelFormats::getBytesPerRow(MTLPixelFormat mtlFormat, uint32_t texelsPerRow) {
auto& vkDesc = getVkFormatDesc(mtlFormat);
return mvkCeilingDivide(texelsPerRow, vkDesc.blockTexelSize.width) * vkDesc.bytesPerBlock;
}
-size_t MVKPixelFormats::getVkFormatBytesPerLayer(VkFormat vkFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer) {
+size_t MVKPixelFormats::getBytesPerLayer(VkFormat vkFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer) {
return mvkCeilingDivide(texelRowsPerLayer, getVkFormatDesc(vkFormat).blockTexelSize.height) * bytesPerRow;
}
-size_t MVKPixelFormats::getMTLPixelFormatBytesPerLayer(MTLPixelFormat mtlFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer) {
+size_t MVKPixelFormats::getBytesPerLayer(MTLPixelFormat mtlFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer) {
return mvkCeilingDivide(texelRowsPerLayer, getVkFormatDesc(mtlFormat).blockTexelSize.height) * bytesPerRow;
}
@@ -266,19 +266,19 @@
return getVkFormatDesc(vkFormat).properties;
}
-MVKMTLFmtCaps MVKPixelFormats::getVkFormatCapabilities(VkFormat vkFormat) {
+MVKMTLFmtCaps MVKPixelFormats::getCapabilities(VkFormat vkFormat) {
return getMTLPixelFormatDesc(vkFormat).mtlFmtCaps;
}
-MVKMTLFmtCaps MVKPixelFormats::getMTLPixelFormatCapabilities(MTLPixelFormat mtlFormat) {
+MVKMTLFmtCaps MVKPixelFormats::getCapabilities(MTLPixelFormat mtlFormat) {
return getMTLPixelFormatDesc(mtlFormat).mtlFmtCaps;
}
-const char* MVKPixelFormats::getVkFormatName(VkFormat vkFormat) {
+const char* MVKPixelFormats::getName(VkFormat vkFormat) {
return getVkFormatDesc(vkFormat).name;
}
-const char* MVKPixelFormats::getMTLPixelFormatName(MTLPixelFormat mtlFormat) {
+const char* MVKPixelFormats::getName(MTLPixelFormat mtlFormat) {
return getMTLPixelFormatDesc(mtlFormat).name;
}
@@ -302,7 +302,7 @@
}
}
-MTLVertexFormat MVKPixelFormats::getMTLVertexFormatFromVkFormat(VkFormat vkFormat) {
+MTLVertexFormat MVKPixelFormats::getMTLVertexFormat(VkFormat vkFormat) {
auto& vkDesc = getVkFormatDesc(vkFormat);
MTLVertexFormat mtlVtxFmt = vkDesc.mtlVertexFormat;
@@ -328,10 +328,9 @@
return mtlVtxFmt;
}
-MTLClearColor MVKPixelFormats::getMTLClearColorFromVkClearValue(VkClearValue vkClearValue,
- VkFormat vkFormat) {
+MTLClearColor MVKPixelFormats::getMTLClearColor(VkClearValue vkClearValue, VkFormat vkFormat) {
MTLClearColor mtlClr;
- switch (getFormatTypeFromVkFormat(vkFormat)) {
+ switch (getFormatType(vkFormat)) {
case kMVKFormatColorHalf:
case kMVKFormatColorFloat:
mtlClr.red = vkClearValue.color.float32[0];
@@ -365,16 +364,16 @@
return mtlClr;
}
-double MVKPixelFormats::getMTLClearDepthFromVkClearValue(VkClearValue vkClearValue) {
+double MVKPixelFormats::getMTLClearDepthValue(VkClearValue vkClearValue) {
return vkClearValue.depthStencil.depth;
}
-uint32_t MVKPixelFormats::getMTLClearStencilFromVkClearValue(VkClearValue vkClearValue) {
+uint32_t MVKPixelFormats::getMTLClearStencilValue(VkClearValue vkClearValue) {
return vkClearValue.depthStencil.stencil;
}
-VkImageUsageFlags MVKPixelFormats::getVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsage mtlUsage,
- MTLPixelFormat mtlFormat) {
+VkImageUsageFlags MVKPixelFormats::getVkImageUsageFlags(MTLTextureUsage mtlUsage,
+ MTLPixelFormat mtlFormat) {
VkImageUsageFlags vkImageUsageFlags = 0;
if ( mvkAreAllFlagsEnabled(mtlUsage, MTLTextureUsageShaderRead) ) {
@@ -384,7 +383,7 @@
}
if ( mvkAreAllFlagsEnabled(mtlUsage, MTLTextureUsageRenderTarget) ) {
mvkEnableFlags(vkImageUsageFlags, VK_IMAGE_USAGE_TRANSFER_DST_BIT);
- if (mtlPixelFormatIsDepthFormat(mtlFormat) || mtlPixelFormatIsStencilFormat(mtlFormat)) {
+ if (isDepthFormat(mtlFormat) || isStencilFormat(mtlFormat)) {
mvkEnableFlags(vkImageUsageFlags, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
} else {
mvkEnableFlags(vkImageUsageFlags, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
@@ -397,15 +396,15 @@
return vkImageUsageFlags;
}
-MTLTextureUsage MVKPixelFormats::getMTLTextureUsageFromVkImageUsageFlags(VkImageUsageFlags vkImageUsageFlags,
- MTLPixelFormat mtlFormat,
- MTLTextureUsage minUsage) {
- bool isDepthFmt = mtlPixelFormatIsDepthFormat(mtlFormat);
- bool isStencilFmt = mtlPixelFormatIsStencilFormat(mtlFormat);
+MTLTextureUsage MVKPixelFormats::getMTLTextureUsage(VkImageUsageFlags vkImageUsageFlags,
+ MTLPixelFormat mtlFormat,
+ MTLTextureUsage minUsage) {
+ bool isDepthFmt = isDepthFormat(mtlFormat);
+ bool isStencilFmt = isStencilFormat(mtlFormat);
bool isCombinedDepthStencilFmt = isDepthFmt && isStencilFmt;
bool isColorFormat = !(isDepthFmt || isStencilFmt);
bool supportsStencilViews = _physicalDevice ? _physicalDevice->getMetalFeatures()->stencilViews : false;
- MVKMTLFmtCaps mtlFmtCaps = getMTLPixelFormatCapabilities(mtlFormat);
+ MVKMTLFmtCaps mtlFmtCaps = getCapabilities(mtlFormat);
MTLTextureUsage mtlUsage = minUsage;
@@ -1353,50 +1352,50 @@
if (fd.isSupportedOrSubstitutable()) {
MVKLogInfo("Testing %s", fd.name);
- testFmt(vkFormatIsSupported(vkFmt), mvkVkFormatIsSupported(vkFmt));
- testFmt(mtlPixelFormatIsSupported(mtlFmt), mvkMTLPixelFormatIsSupported(mtlFmt));
- testFmt(mtlPixelFormatIsDepthFormat(mtlFmt), mvkMTLPixelFormatIsDepthFormat(mtlFmt));
- testFmt(mtlPixelFormatIsStencilFormat(mtlFmt), mvkMTLPixelFormatIsStencilFormat(mtlFmt));
- testFmt(mtlPixelFormatIsPVRTCFormat(mtlFmt), mvkMTLPixelFormatIsPVRTCFormat(mtlFmt));
- testFmt(getFormatTypeFromVkFormat(vkFmt), mvkFormatTypeFromVkFormat(vkFmt));
- testFmt(getFormatTypeFromMTLPixelFormat(mtlFmt), mvkFormatTypeFromMTLPixelFormat(mtlFmt));
- testFmt(getMTLPixelFormatFromVkFormat(vkFmt), mvkMTLPixelFormatFromVkFormat(vkFmt));
- testFmt(getVkFormatFromMTLPixelFormat(mtlFmt), mvkVkFormatFromMTLPixelFormat(mtlFmt));
- testFmt(getVkFormatBytesPerBlock(vkFmt), mvkVkFormatBytesPerBlock(vkFmt));
- testFmt(getMTLPixelFormatBytesPerBlock(mtlFmt), mvkMTLPixelFormatBytesPerBlock(mtlFmt));
- testFmt(getVkFormatBlockTexelSize(vkFmt), mvkVkFormatBlockTexelSize(vkFmt));
- testFmt(getMTLPixelFormatBlockTexelSize(mtlFmt), mvkMTLPixelFormatBlockTexelSize(mtlFmt));
- testFmt(getVkFormatBytesPerTexel(vkFmt), mvkVkFormatBytesPerTexel(vkFmt));
- testFmt(getMTLPixelFormatBytesPerTexel(mtlFmt), mvkMTLPixelFormatBytesPerTexel(mtlFmt));
- testFmt(getVkFormatBytesPerRow(vkFmt, 4), mvkVkFormatBytesPerRow(vkFmt, 4));
- testFmt(getMTLPixelFormatBytesPerRow(mtlFmt, 4), mvkMTLPixelFormatBytesPerRow(mtlFmt, 4));
- testFmt(getVkFormatBytesPerLayer(vkFmt, 256, 4), mvkVkFormatBytesPerLayer(vkFmt, 256, 4));
- testFmt(getMTLPixelFormatBytesPerLayer(mtlFmt, 256, 4), mvkMTLPixelFormatBytesPerLayer(mtlFmt, 256, 4));
+ testFmt(isSupported(vkFmt), mvkVkFormatIsSupported(vkFmt));
+ testFmt(isSupported(mtlFmt), mvkMTLPixelFormatIsSupported(mtlFmt));
+ testFmt(isDepthFormat(mtlFmt), mvkMTLPixelFormatIsDepthFormat(mtlFmt));
+ testFmt(isStencilFormat(mtlFmt), mvkMTLPixelFormatIsStencilFormat(mtlFmt));
+ testFmt(isPVRTCFormat(mtlFmt), mvkMTLPixelFormatIsPVRTCFormat(mtlFmt));
+ testFmt(getFormatType(vkFmt), mvkFormatTypeFromVkFormat(vkFmt));
+ testFmt(getFormatType(mtlFmt), mvkFormatTypeFromMTLPixelFormat(mtlFmt));
+ testFmt(getMTLPixelFormat(vkFmt), mvkMTLPixelFormatFromVkFormat(vkFmt));
+ testFmt(getVkFormat(mtlFmt), mvkVkFormatFromMTLPixelFormat(mtlFmt));
+ testFmt(getBytesPerBlock(vkFmt), mvkVkFormatBytesPerBlock(vkFmt));
+ testFmt(getBytesPerBlock(mtlFmt), mvkMTLPixelFormatBytesPerBlock(mtlFmt));
+ testFmt(getBlockTexelSize(vkFmt), mvkVkFormatBlockTexelSize(vkFmt));
+ testFmt(getBlockTexelSize(mtlFmt), mvkMTLPixelFormatBlockTexelSize(mtlFmt));
+ testFmt(getBytesPerTexel(vkFmt), mvkVkFormatBytesPerTexel(vkFmt));
+ testFmt(getBytesPerTexel(mtlFmt), mvkMTLPixelFormatBytesPerTexel(mtlFmt));
+ testFmt(getBytesPerRow(vkFmt, 4), mvkVkFormatBytesPerRow(vkFmt, 4));
+ testFmt(getBytesPerRow(mtlFmt, 4), mvkMTLPixelFormatBytesPerRow(mtlFmt, 4));
+ testFmt(getBytesPerLayer(vkFmt, 256, 4), mvkVkFormatBytesPerLayer(vkFmt, 256, 4));
+ testFmt(getBytesPerLayer(mtlFmt, 256, 4), mvkMTLPixelFormatBytesPerLayer(mtlFmt, 256, 4));
testProps(getVkFormatProperties(vkFmt), mvkVkFormatProperties(vkFmt));
- testFmt(strcmp(getVkFormatName(vkFmt), mvkVkFormatName(vkFmt)), 0);
- testFmt(strcmp(getMTLPixelFormatName(mtlFmt), mvkMTLPixelFormatName(mtlFmt)), 0);
- testFmt(getMTLClearColorFromVkClearValue(VkClearValue(), vkFmt),
+ testFmt(strcmp(getName(vkFmt), mvkVkFormatName(vkFmt)), 0);
+ testFmt(strcmp(getName(mtlFmt), mvkMTLPixelFormatName(mtlFmt)), 0);
+ testFmt(getMTLClearColor(VkClearValue(), vkFmt),
mvkMTLClearColorFromVkClearValue(VkClearValue(), vkFmt));
- testFmt(getVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageUnknown, mtlFmt),
+ testFmt(getVkImageUsageFlags(MTLTextureUsageUnknown, mtlFmt),
mvkVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageUnknown, mtlFmt));
- testFmt(getVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageShaderRead, mtlFmt),
+ testFmt(getVkImageUsageFlags(MTLTextureUsageShaderRead, mtlFmt),
mvkVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageShaderRead, mtlFmt));
- testFmt(getVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageShaderWrite, mtlFmt),
+ testFmt(getVkImageUsageFlags(MTLTextureUsageShaderWrite, mtlFmt),
mvkVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageShaderWrite, mtlFmt));
- testFmt(getVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageRenderTarget, mtlFmt),
+ testFmt(getVkImageUsageFlags(MTLTextureUsageRenderTarget, mtlFmt),
mvkVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsageRenderTarget, mtlFmt));
- testFmt(getVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsagePixelFormatView, mtlFmt),
+ testFmt(getVkImageUsageFlags(MTLTextureUsagePixelFormatView, mtlFmt),
mvkVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsagePixelFormatView, mtlFmt));
VkImageUsageFlags vkUsage;
vkUsage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
- testFmt(getMTLTextureUsageFromVkImageUsageFlags(vkUsage, mtlFmt), mvkMTLTextureUsageFromVkImageUsageFlags(vkUsage, mtlFmt));
+ testFmt(getMTLTextureUsage(vkUsage, mtlFmt), mvkMTLTextureUsageFromVkImageUsageFlags(vkUsage, mtlFmt));
vkUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_STORAGE_BIT;
- testFmt(getMTLTextureUsageFromVkImageUsageFlags(vkUsage, mtlFmt), mvkMTLTextureUsageFromVkImageUsageFlags(vkUsage, mtlFmt));
+ testFmt(getMTLTextureUsage(vkUsage, mtlFmt), mvkMTLTextureUsageFromVkImageUsageFlags(vkUsage, mtlFmt));
- testFmt(getMTLVertexFormatFromVkFormat(vkFmt), mvkMTLVertexFormatFromVkFormat(vkFmt));
+ testFmt(getMTLVertexFormat(vkFmt), mvkMTLVertexFormatFromVkFormat(vkFmt));
} else {
MVKLogInfo("%s not supported or substitutable on this device.", fd.name);
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
index b09b1e3..7fe41fe 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKRenderPass.mm
@@ -100,7 +100,7 @@
hasResolveAttachment, false,
loadOverride,
storeOverride)) {
- mtlColorAttDesc.clearColor = pixFmts->getMTLClearColorFromVkClearValue(clearValues[clrRPAttIdx], clrMVKRPAtt->getFormat());
+ mtlColorAttDesc.clearColor = pixFmts->getMTLClearColor(clearValues[clrRPAttIdx], clrMVKRPAtt->getFormat());
}
}
}
@@ -112,7 +112,7 @@
MVKImageView* dsImage = framebuffer->getAttachment(dsRPAttIdx);
MTLPixelFormat mtlDSFormat = dsImage->getMTLPixelFormat();
- if (pixFmts->mtlPixelFormatIsDepthFormat(mtlDSFormat)) {
+ if (pixFmts->isDepthFormat(mtlDSFormat)) {
MTLRenderPassDepthAttachmentDescriptor* mtlDepthAttDesc = mtlRPDesc.depthAttachment;
dsImage->populateMTLRenderPassAttachmentDescriptor(mtlDepthAttDesc);
if (dsMVKRPAtt->populateMTLRenderPassAttachmentDescriptor(mtlDepthAttDesc, this,
@@ -120,10 +120,10 @@
false, false,
loadOverride,
storeOverride)) {
- mtlDepthAttDesc.clearDepth = pixFmts->getMTLClearDepthFromVkClearValue(clearValues[dsRPAttIdx]);
+ mtlDepthAttDesc.clearDepth = pixFmts->getMTLClearDepthValue(clearValues[dsRPAttIdx]);
}
}
- if (pixFmts->mtlPixelFormatIsStencilFormat(mtlDSFormat)) {
+ if (pixFmts->isStencilFormat(mtlDSFormat)) {
MTLRenderPassStencilAttachmentDescriptor* mtlStencilAttDesc = mtlRPDesc.stencilAttachment;
dsImage->populateMTLRenderPassAttachmentDescriptor(mtlStencilAttDesc);
if (dsMVKRPAtt->populateMTLRenderPassAttachmentDescriptor(mtlStencilAttDesc, this,
@@ -131,7 +131,7 @@
false, true,
loadOverride,
storeOverride)) {
- mtlStencilAttDesc.clearStencil = pixFmts->getMTLClearStencilFromVkClearValue(clearValues[dsRPAttIdx]);
+ mtlStencilAttDesc.clearStencil = pixFmts->getMTLClearStencilValue(clearValues[dsRPAttIdx]);
}
}
}
@@ -190,9 +190,9 @@
cAtt.clearValue = clearValues[attIdx];
MVKPixelFormats* pixFmts = _renderPass->getPixelFormats();
- MTLPixelFormat mtlDSFmt = _renderPass->getPixelFormats()->getMTLPixelFormatFromVkFormat(getDepthStencilFormat());
- if (pixFmts->mtlPixelFormatIsDepthFormat(mtlDSFmt)) { cAtt.aspectMask |= VK_IMAGE_ASPECT_DEPTH_BIT; }
- if (pixFmts->mtlPixelFormatIsStencilFormat(mtlDSFmt)) { cAtt.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; }
+ MTLPixelFormat mtlDSFmt = _renderPass->getPixelFormats()->getMTLPixelFormat(getDepthStencilFormat());
+ if (pixFmts->isDepthFormat(mtlDSFmt)) { cAtt.aspectMask |= VK_IMAGE_ASPECT_DEPTH_BIT; }
+ if (pixFmts->isStencilFormat(mtlDSFmt)) { cAtt.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; }
if (cAtt.aspectMask) { clearAtts.push_back(cAtt); }
}
}
@@ -326,8 +326,8 @@
// Validate pixel format is supported
MVKPixelFormats* pixFmts = _renderPass->getPixelFormats();
- if ( !pixFmts->vkFormatIsSupportedOrSubstitutable(_info.format) ) {
- _renderPass->setConfigurationResult(reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "vkCreateRenderPass(): Attachment format %s is not supported on this device.", _renderPass->getPixelFormats()->getVkFormatName(_info.format)));
+ if ( !pixFmts->isSupportedOrSubstitutable(_info.format) ) {
+ _renderPass->setConfigurationResult(reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "vkCreateRenderPass(): Attachment format %s is not supported on this device.", _renderPass->getPixelFormats()->getName(_info.format)));
}
// Determine the indices of the first and last render subpasses to use this attachment.
@@ -342,8 +342,8 @@
_lastUseSubpassIdx = max(spIdx, _lastUseSubpassIdx);
// Validate that the attachment pixel format supports the capabilities required by the subpass.
- if ( !mvkAreAllFlagsEnabled(pixFmts->getVkFormatCapabilities(_info.format), reqCaps) ) {
- _renderPass->setConfigurationResult(reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "vkCreateRenderPass(): Attachment format %s on this device does not support the VkFormat attachment capabilities required by the subpass at index %d.", _renderPass->getPixelFormats()->getVkFormatName(_info.format), spIdx));
+ if ( !mvkAreAllFlagsEnabled(pixFmts->getCapabilities(_info.format), reqCaps) ) {
+ _renderPass->setConfigurationResult(reportError(VK_ERROR_FORMAT_NOT_SUPPORTED, "vkCreateRenderPass(): Attachment format %s on this device does not support the VkFormat attachment capabilities required by the subpass at index %d.", _renderPass->getPixelFormats()->getName(_info.format), spIdx));
}
}
}
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm b/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm
index a5983f3..c73d16d 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.mm
@@ -126,7 +126,7 @@
__watermarkTextureWidth,
__watermarkTextureHeight,
__watermarkTextureFormat,
- getPixelFormats()->getMTLPixelFormatBytesPerRow(__watermarkTextureFormat, __watermarkTextureWidth),
+ getPixelFormats()->getBytesPerRow(__watermarkTextureFormat, __watermarkTextureWidth),
__watermarkShaderSource);
}
_licenseWatermark->render(mtlTexture, mtlCmdBuff, 0.02f);
@@ -260,7 +260,7 @@
_mtlLayer = mvkSrfc->getCAMetalLayer();
_mtlLayer.device = getMTLDevice();
- _mtlLayer.pixelFormat = getPixelFormats()->getMTLPixelFormatFromVkFormat(pCreateInfo->imageFormat);
+ _mtlLayer.pixelFormat = getPixelFormats()->getMTLPixelFormat(pCreateInfo->imageFormat);
_mtlLayer.maximumDrawableCountMVK = imgCnt;
_mtlLayer.displaySyncEnabledMVK = (pCreateInfo->presentMode != VK_PRESENT_MODE_IMMEDIATE_KHR);
_mtlLayer.magnificationFilter = _device->_pMVKConfig->swapchainMagFilterUseNearest ? kCAFilterNearest : kCAFilterLinear;
@@ -349,7 +349,7 @@
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.pNext = VK_NULL_HANDLE,
.imageType = VK_IMAGE_TYPE_2D,
- .format = getPixelFormats()->getVkFormatFromMTLPixelFormat(_mtlLayer.pixelFormat),
+ .format = getPixelFormats()->getVkFormat(_mtlLayer.pixelFormat),
.extent = { imgExtent.width, imgExtent.height, 1 },
.mipLevels = 1,
.arrayLayers = 1,
diff --git a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
index b9e52c5..e3407ec 100644
--- a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
+++ b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm
@@ -35,67 +35,67 @@
static MVKPixelFormats _platformPixelFormats;
MVK_PUBLIC_SYMBOL bool mvkVkFormatIsSupported(VkFormat vkFormat) {
- return _platformPixelFormats.vkFormatIsSupported(vkFormat);
+ return _platformPixelFormats.isSupported(vkFormat);
}
MVK_PUBLIC_SYMBOL bool mvkMTLPixelFormatIsSupported(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.mtlPixelFormatIsSupported(mtlFormat);
+ return _platformPixelFormats.isSupported(mtlFormat);
}
MVK_PUBLIC_SYMBOL MVKFormatType mvkFormatTypeFromVkFormat(VkFormat vkFormat) {
- return _platformPixelFormats.getFormatTypeFromVkFormat(vkFormat);
+ return _platformPixelFormats.getFormatType(vkFormat);
}
MVK_PUBLIC_SYMBOL MVKFormatType mvkFormatTypeFromMTLPixelFormat(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.getFormatTypeFromMTLPixelFormat(mtlFormat);
+ return _platformPixelFormats.getFormatType(mtlFormat);
}
MVK_PUBLIC_SYMBOL MTLPixelFormat mvkMTLPixelFormatFromVkFormat(VkFormat vkFormat) {
- return _platformPixelFormats.getMTLPixelFormatFromVkFormat(vkFormat);
+ return _platformPixelFormats.getMTLPixelFormat(vkFormat);
}
MVK_PUBLIC_SYMBOL VkFormat mvkVkFormatFromMTLPixelFormat(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.getVkFormatFromMTLPixelFormat(mtlFormat);
+ return _platformPixelFormats.getVkFormat(mtlFormat);
}
MVK_PUBLIC_SYMBOL uint32_t mvkVkFormatBytesPerBlock(VkFormat vkFormat) {
- return _platformPixelFormats.getVkFormatBytesPerBlock(vkFormat);
+ return _platformPixelFormats.getBytesPerBlock(vkFormat);
}
MVK_PUBLIC_SYMBOL uint32_t mvkMTLPixelFormatBytesPerBlock(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.getMTLPixelFormatBytesPerBlock(mtlFormat);
+ return _platformPixelFormats.getBytesPerBlock(mtlFormat);
}
MVK_PUBLIC_SYMBOL VkExtent2D mvkVkFormatBlockTexelSize(VkFormat vkFormat) {
- return _platformPixelFormats.getVkFormatBlockTexelSize(vkFormat);
+ return _platformPixelFormats.getBlockTexelSize(vkFormat);
}
MVK_PUBLIC_SYMBOL VkExtent2D mvkMTLPixelFormatBlockTexelSize(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.getMTLPixelFormatBlockTexelSize(mtlFormat);
+ return _platformPixelFormats.getBlockTexelSize(mtlFormat);
}
MVK_PUBLIC_SYMBOL float mvkVkFormatBytesPerTexel(VkFormat vkFormat) {
- return _platformPixelFormats.getVkFormatBytesPerTexel(vkFormat);
+ return _platformPixelFormats.getBytesPerTexel(vkFormat);
}
MVK_PUBLIC_SYMBOL float mvkMTLPixelFormatBytesPerTexel(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.getMTLPixelFormatBytesPerTexel(mtlFormat);
+ return _platformPixelFormats.getBytesPerTexel(mtlFormat);
}
MVK_PUBLIC_SYMBOL size_t mvkVkFormatBytesPerRow(VkFormat vkFormat, uint32_t texelsPerRow) {
- return _platformPixelFormats.getVkFormatBytesPerRow(vkFormat, texelsPerRow);
+ return _platformPixelFormats.getBytesPerRow(vkFormat, texelsPerRow);
}
MVK_PUBLIC_SYMBOL size_t mvkMTLPixelFormatBytesPerRow(MTLPixelFormat mtlFormat, uint32_t texelsPerRow) {
- return _platformPixelFormats.getMTLPixelFormatBytesPerRow(mtlFormat, texelsPerRow);
+ return _platformPixelFormats.getBytesPerRow(mtlFormat, texelsPerRow);
}
MVK_PUBLIC_SYMBOL size_t mvkVkFormatBytesPerLayer(VkFormat vkFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer) {
- return _platformPixelFormats.getVkFormatBytesPerLayer(vkFormat, bytesPerRow, texelRowsPerLayer);
+ return _platformPixelFormats.getBytesPerLayer(vkFormat, bytesPerRow, texelRowsPerLayer);
}
MVK_PUBLIC_SYMBOL size_t mvkMTLPixelFormatBytesPerLayer(MTLPixelFormat mtlFormat, size_t bytesPerRow, uint32_t texelRowsPerLayer) {
- return _platformPixelFormats.getMTLPixelFormatBytesPerLayer(mtlFormat, bytesPerRow, texelRowsPerLayer);
+ return _platformPixelFormats.getBytesPerLayer(mtlFormat, bytesPerRow, texelRowsPerLayer);
}
MVK_PUBLIC_SYMBOL VkFormatProperties mvkVkFormatProperties(VkFormat vkFormat) {
@@ -103,40 +103,40 @@
}
MVK_PUBLIC_SYMBOL const char* mvkVkFormatName(VkFormat vkFormat) {
- return _platformPixelFormats.getVkFormatName(vkFormat);
+ return _platformPixelFormats.getName(vkFormat);
}
MVK_PUBLIC_SYMBOL const char* mvkMTLPixelFormatName(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.getMTLPixelFormatName(mtlFormat);
+ return _platformPixelFormats.getName(mtlFormat);
}
MVK_PUBLIC_SYMBOL MTLVertexFormat mvkMTLVertexFormatFromVkFormat(VkFormat vkFormat) {
- return _platformPixelFormats.getMTLVertexFormatFromVkFormat(vkFormat);
+ return _platformPixelFormats.getMTLVertexFormat(vkFormat);
}
MVK_PUBLIC_SYMBOL MTLClearColor mvkMTLClearColorFromVkClearValue(VkClearValue vkClearValue,
VkFormat vkFormat) {
- return _platformPixelFormats.getMTLClearColorFromVkClearValue(vkClearValue, vkFormat);
+ return _platformPixelFormats.getMTLClearColor(vkClearValue, vkFormat);
}
MVK_PUBLIC_SYMBOL double mvkMTLClearDepthFromVkClearValue(VkClearValue vkClearValue) {
- return _platformPixelFormats.getMTLClearDepthFromVkClearValue(vkClearValue);
+ return _platformPixelFormats.getMTLClearDepthValue(vkClearValue);
}
MVK_PUBLIC_SYMBOL uint32_t mvkMTLClearStencilFromVkClearValue(VkClearValue vkClearValue) {
- return _platformPixelFormats.getMTLClearStencilFromVkClearValue(vkClearValue);
+ return _platformPixelFormats.getMTLClearStencilValue(vkClearValue);
}
MVK_PUBLIC_SYMBOL bool mvkMTLPixelFormatIsDepthFormat(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.mtlPixelFormatIsDepthFormat(mtlFormat);
+ return _platformPixelFormats.isDepthFormat(mtlFormat);
}
MVK_PUBLIC_SYMBOL bool mvkMTLPixelFormatIsStencilFormat(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.mtlPixelFormatIsStencilFormat(mtlFormat);
+ return _platformPixelFormats.isStencilFormat(mtlFormat);
}
MVK_PUBLIC_SYMBOL bool mvkMTLPixelFormatIsPVRTCFormat(MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.mtlPixelFormatIsPVRTCFormat(mtlFormat);
+ return _platformPixelFormats.isPVRTCFormat(mtlFormat);
}
MVK_PUBLIC_SYMBOL MTLTextureType mvkMTLTextureTypeFromVkImageType(VkImageType vkImageType,
@@ -192,11 +192,11 @@
}
MVK_PUBLIC_SYMBOL MTLTextureUsage mvkMTLTextureUsageFromVkImageUsageFlags(VkImageUsageFlags vkImageUsageFlags, MTLPixelFormat mtlPixFmt) {
- return _platformPixelFormats.getMTLTextureUsageFromVkImageUsageFlags(vkImageUsageFlags, mtlPixFmt);
+ return _platformPixelFormats.getMTLTextureUsage(vkImageUsageFlags, mtlPixFmt);
}
MVK_PUBLIC_SYMBOL VkImageUsageFlags mvkVkImageUsageFlagsFromMTLTextureUsage(MTLTextureUsage mtlUsage, MTLPixelFormat mtlFormat) {
- return _platformPixelFormats.getVkImageUsageFlagsFromMTLTextureUsage(mtlUsage, mtlFormat);
+ return _platformPixelFormats.getVkImageUsageFlags(mtlUsage, mtlFormat);
}
MVK_PUBLIC_SYMBOL uint32_t mvkSampleCountFromVkSampleCountFlagBits(VkSampleCountFlagBits vkSampleCountFlag) {