OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::VertexFormatWarmUpStorage Class Reference

The purpose of this class is to trigger shader compilations on demand (e.g. More...

#include <OgreVertexFormatWarmUp.h>

Public Member Functions

 VertexFormatWarmUpStorage ()
 
 ~VertexFormatWarmUpStorage ()
 
void analyze (SceneManager *sceneManager)
 
void createWarmUp (SceneManager *sceneManager)
 
void destroyWarmUp ()
 
void loadFrom (DataStreamPtr &dataStream)
 
void saveTo (DataStreamPtr &dataStream)
 

Detailed Description

The purpose of this class is to trigger shader compilations on demand (e.g.

at startup or at loading time) without having to load meshes and skeletons.

Normally to warm up all shader caches, you'd have to create an Item of each Mesh + Material combo that is needed.

This is tedious to keep by hand and can increase loading time and RAM consumption because a significant time is spent on loading meshes and skeletons.

This class simplifies that task by splitting up it up in parts:

Part 1:

  1. Create a scene with all objects you plan on ever using (or at least as much as possible).
  2. Run VertexFormatWarmUpStorage::analyze.
  3. Save the results to file via VertexFormatWarmUpStorage::saveTo.

Part 2:

  1. Load the saved file via VertexFormatWarmUpStorage::loadFrom.
  2. Call VertexFormatWarmUpStorage::createWarmUp.
  3. Render one frame (or multiple ones). Either directly to the screen or with the help of warm_up compositor passeses (see CompositorPassWarmUpDef and see WarmUpHelper).
  4. Destroy the VertexFormatWarmUpStorage.

What VertexFormatWarmUpStorage in Part I simply does is to collect all useful combos of Vertex_Format + Material settings and saves them to file.

Note
Many Materials when applied to the same Vertex_Format may result in the exact same shader. In that case, the VertexFormatWarmUpStorage will only save one material (the first one it sees with for that combo). It doesn't waste time saving all materials.

In Part II, VertexFormatWarmUpStorage will create a very small vertex buffer with the same vertex format and apply the material to it. This way attempting to render will result in nothing on screen (because it's all 0s and degenerate triangles), the shader gets parsed and the hit to VRAM and disk loading times are minimum.

Constructor & Destructor Documentation

◆ VertexFormatWarmUpStorage()

Ogre::VertexFormatWarmUpStorage::VertexFormatWarmUpStorage ( )

◆ ~VertexFormatWarmUpStorage()

Ogre::VertexFormatWarmUpStorage::~VertexFormatWarmUpStorage ( )

Member Function Documentation

◆ analyze()

void Ogre::VertexFormatWarmUpStorage::analyze ( SceneManager sceneManager)

◆ createWarmUp()

void Ogre::VertexFormatWarmUpStorage::createWarmUp ( SceneManager sceneManager)

◆ destroyWarmUp()

void Ogre::VertexFormatWarmUpStorage::destroyWarmUp ( )

◆ loadFrom()

void Ogre::VertexFormatWarmUpStorage::loadFrom ( DataStreamPtr dataStream)

◆ saveTo()

void Ogre::VertexFormatWarmUpStorage::saveTo ( DataStreamPtr dataStream)

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