Instance Methods | Class Methods | Properties | List of all members
CC3ShaderPrewarmer Class Reference

#import <CC3Shaders.h>

Inheritance diagram for CC3ShaderPrewarmer:
Inheritance graph

Instance Methods

(void) - prewarmShaderProgram:
- Instance Methods inherited from CC3Identifiable
(void) - __deprecated
(id) - copy
(id) - copyAsClass:
(void) - copyUserDataFrom:
(id) - copyWithName:
(id) - copyWithName:asClass:
(id) - copyWithZone:withName:
(id) - copyWithZone:withName:asClass:
(BOOL) - deriveNameFrom:
(BOOL) - deriveNameFrom:usingSuffix:
(NSString *) - fullDescription
(id) - init
(id) - initAtIndex:fromPODResource:
(void) - initUserData
(id) - initWithName:
(id) - initWithTag:
(id) - initWithTag:withName:
(GLuint) - nextTag
(void) - populateFrom:

Class Methods

(id) + prewarmerWithName:
- Class Methods inherited from CC3Identifiable
(GLint) + instanceCount
(void) + resetTagAllocation


id< CC3RenderSurfaceprewarmingSurface
- Properties inherited from CC3Identifiable
NSObject *sharedUserData __deprecated
NSString * name
NSString * nameSuffix
GLint podIndex
BOOL shouldIncludeInDeepCopy
GLuint tag
NSObject * userData
- Properties inherited from <CC3Cacheable>
NSString * name

Detailed Description

Utility class that pre-warms shader programs by using them to render a small mesh node to an off-screen surface.

The GL engine may choose to defer some final shader program compilation steps until the first time the shader program is used to render a mesh. This can cause the first frame of the first mesh drawn with the shader program to take significantly longer than subsequent renderings with that shader program, which can often result in a transient, but noticable, "freezing" of the scene. This is particularly apparent for new meshes that are added to the scene at any point other than during scene initialization.

To avoid this, this class contains a small mesh and an off-screen rendering surface to which the mesh can be rendered using a shader program, in order to force that shader program to perform its final compilation and linking steps at a controlled, and predicatble, time.

Method Documentation

+ (id) prewarmerWithName: (NSString *)  name

Allocates and initializes an autoreleased instance with the specified name.

- (void) prewarmShaderProgram: (CC3ShaderProgram *)  program

Pre-warms the specified shader program by rendering the prewarmingMeshNode to the prewarmingSurface.

Property Documentation

- (CC3NodeDrawingVisitor*) drawingVisitor

The drawing visitor used to render the prewarmingMeshNode to the prewarmingSurface.

If not set directly, this property will be lazily initialized to a a basic drawing visitor.

- (CC3MeshNode*) prewarmingMeshNode

The mesh node that is rendered to the prewarmingSurface in order to pre-warm a shader program.

If not set directly, this property will be lazily initialized to a minimal mesh consisting of a single triangular face containing only location content in the verticies.

- (id<CC3RenderSurface>) prewarmingSurface

The surface to which the prewarmingMeshNode is rendered in order to pre-warm a shader program.

If not set directly, this property will be initialized to a minimal off-screen surface that contains only a color buffer, with no depth buffer.

The documentation for this class was generated from the following file: