Merge pull request #1079 from cdavis5e/indexed-non-indexed-tess-draw

MVKPipeline: Don't rely on the index buffer to tell apart indexed draws.
This commit is contained in:
Bill Hollings 2020-09-28 12:02:52 -04:00 committed by GitHub
commit 1831eb9f38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -108,6 +108,8 @@ void MVKCmdDraw::encode(MVKCommandEncoder* cmdEncoder) {
return;
}
cmdEncoder->_isIndexedDraw = false;
auto* pipeline = (MVKGraphicsPipeline*)cmdEncoder->_graphicsPipelineState.getPipeline();
MVKPiplineStages stages;
@ -302,6 +304,8 @@ void MVKCmdDrawIndexed::encode(MVKCommandEncoder* cmdEncoder) {
return;
}
cmdEncoder->_isIndexedDraw = true;
auto* pipeline = (MVKGraphicsPipeline*)cmdEncoder->_graphicsPipelineState.getPipeline();
MVKPiplineStages stages;
@ -510,6 +514,8 @@ static const uint32_t kMVKDrawIndirectVertexCountUpperBound = 131072;
void MVKCmdDrawIndirect::encode(MVKCommandEncoder* cmdEncoder) {
cmdEncoder->_isIndexedDraw = false;
auto* pipeline = (MVKGraphicsPipeline*)cmdEncoder->_graphicsPipelineState.getPipeline();
bool needsInstanceAdjustment = cmdEncoder->getSubpass()->isMultiview() &&
cmdEncoder->getDevice()->getPhysicalDevice()->canUseInstancingForMultiview();
@ -820,6 +826,8 @@ VkResult MVKCmdDrawIndexedIndirect::setContent(MVKCommandBuffer* cmdBuff,
void MVKCmdDrawIndexedIndirect::encode(MVKCommandEncoder* cmdEncoder) {
cmdEncoder->_isIndexedDraw = true;
MVKIndexMTLBufferBinding& ibb = cmdEncoder->_graphicsResourcesState._mtlIndexBufferBinding;
auto* pipeline = (MVKGraphicsPipeline*)cmdEncoder->_graphicsPipelineState.getPipeline();
bool needsInstanceAdjustment = cmdEncoder->getSubpass()->isMultiview() &&

View File

@ -452,6 +452,9 @@ public:
/** Indicates whether the current render subpass is able to render to an array (layered) framebuffer. */
bool _canUseLayeredRendering;
/** Indicates whether the current draw is an indexed draw. */
bool _isIndexedDraw;
#pragma mark Construction

View File

@ -207,7 +207,7 @@ void MVKGraphicsPipeline::encode(MVKCommandEncoder* cmdEncoder, uint32_t stage)
id<MTLComputePipelineState> plState;
const MVKIndexMTLBufferBinding& indexBuff = cmdEncoder->_graphicsResourcesState._mtlIndexBufferBinding;
if (!indexBuff.mtlBuffer) {
if (!cmdEncoder->_isIndexedDraw) {
plState = getTessVertexStageState();
} else if (indexBuff.mtlIndexType == MTLIndexTypeUInt16) {
plState = getTessVertexStageIndex16State();