diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a03717.html | 1777 |
1 files changed, 1777 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03717.html b/docs/doxygen/nel/a03717.html new file mode 100644 index 00000000..07933653 --- /dev/null +++ b/docs/doxygen/nel/a03717.html @@ -0,0 +1,1777 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: CVPParser class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>CVPParser Class Reference</h1><code>#include <<a class="el" href="a06719.html">vertex_program_parse.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +A vertex program parser. <dl compact><dt><b>Author:</b></dt><dd>Nicolas Vizerie <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06719.html#l00191">191</a> of file <a class="el" href="a06719.html">vertex_program_parse.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::vector< <a class="el" href="a03714.html">CVPInstruction</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserw0">TProgram</a></td></tr> + +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParsera0">parse</a> (const char *<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a03717.html#CVPParserw0">TProgram</a> &result, std::string &errorOutput)</td></tr> + +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParsere0">dump</a> (const <a class="el" href="a03717.html#CVPParserw0">TProgram</a> &prg, std::string &dest)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParsere1">isInputUsed</a> (const <a class="el" href="a03717.html#CVPParserw0">TProgram</a> &prg, <a class="el" href="a03715.html#CVPOperandw2">CVPOperand::EInputRegister</a> input)</td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd0">parseAddressRegister</a> (<a class="el" href="a03715.html">CVPOperand</a> &operand, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd1">parseConstantRegister</a> (<a class="el" href="a03715.html">CVPOperand</a> &operand, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd2">parseInputRegister</a> (<a class="el" href="a03715.html">CVPOperand</a> &operand, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd3">parseInstruction</a> (<a class="el" href="a03714.html">CVPInstruction</a> &instr, std::string &errorOutput, bool &endEncountered)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd4">parseOp2</a> (<a class="el" href="a03714.html">CVPInstruction</a> &instr, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd5">parseOp3</a> (<a class="el" href="a03714.html">CVPInstruction</a> &instr, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd6">parseOp4</a> (<a class="el" href="a03714.html">CVPInstruction</a> &instr, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd7">parseOperand</a> (<a class="el" href="a03715.html">CVPOperand</a> &operand, bool outputOperand, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd8">parseOutputRegister</a> (<a class="el" href="a03715.html">CVPOperand</a> &operand, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd9">parseSwizzle</a> (<a class="el" href="a03718.html">CVPSwizzle</a> &swizzle, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd10">parseVariableRegister</a> (<a class="el" href="a03715.html">CVPOperand</a> &operand, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd11">parseWriteMask</a> (<a class="el" href="a04558.html#a15">uint</a> &mask, std::string &errorOutput)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserd12">skipSpacesAndComments</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserr0">_CurrChar</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserr1">_LineIndex</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserr2">_LineStart</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03717.html#CVPParserr3">_RegisterMask</a> [96]</td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="CVPParserw0" doxytag="CVPParser::TProgram" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::vector<<a class="el" href="a03714.html">CVPInstruction</a>> <a class="el" href="a03717.html#CVPParserw0">CVPParser::TProgram</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06719.html#l00194">194</a> of file <a class="el" href="a06719.html">vertex_program_parse.h</a>. +<p> +Referenced by <a class="el" href="a05656.html#l01148">NL3D::CDriverGL::activeEXTVertexShader()</a>, <a class="el" href="a05656.html#l00079">NL3D::CDriverGL::activeNVVertexProgram()</a>, <a class="el" href="a06718.html#l01110">dump()</a>, <a class="el" href="a06022.html#l00371">NL3D::CMeshVPPerPixelLight::initInstance()</a>, <a class="el" href="a06718.html#l00893">isInputUsed()</a>, <a class="el" href="a06718.html#l00921">parse()</a>, and <a class="el" href="a05656.html#l00372">NL3D::CDriverGL::setupEXTVertexShader()</a>. </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="CVPParsere0" doxytag="CVPParser::dump" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CVPParser::dump </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03717.html#CVPParserw0">TProgram</a> & </td> + <td class="mdname" nowrap> <em>prg</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>dest</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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 +<p> +Definition at line <a class="el" href="a06718.html#l01110">1110</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06718.html#l01091">dumpInstr()</a>, <a class="el" href="a06719.html#l00194">TProgram</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01111 { +01112 dest = <span class="stringliteral">"!!VP1.0 \n"</span>; +01113 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> k = 0; k < prg.size(); ++k) +01114 { +01115 std::string instr; +01116 <a class="code" href="a05295.html#a8">dumpInstr</a>(prg[k], instr); +01117 dest += instr; +01118 } +01119 dest +=<span class="stringliteral">"END"</span>; +01120 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParsere1" doxytag="CVPParser::isInputUsed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::isInputUsed </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03717.html#CVPParserw0">TProgram</a> & </td> + <td class="mdname" nowrap> <em>prg</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03715.html#CVPOperandw2">CVPOperand::EInputRegister</a> </td> + <td class="mdname" nowrap> <em>input</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00893">893</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a06719.html#l00194">TProgram</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05656.html#l00372">NL3D::CDriverGL::setupEXTVertexShader()</a>. +<p> +<div class="fragment"><pre>00894 { +00895 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> k = 0; k < prg.size(); ++k) +00896 { +00897 <a class="code" href="a04558.html#a15">uint</a> numSrc = prg[k].getNumUsedSrc(); +00898 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a05373.html#a2">l</a> = 0; <a class="code" href="a05373.html#a2">l</a> < numSrc; ++<a class="code" href="a05373.html#a2">l</a>) +00899 { +00900 <span class="keyword">const</span> <a class="code" href="a03715.html">CVPOperand</a> &<a class="code" href="a04223.html#a652">src</a> = prg[k].getSrc(l); +00901 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a652">src</a>.Type == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a> && <a class="code" href="a04223.html#a652">src</a>.Value.InputRegisterValue == input) <span class="keywordflow">return</span> <span class="keyword">true</span>; +00902 } +00903 } +00904 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00905 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParsera0" doxytag="CVPParser::parse" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parse </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname" nowrap> <em>src</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03717.html#CVPParserw0">TProgram</a> & </td> + <td class="mdname" nowrap> <em>result</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Parse a vertex program, and convert to proprietary format. It is intended to be use by a driver implementation. <dl compact><dt><b>Warning:</b></dt><dd>: Only syntax is checked. It doesn't check that a register has been initialised before use. </dd></dl> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>src</em> </td><td>The input text of a vertex program, in OpenGL format. </td></tr> + <tr><td valign=top><em>result</em> </td><td>The result program. </td></tr> + <tr><td valign=top><em>errorOuput</em> </td><td>If parsing failed, contains the reason </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if the parsing succeeded</dd></dl> + +<p> +Definition at line <a class="el" href="a06718.html#l00921">921</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00218">_LineIndex</a>, <a class="el" href="a06719.html#l00217">_LineStart</a>, <a class="el" href="a06719.html#l00219">_RegisterMask</a>, <a class="el" href="a06718.html#l00908">getStringUntilCR()</a>, <a class="el" href="a06718.html#l00714">parseInstruction()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, and <a class="el" href="a06719.html#l00194">TProgram</a>. +<p> +Referenced by <a class="el" href="a05656.html#l01148">NL3D::CDriverGL::activeEXTVertexShader()</a>, <a class="el" href="a05656.html#l00079">NL3D::CDriverGL::activeNVVertexProgram()</a>, and <a class="el" href="a06022.html#l00371">NL3D::CMeshVPPerPixelLight::initInstance()</a>. +<p> +<div class="fragment"><pre>00922 { +00923 <span class="keywordflow">if</span> (!<a class="code" href="a04223.html#a652">src</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00924 <span class="comment">//</span> +00925 std::fill(_RegisterMask, _RegisterMask + 96, 0); +00926 +00927 <span class="comment">//</span> +00928 <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> = <a class="code" href="a04223.html#a652">src</a>; +00929 <a class="code" href="a03717.html#CVPParserr2">_LineStart</a> = <a class="code" href="a04223.html#a652">src</a>; +00930 <a class="code" href="a03717.html#CVPParserr1">_LineIndex</a> = 1; +00931 <span class="comment">//</span> +00932 <span class="comment">//skipSpacesAndComments(); // in fact space are not allowed at the start of the vertex program</span> +00933 +00934 <span class="comment">// parse version</span> +00935 <span class="keywordflow">if</span> ( <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[0] != <span class="charliteral">'!'</span> +00936 || <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[1] != <span class="charliteral">'!'</span> +00937 || <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[2] != <span class="charliteral">'V'</span> +00938 || <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[3] != <span class="charliteral">'P'</span> +00939 || <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[4] != <span class="charliteral">'1'</span> +00940 || <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[5] != <span class="charliteral">'.'</span> +00941 || (<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[6] != <span class="charliteral">'0'</span> && <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[6] != <span class="charliteral">'1'</span>)) +00942 { +00943 errorOutput = <span class="stringliteral">"Can't parse version."</span>; +00944 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00945 } +00946 <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> += 7; +00947 +00948 errorOutput.clear(); +00949 <span class="comment">// parse instructions</span> +00950 <span class="keywordtype">bool</span> endEncoutered = <span class="keyword">false</span>; +00951 +00952 std::string errorMess; +00953 <span class="keywordflow">for</span>(;;) +00954 { +00955 <a class="code" href="a03714.html">CVPInstruction</a> instr; +00956 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd3">parseInstruction</a>(instr, errorMess, endEncoutered)) +00957 { +00958 errorOutput = std::string(<span class="stringliteral">"CVPParser::parse : Error encountered at line "</span>) + <a class="code" href="a05378.html#a244">NLMISC::toString</a>(_LineIndex) + std::string(<span class="stringliteral">" : "</span>) + errorMess + std::string(<span class="stringliteral">" Text : "</span>) + <a class="code" href="a05295.html#a4">getStringUntilCR</a>(_LineStart); +00959 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00960 } +00961 <span class="keywordflow">if</span> (endEncoutered) <span class="keywordflow">break</span>; +00962 result.push_back(instr); +00963 } +00964 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00965 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd0" doxytag="CVPParser::parseAddressRegister" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseAddressRegister </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03715.html">CVPOperand</a> & </td> + <td class="mdname" nowrap> <em>operand</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00533">533</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, and <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00142">parseOperand()</a>. +<p> +<div class="fragment"><pre>00534 { +00535 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00536 operand.<a class="code" href="a03715.html#CVPOperando6">Type</a> = <a class="code" href="a03715.html#CVPOperandw3CVPOperandw0">CVPOperand::AddressRegister</a>; +00537 <span class="keywordflow">if</span> (<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[0] != <span class="charliteral">'0'</span> || <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[1] != <span class="charliteral">'.'</span> || <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[2] != <span class="charliteral">'x'</span>) +00538 { +00539 errorOutput = <span class="stringliteral">"Can't parse address register."</span>; +00540 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00541 } +00542 <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> += 3; +00543 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00544 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd1" doxytag="CVPParser::parseConstantRegister" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseConstantRegister </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03715.html">CVPOperand</a> & </td> + <td class="mdname" nowrap> <em>operand</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00442">442</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a06719.html#l00129">CVPOperand::Indexed</a>, <a class="el" href="a06718.html#l00428">parseUInt()</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00142">parseOperand()</a>. +<p> +<div class="fragment"><pre>00443 { +00444 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00445 operand.<a class="code" href="a03715.html#CVPOperando6">Type</a> = <a class="code" href="a03715.html#CVPOperandw3CVPOperandw1">CVPOperand::Constant</a>; +00446 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">'['</span>) +00447 { +00448 errorOutput = <span class="stringliteral">"'[' expected when parsing a constant register."</span>; +00449 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00450 } +00451 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00452 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00453 <a class="code" href="a04558.html#a15">uint</a> &<a class="code" href="a04223.html#a566">index</a> = operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.ConstantValue; +00454 <span class="keywordflow">if</span> (isdigit(*_CurrChar)) +00455 { +00456 <span class="comment">// immediat case : c[0] to c[95]</span> +00457 <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> = <a class="code" href="a05295.html#a3">parseUInt</a>(_CurrChar, index); +00458 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a566">index</a> > 95) +00459 { +00460 errorOutput = <span class="stringliteral">"Constant register index must range from 0 to 95."</span>; +00461 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00462 } +00463 operand.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> = <span class="keyword">false</span>; +00464 } +00465 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> == <span class="charliteral">'A'</span>) +00466 { +00467 <span class="comment">// indexed case : c[A0.x + 0] to c[A0.x + 95]</span> +00468 operand.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> = <span class="keyword">true</span>; +00469 <a class="code" href="a04223.html#a566">index</a> = 0; +00470 <span class="keywordflow">if</span> (<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[1] == <span class="charliteral">'0'</span> +00471 && <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>[2] == <span class="charliteral">'.'</span> +00472 && _CurrChar[3] == <span class="charliteral">'x'</span>) +00473 { +00474 _CurrChar += 4; +00475 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00476 <span class="keywordflow">if</span> (*_CurrChar == <span class="charliteral">'+'</span>) +00477 { +00478 ++ _CurrChar; +00479 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00480 <span class="keywordflow">if</span> (isdigit(*_CurrChar)) +00481 { +00482 _CurrChar = <a class="code" href="a05295.html#a3">parseUInt</a>(_CurrChar, index); +00483 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a566">index</a> > 95) +00484 { +00485 errorOutput = <span class="stringliteral">"Constant register index must range from 0 to 95."</span>; +00486 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00487 } +00488 } +00489 <span class="keywordflow">else</span> +00490 { +00491 errorOutput = <span class="stringliteral">"Can't parse offset for constant register."</span>; +00492 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00493 } +00494 } +00495 } +00496 <span class="keywordflow">else</span> +00497 { +00498 errorOutput = <span class="stringliteral">"Can't parse constant register index."</span>; +00499 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00500 } +00501 } +00502 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00503 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">']'</span>) +00504 { +00505 errorOutput = <span class="stringliteral">"']' expected when parsing an input register."</span>; +00506 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00507 } +00508 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00509 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00510 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd2" doxytag="CVPParser::parseInputRegister" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseInputRegister </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03715.html">CVPOperand</a> & </td> + <td class="mdname" nowrap> <em>operand</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00224">224</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00142">parseOperand()</a>. +<p> +<div class="fragment"><pre>00225 { +00226 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00227 operand.<a class="code" href="a03715.html#CVPOperando6">Type</a> = <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a>; +00228 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">'['</span>) +00229 { +00230 errorOutput = <span class="stringliteral">"'[' expected when parsing an input register."</span>; +00231 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00232 } +00233 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00234 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00235 <span class="keywordflow">if</span> (isdigit(*_CurrChar)) +00236 { +00237 <span class="comment">// The input register is expressed as an index</span> +00238 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a> = *<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> - <span class="charliteral">'0'</span>; +00239 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00240 <span class="keywordflow">if</span> (isdigit(*_CurrChar)) +00241 { +00242 <a class="code" href="a04223.html#a566">index</a> = 10 * <a class="code" href="a04223.html#a566">index</a> + (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> - <span class="charliteral">'0'</span>); +00243 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00244 } +00245 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a566">index</a> > 15) +00246 { +00247 errorOutput = <span class="stringliteral">"Invalid index for input register, must be in [0, 15]."</span>; +00248 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00249 } +00250 operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = (<a class="code" href="a03715.html#CVPOperandw2">CVPOperand::EInputRegister</a>) <a class="code" href="a04223.html#a566">index</a>; +00251 } +00252 <span class="keywordflow">else</span> +00253 { +00254 <span class="comment">// The input register is expressed as a string</span> +00255 <a class="code" href="a04558.html#a11">uint32</a> strValue = 0; +00256 <span class="comment">// read the 4 letters</span> +00257 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> k = 0; k < 4; ++k) +00258 { +00259 <span class="keywordflow">if</span> (!isalnum(*_CurrChar)) +00260 { +00261 errorOutput = <span class="stringliteral">"Can't parse index for input register."</span>; +00262 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00263 } +00264 strValue |= ((<a class="code" href="a04558.html#a11">uint32</a>) *<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>) << (8 * (3 - k)); +00265 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00266 } +00267 <span class="keywordflow">switch</span> (strValue) +00268 { +00269 <span class="keywordflow">case</span> 'OPOS': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = <a class="code" href="a03715.html#CVPOperandw2CVPOperandw11">CVPOperand::IPosition</a>; <span class="keywordflow">break</span>; +00270 <span class="keywordflow">case</span> 'WGHT': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = <a class="code" href="a03715.html#CVPOperandw2CVPOperandw23">CVPOperand::IWeight</a>; <span class="keywordflow">break</span>; +00271 <span class="keywordflow">case</span> 'NRML': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = <a class="code" href="a03715.html#CVPOperandw2CVPOperandw7">CVPOperand::INormal</a>; <span class="keywordflow">break</span>; +00272 <span class="keywordflow">case</span> 'COL0': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = <a class="code" href="a03715.html#CVPOperandw2CVPOperandw12">CVPOperand::IPrimaryColor</a>; <span class="keywordflow">break</span>; +00273 <span class="keywordflow">case</span> 'COL1': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = <a class="code" href="a03715.html#CVPOperandw2CVPOperandw13">CVPOperand::ISecondaryColor</a>; <span class="keywordflow">break</span>; +00274 <span class="keywordflow">case</span> 'FOGC': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = <a class="code" href="a03715.html#CVPOperandw2CVPOperandw6">CVPOperand::IFogCoord</a>; <span class="keywordflow">break</span>; +00275 <span class="comment">// texture argument</span> +00276 <span class="keywordflow">case</span> 'TEX0': +00277 <span class="keywordflow">case</span> 'TEX1': +00278 <span class="keywordflow">case</span> 'TEX2': +00279 <span class="keywordflow">case</span> 'TEX3': +00280 <span class="keywordflow">case</span> 'TEX4': +00281 <span class="keywordflow">case</span> 'TEX5': +00282 <span class="keywordflow">case</span> 'TEX6': +00283 <span class="keywordflow">case</span> 'TEX7': +00284 operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue = (<a class="code" href="a03715.html#CVPOperandw2">CVPOperand::EInputRegister</a>) (<a class="code" href="a03715.html#CVPOperandw2CVPOperandw14">CVPOperand::ITex0</a> + strValue & 0xff - <span class="charliteral">'0'</span>); +00285 <span class="keywordflow">break</span>; +00286 <span class="keywordflow">default</span>: +00287 errorOutput = <span class="stringliteral">"Can't parse index for input register."</span>; +00288 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00289 } +00290 } +00291 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00292 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">']'</span>) +00293 { +00294 errorOutput = <span class="stringliteral">"']' expected when parsing an input register."</span>; +00295 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00296 } +00297 ++ <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00298 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00299 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd3" doxytag="CVPParser::parseInstruction" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseInstruction </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03714.html">CVPInstruction</a> & </td> + <td class="mdname" nowrap> <em>instr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool & </td> + <td class="mdname" nowrap> <em>endEncountered</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00714">714</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00219">_RegisterMask</a>, <a class="el" href="a06719.html#l00164">CVPInstruction::Dest</a>, <a class="el" href="a06756.html#l00068">END</a>, <a class="el" href="a06719.html#l00040">CVPSwizzle::isScalar()</a>, <a class="el" href="a03714.html#CVPInstructionw5CVPInstructionw8">CVPInstruction::LOG</a>, <a class="el" href="a06756.html#l00100">LOG</a>, <a class="el" href="a06719.html#l00163">CVPInstruction::Opcode</a>, <a class="el" href="a06718.html#l00547">parseOp2()</a>, <a class="el" href="a06718.html#l00579">parseOp3()</a>, <a class="el" href="a06718.html#l00632">parseOp4()</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00165">CVPInstruction::Src1</a>, <a class="el" href="a06719.html#l00136">CVPOperand::Swizzle</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>, and <a class="el" href="a06719.html#l00132">CVPOperand::WriteMask</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00921">parse()</a>. +<p> +<div class="fragment"><pre>00715 { +00716 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00717 endEncountered = <span class="keyword">false</span>; +00718 <a class="code" href="a04558.html#a11">uint32</a> instrStr = 0; +00719 <a class="code" href="a04558.html#a15">uint</a> k; +00720 <span class="keywordflow">for</span>(k = 0; k < 4; ++k) +00721 { +00722 <span class="keywordflow">if</span> (!isalnum(*_CurrChar)) +00723 { +00724 <span class="keywordflow">if</span> (k < 3) <span class="comment">// at least 3 letter in an instruction</span> +00725 { +00726 errorOutput = <span class="stringliteral">"Syntax error : can't read opcode."</span>; +00727 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00728 } +00729 <span class="keywordflow">else</span> <span class="keywordflow">break</span>; +00730 } +00731 instrStr |= ((<a class="code" href="a04558.html#a15">uint</a>) *<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>) << (8 * (3 - k)); +00732 ++ <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00733 } +00734 <span class="keywordflow">if</span> (k != 4) +00735 { +00736 instrStr |= (<a class="code" href="a04558.html#a11">uint32</a>) <span class="charliteral">' '</span>; +00737 } +00738 <span class="keywordflow">switch</span> (instrStr) +00739 { +00740 <span class="keywordflow">case</span> 'ARL ': +00741 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw1">CVPInstruction::ARL</a>; +00742 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00743 <span class="keywordflow">if</span> (!instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando5">Swizzle</a>.<a class="code" href="a03718.html#CVPSwizzlea1">isScalar</a>()) +00744 { +00745 errorOutput = <span class="stringliteral">"ARL need a scalar src value."</span>; +00746 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00747 } +00748 <span class="keywordflow">break</span>; +00749 <span class="keywordflow">case</span> 'RSQ ': +00750 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw16">CVPInstruction::RSQ</a>; +00751 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00752 <span class="keywordflow">if</span> (!instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando5">Swizzle</a>.<a class="code" href="a03718.html#CVPSwizzlea1">isScalar</a>()) +00753 { +00754 errorOutput = <span class="stringliteral">"RSQ need a scalar src value."</span>; +00755 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00756 } +00757 <span class="keywordflow">break</span>; +00758 <span class="keywordflow">case</span> 'EXP ': +00759 <span class="keywordflow">case</span> 'EXPP': +00760 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw6">CVPInstruction::EXPP</a>; +00761 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00762 <span class="keywordflow">if</span> (!instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando5">Swizzle</a>.<a class="code" href="a03718.html#CVPSwizzlea1">isScalar</a>()) +00763 { +00764 errorOutput = <span class="stringliteral">"EXP need a scalar src value."</span>; +00765 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00766 } +00767 <span class="comment">/*</span> +00768 <span class="comment"> if (instr.Src1.Swizzle.Comp[0] != CVPSwizzle.W)</span> +00769 <span class="comment"> {</span> +00770 <span class="comment"> errorOutput = "EXPP input scalar must be w";</span> +00771 <span class="comment"> return false;</span> +00772 <span class="comment"> }*/</span> +00773 <span class="keywordflow">break</span>; +00774 <span class="keywordflow">case</span> '<a class="code" href="a05333.html#a92">LOG</a> ': +00775 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw8">CVPInstruction::LOG</a>; +00776 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00777 <span class="keywordflow">if</span> (!instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando5">Swizzle</a>.<a class="code" href="a03718.html#CVPSwizzlea1">isScalar</a>()) +00778 { +00779 errorOutput = <span class="stringliteral">"LOG need a scalar src value."</span>; +00780 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00781 } +00782 <span class="comment">/*</span> +00783 <span class="comment"> if (instr.Src1.Swizzle.Comp[0] != CVPSwizzle.W)</span> +00784 <span class="comment"> {</span> +00785 <span class="comment"> errorOutput = "LOG input scalar must be w";</span> +00786 <span class="comment"> return false;</span> +00787 <span class="comment"> }</span> +00788 <span class="comment"> */</span> +00789 <span class="keywordflow">break</span>; +00790 <span class="keywordflow">case</span> 'RCP ': +00791 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw15">CVPInstruction::RCP</a>; +00792 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00793 <span class="keywordflow">if</span> (!instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando5">Swizzle</a>.<a class="code" href="a03718.html#CVPSwizzlea1">isScalar</a>()) +00794 { +00795 errorOutput = <span class="stringliteral">"RCP need a scalar src value."</span>; +00796 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00797 } +00798 <span class="keywordflow">break</span>; +00800 <span class="keywordflow">case</span> 'MOV ': +00801 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw12">CVPInstruction::MOV</a>; +00802 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00803 +00804 <span class="keywordflow">break</span>; +00805 <span class="keywordflow">case</span> 'LIT ': +00806 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw7">CVPInstruction::LIT</a>; +00807 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00808 <span class="keywordflow">break</span>; +00810 <span class="keywordflow">case</span> 'MAD ': +00811 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw9">CVPInstruction::MAD</a>; +00812 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd6">parseOp4</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00813 <span class="keywordflow">break</span>; +00815 <span class="keywordflow">case</span> 'ADD ': +00816 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw0">CVPInstruction::ADD</a>; +00817 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00818 <span class="keywordflow">break</span>; +00820 <span class="keywordflow">case</span> 'MUL ': +00821 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw13">CVPInstruction::MUL</a>; +00822 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00823 <span class="keywordflow">break</span>; +00824 <span class="keywordflow">case</span> 'DP3 ': +00825 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw2">CVPInstruction::DP3</a>; +00826 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00827 <span class="keywordflow">break</span>; +00828 <span class="keywordflow">case</span> 'DP4 ': +00829 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw3">CVPInstruction::DP4</a>; +00830 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00831 <span class="keywordflow">break</span>; +00832 <span class="keywordflow">case</span> 'DST ': +00833 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw4">CVPInstruction::DST</a>; +00834 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00835 <span class="keywordflow">break</span>; +00836 <span class="keywordflow">case</span> 'MIN ': +00837 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw11">CVPInstruction::MIN</a>; +00838 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00839 <span class="keywordflow">break</span>; +00840 <span class="keywordflow">case</span> 'MAX ': +00841 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw10">CVPInstruction::MAX</a>; +00842 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00843 <span class="keywordflow">break</span>; +00844 <span class="keywordflow">case</span> 'SLT ': +00845 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw18">CVPInstruction::SLT</a>; +00846 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00847 <span class="keywordflow">break</span>; +00848 <span class="keywordflow">case</span> 'SGE ': +00849 instr.<a class="code" href="a03714.html#CVPInstructiono1">Opcode</a> = <a class="code" href="a03714.html#CVPInstructionw5CVPInstructionw17">CVPInstruction::SGE</a>; +00850 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00851 <span class="keywordflow">break</span>; +00853 <span class="keywordflow">case</span> '<a class="code" href="a05333.html#a60">END</a> ': +00854 endEncountered = <span class="keyword">true</span>; +00855 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00856 <span class="keywordflow">break</span>; +00857 <span class="keywordflow">default</span>: +00858 errorOutput = <span class="stringliteral">"Syntax error : unknow opcode."</span>; +00859 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00860 <span class="keywordflow">break</span>; +00861 } +00862 +00863 +00864 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono0">Dest</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw42">CVPOperand::Variable</a>) +00865 { +00866 <a class="code" href="a03717.html#CVPParserr3">_RegisterMask</a>[instr.<a class="code" href="a03714.html#CVPInstructiono0">Dest</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.VariableValue] |= instr.<a class="code" href="a03714.html#CVPInstructiono0">Dest</a>.<a class="code" href="a03715.html#CVPOperando9">WriteMask</a>; +00867 } +00868 +00869 <span class="comment">// it is not allowed to write to an adress register except for ARL</span> +00870 <span class="keywordflow">if</span> (instrStr != 'ARL ') +00871 { +00872 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono0">Dest</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw0">CVPOperand::AddressRegister</a>) +00873 { +00874 errorOutput = <span class="stringliteral">"Can't write to address register."</span>; +00875 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00876 } +00877 } +00878 +00879 <span class="comment">// parse semi-colon</span> +00880 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00881 <span class="comment">//</span> +00882 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">';'</span>) +00883 { +00884 errorOutput = <span class="stringliteral">"';' expected."</span>; +00885 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00886 } +00887 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00888 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00889 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd4" doxytag="CVPParser::parseOp2" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseOp2 </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03714.html">CVPInstruction</a> & </td> + <td class="mdname" nowrap> <em>instr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00547">547</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00164">CVPInstruction::Dest</a>, <a class="el" href="a06718.html#l00142">parseOperand()</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00165">CVPInstruction::Src1</a>, and <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00714">parseInstruction()</a>, and <a class="el" href="a06718.html#l00579">parseOp3()</a>. +<p> +<div class="fragment"><pre>00548 { +00549 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00550 <span class="comment">// parse ouput</span> +00551 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd7">parseOperand</a>(instr.<a class="code" href="a03714.html#CVPInstructiono0">Dest</a>, <span class="keyword">true</span>, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00552 <span class="comment">// Can't write in input or consant register</span> +00553 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono0">Dest</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw1">CVPOperand::Constant</a> || instr.<a class="code" href="a03714.html#CVPInstructiono0">Dest</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a>) +00554 { +00555 errorOutput = <span class="stringliteral">"Can't write to a constant or input register"</span>; +00556 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00557 } +00558 <span class="comment">//</span> +00559 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00560 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">','</span>) +00561 { +00562 errorOutput = <span class="stringliteral">"',' expected."</span>; +00563 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00564 } +00565 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00566 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00567 <span class="comment">// parse src1</span> +00568 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd7">parseOperand</a>(instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>, <span class="keyword">false</span>, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00569 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw0">CVPOperand::AddressRegister</a> +00570 || instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw40">CVPOperand::OutputRegister</a>) +00571 { +00572 errorOutput = <span class="stringliteral">"Src1 must be constant, variable, or input register."</span>; +00573 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00574 } +00575 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00576 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd5" doxytag="CVPParser::parseOp3" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseOp3 </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03714.html">CVPInstruction</a> & </td> + <td class="mdname" nowrap> <em>instr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00579">579</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00129">CVPOperand::Indexed</a>, <a class="el" href="a06718.html#l00547">parseOp2()</a>, <a class="el" href="a06718.html#l00142">parseOperand()</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00165">CVPInstruction::Src1</a>, <a class="el" href="a06719.html#l00166">CVPInstruction::Src2</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, and <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00714">parseInstruction()</a>, and <a class="el" href="a06718.html#l00632">parseOp4()</a>. +<p> +<div class="fragment"><pre>00580 { +00581 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd4">parseOp2</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00582 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00583 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">','</span>) +00584 { +00585 errorOutput = <span class="stringliteral">"',' expected."</span>; +00586 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00587 } +00588 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00589 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00590 <span class="comment">// parse src2</span> +00591 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd7">parseOperand</a>(instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>, <span class="keyword">false</span>, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00592 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw0">CVPOperand::AddressRegister</a> +00593 || instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw40">CVPOperand::OutputRegister</a>) +00594 { +00595 errorOutput = <span class="stringliteral">"Src2 must be constant, variable, or input register."</span>; +00596 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00597 } +00598 <span class="comment">// make sure we do not have 2 =/= contant register as src (or in put register)</span> +00599 +00600 <span class="comment">// 2 constant registers ?</span> +00601 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw1">CVPOperand::Constant</a> +00602 && instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw1">CVPOperand::Constant</a>) +00603 { +00604 <span class="comment">// the index must be the same</span> +00605 <span class="keywordflow">if</span> (! +00606 ( +00607 instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> == instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> +00608 && instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.ConstantValue == instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.ConstantValue +00609 ) +00610 ) +00611 { +00612 errorOutput = <span class="stringliteral">"Can't read 2 different constant registers in a single instruction."</span>; +00613 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00614 } +00615 } +00616 +00617 <span class="comment">// 2 input registers ?</span> +00618 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a> +00619 && instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a>) +00620 { +00621 <span class="comment">// the index must be the same</span> +00622 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue != instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue) +00623 { +00624 errorOutput = <span class="stringliteral">"Can't read 2 different input registers in a single instruction."</span>; +00625 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00626 } +00627 } +00628 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00629 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd6" doxytag="CVPParser::parseOp4" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseOp4 </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03714.html">CVPInstruction</a> & </td> + <td class="mdname" nowrap> <em>instr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00632">632</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00129">CVPOperand::Indexed</a>, <a class="el" href="a06718.html#l00579">parseOp3()</a>, <a class="el" href="a06718.html#l00142">parseOperand()</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00165">CVPInstruction::Src1</a>, <a class="el" href="a06719.html#l00166">CVPInstruction::Src2</a>, <a class="el" href="a06719.html#l00167">CVPInstruction::Src3</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, and <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00714">parseInstruction()</a>. +<p> +<div class="fragment"><pre>00633 { +00634 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd5">parseOp3</a>(instr, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00635 <span class="comment">// parse src 3</span> +00636 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00637 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">','</span>) +00638 { +00639 errorOutput = <span class="stringliteral">"',' expected."</span>; +00640 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00641 } +00642 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00643 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00644 <span class="comment">// parse src4</span> +00645 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd7">parseOperand</a>(instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>, <span class="keyword">false</span>, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00646 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw0">CVPOperand::AddressRegister</a> +00647 || instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw40">CVPOperand::OutputRegister</a>) +00648 { +00649 errorOutput = <span class="stringliteral">"Src3 must be constant, variable, or input register."</span>; +00650 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00651 } +00652 +00654 <span class="comment">// check for different contant / input registers //</span> +00656 <span class="comment"></span> +00657 <span class="comment">// Duplicated constant register</span> +00658 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw1">CVPOperand::Constant</a>) +00659 { +00660 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw1">CVPOperand::Constant</a>) +00661 { +00662 <span class="keywordflow">if</span> (! +00663 ( +00664 instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> == instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> +00665 && instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.ConstantValue == instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.ConstantValue +00666 ) +00667 ) +00668 { +00669 errorOutput = <span class="stringliteral">"Can't read 2 different constant registers in a single instruction."</span>; +00670 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00671 } +00672 } +00673 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw1">CVPOperand::Constant</a>) +00674 { +00675 <span class="keywordflow">if</span> (! +00676 ( +00677 instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> == instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando1">Indexed</a> +00678 && instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.ConstantValue == instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.ConstantValue +00679 ) +00680 ) +00681 { +00682 errorOutput = <span class="stringliteral">"Can't read 2 different constant registers in a single instruction."</span>; +00683 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00684 } +00685 } +00686 } +00687 +00688 <span class="comment">// Duplicated input register</span> +00689 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a>) +00690 { +00691 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a>) +00692 { +00693 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono2">Src1</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue != instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue) +00694 { +00695 errorOutput = <span class="stringliteral">"Can't read 2 different input registers in a single instruction."</span>; +00696 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00697 } +00698 } +00699 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw8">CVPOperand::InputRegister</a>) +00700 { +00701 <span class="keywordflow">if</span> (instr.<a class="code" href="a03714.html#CVPInstructiono3">Src2</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue != instr.<a class="code" href="a03714.html#CVPInstructiono4">Src3</a>.<a class="code" href="a03715.html#CVPOperando7">Value</a>.InputRegisterValue) +00702 { +00703 errorOutput = <span class="stringliteral">"Can't read 2 different input registers in a single instruction."</span>; +00704 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00705 } +00706 } +00707 } +00708 +00709 +00710 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00711 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd7" doxytag="CVPParser::parseOperand" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseOperand </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03715.html">CVPOperand</a> & </td> + <td class="mdname" nowrap> <em>operand</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>outputOperand</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00142">142</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00219">_RegisterMask</a>, <a class="el" href="a06719.html#l00038">CVPSwizzle::Comp</a>, <a class="el" href="a06719.html#l00135">CVPOperand::Negate</a>, <a class="el" href="a06718.html#l00533">parseAddressRegister()</a>, <a class="el" href="a06718.html#l00442">parseConstantRegister()</a>, <a class="el" href="a06718.html#l00224">parseInputRegister()</a>, <a class="el" href="a06718.html#l00370">parseOutputRegister()</a>, <a class="el" href="a06718.html#l00315">parseSwizzle()</a>, <a class="el" href="a06718.html#l00513">parseVariableRegister()</a>, <a class="el" href="a06718.html#l00031">parseWriteMask()</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00136">CVPOperand::Swizzle</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>, and <a class="el" href="a06719.html#l00132">CVPOperand::WriteMask</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00547">parseOp2()</a>, <a class="el" href="a06718.html#l00579">parseOp3()</a>, and <a class="el" href="a06718.html#l00632">parseOp4()</a>. +<p> +<div class="fragment"><pre>00143 { +00144 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00145 <span class="keywordtype">bool</span> result; +00146 <span class="keywordflow">if</span> (outputOperand) +00147 { +00148 operand.<a class="code" href="a03715.html#CVPOperando3">Negate</a> = <span class="keyword">false</span>; +00149 <span class="keywordflow">switch</span>(*_CurrChar) +00150 { +00151 <span class="keywordflow">case</span> <span class="charliteral">'o'</span>: result = <a class="code" href="a03717.html#CVPParserd8">parseOutputRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00152 <span class="keywordflow">case</span> <span class="charliteral">'R'</span>: +00153 result = <a class="code" href="a03717.html#CVPParserd10">parseVariableRegister</a>(operand, errorOutput); +00154 <span class="keywordflow">break</span>; +00155 <span class="keywordflow">case</span> <span class="charliteral">'A'</span>: result = <a class="code" href="a03717.html#CVPParserd0">parseAddressRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00156 <span class="keywordflow">case</span> <span class="charliteral">'-'</span>: +00157 errorOutput = <span class="stringliteral">"Negation not allowed on ouput register."</span>; +00158 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00159 <span class="keywordflow">default</span>: +00160 errorOutput = <span class="stringliteral">"Output, Address, or Temporary register expected as an output operand."</span>; +00161 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00162 } +00163 <span class="keywordflow">if</span> (!result) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00164 +00165 <span class="comment">// parse the write mask</span> +00166 <span class="keywordflow">return</span> <a class="code" href="a03717.html#CVPParserd11">parseWriteMask</a>(operand.<a class="code" href="a03715.html#CVPOperando9">WriteMask</a>, errorOutput); +00167 } +00168 <span class="keywordflow">else</span> +00169 { +00170 operand.<a class="code" href="a03715.html#CVPOperando3">Negate</a> = <span class="keyword">false</span>; +00171 <span class="keywordflow">switch</span>(*_CurrChar) +00172 { +00173 <span class="keywordflow">case</span> <span class="charliteral">'v'</span>: result = <a class="code" href="a03717.html#CVPParserd2">parseInputRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00174 <span class="keywordflow">case</span> <span class="charliteral">'R'</span>: result = <a class="code" href="a03717.html#CVPParserd10">parseVariableRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00175 <span class="keywordflow">case</span> <span class="charliteral">'c'</span>: result = <a class="code" href="a03717.html#CVPParserd1">parseConstantRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00176 <span class="keywordflow">case</span> <span class="charliteral">'a'</span>: result = <a class="code" href="a03717.html#CVPParserd0">parseAddressRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00177 <span class="keywordflow">case</span> <span class="charliteral">'-'</span>: +00178 { +00179 operand.<a class="code" href="a03715.html#CVPOperando3">Negate</a> = <span class="keyword">true</span>; +00180 <span class="comment">// negation</span> +00181 ++ <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00182 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00183 <span class="keywordflow">switch</span>(*_CurrChar) +00184 { +00185 <span class="keywordflow">case</span> <span class="charliteral">'v'</span>: result = <a class="code" href="a03717.html#CVPParserd2">parseInputRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00186 <span class="keywordflow">case</span> <span class="charliteral">'R'</span>: result = <a class="code" href="a03717.html#CVPParserd10">parseVariableRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00187 <span class="keywordflow">case</span> <span class="charliteral">'c'</span>: result = <a class="code" href="a03717.html#CVPParserd1">parseConstantRegister</a>(operand, errorOutput); <span class="keywordflow">break</span>; +00188 <span class="keywordflow">default</span>: +00189 errorOutput = <span class="stringliteral">"Negation must be followed by an input register, a variable register, or a constant."</span>; +00190 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00191 <span class="keywordflow">break</span>; +00192 } +00193 } +00194 <span class="keywordflow">break</span>; +00195 <span class="keywordflow">default</span>: +00196 errorOutput = <span class="stringliteral">"Syntax error."</span>; +00197 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00198 <span class="keywordflow">break</span>; +00199 } +00200 <span class="keywordflow">if</span> (!result) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00201 <span class="keywordflow">if</span> (operand.<a class="code" href="a03715.html#CVPOperando6">Type</a> != <a class="code" href="a03715.html#CVPOperandw3CVPOperandw0">CVPOperand::AddressRegister</a>) +00202 { +00203 <span class="keywordflow">if</span> (!<a class="code" href="a03717.html#CVPParserd9">parseSwizzle</a>(operand.<a class="code" href="a03715.html#CVPOperando5">Swizzle</a>, errorOutput)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00204 <span class="keywordflow">if</span> (operand.<a class="code" href="a03715.html#CVPOperando6">Type</a> == <a class="code" href="a03715.html#CVPOperandw3CVPOperandw42">CVPOperand::Variable</a>) +00205 { +00206 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> k = 0; k < 4; ++k) +00207 { +00208 <span class="keywordflow">if</span> (!(<a class="code" href="a03717.html#CVPParserr3">_RegisterMask</a>[operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.VariableValue] & (1 << operand.<a class="code" href="a03715.html#CVPOperando5">Swizzle</a>.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[k]))) +00209 { +00210 errorOutput = <span class="stringliteral">"Can't read a register component before writing to it."</span>; +00211 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00212 } +00213 } +00214 } +00215 } +00216 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00217 } +00218 +00219 +00220 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd8" doxytag="CVPParser::parseOutputRegister" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseOutputRegister </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03715.html">CVPOperand</a> & </td> + <td class="mdname" nowrap> <em>operand</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00370">370</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00142">parseOperand()</a>. +<p> +<div class="fragment"><pre>00371 { +00372 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00373 operand.<a class="code" href="a03715.html#CVPOperando6">Type</a> = <a class="code" href="a03715.html#CVPOperandw3CVPOperandw40">CVPOperand::OutputRegister</a>; +00374 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">'['</span>) +00375 { +00376 errorOutput = <span class="stringliteral">"'[' expected when parsing an ouput register."</span>; +00377 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00378 } +00379 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00380 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00381 <span class="comment">// The input register is expressed as a string</span> +00382 <a class="code" href="a04558.html#a11">uint32</a> strValue = 0; +00383 <span class="comment">// read the 4 letters</span> +00384 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> k = 0; k < 4; ++k) +00385 { +00386 <span class="keywordflow">if</span> (!isalnum(*_CurrChar)) +00387 { +00388 errorOutput = <span class="stringliteral">"Can't parse index for output register."</span>; +00389 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00390 } +00391 strValue |= ((<a class="code" href="a04558.html#a11">uint32</a>) *<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>) << (8 * (3 - k)); +00392 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00393 } +00394 <span class="comment">// convert to enum</span> +00395 <span class="keywordflow">switch</span>(strValue) +00396 { +00397 <span class="keywordflow">case</span> 'HPOS': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw27">CVPOperand::OHPosition</a>; <span class="keywordflow">break</span>; +00398 <span class="keywordflow">case</span> 'COL0': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw30">CVPOperand::OPrimaryColor</a>; <span class="keywordflow">break</span>; +00399 <span class="keywordflow">case</span> 'COL1': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw31">CVPOperand::OSecondaryColor</a>; <span class="keywordflow">break</span>; +00400 <span class="keywordflow">case</span> 'BFC0': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw24">CVPOperand::OBackFacePrimaryColor</a>; <span class="keywordflow">break</span>; +00401 <span class="keywordflow">case</span> 'BFC1': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw25">CVPOperand::OBackFaceSecondaryColor</a>; <span class="keywordflow">break</span>; +00402 <span class="keywordflow">case</span> 'FOGC': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw26">CVPOperand::OFogCoord</a>; <span class="keywordflow">break</span>; +00403 <span class="keywordflow">case</span> 'PSIZ': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw29">CVPOperand::OPointSize</a>; <span class="keywordflow">break</span>; +00404 <span class="keywordflow">case</span> 'TEX0': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw32">CVPOperand::OTex0</a>; <span class="keywordflow">break</span>; +00405 <span class="keywordflow">case</span> 'TEX1': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw33">CVPOperand::OTex1</a>; <span class="keywordflow">break</span>; +00406 <span class="keywordflow">case</span> 'TEX2': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw34">CVPOperand::OTex2</a>; <span class="keywordflow">break</span>; +00407 <span class="keywordflow">case</span> 'TEX3': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw35">CVPOperand::OTex3</a>; <span class="keywordflow">break</span>; +00408 <span class="keywordflow">case</span> 'TEX4': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw36">CVPOperand::OTex4</a>; <span class="keywordflow">break</span>; +00409 <span class="keywordflow">case</span> 'TEX5': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw37">CVPOperand::OTex5</a>; <span class="keywordflow">break</span>; +00410 <span class="keywordflow">case</span> 'TEX6': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw38">CVPOperand::OTex6</a>; <span class="keywordflow">break</span>; +00411 <span class="keywordflow">case</span> 'TEX7': operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.OutputRegisterValue = <a class="code" href="a03715.html#CVPOperandw4CVPOperandw39">CVPOperand::OTex7</a>; <span class="keywordflow">break</span>; +00412 <span class="keywordflow">default</span>: +00413 errorOutput = <span class="stringliteral">"Can't read index for output register."</span>; +00414 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00415 <span class="keywordflow">break</span>; +00416 } +00417 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00418 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">']'</span>) +00419 { +00420 errorOutput = <span class="stringliteral">"']' expected when parsing an output register."</span>; +00421 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00422 } +00423 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00424 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00425 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd9" doxytag="CVPParser::parseSwizzle" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseSwizzle </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03718.html">CVPSwizzle</a> & </td> + <td class="mdname" nowrap> <em>swizzle</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00315">315</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00038">CVPSwizzle::Comp</a>, <a class="el" href="a06718.html#l00302">letterToSwizzleComp()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00142">parseOperand()</a>. +<p> +<div class="fragment"><pre>00316 { +00317 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">'.'</span>) +00318 { +00319 <span class="comment">// no swizzle</span> +00320 swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[0] = <a class="code" href="a03718.html#CVPSwizzlew0CVPSwizzlew2">CVPSwizzle::X</a>; +00321 swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[1] = <a class="code" href="a03718.html#CVPSwizzlew0CVPSwizzlew3">CVPSwizzle::Y</a>; +00322 swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[2] = <a class="code" href="a03718.html#CVPSwizzlew0CVPSwizzlew4">CVPSwizzle::Z</a>; +00323 swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[3] = <a class="code" href="a03718.html#CVPSwizzlew0CVPSwizzlew1">CVPSwizzle::W</a>; +00324 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00325 } +00326 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00327 <span class="comment">// 4 letters case</span> +00328 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> k = 0; k < 4; ++k) +00329 { +00330 <span class="keywordflow">if</span> (!isalpha(*_CurrChar)) +00331 { +00332 <span class="keywordflow">if</span> (k == 1) <span class="comment">// 1 letter case</span> +00333 { +00334 <span class="keywordflow">switch</span>(*_CurrChar) +00335 { +00336 <span class="keywordflow">case</span> <span class="charliteral">','</span>: +00337 <span class="keywordflow">case</span> <span class="charliteral">';'</span>: +00338 <span class="keywordflow">case</span> <span class="charliteral">' '</span>: +00339 <span class="keywordflow">case</span> <span class="charliteral">'\t'</span>: +00340 <span class="keywordflow">case</span> <span class="charliteral">'\r'</span>: +00341 <span class="keywordflow">case</span> <span class="charliteral">'\n'</span>: +00342 <span class="keywordflow">case</span> <span class="charliteral">'#'</span>: +00343 swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[1] = swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[2] = swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[3] = swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[0]; +00344 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00345 <span class="keywordflow">break</span>; +00346 <span class="keywordflow">default</span>: +00347 errorOutput = <span class="stringliteral">"Can't parse swizzle."</span>; +00348 +00349 } +00350 } +00351 <span class="keywordflow">else</span> +00352 { +00353 errorOutput = <span class="stringliteral">"Invalid swizzle value."</span>; +00354 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00355 } +00356 } +00357 +00358 <span class="keywordflow">if</span> (!<a class="code" href="a05295.html#a2">letterToSwizzleComp</a>(*_CurrChar, swizzle.<a class="code" href="a03718.html#CVPSwizzleo0">Comp</a>[k])) +00359 { +00360 errorOutput = <span class="stringliteral">"Invalid swizzle value."</span>; +00361 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00362 } +00363 ++ <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00364 } +00365 +00366 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00367 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd10" doxytag="CVPParser::parseVariableRegister" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseVariableRegister </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03715.html">CVPOperand</a> & </td> + <td class="mdname" nowrap> <em>operand</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00513">513</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a06718.html#l00428">parseUInt()</a>, <a class="el" href="a06719.html#l00118">CVPOperand::Type</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a03715.html#CVPOperando7">CVPOperand::Value</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00142">parseOperand()</a>. +<p> +<div class="fragment"><pre>00514 { +00515 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00516 operand.<a class="code" href="a03715.html#CVPOperando6">Type</a> = <a class="code" href="a03715.html#CVPOperandw3CVPOperandw42">CVPOperand::Variable</a>; +00517 <span class="keywordflow">if</span> (!isdigit(*_CurrChar)) +00518 { +00519 errorOutput = <span class="stringliteral">"Can't parse variable register."</span>; +00520 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00521 } +00522 <a class="code" href="a04558.html#a15">uint</a> &<a class="code" href="a04223.html#a566">index</a> = operand.<a class="code" href="a03715.html#CVPOperando7">Value</a>.VariableValue; +00523 <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> = <a class="code" href="a05295.html#a3">parseUInt</a>(_CurrChar, index); +00524 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a566">index</a> > 11) +00525 { +00526 errorOutput = <span class="stringliteral">"Variable register index must range from 0 to 11."</span>; +00527 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00528 } +00529 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00530 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd11" doxytag="CVPParser::parseWriteMask" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CVPParser::parseWriteMask </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> & </td> + <td class="mdname" nowrap> <em>mask</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::string & </td> + <td class="mdname" nowrap> <em>errorOutput</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06718.html#l00031">31</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00142">parseOperand()</a>. +<p> +<div class="fragment"><pre>00032 { +00033 <span class="comment">// parse output mask</span> +00034 <span class="keywordflow">if</span> (*<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a> != <span class="charliteral">'.'</span>) +00035 { +00036 <span class="comment">// no output masks</span> +00037 mask = 0xf; <span class="comment">//output 4 coordinates</span> +00038 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00039 } +00040 <span class="keywordflow">else</span> +00041 { +00042 ++ <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00043 mask = 0; +00044 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> k = 0; k < 4; ++k) +00045 { +00046 <a class="code" href="a04558.html#a15">uint</a> maskIndex; +00047 <span class="keywordflow">switch</span>(*_CurrChar) +00048 { +00049 <span class="keywordflow">case</span> <span class="charliteral">'x'</span>: maskIndex = 0; <span class="keywordflow">break</span>; +00050 <span class="keywordflow">case</span> <span class="charliteral">'y'</span>: maskIndex = 1; <span class="keywordflow">break</span>; +00051 <span class="keywordflow">case</span> <span class="charliteral">'z'</span>: maskIndex = 2; <span class="keywordflow">break</span>; +00052 <span class="keywordflow">case</span> <span class="charliteral">'w'</span>: maskIndex = 3; <span class="keywordflow">break</span>; +00053 <span class="keywordflow">default</span>: +00054 <span class="keywordflow">if</span> (k >= 1) <span class="keywordflow">return</span> <span class="keyword">true</span>; +00055 <span class="keywordflow">else</span> +00056 { +00057 errorOutput = <span class="stringliteral">"Can't parse output mask."</span>; +00058 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00059 } +00060 <span class="keywordflow">break</span>; +00061 } +00062 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00063 <span class="keywordflow">if</span> (mask & (1 << maskIndex)) +00064 { +00065 errorOutput = <span class="stringliteral">"Duplicated output mask component."</span>; +00066 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00067 } +00068 mask |= 1 << maskIndex; +00069 } +00070 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00071 } +00072 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="CVPParserd12" doxytag="CVPParser::skipSpacesAndComments" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CVPParser::skipSpacesAndComments </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Skip tabulation and space in a source code +<p> +Definition at line <a class="el" href="a06718.html#l00077">77</a> of file <a class="el" href="a06718.html">vertex_program_parse.cpp</a>. +<p> +References <a class="el" href="a06719.html#l00216">_CurrChar</a>, <a class="el" href="a06719.html#l00218">_LineIndex</a>, and <a class="el" href="a06719.html#l00217">_LineStart</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00442">parseConstantRegister()</a>, <a class="el" href="a06718.html#l00224">parseInputRegister()</a>, <a class="el" href="a06718.html#l00714">parseInstruction()</a>, <a class="el" href="a06718.html#l00547">parseOp2()</a>, <a class="el" href="a06718.html#l00579">parseOp3()</a>, <a class="el" href="a06718.html#l00632">parseOp4()</a>, <a class="el" href="a06718.html#l00142">parseOperand()</a>, and <a class="el" href="a06718.html#l00370">parseOutputRegister()</a>. +<p> +<div class="fragment"><pre>00078 { +00079 <span class="keywordtype">bool</span> stop = <span class="keyword">false</span>; +00080 <span class="keywordflow">do</span> +00081 { +00082 <span class="keywordflow">switch</span>(*_CurrChar) +00083 { +00084 <span class="keywordflow">case</span> <span class="charliteral">'\t'</span>: +00085 <span class="keywordflow">case</span> <span class="charliteral">'\r'</span>: +00086 <span class="keywordflow">case</span> <span class="charliteral">' '</span> : +00087 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00088 <span class="keywordflow">break</span>; +00089 <span class="comment">//</span> +00090 <span class="keywordflow">case</span> <span class="charliteral">'\n'</span>: +00091 ++<a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00092 ++<a class="code" href="a03717.html#CVPParserr1">_LineIndex</a>; +00093 <a class="code" href="a03717.html#CVPParserr2">_LineStart</a> = <a class="code" href="a03717.html#CVPParserr0">_CurrChar</a>; +00094 <span class="keywordflow">break</span>; +00095 <span class="keywordflow">case</span> <span class="charliteral">'#'</span>: <span class="comment">// comment go till end of line</span> +00096 <span class="keywordflow">while</span> (*_CurrChar != <span class="charliteral">'\n'</span> && *_CurrChar != <span class="charliteral">'\0'</span>) ++_CurrChar; +00097 <a class="code" href="a03717.html#CVPParserd12">skipSpacesAndComments</a>(); +00098 <span class="keywordflow">break</span>; +00099 <span class="keywordflow">default</span>: +00100 stop = <span class="keyword">true</span>; +00101 <span class="keywordflow">break</span>; +00102 } +00103 } +00104 <span class="keywordflow">while</span> (!stop); +00105 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="CVPParserr0" doxytag="CVPParser::_CurrChar" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const char* <a class="el" href="a03717.html#CVPParserr0">CVPParser::_CurrChar</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06719.html#l00216">216</a> of file <a class="el" href="a06719.html">vertex_program_parse.h</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00921">parse()</a>, <a class="el" href="a06718.html#l00533">parseAddressRegister()</a>, <a class="el" href="a06718.html#l00442">parseConstantRegister()</a>, <a class="el" href="a06718.html#l00224">parseInputRegister()</a>, <a class="el" href="a06718.html#l00714">parseInstruction()</a>, <a class="el" href="a06718.html#l00547">parseOp2()</a>, <a class="el" href="a06718.html#l00579">parseOp3()</a>, <a class="el" href="a06718.html#l00632">parseOp4()</a>, <a class="el" href="a06718.html#l00142">parseOperand()</a>, <a class="el" href="a06718.html#l00370">parseOutputRegister()</a>, <a class="el" href="a06718.html#l00315">parseSwizzle()</a>, <a class="el" href="a06718.html#l00513">parseVariableRegister()</a>, <a class="el" href="a06718.html#l00031">parseWriteMask()</a>, and <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>. </td> + </tr> +</table> +<a class="anchor" name="CVPParserr1" doxytag="CVPParser::_LineIndex" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03717.html#CVPParserr1">CVPParser::_LineIndex</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06719.html#l00218">218</a> of file <a class="el" href="a06719.html">vertex_program_parse.h</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00921">parse()</a>, and <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>. </td> + </tr> +</table> +<a class="anchor" name="CVPParserr2" doxytag="CVPParser::_LineStart" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const char* <a class="el" href="a03717.html#CVPParserr2">CVPParser::_LineStart</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06719.html#l00217">217</a> of file <a class="el" href="a06719.html">vertex_program_parse.h</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00921">parse()</a>, and <a class="el" href="a06718.html#l00077">skipSpacesAndComments()</a>. </td> + </tr> +</table> +<a class="anchor" name="CVPParserr3" doxytag="CVPParser::_RegisterMask" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03717.html#CVPParserr3">CVPParser::_RegisterMask</a>[96]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06719.html#l00219">219</a> of file <a class="el" href="a06719.html">vertex_program_parse.h</a>. +<p> +Referenced by <a class="el" href="a06718.html#l00921">parse()</a>, <a class="el" href="a06718.html#l00714">parseInstruction()</a>, and <a class="el" href="a06718.html#l00142">parseOperand()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06719.html">vertex_program_parse.h</a><li><a class="el" href="a06718.html">vertex_program_parse.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:43:56 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |