C# Class Axiom.Graphics.GpuProgramUsage

This class makes the usage of a vertex and fragment programs (low-level or high-level), with a given set of parameters, explicit.
Using a vertex or fragment program can get fairly complex; besides the fairly rudimentary process of binding a program to the GPU for rendering, managing usage has few complications, such as:
  • Programs can be high level (e.g. Cg, GLSlang) or low level (assembler). Using either should be relatively seamless, although high-level programs give you the advantage of being able to use named parameters, instead of just indexed registers
  • Programs and parameters can be shared between multiple usages, in order to save memory
  • When you define a user of a program, such as a material, you often want to be able to set up the definition but not load / compile / assemble the program at that stage, because it is not needed just yet. The program should be loaded when it is first needed, or earlier if specifically requested. The program may not be defined at this time, you may want to have scripts that can set up the definitions independent of the order in which those scripts are loaded.
This class packages up those details so you don't have to worry about them. For example, this class lets you define a high-level program and set up the parameters for it, without having loaded the program (which you normally could not do). When the program is loaded and compiled, this class will then validate the parameters you supplied earlier and turn them into runtime parameters.

Just incase it wasn't clear from the above, this class provides linkage to both GpuProgram and HighLevelGpuProgram, despite its name.

Inheritance: DisposableObject, Resource.IListener
Show file Open project: mono-soc-2011/axiom Class Usage Examples

Protected Properties

Property Type Description
parameters GpuProgramParameters
program Axiom.Graphics.GpuProgram
type GpuProgramType

Public Methods

Method Description
Clone ( ) : GpuProgramUsage

Creates and returns a copy of this GpuProgramUsage object.

GpuProgramUsage ( GpuProgramType type ) : System

Default constructor.

Private Methods

Method Description
Load ( ) : void

Load this usage (and ensure program is loaded).

Unload ( ) : void

Unload this usage.

Method Details

Clone() public method

Creates and returns a copy of this GpuProgramUsage object.
public Clone ( ) : GpuProgramUsage
return GpuProgramUsage

GpuProgramUsage() public method

Default constructor.
public GpuProgramUsage ( GpuProgramType type ) : System
type GpuProgramType Type of program to link to.
return System

Property Details

parameters protected property

Low level GPU program parameters.
protected GpuProgramParameters,Axiom.Graphics parameters
return GpuProgramParameters

program protected property

Reference to the program whose usage is being specified within this class.
protected GpuProgram,Axiom.Graphics program
return Axiom.Graphics.GpuProgram

type protected property

Type of program (vertex or fragment) this usage is being specified for.
protected GpuProgramType type
return GpuProgramType