Metal backend, part 7

This commit is contained in:
tildearrow 2024-04-14 19:14:42 -05:00
parent 1e147ec4e5
commit e180bb5ea0

View file

@ -32,6 +32,14 @@ struct FurnaceGUIRenderMetalPrivate {
id<MTLRenderCommandEncoder> renderEncoder;
id<CAMetalDrawable> drawable;
MTLRenderPassDescriptor* renderPass;
FurnaceGUIRenderMetalPrivate():
context(NULL),
cmdQueue(NULL),
cmdBuf(NULL),
renderEncoder(NULL),
drawable(NULL),
renderPass(NULL) {}
};
class FurnaceMetalTexture: public FurnaceGUITexture {
@ -99,6 +107,20 @@ void FurnaceGUIRenderMetal::clear(ImVec4 color) {
int outW, outH;
getOutputSize(outW,outH);
priv->context.drawableSize=CGSizeMake(outW,outH);
if (priv->drawable) {
[priv->drawable release];
priv->drawable=NULL;
}
if (priv->cmdBuf) {
[priv->cmdBuf release];
priv->cmdBuf=NULL;
}
if (priv->renderEncoder) {
[priv->renderEncoder release];
priv->renderEncoder=NULL;
}
priv->drawable=[priv->context nextDrawable];
priv->cmdBuf=[priv->cmdQueue commandBuffer];