Commit d860eba9 authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

metal: Follow api changes

Compiles again.
parent e0f172e8
......@@ -684,12 +684,12 @@ bool QMetalSampler::build()
// dummy, no Vulkan-style RenderPass+Framebuffer concept here.
// We do have MTLRenderPassDescriptor of course, but it will be created on the fly for each pass.
QMetalRenderPass::QMetalRenderPass(QRhiImplementation *rhi)
: QRhiRenderPass(rhi)
QMetalRenderPassDescriptor::QMetalRenderPassDescriptor(QRhiImplementation *rhi)
: QRhiRenderPassDescriptor(rhi)
{
}
void QMetalRenderPass::release()
void QMetalRenderPassDescriptor::release()
{
// nothing to do here
}
......@@ -715,11 +715,6 @@ QSize QMetalReferenceRenderTarget::sizeInPixels() const
return d.pixelSize;
}
const QRhiRenderPass *QMetalReferenceRenderTarget::renderPass() const
{
return &d.rp;
}
QMetalTextureRenderTarget::QMetalTextureRenderTarget(QRhiImplementation *rhi,
const QRhiTextureRenderTargetDescription &desc,
Flags flags)
......@@ -732,9 +727,9 @@ void QMetalTextureRenderTarget::release()
{
}
QRhiRenderPass *QMetalTextureRenderTarget::newCompatibleRenderPass()
QRhiRenderPassDescriptor *QMetalTextureRenderTarget::newCompatibleRenderPassDescriptor()
{
return new QMetalRenderPass(rhi);
return new QMetalRenderPassDescriptor(rhi);
}
bool QMetalTextureRenderTarget::build()
......@@ -752,11 +747,6 @@ QSize QMetalTextureRenderTarget::sizeInPixels() const
return d.pixelSize;
}
const QRhiRenderPass *QMetalTextureRenderTarget::renderPass() const
{
return &d.rp;
}
QMetalShaderResourceBindings::QMetalShaderResourceBindings(QRhiImplementation *rhi)
: QRhiShaderResourceBindings(rhi)
{
......@@ -1245,39 +1235,28 @@ QRhiRenderTarget *QMetalSwapChain::currentFrameRenderTarget()
return &rtWrapper;
}
const QRhiRenderPass *QMetalSwapChain::defaultRenderPass() const
{
return rtWrapper.renderPass();
}
QSize QMetalSwapChain::requestedSizeInPixels() const
{
return requestedPixelSize;
}
QSize QMetalSwapChain::effectiveSizeInPixels() const
{
return effectivePixelSize;
}
bool QMetalSwapChain::build(QWindow *window_, const QSize &requestedPixelSize_, SurfaceImportFlags flags,
QRhiRenderBuffer *depthStencil, int sampleCount)
QRhiRenderPassDescriptor *QMetalSwapChain::newCompatibleRenderPassDescriptor()
{
Q_UNUSED(flags);
Q_UNUSED(sampleCount); // ###
return new QMetalRenderPassDescriptor(rhi);
}
bool QMetalSwapChain::buildOrResize()
{
if (d->layer)
release();
if (window_->surfaceType() != QSurface::MetalSurface) {
Q_ASSERT(m_window);
if (m_window->surfaceType() != QSurface::MetalSurface) {
qWarning("QMetalSwapChain only supports MetalSurface windows");
return false;
}
window = window_;
requestedPixelSize = requestedPixelSize_;
NSView *v = (NSView *) window->winId();
NSView *v = (NSView *) m_window->winId();
d->layer = (CAMetalLayer *) [v layer];
Q_ASSERT(d->layer);
......@@ -1290,7 +1269,7 @@ bool QMetalSwapChain::build(QWindow *window_, const QSize &requestedPixelSize_,
d->sem = dispatch_semaphore_create(QMTL_FRAMES_IN_FLIGHT);
currentFrame = 0;
ds = depthStencil ? QRHI_RES(QMetalRenderBuffer, depthStencil) : nullptr;
ds = m_depthStencil ? QRHI_RES(QMetalRenderBuffer, m_depthStencil) : nullptr;
rtWrapper.d.pixelSize = effectivePixelSize;
rtWrapper.d.attCount = 1;
......@@ -1300,10 +1279,4 @@ bool QMetalSwapChain::build(QWindow *window_, const QSize &requestedPixelSize_,
return true;
}
bool QMetalSwapChain::build(QObject *target)
{
Q_UNUSED(target);
return false;
}
QT_END_NAMESPACE
......@@ -99,9 +99,9 @@ struct QMetalSampler : public QRhiSampler
friend class QRhiMetal;
};
struct QMetalRenderPass : public QRhiRenderPass
struct QMetalRenderPassDescriptor : public QRhiRenderPassDescriptor
{
QMetalRenderPass(QRhiImplementation *rhi);
QMetalRenderPassDescriptor(QRhiImplementation *rhi);
void release() override;
// there is no MTLRenderPassDescriptor here as one will be created for each pass in beginPass()
......@@ -109,11 +109,10 @@ struct QMetalRenderPass : public QRhiRenderPass
struct QMetalBasicRenderTargetData
{
QMetalBasicRenderTargetData(QRhiImplementation *rhi) : rp(rhi) { }
QMetalBasicRenderTargetData(QRhiImplementation *) { }
QMetalRenderPass rp;
QSize pixelSize;
int attCount;
int attCount = 0;
};
struct QMetalReferenceRenderTarget : public QRhiReferenceRenderTarget
......@@ -122,7 +121,6 @@ struct QMetalReferenceRenderTarget : public QRhiReferenceRenderTarget
void release() override;
Type type() const override;
QSize sizeInPixels() const override;
const QRhiRenderPass *renderPass() const override;
QMetalBasicRenderTargetData d;
};
......@@ -134,9 +132,8 @@ struct QMetalTextureRenderTarget : public QRhiTextureRenderTarget
Type type() const override;
QSize sizeInPixels() const override;
const QRhiRenderPass *renderPass() const override;
QRhiRenderPass *newCompatibleRenderPass() override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool build() override;
QMetalBasicRenderTargetData d;
......@@ -208,21 +205,13 @@ struct QMetalSwapChain : public QRhiSwapChain
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
const QRhiRenderPass *defaultRenderPass() const override;
QSize requestedSizeInPixels() const override;
QSize effectiveSizeInPixels() const override;
QRhiRenderPass *newCompatibleRenderPass() override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool build(QWindow *window, const QSize &requestedPixelSize, SurfaceImportFlags flags,
QRhiRenderBuffer *depthStencil, int sampleCount) override;
bool buildOrResize() override;
bool build(QObject *target) override;
QWindow *window = nullptr;
QSize requestedPixelSize;
QSize effectivePixelSize;
int currentFrame = 0; // 0..QMTL_FRAMES_IN_FLIGHT-1
QMetalReferenceRenderTarget rtWrapper;
QMetalCommandBuffer cbWrapper;
......
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