UniShader
1.0.0a
Interface for GPGPU and working with shader programs
|
#include <Varying.h>
Public Types | |
typedef SafePtr< Varying > | Ptr |
Safe pointer. | |
typedef SafePtr< const Varying > | PtrConst |
Safe pointer. | |
Public Member Functions | |
Varying (ShaderProgram &program, ShaderOutput &output, std::string name) | |
virtual const std::string & | getClassName () const |
Get name of this class. | |
template<typename T > | |
Buffer< T >::PtrConst | getBuffer () |
Get buffer. | |
const GLSLType & | getGLSLType () const |
Get GLSL type. | |
std::string | getName () const |
Get shader variable name. | |
bool | prepare (unsigned int index, unsigned int primitiveCount, size_t *unitSize=0) |
Prepare varying. | |
virtual bool | handleSignal (unsigned int signalID, const ObjectBase *callerPtr) |
Handle incoming signal. |
Varying class.
Varyings are output variables for GLSL vertex and geometry shader programs. In newer GLSL versions varying keyword was replaced by output keyword, but functionality is the same. Varyings are used to pass data between subsequent shader stages.
It is possible to record values in varying before they enter fragment shader stage with transform feedback. This class, therefore, seves as interface to access recorded values in application. Recorded values are originaly stored in buffer in graphics card memory.
If a geometry shader stage is present, only output variables of geometry shader can be recorded. If only vertex shader stage is present, recording of output variable is considered as valid usage of that variable and shader program can be run.
UNISHADER_BEGIN Buffer< T >::PtrConst Varying::getBuffer | ( | ) |
Get buffer.
const GLSLType& Varying::getGLSLType | ( | ) | const |
Get GLSL type.
std::string Varying::getName | ( | ) | const |
Get shader variable name.
virtual bool Varying::handleSignal | ( | unsigned int | signalID, |
const ObjectBase * | callerPtr | ||
) | [virtual] |
Handle incoming signal.
signalID | Signal identifier. |
callerPtr | Pointer to object sending signal. |
Implements SignalReceiver.
bool Varying::prepare | ( | unsigned int | index, |
unsigned int | primitiveCount, | ||
size_t * | unitSize = 0 |
||
) |
Prepare varying.
Retrieve info about varying from shader program and prepare varying for use.