MVKPipeline: Don't rely on the index buffer to tell apart indexed draws.
This was a good heuristic, because the index buffer must be bound for indexed draws. However, it may also be bound for non-indexed draws--for example, if an indexed draw were immediately followed by a non-indexed draw, as happens in some `dEQP-VK.synchronization.*` tests. Therefore, we can't tell from the presence or absence of the index buffer what kind of draw we're in. We'll have to keep track of this state in the command encoder.
This commit is contained in:
parent
f319e9bd68
commit
481fe3553d
@ -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() &&
|
||||
|
@ -449,6 +449,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
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user