CmCgProgram.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org/
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #include "CmCgProgram.h"
  25. #include "CmGpuProgramManager.h"
  26. #include "CmHighLevelGpuProgramManager.h"
  27. #include "CmDebug.h"
  28. #include "CmException.h"
  29. #include "CmCgProgramRTTI.h"
  30. namespace CamelotEngine {
  31. void checkForCgError(const String& ogreMethod, const String& errorTextPrefix, CGcontext context)
  32. {
  33. CGerror error = cgGetError();
  34. if (error != CG_NO_ERROR)
  35. {
  36. String msg = errorTextPrefix + cgGetErrorString(error);
  37. if (error == CG_COMPILER_ERROR)
  38. {
  39. // Get listing with full compile errors
  40. msg = msg + "\n" + cgGetLastListing(context);
  41. }
  42. CM_EXCEPT(InternalErrorException, msg);
  43. }
  44. }
  45. //-----------------------------------------------------------------------
  46. void CgProgram::selectProfile(void)
  47. {
  48. mSelectedProfile.clear();
  49. mSelectedCgProfile = CG_PROFILE_UNKNOWN;
  50. mSelectedProfile = GpuProgramManager::instance().gpuProgProfileToRSSpecificProfile(mProfile);
  51. GpuProgramManager& gpuMgr = GpuProgramManager::instance();
  52. if (gpuMgr.isSyntaxSupported(mSelectedProfile))
  53. {
  54. mSelectedCgProfile = cgGetProfile(mSelectedProfile.c_str());
  55. // Check for errors
  56. checkForCgError("CgProgram::selectProfile",
  57. "Unable to find CG profile enum for program.", mCgContext);
  58. }
  59. else
  60. mSelectedProfile.clear();
  61. }
  62. //-----------------------------------------------------------------------
  63. void CgProgram::buildArgs(void)
  64. {
  65. vector<String>::type args;
  66. if (!mCompileArgs.empty())
  67. args = StringUtil::split(mCompileArgs);
  68. vector<String>::type::const_iterator i;
  69. if (mSelectedCgProfile == CG_PROFILE_VS_1_1)
  70. {
  71. // Need the 'dcls' argument whenever we use this profile
  72. // otherwise compilation of the assembler will fail
  73. bool dclsFound = false;
  74. for (i = args.begin(); i != args.end(); ++i)
  75. {
  76. if (*i == "dcls")
  77. {
  78. dclsFound = true;
  79. break;
  80. }
  81. }
  82. if (!dclsFound)
  83. {
  84. args.push_back("-profileopts");
  85. args.push_back("dcls");
  86. }
  87. }
  88. // Now split args into that god-awful char** that Cg insists on
  89. freeCgArgs();
  90. mCgArguments = (char**)malloc(sizeof(char*) * (args.size() + 1));
  91. int index = 0;
  92. for (i = args.begin(); i != args.end(); ++i, ++index)
  93. {
  94. mCgArguments[index] = (char*)malloc(sizeof(char) * (i->length() + 1));
  95. strcpy(mCgArguments[index], i->c_str());
  96. }
  97. // Null terminate list
  98. mCgArguments[index] = 0;
  99. }
  100. //-----------------------------------------------------------------------
  101. void CgProgram::freeCgArgs(void)
  102. {
  103. if (mCgArguments)
  104. {
  105. size_t index = 0;
  106. char* current = mCgArguments[index];
  107. while (current)
  108. {
  109. free(current);
  110. mCgArguments[index] = 0;
  111. current = mCgArguments[++index];
  112. }
  113. free(mCgArguments);
  114. mCgArguments = 0;
  115. }
  116. }
  117. //-----------------------------------------------------------------------
  118. void CgProgram::loadFromSource(void)
  119. {
  120. // Create Cg Program
  121. selectProfile();
  122. if (mSelectedCgProfile == CG_PROFILE_UNKNOWN)
  123. {
  124. gDebug().log("Attempted to load Cg program but no supported "
  125. "profile was found.", "RenderSystem");
  126. return;
  127. }
  128. buildArgs();
  129. // TODO PORT - This doesn't load includes
  130. // deal with includes
  131. String sourceToUse = mSource;
  132. //String sourceToUse = resolveCgIncludes(mSource, this, mFilename);
  133. mCgProgram = cgCreateProgram(mCgContext, CG_SOURCE, sourceToUse.c_str(),
  134. mSelectedCgProfile, mEntryPoint.c_str(), const_cast<const char**>(mCgArguments));
  135. // Test
  136. //LogManager::getSingleton().logMessage(cgGetProgramString(mCgProgram, CG_COMPILED_PROGRAM));
  137. // Check for errors
  138. checkForCgError("CgProgram::loadFromSource",
  139. "Unable to compile Cg program", mCgContext);
  140. }
  141. //-----------------------------------------------------------------------
  142. void CgProgram::createLowLevelImpl(void)
  143. {
  144. // ignore any previous error
  145. if (mSelectedCgProfile != CG_PROFILE_UNKNOWN && !mCompileError)
  146. {
  147. if (mSelectedCgProfile == CG_PROFILE_VS_4_0 || mSelectedCgProfile == CG_PROFILE_PS_4_0)
  148. {
  149. String hlslSourceFromCg = cgGetProgramString(mCgProgram, CG_COMPILED_PROGRAM);
  150. // Create a high-level program, give it the same name as us
  151. HighLevelGpuProgramPtr vp =
  152. HighLevelGpuProgramManager::instance().create(
  153. hlslSourceFromCg, "main", "hlsl", mType, mProfile);
  154. vp->initialize();
  155. mAssemblerProgram = vp;
  156. }
  157. else
  158. {
  159. String shaderAssemblerCode = cgGetProgramString(mCgProgram, CG_COMPILED_PROGRAM);
  160. // Create a low-level program, give it the same name as us
  161. mAssemblerProgram =
  162. GpuProgramManager::instance().createProgram(
  163. shaderAssemblerCode,
  164. mType,
  165. mSelectedProfile);
  166. }
  167. // Shader params need to be forwarded to low level implementation
  168. mAssemblerProgram->setAdjacencyInfoRequired(isAdjacencyInfoRequired());
  169. }
  170. }
  171. //-----------------------------------------------------------------------
  172. void CgProgram::unloadHighLevelImpl(void)
  173. {
  174. // Unload Cg Program
  175. // Lowlevel program will get unloaded elsewhere
  176. if (mCgProgram)
  177. {
  178. cgDestroyProgram(mCgProgram);
  179. checkForCgError("CgProgram::unloadImpl",
  180. "Error while unloading Cg program",
  181. mCgContext);
  182. mCgProgram = 0;
  183. }
  184. }
  185. //-----------------------------------------------------------------------
  186. void CgProgram::buildConstantDefinitions() const
  187. {
  188. // Derive parameter names from Cg
  189. createParameterMappingStructures(true);
  190. if (!mCgProgram)
  191. return;
  192. recurseParams(cgGetFirstParameter(mCgProgram, CG_PROGRAM));
  193. recurseParams(cgGetFirstParameter(mCgProgram, CG_GLOBAL));
  194. }
  195. //---------------------------------------------------------------------
  196. void CgProgram::recurseParams(CGparameter parameter, size_t contextArraySize) const
  197. {
  198. while (parameter != 0)
  199. {
  200. // Look for parameters
  201. // Don't bother enumerating unused parameters, especially since they will
  202. // be optimised out and therefore not in the indexed versions
  203. CGtype paramType = cgGetParameterType(parameter);
  204. if (cgGetParameterVariability(parameter) == CG_UNIFORM &&
  205. paramType != CG_SAMPLERRECT &&
  206. cgGetParameterDirection(parameter) != CG_OUT &&
  207. cgIsParameterReferenced(parameter))
  208. {
  209. int arraySize;
  210. switch(paramType)
  211. {
  212. case CG_STRUCT:
  213. recurseParams(cgGetFirstStructParameter(parameter));
  214. break;
  215. case CG_ARRAY:
  216. // Support only 1-dimensional arrays
  217. arraySize = cgGetArraySize(parameter, 0);
  218. recurseParams(cgGetArrayParameter(parameter, 0), (size_t)arraySize);
  219. break;
  220. default:
  221. // Normal path (leaf)
  222. String paramName = cgGetParameterName(parameter);
  223. size_t logicalIndex = cgGetParameterResourceIndex(parameter);
  224. // Get the parameter resource, to calculate the physical index
  225. CGresource res = cgGetParameterResource(parameter);
  226. bool isRegisterCombiner = false;
  227. size_t regCombinerPhysicalIndex = 0;
  228. switch (res)
  229. {
  230. case CG_COMBINER_STAGE_CONST0:
  231. // register combiner, const 0
  232. // the index relates to the texture stage; store this as (stage * 2) + 0
  233. regCombinerPhysicalIndex = logicalIndex * 2;
  234. isRegisterCombiner = true;
  235. break;
  236. case CG_COMBINER_STAGE_CONST1:
  237. // register combiner, const 1
  238. // the index relates to the texture stage; store this as (stage * 2) + 1
  239. regCombinerPhysicalIndex = (logicalIndex * 2) + 1;
  240. isRegisterCombiner = true;
  241. break;
  242. default:
  243. // normal constant
  244. break;
  245. }
  246. // Trim the '[0]' suffix if it exists, we will add our own indexing later
  247. if (StringUtil::endsWith(paramName, "[0]", false))
  248. {
  249. paramName.erase(paramName.size() - 3);
  250. }
  251. GpuConstantDefinition def;
  252. def.arraySize = contextArraySize;
  253. mapTypeAndElementSize(paramType, isRegisterCombiner, def);
  254. if (def.constType == GCT_UNKNOWN)
  255. {
  256. gDebug().log("Problem parsing the following Cg Uniform: '" + paramName + "'", "RenderSystem");
  257. // next uniform
  258. parameter = cgGetNextParameter(parameter);
  259. continue;
  260. }
  261. if (isRegisterCombiner)
  262. {
  263. def.physicalIndex = regCombinerPhysicalIndex;
  264. }
  265. else
  266. {
  267. // base position on existing buffer contents
  268. if(def.isSampler())
  269. {
  270. def.physicalIndex = mSamplerLogicalToPhysical->bufferSize;
  271. }
  272. else
  273. {
  274. if (def.isFloat())
  275. {
  276. def.physicalIndex = mFloatLogicalToPhysical->bufferSize;
  277. }
  278. else
  279. {
  280. def.physicalIndex = mIntLogicalToPhysical->bufferSize;
  281. }
  282. }
  283. }
  284. def.logicalIndex = logicalIndex;
  285. mConstantDefs->map.insert(GpuConstantDefinitionMap::value_type(paramName, def));
  286. // Record logical / physical mapping
  287. if(def.isSampler())
  288. {
  289. CM_LOCK_MUTEX(mSamplerLogicalToPhysical->mutex)
  290. mSamplerLogicalToPhysical->map.insert(
  291. GpuLogicalIndexUseMap::value_type(logicalIndex,
  292. GpuLogicalIndexUse(def.physicalIndex, def.arraySize, GPV_GLOBAL)));
  293. mSamplerLogicalToPhysical->bufferSize += def.arraySize;
  294. mConstantDefs->samplerCount = mSamplerLogicalToPhysical->bufferSize;
  295. }
  296. else
  297. {
  298. if (def.isFloat())
  299. {
  300. CM_LOCK_MUTEX(mFloatLogicalToPhysical->mutex)
  301. mFloatLogicalToPhysical->map.insert(
  302. GpuLogicalIndexUseMap::value_type(logicalIndex,
  303. GpuLogicalIndexUse(def.physicalIndex, def.arraySize * def.elementSize, GPV_GLOBAL)));
  304. mFloatLogicalToPhysical->bufferSize += def.arraySize * def.elementSize;
  305. mConstantDefs->floatBufferSize = mFloatLogicalToPhysical->bufferSize;
  306. }
  307. else
  308. {
  309. CM_LOCK_MUTEX(mIntLogicalToPhysical->mutex)
  310. mIntLogicalToPhysical->map.insert(
  311. GpuLogicalIndexUseMap::value_type(logicalIndex,
  312. GpuLogicalIndexUse(def.physicalIndex, def.arraySize * def.elementSize, GPV_GLOBAL)));
  313. mIntLogicalToPhysical->bufferSize += def.arraySize * def.elementSize;
  314. mConstantDefs->intBufferSize = mIntLogicalToPhysical->bufferSize;
  315. }
  316. }
  317. // Deal with array indexing
  318. mConstantDefs->generateConstantDefinitionArrayEntries(paramName, def);
  319. break;
  320. }
  321. }
  322. // Get next
  323. parameter = cgGetNextParameter(parameter);
  324. }
  325. }
  326. //-----------------------------------------------------------------------
  327. void CgProgram::mapTypeAndElementSize(CGtype cgType, bool isRegisterCombiner,
  328. GpuConstantDefinition& def) const
  329. {
  330. if (isRegisterCombiner)
  331. {
  332. // register combiners are the only single-float entries in our buffer
  333. def.constType = GCT_FLOAT1;
  334. def.elementSize = 1;
  335. }
  336. else
  337. {
  338. switch(cgType)
  339. {
  340. case CG_SAMPLER1D:
  341. def.constType = GCT_SAMPLER1D;
  342. break;
  343. case CG_SAMPLER2D:
  344. def.constType = GCT_SAMPLER2D;
  345. break;
  346. case CG_SAMPLER3D:
  347. def.constType = GCT_SAMPLER3D;
  348. break;
  349. case CG_SAMPLERCUBE:
  350. def.constType = GCT_SAMPLERCUBE;
  351. break;
  352. case CG_FLOAT:
  353. case CG_FLOAT1:
  354. case CG_HALF:
  355. case CG_HALF1:
  356. def.constType = GCT_FLOAT1;
  357. break;
  358. case CG_FLOAT2:
  359. case CG_HALF2:
  360. def.constType = GCT_FLOAT2;
  361. break;
  362. case CG_FLOAT3:
  363. case CG_HALF3:
  364. def.constType = GCT_FLOAT3;
  365. break;
  366. case CG_FLOAT4:
  367. case CG_HALF4:
  368. def.constType = GCT_FLOAT4;
  369. break;
  370. case CG_FLOAT2x2:
  371. case CG_HALF2x2:
  372. def.constType = GCT_MATRIX_2X2;
  373. break;
  374. case CG_FLOAT2x3:
  375. case CG_HALF2x3:
  376. def.constType = GCT_MATRIX_2X3;
  377. break;
  378. case CG_FLOAT2x4:
  379. case CG_HALF2x4:
  380. def.constType = GCT_MATRIX_2X4;
  381. break;
  382. case CG_FLOAT3x2:
  383. case CG_HALF3x2:
  384. def.constType = GCT_MATRIX_3X2;
  385. break;
  386. case CG_FLOAT3x3:
  387. case CG_HALF3x3:
  388. def.constType = GCT_MATRIX_3X3;
  389. break;
  390. case CG_FLOAT3x4:
  391. case CG_HALF3x4:
  392. def.constType = GCT_MATRIX_3X4;
  393. break;
  394. case CG_FLOAT4x2:
  395. case CG_HALF4x2:
  396. def.constType = GCT_MATRIX_4X2;
  397. break;
  398. case CG_FLOAT4x3:
  399. case CG_HALF4x3:
  400. def.constType = GCT_MATRIX_4X3;
  401. break;
  402. case CG_FLOAT4x4:
  403. case CG_HALF4x4:
  404. def.constType = GCT_MATRIX_4X4;
  405. break;
  406. case CG_INT:
  407. case CG_INT1:
  408. def.constType = GCT_INT1;
  409. break;
  410. case CG_INT2:
  411. def.constType = GCT_INT2;
  412. break;
  413. case CG_INT3:
  414. def.constType = GCT_INT3;
  415. break;
  416. case CG_INT4:
  417. def.constType = GCT_INT4;
  418. break;
  419. default:
  420. def.constType = GCT_UNKNOWN;
  421. break;
  422. }
  423. // Cg pads
  424. def.elementSize = GpuConstantDefinition::getElementSize(def.constType, true);
  425. }
  426. }
  427. //-----------------------------------------------------------------------
  428. CgProgram::CgProgram(CGcontext context)
  429. : HighLevelGpuProgram(),
  430. mCgContext(context), mCgProgram(0),
  431. mSelectedCgProfile(CG_PROFILE_UNKNOWN), mCgArguments(0)
  432. {
  433. }
  434. //-----------------------------------------------------------------------
  435. CgProgram::~CgProgram()
  436. {
  437. freeCgArgs();
  438. unloadHighLevel();
  439. }
  440. //-----------------------------------------------------------------------
  441. bool CgProgram::isSupported(void) const
  442. {
  443. if (mCompileError || !isRequiredCapabilitiesSupported())
  444. return false;
  445. String selectedProfile = GpuProgramManager::instance().gpuProgProfileToRSSpecificProfile(mProfile);
  446. if (GpuProgramManager::instance().isSyntaxSupported(selectedProfile))
  447. return true;
  448. return false;
  449. }
  450. //-----------------------------------------------------------------------
  451. void CgProgram::setProfiles(const vector<String>::type& profiles)
  452. {
  453. mProfiles.clear();
  454. vector<String>::type::const_iterator i, iend;
  455. iend = profiles.end();
  456. for (i = profiles.begin(); i != iend; ++i)
  457. {
  458. mProfiles.push_back(*i);
  459. }
  460. }
  461. //-----------------------------------------------------------------------
  462. String CgProgram::resolveCgIncludes(const String& inSource, Resource* resourceBeingLoaded, const String& fileName)
  463. {
  464. String outSource;
  465. // TODO PORT - Includes are not handled ATM
  466. // output will be at least this big
  467. //outSource.reserve(inSource.length());
  468. //size_t startMarker = 0;
  469. //size_t i = inSource.find("#include");
  470. //while (i != String::npos)
  471. //{
  472. // size_t includePos = i;
  473. // size_t afterIncludePos = includePos + 8;
  474. // size_t newLineBefore = inSource.rfind("\n", includePos);
  475. // // check we're not in a comment
  476. // size_t lineCommentIt = inSource.rfind("//", includePos);
  477. // if (lineCommentIt != String::npos)
  478. // {
  479. // if (newLineBefore == String::npos || lineCommentIt > newLineBefore)
  480. // {
  481. // // commented
  482. // i = inSource.find("#include", afterIncludePos);
  483. // continue;
  484. // }
  485. // }
  486. // size_t blockCommentIt = inSource.rfind("/*", includePos);
  487. // if (blockCommentIt != String::npos)
  488. // {
  489. // size_t closeCommentIt = inSource.rfind("*/", includePos);
  490. // if (closeCommentIt == String::npos || closeCommentIt < blockCommentIt)
  491. // {
  492. // // commented
  493. // i = inSource.find("#include", afterIncludePos);
  494. // continue;
  495. // }
  496. // }
  497. // // find following newline (or EOF)
  498. // size_t newLineAfter = inSource.find("\n", afterIncludePos);
  499. // // find include file string container
  500. // String endDelimeter = "\"";
  501. // size_t startIt = inSource.find("\"", afterIncludePos);
  502. // if (startIt == String::npos || startIt > newLineAfter)
  503. // {
  504. // // try <>
  505. // startIt = inSource.find("<", afterIncludePos);
  506. // if (startIt == String::npos || startIt > newLineAfter)
  507. // {
  508. // CM_EXCEPT(InternalErrorException,
  509. // "Badly formed #include directive (expected \" or <) in file "
  510. // + fileName + ": " + inSource.substr(includePos, newLineAfter-includePos));
  511. // }
  512. // else
  513. // {
  514. // endDelimeter = ">";
  515. // }
  516. // }
  517. // size_t endIt = inSource.find(endDelimeter, startIt+1);
  518. // if (endIt == String::npos || endIt <= startIt)
  519. // {
  520. // CM_EXCEPT(InternalErrorException,
  521. // "Badly formed #include directive (expected " + endDelimeter + ") in file "
  522. // + fileName + ": " + inSource.substr(includePos, newLineAfter-includePos));
  523. // }
  524. // // extract filename
  525. // String filename(inSource.substr(startIt+1, endIt-startIt-1));
  526. // // open included file
  527. // DataStreamPtr resource = ResourceGroupManager::getSingleton().
  528. // openResource(filename, resourceBeingLoaded->getGroup(), true, resourceBeingLoaded);
  529. // // replace entire include directive line
  530. // // copy up to just before include
  531. // if (newLineBefore != String::npos && newLineBefore >= startMarker)
  532. // outSource.append(inSource.substr(startMarker, newLineBefore-startMarker+1));
  533. // size_t lineCount = 0;
  534. // size_t lineCountPos = 0;
  535. //
  536. // // Count the line number of #include statement
  537. // lineCountPos = outSource.find('\n');
  538. // while(lineCountPos != String::npos)
  539. // {
  540. // lineCountPos = outSource.find('\n', lineCountPos+1);
  541. // lineCount++;
  542. // }
  543. // // Add #line to the start of the included file to correct the line count
  544. // outSource.append("#line 1 \"" + filename + "\"\n");
  545. // outSource.append(resource->getAsString());
  546. // // Add #line to the end of the included file to correct the line count
  547. // outSource.append("\n#line " + toString(lineCount) +
  548. // "\"" + fileName + "\"\n");
  549. // startMarker = newLineAfter;
  550. // if (startMarker != String::npos)
  551. // i = inSource.find("#include", startMarker);
  552. // else
  553. // i = String::npos;
  554. //}
  555. //// copy any remaining characters
  556. //outSource.append(inSource.substr(startMarker));
  557. return outSource;
  558. }
  559. //-----------------------------------------------------------------------
  560. const String& CgProgram::getLanguage(void) const
  561. {
  562. static const String language = "cg";
  563. return language;
  564. }
  565. /************************************************************************/
  566. /* SERIALIZATION */
  567. /************************************************************************/
  568. RTTITypeBase* CgProgram::getRTTIStatic()
  569. {
  570. return CgProgramRTTI::instance();
  571. }
  572. RTTITypeBase* CgProgram::getRTTI() const
  573. {
  574. return CgProgram::getRTTIStatic();
  575. }
  576. }