Metal base vertex instance drawing disabled on GPUFamilyApple2 devices (#2470)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -32,6 +32,7 @@ public:
|
||||
|
||||
const MTLDevicePtr& getDevice() const { return device; }
|
||||
const MTLCommandQueuePtr& getCommandQueue() const { return commandQueue; }
|
||||
const bool isBaseVertexInstanceDrawingSupported() const { return baseVertexInstanceDrawingSupported; }
|
||||
|
||||
protected:
|
||||
std::unique_ptr<gfx::Context> createContext() override;
|
||||
@@ -61,6 +62,7 @@ public:
|
||||
protected:
|
||||
MTLDevicePtr device;
|
||||
MTLCommandQueuePtr commandQueue;
|
||||
bool baseVertexInstanceDrawingSupported = false;
|
||||
};
|
||||
|
||||
} // namespace mtl
|
||||
|
||||
@@ -416,9 +416,7 @@ bool Context::renderTileClippingMasks(gfx::RenderPass& renderPass,
|
||||
MTL::IndexType::IndexTypeUInt16,
|
||||
indexRes->getMetalBuffer().get(),
|
||||
/*indexOffset=*/0,
|
||||
/*instanceCount=*/static_cast<NS::UInteger>(tileUBOs.size()),
|
||||
/*baseVertex=*/0,
|
||||
/*baseInstance=*/0);
|
||||
/*instanceCount=*/static_cast<NS::UInteger>(tileUBOs.size()));
|
||||
#else
|
||||
const auto uboIndex = ShaderClass::uniforms[0].index;
|
||||
for (std::size_t ii = 0; ii < tileUBOs.size(); ++ii) {
|
||||
@@ -429,9 +427,7 @@ bool Context::renderTileClippingMasks(gfx::RenderPass& renderPass,
|
||||
MTL::IndexType::IndexTypeUInt16,
|
||||
indexRes->getMetalBuffer().get(),
|
||||
/*indexOffset=*/0,
|
||||
/*instanceCount=*/1,
|
||||
/*baseVertex=*/0,
|
||||
/*baseInstance=*/0);
|
||||
/*instanceCount=*/1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -292,14 +292,20 @@ void Drawable::draw(PaintParameters& parameters) const {
|
||||
assert(static_cast<std::size_t>(maxIndex) < mlSegment.vertexLength);
|
||||
#endif
|
||||
|
||||
encoder->drawIndexedPrimitives(primitiveType,
|
||||
mlSegment.indexLength,
|
||||
indexType,
|
||||
indexBuffer,
|
||||
indexOffset,
|
||||
instanceCount,
|
||||
baseVertex,
|
||||
baseInstance);
|
||||
if (context.getBackend().isBaseVertexInstanceDrawingSupported()) {
|
||||
encoder->drawIndexedPrimitives(primitiveType,
|
||||
mlSegment.indexLength,
|
||||
indexType,
|
||||
indexBuffer,
|
||||
indexOffset,
|
||||
instanceCount,
|
||||
baseVertex,
|
||||
baseInstance);
|
||||
} else {
|
||||
encoder->drawIndexedPrimitives(
|
||||
primitiveType, mlSegment.indexLength, indexType, indexBuffer, indexOffset, instanceCount);
|
||||
}
|
||||
|
||||
context.renderingStats().numDrawCalls++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ RendererBackend::RendererBackend(const gfx::ContextMode contextMode_)
|
||||
commandQueue(NS::TransferPtr(device->newCommandQueue())) {
|
||||
assert(device);
|
||||
assert(commandQueue);
|
||||
baseVertexInstanceDrawingSupported = device->supportsFamily(MTL::GPUFamilyApple3);
|
||||
}
|
||||
|
||||
RendererBackend::~RendererBackend() = default;
|
||||
|
||||
Reference in New Issue
Block a user