forked from disini/sample-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMBEMetalView.h
More file actions
47 lines (35 loc) · 1.79 KB
/
Copy pathMBEMetalView.h
File metadata and controls
47 lines (35 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@import UIKit;
@import Metal;
@import QuartzCore.CAMetalLayer;
@protocol MBEMetalViewDelegate;
@interface MBEMetalView : UIView
/// The delegate of this view, responsible for drawing
@property (nonatomic, weak) id<MBEMetalViewDelegate> delegate;
/// The Metal layer that backs this view
@property (nonatomic, readonly) CAMetalLayer *metalLayer;
/// The target frame rate (in Hz). For best results, this should
/// be a number that evenly divides 60 (e.g., 60, 30, 15).
@property (nonatomic) NSInteger preferredFramesPerSecond;
/// The desired pixel format of the color attachment
@property (nonatomic) MTLPixelFormat colorPixelFormat;
/// The color to which the color attachment should be cleared at the start of
/// a rendering pass
@property (nonatomic, assign) MTLClearColor clearColor;
/// The duration (in seconds) of the previous frame. This is valid only in the context
/// of a callback to the delegate's -drawInView: method.
@property (nonatomic, readonly) NSTimeInterval frameDuration;
/// The view's layer's current drawable. This is valid only in the context
/// of a callback to the delegate's -drawInView: method.
@property (nonatomic, readonly) id<CAMetalDrawable> currentDrawable;
/// A render pass descriptor configured to use the current drawable's texture
/// as its primary color attachment and an internal depth texture of the same
/// size as its depth attachment's texture
@property (nonatomic, readonly) MTLRenderPassDescriptor *currentRenderPassDescriptor;
@end
@protocol MBEMetalViewDelegate <NSObject>
/// This method is called once per frame. Within the method, you may access
/// any of the properties of the view, and request the current render pass
/// descriptor to get a descriptor configured with renderable color and depth
/// textures.
- (void)drawInView:(MBEMetalView *)view;
@end