mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 12:39:13 +12:00
release resources
This commit is contained in:
parent
3431f6d192
commit
23af64ade8
6 changed files with 44 additions and 19 deletions
|
@ -18,7 +18,7 @@ public:
|
|||
BlitPipelineCache() = default;
|
||||
|
||||
~BlitPipelineCache() {
|
||||
clear();
|
||||
reset();
|
||||
vertexFunction->release();
|
||||
fragmentFunction->release();
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
return pipeline;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
void reset() {
|
||||
for (auto& pair : pipelineCache) {
|
||||
pair.second->release();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
DepthStencilCache() = default;
|
||||
|
||||
~DepthStencilCache() {
|
||||
clear();
|
||||
reset();
|
||||
}
|
||||
|
||||
void set(MTL::Device* dev) {
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
return depthStencilState;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
void reset() {
|
||||
for (auto& pair : depthStencilCache) {
|
||||
pair.second->release();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
DrawPipelineCache() = default;
|
||||
|
||||
~DrawPipelineCache() {
|
||||
clear();
|
||||
reset();
|
||||
vertexDescriptor->release();
|
||||
vertexFunction->release();
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
return pipeline;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
void reset() {
|
||||
for (auto& pair : pipelineCache) {
|
||||
pair.second->release();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
VertexBufferCache() = default;
|
||||
|
||||
~VertexBufferCache() {
|
||||
clear();
|
||||
reset();
|
||||
}
|
||||
|
||||
void set(MTL::Device* dev) {
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
return BufferHandle{buffer, oldPtr};
|
||||
}
|
||||
|
||||
void clear() {
|
||||
void reset() {
|
||||
endFrame();
|
||||
buffer->release();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,9 @@ class RendererMTL final : public Renderer {
|
|||
MTL::Device* device;
|
||||
MTL::CommandQueue* commandQueue;
|
||||
|
||||
// Libraries
|
||||
MTL::Library* library;
|
||||
|
||||
// Caches
|
||||
SurfaceCache<Metal::ColorRenderTarget, 16, true> colorRenderTargetCache;
|
||||
SurfaceCache<Metal::DepthStencilRenderTarget, 16, true> depthStencilRenderTargetCache;
|
||||
|
@ -105,10 +108,12 @@ class RendererMTL final : public Renderer {
|
|||
void commitCommandBuffer() {
|
||||
if (renderCommandEncoder) {
|
||||
renderCommandEncoder->endEncoding();
|
||||
renderCommandEncoder->release();
|
||||
renderCommandEncoder = nullptr;
|
||||
}
|
||||
if (commandBuffer) {
|
||||
commandBuffer->commit();
|
||||
commandBuffer->release();
|
||||
commandBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue