# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

CVPParser Class Reference

A vertex program parser. More...

#include <vertex_program_parse.h>

List of all members.

Public Types

typedef std::vector< CVPInstructionTProgram

Public Methods

bool parse (const char *src, TProgram &result, std::string &errorOutput)
 Parse a vertex program, and convert to proprietary format. More...


Static Public Methods

void dump (const TProgram &prg, std::string &dest)
 Debugging purpose : This output a parsed vertex program in a string, with the standard format. More...


Private Methods

bool parseOperand (CVPOperand &operand, bool outputOperand, std::string &errorOutput)
bool parseInputRegister (CVPOperand &operand, std::string &errorOutput)
bool parseOutputRegister (CVPOperand &operand, std::string &errorOutput)
bool parseConstantRegister (CVPOperand &operand, std::string &errorOutput)
bool parseVariableRegister (CVPOperand &operand, std::string &errorOutput)
bool parseAddressRegister (CVPOperand &operand, std::string &errorOutput)
bool parseSwizzle (CVPSwizzle &swizzle, std::string &errorOutput)
bool parseWriteMask (uint &mask, std::string &errorOutput)
bool parseInstruction (CVPInstruction &instr, std::string &errorOutput, bool &endEncountered)
bool parseOp2 (CVPInstruction &instr, std::string &errorOutput)
bool parseOp3 (CVPInstruction &instr, std::string &errorOutput)
bool parseOp4 (CVPInstruction &instr, std::string &errorOutput)
void skipSpacesAndComments ()
 Skip tabulation and space in a source code. More...


Private Attributes

const char * _CurrChar
const char * _LineStart
uint _LineIndex
uint _RegisterMask [96]


Detailed Description

A vertex program parser.

Author:
Nicolas Vizerie , Nevrax France
Date:
2002

Definition at line 191 of file vertex_program_parse.h.


Member Typedef Documentation

typedef std::vector<CVPInstruction> CVPParser::TProgram
 

Definition at line 194 of file vertex_program_parse.h.

Referenced by NL3D::CDriverGL::activeEXTVertexShader, NL3D::CDriverGL::activeNVVertexProgram, NL3D::CMeshVPPerPixelLight::initInstance, parse, and NL3D::CDriverGL::setupEXTVertexShader.


Member Function Documentation

void CVPParser::dump const TProgram   prg,
std::string &    dest
[static]
 

Debugging purpose : This output a parsed vertex program in a string, with the standard format.

This can serve as a base for other format code generation

Definition at line 1095 of file vertex_program_parse.cpp.

References dumpInstr.

bool CVPParser::parse const char *    src,
TProgram   result,
std::string &    errorOutput
 

Parse a vertex program, and convert to proprietary format.

It is intended to be use by a driver implementation. \warning: Only syntax is checked. It doesn't check that a register has been initialised before use.

Parameters:
src  The input text of a vertex program, in OpenGL format.
result  The result program.
errorOuput  If parsing failed, contains the reason
Returns:
true if the parsing succeeded

Definition at line 906 of file vertex_program_parse.cpp.

References _CurrChar, _LineIndex, _LineStart, _RegisterMask, getStringUntilCR, parseInstruction, skipSpacesAndComments, src, NLMISC::toString, and TProgram.

Referenced by NL3D::CDriverGL::activeEXTVertexShader, NL3D::CDriverGL::activeNVVertexProgram, and NL3D::CMeshVPPerPixelLight::initInstance.

bool CVPParser::parseAddressRegister CVPOperand   operand,
std::string &    errorOutput
[private]
 

Definition at line 533 of file vertex_program_parse.cpp.

References _CurrChar, CVPOperand::AddressRegister, and CVPOperand::Type.

Referenced by parseOperand.

bool CVPParser::parseConstantRegister CVPOperand   operand,
std::string &    errorOutput
[private]
 

Definition at line 442 of file vertex_program_parse.cpp.

References _CurrChar, CVPOperand::Constant, index, CVPOperand::Indexed, parseUInt, skipSpacesAndComments, CVPOperand::Type, and CVPOperand::Value.

Referenced by parseOperand.

bool CVPParser::parseInputRegister CVPOperand   operand,
std::string &    errorOutput
[private]
 

Definition at line 224 of file vertex_program_parse.cpp.

References _CurrChar, CVPOperand::IFogCoord, index, CVPOperand::INormal, CVPOperand::InputRegister, CVPOperand::IPosition, CVPOperand::IPrimaryColor, CVPOperand::ISecondaryColor, CVPOperand::ITex0, CVPOperand::IWeight, skipSpacesAndComments, CVPOperand::Type, and CVPOperand::Value.

Referenced by parseOperand.

bool CVPParser::parseInstruction CVPInstruction   instr,
std::string &    errorOutput,
bool &    endEncountered
[private]
 

Definition at line 714 of file vertex_program_parse.cpp.

References _CurrChar, _RegisterMask, CVPInstruction::ADD, CVPOperand::AddressRegister, CVPInstruction::ARL, CVPInstruction::Dest, CVPInstruction::DP3, CVPInstruction::DP4, CVPInstruction::DST, CVPInstruction::EXPP, CVPSwizzle::isScalar, CVPInstruction::LIT, CVPInstruction::LOG, CVPInstruction::MAD, CVPInstruction::MAX, CVPInstruction::MIN, CVPInstruction::MOV, CVPInstruction::MUL, CVPInstruction::Opcode, parseOp2, parseOp3, parseOp4, CVPInstruction::RCP, CVPInstruction::RSQ, CVPInstruction::SGE, skipSpacesAndComments, CVPInstruction::SLT, CVPInstruction::Src1, CVPOperand::Swizzle, CVPOperand::Type, CVPOperand::Value, CVPOperand::Variable, and CVPOperand::WriteMask.

