Merge pull request #992 from cdavis5e/fix-988-991
MVKCommandBuffer: Don't set renderTargetArrayLength on devices that don't support it.
This commit is contained in:
commit
769f0e4592
@ -1035,7 +1035,7 @@ void MVKCmdClearAttachments<N>::encode(MVKCommandEncoder* cmdEncoder) {
|
|||||||
|
|
||||||
// Populate the render pipeline state attachment key with info from the subpass and framebuffer.
|
// Populate the render pipeline state attachment key with info from the subpass and framebuffer.
|
||||||
_rpsKey.mtlSampleCount = mvkSampleCountFromVkSampleCountFlagBits(subpass->getSampleCount());
|
_rpsKey.mtlSampleCount = mvkSampleCountFromVkSampleCountFlagBits(subpass->getSampleCount());
|
||||||
if (cmdEncoder->_isUsingLayeredRendering) { _rpsKey.enableLayeredRendering(); }
|
if (cmdEncoder->_canUseLayeredRendering && cmdEncoder->_framebuffer->getLayerCount() > 1) { _rpsKey.enableLayeredRendering(); }
|
||||||
|
|
||||||
uint32_t caCnt = subpass->getColorAttachmentCount();
|
uint32_t caCnt = subpass->getColorAttachmentCount();
|
||||||
for (uint32_t caIdx = 0; caIdx < caCnt; caIdx++) {
|
for (uint32_t caIdx = 0; caIdx < caCnt; caIdx++) {
|
||||||
|
@ -432,8 +432,8 @@ public:
|
|||||||
/** The size of the threadgroup for the compute shader. */
|
/** The size of the threadgroup for the compute shader. */
|
||||||
MTLSize _mtlThreadgroupSize;
|
MTLSize _mtlThreadgroupSize;
|
||||||
|
|
||||||
/** Indicates whether the current render subpass is rendering to an array (layered) framebuffer. */
|
/** Indicates whether the current render subpass is able to render to an array (layered) framebuffer. */
|
||||||
bool _isUsingLayeredRendering;
|
bool _canUseLayeredRendering;
|
||||||
|
|
||||||
|
|
||||||
#pragma mark Construction
|
#pragma mark Construction
|
||||||
|
@ -237,7 +237,7 @@ void MVKCommandBuffer::recordDraw(MVKLoadStoreOverrideMixin* mvkDraw) {
|
|||||||
void MVKCommandEncoder::encode(id<MTLCommandBuffer> mtlCmdBuff) {
|
void MVKCommandEncoder::encode(id<MTLCommandBuffer> mtlCmdBuff) {
|
||||||
_subpassContents = VK_SUBPASS_CONTENTS_INLINE;
|
_subpassContents = VK_SUBPASS_CONTENTS_INLINE;
|
||||||
_renderSubpassIndex = 0;
|
_renderSubpassIndex = 0;
|
||||||
_isUsingLayeredRendering = false;
|
_canUseLayeredRendering = false;
|
||||||
|
|
||||||
_mtlCmdBuffer = mtlCmdBuff; // not retained
|
_mtlCmdBuffer = mtlCmdBuff; // not retained
|
||||||
|
|
||||||
@ -286,10 +286,9 @@ void MVKCommandEncoder::setSubpass(VkSubpassContents subpassContents, uint32_t s
|
|||||||
_subpassContents = subpassContents;
|
_subpassContents = subpassContents;
|
||||||
_renderSubpassIndex = subpassIndex;
|
_renderSubpassIndex = subpassIndex;
|
||||||
|
|
||||||
_isUsingLayeredRendering = ((_framebuffer->getLayerCount() > 1) &&
|
_canUseLayeredRendering = (_device->_pMetalFeatures->layeredRendering &&
|
||||||
_device->_pMetalFeatures->layeredRendering &&
|
(_device->_pMetalFeatures->multisampleLayeredRendering ||
|
||||||
(_device->_pMetalFeatures->multisampleLayeredRendering ||
|
(getSubpass()->getSampleCount() == VK_SAMPLE_COUNT_1_BIT)));
|
||||||
(getSubpass()->getSampleCount() == VK_SAMPLE_COUNT_1_BIT)));
|
|
||||||
|
|
||||||
beginMetalRenderPass(loadOverride, storeOverride);
|
beginMetalRenderPass(loadOverride, storeOverride);
|
||||||
}
|
}
|
||||||
@ -306,7 +305,9 @@ void MVKCommandEncoder::beginMetalRenderPass(bool loadOverride, bool storeOverri
|
|||||||
VkExtent2D fbExtent = _framebuffer->getExtent2D();
|
VkExtent2D fbExtent = _framebuffer->getExtent2D();
|
||||||
mtlRPDesc.renderTargetWidthMVK = min(_renderArea.offset.x + _renderArea.extent.width, fbExtent.width);
|
mtlRPDesc.renderTargetWidthMVK = min(_renderArea.offset.x + _renderArea.extent.width, fbExtent.width);
|
||||||
mtlRPDesc.renderTargetHeightMVK = min(_renderArea.offset.y + _renderArea.extent.height, fbExtent.height);
|
mtlRPDesc.renderTargetHeightMVK = min(_renderArea.offset.y + _renderArea.extent.height, fbExtent.height);
|
||||||
mtlRPDesc.renderTargetArrayLengthMVK = _framebuffer->getLayerCount();
|
if (_canUseLayeredRendering) {
|
||||||
|
mtlRPDesc.renderTargetArrayLengthMVK = _framebuffer->getLayerCount();
|
||||||
|
}
|
||||||
|
|
||||||
_mtlRenderEncoder = [_mtlCmdBuffer renderCommandEncoderWithDescriptor: mtlRPDesc]; // not retained
|
_mtlRenderEncoder = [_mtlCmdBuffer renderCommandEncoderWithDescriptor: mtlRPDesc]; // not retained
|
||||||
setLabelIfNotNil(_mtlRenderEncoder, getMTLRenderCommandEncoderName());
|
setLabelIfNotNil(_mtlRenderEncoder, getMTLRenderCommandEncoderName());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user