Clean up recent commits for iOS compatibility.
Test for _pMetalFeatures->layeredRendering before setting MTLRenderPassDescriptor.renderTargetArrayLength. Change NSString comparisons using isEqualTo: to isEqualToString:.
This commit is contained in:
parent
dfd5638a0f
commit
6a77fc950a
@ -1054,7 +1054,8 @@ void MVKCmdClearImage::encode(MVKCommandEncoder* cmdEncoder) {
|
||||
mtlRPCADesc.level = mipLvl;
|
||||
mtlRPDADesc.level = mipLvl;
|
||||
mtlRPSADesc.level = mipLvl;
|
||||
mtlRPDesc.renderTargetArrayLengthMVK = mvkMipmapLevelSizeFromBaseSize3D(imgBaseExtent, mipLvl).depth;
|
||||
uint32_t imgLayerCount = mvkMipmapLevelSizeFromBaseSize3D(imgBaseExtent, mipLvl).depth;
|
||||
mtlRPDesc.renderTargetArrayLengthMVK = getDevice()->_pMetalFeatures->layeredRendering ? imgLayerCount : 0;
|
||||
|
||||
for (uint32_t layer = layerStart; layer < layerEnd; layer++) {
|
||||
mtlRPCADesc.slice = layer;
|
||||
|
@ -246,10 +246,11 @@ void MVKCommandEncoder::beginMetalRenderPass() {
|
||||
|
||||
endCurrentMetalEncoding();
|
||||
|
||||
auto pMTLFeats = _device->_pMetalFeatures;
|
||||
MTLRenderPassDescriptor* mtlRPDesc = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||
getSubpass()->populateMTLRenderPassDescriptor(mtlRPDesc, _framebuffer, _clearValues, _isRenderingEntireAttachment);
|
||||
mtlRPDesc.visibilityResultBuffer = _occlusionQueryState.getVisibilityResultMTLBuffer();
|
||||
mtlRPDesc.renderTargetArrayLengthMVK = _framebuffer->getLayerCount();
|
||||
mtlRPDesc.renderTargetArrayLengthMVK = pMTLFeats->layeredRendering ? _framebuffer->getLayerCount() : 0;
|
||||
mtlRPDesc.renderTargetWidthMVK = min(_framebuffer->getExtent2D().width, _renderArea.offset.x + _renderArea.extent.width);
|
||||
mtlRPDesc.renderTargetHeightMVK = min(_framebuffer->getExtent2D().height, _renderArea.offset.y + _renderArea.extent.height);
|
||||
|
||||
|
@ -62,7 +62,7 @@ MVKSurface::MVKSurface(MVKInstance* mvkInstance,
|
||||
// Sometimes, the owning view can replace its CAMetalLayer. In that case, the client
|
||||
// needs to recreate the surface.
|
||||
_layerObserver = [MVKBlockObserver observerWithBlock: ^(NSString* path, id, NSDictionary*, void*) {
|
||||
if ( ![path isEqualTo: @"layer"] ) { return; }
|
||||
if ( ![path isEqualToString: @"layer"] ) { return; }
|
||||
std::lock_guard<std::mutex> lock(this->_lock);
|
||||
[this->_mtlCAMetalLayer release];
|
||||
this->_mtlCAMetalLayer = nil;
|
||||
|
@ -226,7 +226,7 @@ void MVKSwapchain::initCAMetalLayer(const VkSwapchainCreateInfoKHR* pCreateInfo,
|
||||
// Sometimes, the owning view can replace its CAMetalLayer. In that case, the client
|
||||
// needs to recreate the swapchain, or no content will be displayed.
|
||||
_layerObserver = [MVKBlockObserver observerWithBlock: ^(NSString* path, id, NSDictionary*, void*) {
|
||||
if ( ![path isEqualTo: @"layer"] ) { return; }
|
||||
if ( ![path isEqualToString: @"layer"] ) { return; }
|
||||
this->_surfaceLost = true;
|
||||
[this->_layerObserver release];
|
||||
this->_layerObserver = nil;
|
||||
|
Loading…
x
Reference in New Issue
Block a user