Referenced by parse.

bool CVPParser::parseOp2 CVPInstruction   instr,
std::string &    errorOutput
[private]
 

Definition at line 547 of file vertex_program_parse.cpp.

References _CurrChar, CVPOperand::AddressRegister, CVPOperand::Constant, CVPInstruction::Dest, CVPOperand::InputRegister, CVPOperand::OutputRegister, parseOperand, skipSpacesAndComments, CVPInstruction::Src1, and CVPOperand::Type.

Referenced by parseInstruction, and parseOp3.

bool CVPParser::parseOp3 CVPInstruction   instr,
std::string &    errorOutput
[private]
 

Definition at line 579 of file vertex_program_parse.cpp.

References _CurrChar, CVPOperand::AddressRegister, CVPOperand::Constant, CVPOperand::Indexed, CVPOperand::InputRegister, CVPOperand::OutputRegister, parseOp2, parseOperand, skipSpacesAndComments, CVPInstruction::Src1, CVPInstruction::Src2, CVPOperand::Type, and CVPOperand::Value.

Referenced by parseInstruction, and parseOp4.

bool CVPParser::parseOp4 CVPInstruction   instr,
std::string &    errorOutput
[private]
 

Definition at line 632 of file vertex_program_parse.cpp.

References _CurrChar, CVPOperand::AddressRegister, CVPOperand::Constant, CVPOperand::Indexed, CVPOperand::InputRegister, CVPOperand::OutputRegister, parseOp3, parseOperand, skipSpacesAndComments, CVPInstruction::Src1, CVPInstruction::Src2, CVPInstruction::Src3, CVPOperand::Type, and CVPOperand::Value.

Referenced by parseInstruction.

bool CVPParser::parseOperand CVPOperand   operand,
bool    outputOperand,
std::string &    errorOutput
[private]
 

Definition at line 142 of file vertex_program_parse.cpp.

References _CurrChar, _RegisterMask, CVPOperand::AddressRegister, CVPSwizzle::Comp, CVPOperand::Negate, parseAddressRegister, parseConstantRegister, parseInputRegister, parseOutputRegister, parseSwizzle, parseVariableRegister, parseWriteMask, skipSpacesAndComments, CVPOperand::Swizzle, CVPOperand::Type, CVPOperand::Value, CVPOperand::Variable, and CVPOperand::WriteMask.

Referenced by parseOp2, parseOp3, and parseOp4.

bool CVPParser::parseOutputRegister CVPOperand   operand,
std::string &    errorOutput
[private]
 

Definition at line 370 of file vertex_program_parse.cpp.

References _CurrChar, CVPOperand::OBackFacePrimaryColor, CVPOperand::OBackFaceSecondaryColor, CVPOperand::OFogCoord, CVPOperand::OHPosition, CVPOperand::OPointSize, CVPOperand::OPrimaryColor, CVPOperand::OSecondaryColor, CVPOperand::OTex0, CVPOperand::OTex1, CVPOperand::OTex2, CVPOperand::OTex3, CVPOperand::OTex4, CVPOperand::OTex5, CVPOperand::OTex6, CVPOperand::OTex7, CVPOperand::OutputRegister, skipSpacesAndComments, CVPOperand::Type, and CVPOperand::Value.

Referenced by parseOperand.

bool CVPParser::parseSwizzle CVPSwizzle   swizzle,
std::string &    errorOutput
[private]
 

Definition at line 315 of file vertex_program_parse.cpp.

References _CurrChar, CVPSwizzle::Comp, letterToSwizzleComp, CVPSwizzle::W, CVPSwizzle::X, CVPSwizzle::Y, and CVPSwizzle::Z.

Referenced by parseOperand.

bool CVPParser::parseVariableRegister CVPOperand   operand,
std::string &    errorOutput
[private]
 

Definition at line 513 of file vertex_program_parse.cpp.

References _CurrChar, index, parseUInt, CVPOperand::Type, CVPOperand::Value, and CVPOperand::Variable.

Referenced by parseOperand.

bool CVPParser::parseWriteMask uint   mask,
std::string &    errorOutput
[private]
 

Definition at line 31 of file vertex_program_parse.cpp.

References _CurrChar.

Referenced by parseOperand.

void CVPParser::skipSpacesAndComments   [private]
 

Skip tabulation and space in a source code.

Definition at line 77 of file vertex_program_parse.cpp.

References _CurrChar, _LineIndex, and _LineStart.

Referenced by parse, parseConstantRegister, parseInputRegister, parseInstruction, parseOp2, parseOp3, parseOp4, parseOperand, and parseOutputRegister.


Member Data Documentation

const char* CVPParser::_CurrChar [private]
 

Definition at line 213 of file vertex_program_parse.h.

Referenced by parse, parseAddressRegister, parseConstantRegister, parseInputRegister, parseInstruction, parseOp2, parseOp3, parseOp4, parseOperand, parseOutputRegister, parseSwizzle, parseVariableRegister, parseWriteMask, and skipSpacesAndComments.

uint CVPParser::_LineIndex [private]
 

Definition at line 215 of file vertex_program_parse.h.

Referenced by parse, and skipSpacesAndComments.

const char* CVPParser::_LineStart [private]
 

Definition at line 214 of file vertex_program_parse.h.

Referenced by parse, and skipSpacesAndComments.

uint CVPParser::_RegisterMask[96] [private]
 

Definition at line 216 of file vertex_program_parse.h.

Referenced by parse, parseInstruction, and parseOperand.


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