Improve performance; don't care about previous state ofcolor attachment

Color attachment is being completely overwritten.
This commit is contained in:
Stuart Carnie 2018-06-29 23:35:27 -07:00
parent 5e1f991e32
commit 1c5d94aca1
2 changed files with 5 additions and 3 deletions

View File

@ -20,7 +20,6 @@
@property (readonly) id<MTLDevice> device;
@property (readonly) id<MTLLibrary> library;
@property (readonly) id<MTLCommandQueue> commandQueue;
/*! @brief Returns the command buffer for the current frame */
@property (readonly) id<MTLCommandBuffer> commandBuffer;
@property (readonly) id<CAMetalDrawable> nextDrawable;

View File

@ -882,8 +882,8 @@ static vertex_t vertex_bytes[] = {
id<MTLCommandBuffer> 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<MTLRenderCommandEncoder> rce = [cb renderCommandEncoderWithDescriptor:rpd];
#if METAL_DEBUG
rce.label = [NSString stringWithFormat:@"pass %d", i];
#endif
[rce setRenderPipelineState:_engine.pass[i]._state];