iShader Struct Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions
iShader Struct Reference

Specific shader. More...

`#include <ivideo/shader/shader.h>`

Inheritance diagram for iShader:

List of all members.

## Public Types
enum | SVUserFlags { svuTextures = (1 << 0), svuBuffers = (1 << 1), svuVProc = (1 << 2), svuVP = (1 << 3), svuFP = (1 << 4), svuAll = 0xffff }
| Flags for SV users to be considered by GetUsedShaderVars. More...
## Public Member Functions
virtual bool | ActivatePass (size_t ticket, size_t number)=0
| Activate a pass for rendering.
virtual bool | DeactivatePass (size_t ticket)=0
| Completly deactivate a pass.
virtual const char * | GetFileName ()=0
| Get name of the File where it was loaded from.
virtual const csShaderMetadata & | GetMetadata () const =0
| Get shader metadata.
virtual size_t | GetNumberOfPasses (size_t ticket)=0
| Get number of passes this shader has.
virtual size_t | GetTicket (const CS::Graphics::RenderMeshModes &modes, const csShaderVariableStack &stack)=0
| Query a "shader ticket".
virtual void | GetUsedShaderVars (size_t ticket, csBitArray &bits, uint userFlags=svuAll) const =0
| Request all shader variables used by a certain shader ticket.
virtual void | PushShaderVariables (csShaderVariableStack &stack, size_t ticket) const =0
| Push the variables of this shader onto the variable stack supplied in the "stack" argument.
virtual iObject * | QueryObject ()=0
| Query the object.
virtual void | SetFileName (const char *filename)=0
| Set name of the File where it was loaded from.
virtual bool | SetupPass (size_t ticket, const CS::Graphics::RenderMesh *mesh, CS::Graphics::RenderMeshModes &modes, const csShaderVariableStack &stack)=0
| Setup a pass.
virtual bool | TeardownPass (size_t ticket)=0
| Tear down current state, and prepare for a new mesh (for which SetupPass is called)
Shader technique selection and metadata
virtual size_t | GetPrioritiesTicket (const CS::Graphics::RenderMeshModes &modes, const csShaderVariableStack &stack)=0
| Query a "priorities ticket".
virtual csPtr < iShaderPriorityList > | GetAvailablePriorities (size_t prioTicket) const =0
| Get a list of all available techniques (resp.
virtual csPtr< iString > | GetTechniqueMetadata (int priority, const char *dataKey) const =0
| Query metadata from a technique.
virtual csPtr< iShader > | ForceTechnique (int priority)=0
| Return a shader that wraps a certain technique of this shader.

## Detailed Description

Specific shader.

Can/will be either render-specific or general The shader in this form is "compiled" and cannot be modified.

Definition at line 488 of file shader.h.

## Member Enumeration Documentation

enum iShader::SVUserFlags

Flags for SV users to be considered by GetUsedShaderVars.

Enumerator:

  svuTextures | Used by texture mappings.
  svuBuffers | Used by buffer bindings.
  svuVProc | Used by VProc program.
  svuVP | Used by vertex program.
  svuFP | Used by fragment program.
  svuAll | All users.

Definition at line 535 of file shader.h.

## Member Function Documentation

virtual bool iShader::ActivatePass | ( | size_t | ticket,
|  | size_t | number
| ) |  | `[pure virtual]`

Activate a pass for rendering.

virtual bool iShader::DeactivatePass | ( | size_t | ticket | ) | `[pure virtual]`

Completly deactivate a pass.

virtual csPtr<iShader> iShader::ForceTechnique | ( | int | priority | ) | `[pure virtual]`

Return a shader that wraps a certain technique of this shader.

Returns 0 if no technique with that priority is actually present.

virtual csPtr<iShaderPriorityList> iShader::GetAvailablePriorities | ( | size_t | prioTicket | ) | const`[pure virtual]`

Get a list of all available techniques (resp.

their priorities) for a priority ticket.

virtual const char* iShader::GetFileName | ( |  | ) | `[pure virtual]`

Get name of the File where it was loaded from.

virtual const csShaderMetadata& iShader::GetMetadata | ( |  | ) | const`[pure virtual]`

Get shader metadata.

virtual size_t iShader::GetNumberOfPasses | ( | size_t | ticket | ) | `[pure virtual]`

Get number of passes this shader has.

virtual size_t iShader::GetPrioritiesTicket | ( | const CS::Graphics::RenderMeshModes & | modes,
|  | const csShaderVariableStack & | stack
| ) |  | `[pure virtual]`

Query a "priorities ticket".

This is a shader-internal token representing the techniques available with the given mesh modes and shader variables.

See also:
  GetTicket

virtual csPtr<iString> iShader::GetTechniqueMetadata | ( | int | priority,
|  | const char * | dataKey
| ) |  | const`[pure virtual]`

Query metadata from a technique.

Returns 0 if no metadata with the given key is available.

virtual size_t iShader::GetTicket | ( | const CS::Graphics::RenderMeshModes & | modes,
|  | const csShaderVariableStack & | stack
| ) |  | `[pure virtual]`

Query a "shader ticket".

Internally, a shader may choose one of several actual techniques or variants at runtime. However, the variant has to be known in order to determine the number of passes or to do pass preparation. As the decision what variant is to be used is made based on the mesh modes and the shader vars used for rendering, those have to be provided to get the actual variant, which is then identified by the "ticket".

virtual void iShader::GetUsedShaderVars | ( | size_t | ticket,
|  | csBitArray & | bits,
|  | uint | userFlags = `svuAll`
| ) |  | const`[pure virtual]`

Request all shader variables used by a certain shader ticket.

Parameters:

  ticket | The ticket for which to retrieve the information.
  bits | Bit array with one bit for each shader variable set; if a shader variable is used, the bit corresponding to the name of the variable is note set. Please note: first, the array passed in must initially have enough bits for all possible shader variables, it will not be resized - thus a good size would be the number of strings in the shader variable string set. Second, bits corresponding to unused shader variables will not be reset. It is the responsibility of the caller to do so.
  userFlags | What users to consider when collecting used SVs. Combination of SVUserFlags values.

virtual void iShader::PushShaderVariables | ( | csShaderVariableStack & | stack,
|  | size_t | ticket
| ) |  | const`[pure virtual]`

Push the variables of this shader onto the variable stack supplied in the "stack" argument.

virtual iObject* iShader::QueryObject | ( |  | ) | `[pure virtual]`

Query the object.

virtual void iShader::SetFileName | ( | const char * | filename | ) | `[pure virtual]`

Set name of the File where it was loaded from.

virtual bool iShader::SetupPass | ( | size_t | ticket,
|  | const CS::Graphics::RenderMesh * | mesh,
|  | CS::Graphics::RenderMeshModes & | modes,
|  | const csShaderVariableStack & | stack
| ) |  | `[pure virtual]`

Setup a pass.

virtual bool iShader::TeardownPass | ( | size_t | ticket | ) | `[pure virtual]`

Tear down current state, and prepare for a new mesh (for which SetupPass is called)

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

- ivideo/shader/shader.h