src/render/metal/SDL_render_metal.m
changeset 11734 6d6dc7d2a704
parent 11733 490588c02a65
child 11735 1d81fcb6edd5
equal deleted inserted replaced
11733:490588c02a65 11734:6d6dc7d2a704
   341     MakePipelineStates(data, data.mtlpipelineprims, @"SDL primitives pipeline", @"SDL_Simple_vertex", @"SDL_Simple_fragment");
   341     MakePipelineStates(data, data.mtlpipelineprims, @"SDL primitives pipeline", @"SDL_Simple_vertex", @"SDL_Simple_fragment");
   342     data.mtlpipelinecopy = [[NSMutableArray alloc] init];
   342     data.mtlpipelinecopy = [[NSMutableArray alloc] init];
   343     MakePipelineStates(data, data.mtlpipelinecopy, @"SDL_RenderCopy pipeline", @"SDL_Copy_vertex", @"SDL_Copy_fragment");
   343     MakePipelineStates(data, data.mtlpipelinecopy, @"SDL_RenderCopy pipeline", @"SDL_Copy_vertex", @"SDL_Copy_fragment");
   344 
   344 
   345     static const float clearverts[] = { -1, -1, -1, 1, 1, 1, 1, -1, -1, -1 };
   345     static const float clearverts[] = { -1, -1, -1, 1, 1, 1, 1, -1, -1, -1 };
   346     data.mtlbufclearverts = [data.mtldevice newBufferWithBytes:clearverts length:sizeof(clearverts) options:MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModePrivate];
   346     data.mtlbufclearverts = [data.mtldevice newBufferWithBytes:clearverts length:sizeof(clearverts) options:MTLResourceCPUCacheModeWriteCombined];
   347     data.mtlbufclearverts.label = @"SDL_RenderClear vertices";
   347     data.mtlbufclearverts.label = @"SDL_RenderClear vertices";
   348 
   348 
   349     // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed.
   349     // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed.
   350 
   350 
   351     return renderer;
   351     return renderer;
   478             mtlrect.x = renderer->viewport.x;
   478             mtlrect.x = renderer->viewport.x;
   479             mtlrect.y = renderer->viewport.y;
   479             mtlrect.y = renderer->viewport.y;
   480             mtlrect.width = renderer->viewport.w;
   480             mtlrect.width = renderer->viewport.w;
   481             mtlrect.height = renderer->viewport.h;
   481             mtlrect.height = renderer->viewport.h;
   482         }
   482         }
   483         [data.mtlcmdencoder setScissorRect:mtlrect];
   483         if (mtlrect.width > 0 && mtlrect.height > 0) {
       
   484             [data.mtlcmdencoder setScissorRect:mtlrect];
       
   485         }
   484     }
   486     }
   485     return 0;
   487     return 0;
   486 }
   488 }
   487 
   489 
   488 static int
   490 static int