Owns a GX2VertexShader's compiled program and uniform/attribute metadata.
More...
#include <VertexShader.h>
|
| | VertexShader (uint32_t numAttr) |
| |
| void | setProgram (const uint32_t *program, uint32_t programSize, const uint32_t *regs, uint32_t regsSize) |
| | Uploads the compiled shader program.
|
| |
| void | addUniformVar (const GX2UniformVar &var) |
| | Registers a uniform variable so it can be set by location.
|
| |
| void | addAttribVar (const GX2AttribVar &var) |
| | Registers an input attribute variable.
|
| |
| void | setShader () const |
| | Binds this vertex shader for subsequent draws.
|
| |
| GX2AttribStream * | getAttributeBuffer (uint32_t idx=0) const |
| |
| uint32_t | getAttributesCount () const |
| |
|
| static void | setAttributeBuffer (uint32_t bufferIdx, uint32_t bufferSize, uint32_t stride, const void *buffer) |
| | Binds a vertex data buffer to an attribute buffer slot.
|
| |
| static void | setUniformReg (uint32_t location, uint32_t size, const void *reg) |
| | Writes uniform registers for the bound vertex shader.
|
| |
| static void | draw (int32_t primitive=GX2_PRIMITIVE_MODE_QUADS, uint32_t vtxCount=4) |
| | Issues the draw call for the currently bound shaders and attribute buffers.
|
| |
|
| uint32_t | attributesCount |
| | Number of attribute streams.
|
| |
| GX2AttribStream * | attributes |
| | Attribute stream descriptions handed to the fetch shader.
|
| |
| GX2VertexShader * | vertexShader |
| | The GX2 vertex shader object.
|
| |
|
| static const uint16_t | cuVertexAttrSize = sizeof(float) * 3 |
| | Size in bytes of one position vertex (3 floats)
|
| |
| static const uint16_t | cuTexCoordAttrSize = sizeof(float) * 2 |
| | Size in bytes of one texture coordinate (2 floats)
|
| |
| static const uint16_t | cuColorAttrSize = sizeof(uint8_t) * 4 |
| | Size in bytes of one vertex color (4 bytes, RGBA)
|
| |
Owns a GX2VertexShader's compiled program and uniform/attribute metadata.
setProgram() uploads the compiled bytecode; addUniformVar()/ addAttribVar() register the reflection info GX2 needs to bind it.
Definition at line 17 of file VertexShader.h.
◆ VertexShader()
| VertexShader::VertexShader |
( |
uint32_t | numAttr | ) |
|
|
inline |
- Parameters
-
| numAttr | Number of vertex attribute streams the shader reads |
Definition at line 21 of file VertexShader.h.
◆ ~VertexShader()
| virtual VertexShader::~VertexShader |
( |
| ) |
|
|
inlinevirtual |
◆ addAttribVar()
| void VertexShader::addAttribVar |
( |
const GX2AttribVar & | var | ) |
|
|
inline |
Registers an input attribute variable.
Definition at line 101 of file VertexShader.h.
◆ addUniformVar()
| void VertexShader::addUniformVar |
( |
const GX2UniformVar & | var | ) |
|
|
inline |
Registers a uniform variable so it can be set by location.
Definition at line 79 of file VertexShader.h.
◆ getAttributeBuffer()
| GX2AttribStream * VertexShader::getAttributeBuffer |
( |
uint32_t | idx = 0 | ) |
const |
|
inline |
- Returns
- the attribute stream description at idx
Definition at line 139 of file VertexShader.h.
◆ getAttributesCount()
| uint32_t VertexShader::getAttributesCount |
( |
| ) |
const |
|
inline |
- Returns
- the number of attribute streams
Definition at line 147 of file VertexShader.h.
◆ setAttributeBuffer()
| static void VertexShader::setAttributeBuffer |
( |
uint32_t | bufferIdx, |
|
|
uint32_t | bufferSize, |
|
|
uint32_t | stride, |
|
|
const void * | buffer ) |
|
inlinestatic |
Binds a vertex data buffer to an attribute buffer slot.
- Parameters
-
| bufferIdx | Attribute buffer slot |
| bufferSize | Size of buffer in bytes |
| stride | Bytes between consecutive vertices |
| buffer | Vertex data |
Definition at line 127 of file VertexShader.h.
◆ setProgram()
| void VertexShader::setProgram |
( |
const uint32_t * | program, |
|
|
uint32_t | programSize, |
|
|
const uint32_t * | regs, |
|
|
uint32_t | regsSize ) |
|
inline |
Uploads the compiled shader program.
- Parameters
-
| program | Compiled GX2 vertex shader bytecode |
| programSize | Size of program in bytes |
| regs | Precomputed shader register values |
| regsSize | Size of regs in bytes |
Definition at line 61 of file VertexShader.h.
◆ setShader()
| void VertexShader::setShader |
( |
| ) |
const |
|
inline |
Binds this vertex shader for subsequent draws.
Definition at line 133 of file VertexShader.h.
◆ setUniformReg()
| static void VertexShader::setUniformReg |
( |
uint32_t | location, |
|
|
uint32_t | size, |
|
|
const void * | reg ) |
|
inlinestatic |
Writes uniform registers for the bound vertex shader.
- Parameters
-
| location | Register location of the uniform |
| size | Number of registers to write |
| reg | Source values |
Definition at line 153 of file VertexShader.h.
◆ attributes
| GX2AttribStream* VertexShader::attributes |
|
protected |
Attribute stream descriptions handed to the fetch shader.
Definition at line 160 of file VertexShader.h.
◆ attributesCount
| uint32_t VertexShader::attributesCount |
|
protected |
◆ vertexShader
| GX2VertexShader* VertexShader::vertexShader |
|
protected |
The documentation for this class was generated from the following file: