Replace rather than update Metal buffers (#1842)

This commit is contained in:
Tim Sylvester
2023-11-20 12:58:19 -08:00
committed by GitHub
parent 48106f7422
commit ffcf132f20
11 changed files with 115 additions and 40 deletions

View File

@@ -10,16 +10,36 @@ struct RenderingStats {
RenderingStats() = default;
bool isZero() const;
/// Number of frames rendered
int numFrames = 0;
/// Number of draw calls (`glDrawElements`, `drawIndexedPrimitives`, etc.) executed during the most recent frame
int numDrawCalls = 0;
/// Total number of draw calls executed during all the frames
int totalDrawCalls = 0;
/// Total number of textures created
int numCreatedTextures = 0;
/// Net textures
int numActiveTextures = 0;
/// Net texture bindings
int numTextureBindings = 0;
/// Number of times a texture was updated
int numTextureUpdates = 0;
/// Number of bytes used in texture updates
std::size_t textureUpdateBytes = 0;
/// Number of buffers created
std::size_t totalBuffers = 0;
/// Number of SDK-specific buffers created
std::size_t totalBufferObjs = 0;
/// Number of times a buffer is updated
std::size_t bufferUpdates = 0;
/// Number of times an SDK-specific buffer is updated
std::size_t bufferObjUpdates = 0;
/// Sum of update sizes
std::size_t bufferUpdateBytes = 0;
/// Number of active buffers
int numBuffers = 0;
int numFrameBuffers = 0;

View File

@@ -66,9 +66,7 @@ public:
MTLTexturePtr createMetalTexture(MTLTextureDescriptorPtr textureDescriptor) const;
MTLSamplerStatePtr createMetalSamplerState(MTLSamplerDescriptorPtr samplerDescriptor) const;
void clear();
// Actually remove the objects we marked as abandoned with the above methods.
/// Called at the end of a frame.
void performCleanup() override;
void reduceMemoryUsage() override {}