Commit d8d4300a authored by Laszlo Agocs's avatar Laszlo Agocs

Fix Metal backend wrt api changes

parent 52c77e47
......@@ -244,22 +244,22 @@ void QRhiMetal::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
QMetalSwapChainData::FrameData &frame(cbD->currentSwapChain->d->frame[currentFrameSlot]);
for (const QRhiShaderResourceBindings::Binding &b : qAsConst(srbD->sortedBindings)) {
for (const QRhiShaderResourceBinding &b : qAsConst(srbD->sortedBindings)) {
switch (b.type) {
case QRhiShaderResourceBindings::Binding::UniformBuffer:
case QRhiShaderResourceBinding::UniformBuffer:
{
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b.ubuf.buf);
Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::UniformBuffer));
bufD->lastActiveFrameSlot = currentFrameSlot;
executeBufferHostWritesForCurrentFrame(bufD);
id<MTLBuffer> mtlbuf = bufD->d->buf[currentFrameSlot]; // ###
if (b.stage.testFlag(QRhiShaderResourceBindings::Binding::VertexStage))
if (b.stage.testFlag(QRhiShaderResourceBinding::VertexStage))
[frame.currentPassEncoder setVertexBuffer: mtlbuf offset: b.ubuf.offset atIndex: b.binding];
if (b.stage.testFlag(QRhiShaderResourceBindings::Binding::FragmentStage))
if (b.stage.testFlag(QRhiShaderResourceBinding::FragmentStage))
[frame.currentPassEncoder setFragmentBuffer: mtlbuf offset: b.ubuf.offset atIndex: b.binding];
}
break;
case QRhiShaderResourceBindings::Binding::SampledTexture:
case QRhiShaderResourceBinding::SampledTexture:
QRHI_RES(QMetalTexture, b.stex.tex)->lastActiveFrameSlot = currentFrameSlot;
QRHI_RES(QMetalSampler, b.stex.sampler)->lastActiveFrameSlot = currentFrameSlot;
break;
......@@ -533,7 +533,7 @@ void QRhiMetal::beginPass(QRhiRenderTarget *rt,
QMetalTextureRenderTarget *rtTex = QRHI_RES(QMetalTextureRenderTarget, rt);
rtD = &rtTex->d;
frame.currentPassRpDesc = d->createDefaultRenderPass(false, colorClearValue, depthStencilClearValue);
if (rtTex->flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents))
if (rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents))
frame.currentPassRpDesc.colorAttachments[0].loadAction = MTLLoadActionLoad;
// ###
}
......
......@@ -148,7 +148,7 @@ struct QMetalShaderResourceBindings : public QRhiShaderResourceBindings
void release() override;
bool build() override;
QVector<Binding> sortedBindings;
QVector<QRhiShaderResourceBinding> sortedBindings;
int maxBinding = -1;
uint generation = 0;
friend class QRhiMetal;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment