From 1c5d94aca19e447c0fd4bf7d813e7c7dab9361a4 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Fri, 29 Jun 2018 23:35:27 -0700 Subject: [PATCH] Improve performance; don't care about previous state ofcolor attachment Color attachment is being completely overwritten. --- gfx/common/metal/Context.h | 1 - gfx/common/metal_common.m | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gfx/common/metal/Context.h b/gfx/common/metal/Context.h index 98f0101842..d1ae25b9e7 100644 --- a/gfx/common/metal/Context.h +++ b/gfx/common/metal/Context.h @@ -20,7 +20,6 @@ @property (readonly) id device; @property (readonly) id library; -@property (readonly) id commandQueue; /*! @brief Returns the command buffer for the current frame */ @property (readonly) id commandBuffer; @property (readonly) id nextDrawable; diff --git a/gfx/common/metal_common.m b/gfx/common/metal_common.m index 7f84ecaf65..472b2703ca 100644 --- a/gfx/common/metal_common.m +++ b/gfx/common/metal_common.m @@ -882,8 +882,8 @@ static vertex_t vertex_bytes[] = { id cb = ctx.commandBuffer; MTLRenderPassDescriptor *rpd = [MTLRenderPassDescriptor new]; - rpd.colorAttachments[0].clearColor = MTLClearColorMake(0, 0, 0, 1.0); - rpd.colorAttachments[0].loadAction = MTLLoadActionClear; + // rpd.colorAttachments[0].clearColor = MTLClearColorMake(0, 0, 0, 1.0); + rpd.colorAttachments[0].loadAction = MTLLoadActionDontCare; rpd.colorAttachments[0].storeAction = MTLStoreActionStore; for (unsigned i = 0; i < _shader->passes; i++) @@ -900,6 +900,9 @@ static vertex_t vertex_bytes[] = { } id rce = [cb renderCommandEncoderWithDescriptor:rpd]; +#if METAL_DEBUG + rce.label = [NSString stringWithFormat:@"pass %d", i]; +#endif [rce setRenderPipelineState:_engine.pass[i]._state];