Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

847 lines
24 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "pch_materialsystem.h"
  7. #include "cmatnullrendercontext.h"
  8. #define MATSYS_INTERNAL
  9. #include "cmatrendercontext.h"
  10. #include "itextureinternal.h"
  11. class CMatNullRenderContext : public CMatRenderContextBase
  12. {
  13. public:
  14. CMatNullRenderContext()
  15. : m_WidthBackBuffer( 0 ),
  16. m_HeightBackBuffer( 0 )
  17. {
  18. }
  19. virtual void InitializeFrom( CMatRenderContextBase *pInitialState )
  20. {
  21. CMatRenderContextBase::InitializeFrom( pInitialState );
  22. g_pShaderAPI->GetBackBufferDimensions( m_WidthBackBuffer, m_HeightBackBuffer );
  23. }
  24. void BeginRender()
  25. {
  26. }
  27. void EndRender()
  28. {
  29. }
  30. void Flush(bool)
  31. {
  32. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  33. }
  34. void GetRenderTargetDimensions(int &,int &) const
  35. {
  36. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  37. }
  38. void DepthRange(float,float)
  39. {
  40. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  41. }
  42. void ClearBuffers(bool,bool,bool)
  43. {
  44. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  45. }
  46. void ReadPixels(int,int,int,int,unsigned char *,ImageFormat)
  47. {
  48. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  49. }
  50. void SetAmbientLight(float,float,float)
  51. {
  52. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  53. }
  54. void SetLight(int,const LightDesc_t &)
  55. {
  56. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  57. }
  58. void SetLightingOrigin( Vector vLightingOrigin )
  59. {
  60. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  61. }
  62. void SetAmbientLightCube(Vector4D [])
  63. {
  64. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  65. }
  66. void CopyRenderTargetToTexture(ITexture *)
  67. {
  68. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  69. }
  70. void SetFrameBufferCopyTexture(ITexture *,int)
  71. {
  72. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  73. }
  74. ITexture *GetFrameBufferCopyTexture(int)
  75. {
  76. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  77. return NULL;
  78. }
  79. void GetViewport( int& x, int& y, int& width, int& height ) const
  80. {
  81. // Verify valid top of RT stack
  82. Assert ( m_RenderTargetStack.Count() > 0 );
  83. // Grab the top of stack
  84. const RenderTargetStackElement_t& element = m_RenderTargetStack.Top();
  85. // If either dimension is negative, set to full bounds of current target
  86. if ( (element.m_nViewW < 0) || (element.m_nViewH < 0) )
  87. {
  88. // Viewport origin at target origin
  89. x = y = 0;
  90. // If target is back buffer
  91. if ( element.m_pRenderTargets[0] == NULL )
  92. {
  93. width = m_WidthBackBuffer;
  94. height = m_HeightBackBuffer;
  95. }
  96. else // if target is texture
  97. {
  98. width = element.m_pRenderTargets[0]->GetActualWidth();
  99. height = element.m_pRenderTargets[0]->GetActualHeight();
  100. }
  101. }
  102. else // use the bounds from the stack directly
  103. {
  104. x = element.m_nViewX;
  105. y = element.m_nViewY;
  106. width = element.m_nViewW;
  107. height = element.m_nViewH;
  108. }
  109. }
  110. void CullMode(MaterialCullMode_t)
  111. {
  112. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  113. }
  114. void FogMode(MaterialFogMode_t)
  115. {
  116. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  117. }
  118. void FogStart(float)
  119. {
  120. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  121. }
  122. void FogEnd(float)
  123. {
  124. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  125. }
  126. void SetFogZ(float)
  127. {
  128. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  129. }
  130. MaterialFogMode_t GetFogMode()
  131. {
  132. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  133. return MATERIAL_FOG_NONE;
  134. }
  135. int GetCurrentNumBones( ) const
  136. {
  137. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  138. return 0;
  139. }
  140. void FogColor3f(float,float,float)
  141. {
  142. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  143. }
  144. void FogColor3fv(const float *)
  145. {
  146. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  147. }
  148. void FogColor3ub(unsigned char,unsigned char,unsigned char)
  149. {
  150. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  151. }
  152. void FogColor3ubv(const unsigned char *)
  153. {
  154. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  155. }
  156. void GetFogColor(unsigned char *)
  157. {
  158. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  159. }
  160. void SetNumBoneWeights(int)
  161. {
  162. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  163. }
  164. IMesh *CreateStaticMesh(VertexFormat_t,const char *,IMaterial *)
  165. {
  166. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  167. return NULL;
  168. }
  169. void DestroyStaticMesh(IMesh *)
  170. {
  171. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  172. }
  173. IMesh *GetDynamicMesh(bool,IMesh *,IMesh *,IMaterial *)
  174. {
  175. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  176. return NULL;
  177. }
  178. virtual IMesh* GetDynamicMeshEx( VertexFormat_t, bool, IMesh*, IMesh*, IMaterial * )
  179. {
  180. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  181. return NULL;
  182. }
  183. int SelectionMode(bool)
  184. {
  185. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  186. return 0;
  187. }
  188. void SelectionBuffer(unsigned int *,int)
  189. {
  190. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  191. }
  192. void ClearSelectionNames()
  193. {
  194. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  195. }
  196. void LoadSelectionName(int)
  197. {
  198. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  199. }
  200. void PushSelectionName(int)
  201. {
  202. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  203. }
  204. void PopSelectionName()
  205. {
  206. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  207. }
  208. void ClearColor3ub(unsigned char,unsigned char,unsigned char)
  209. {
  210. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  211. }
  212. void ClearColor4ub(unsigned char,unsigned char,unsigned char,unsigned char)
  213. {
  214. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  215. }
  216. void OverrideDepthEnable(bool,bool)
  217. {
  218. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  219. }
  220. void OverrideColorWriteEnable( bool, bool )
  221. {
  222. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  223. }
  224. void OverrideAlphaWriteEnable( bool, bool )
  225. {
  226. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  227. }
  228. void DrawScreenSpaceQuad(IMaterial *)
  229. {
  230. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  231. }
  232. void SyncToken(const char *)
  233. {
  234. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  235. }
  236. OcclusionQueryObjectHandle_t CreateOcclusionQueryObject()
  237. {
  238. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  239. return NULL;
  240. }
  241. void DestroyOcclusionQueryObject(OcclusionQueryObjectHandle_t)
  242. {
  243. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  244. }
  245. void ResetOcclusionQueryObject( OcclusionQueryObjectHandle_t hOcclusionQuery )
  246. {
  247. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  248. }
  249. void BeginOcclusionQueryDrawing(OcclusionQueryObjectHandle_t)
  250. {
  251. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  252. }
  253. void EndOcclusionQueryDrawing(OcclusionQueryObjectHandle_t)
  254. {
  255. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  256. }
  257. int OcclusionQuery_GetNumPixelsRendered(OcclusionQueryObjectHandle_t)
  258. {
  259. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  260. return 1;
  261. }
  262. void SetFlashlightMode(bool)
  263. {
  264. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  265. }
  266. virtual bool GetFlashlightMode( void ) const
  267. {
  268. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  269. return false;
  270. }
  271. void SetFlashlightState(const FlashlightState_t &,const VMatrix &)
  272. {
  273. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  274. }
  275. void SetScissorRect( const int nLeft, const int nTop, const int nRight, const int nBottom, const bool bEnableScissor )
  276. {
  277. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  278. }
  279. virtual void PushDeformation( DeformationBase_t const *Deformation )
  280. {
  281. }
  282. virtual void PopDeformation( )
  283. {
  284. }
  285. virtual int GetNumActiveDeformations() const
  286. {
  287. return 0;
  288. }
  289. void EnableUserClipTransformOverride(bool)
  290. {
  291. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  292. }
  293. void UserClipTransform(const VMatrix &)
  294. {
  295. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  296. }
  297. IMorph *CreateMorph(MorphFormat_t, const char *pDebugName)
  298. {
  299. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  300. return NULL;
  301. }
  302. void DestroyMorph(IMorph *)
  303. {
  304. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  305. }
  306. void BindMorph(IMorph *)
  307. {
  308. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  309. }
  310. void SetMorphTargetFactors(int,float *,int)
  311. {
  312. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  313. }
  314. void ReadPixelsAndStretch(Rect_t *,Rect_t *,unsigned char *,ImageFormat,int)
  315. {
  316. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  317. }
  318. void GetWindowSize(int &,int &) const
  319. {
  320. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  321. }
  322. void DrawScreenSpaceRectangle(IMaterial *,int,int,int,int,float,float,float,float,int,int,void*,int,int)
  323. {
  324. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  325. }
  326. void LoadBoneMatrix(int,const matrix3x4_t &)
  327. {
  328. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  329. }
  330. void BindLightmapTexture(ITexture *)
  331. {
  332. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  333. }
  334. void CopyRenderTargetToTextureEx(ITexture *,int,Rect_t *,Rect_t *)
  335. {
  336. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  337. }
  338. void CopyTextureToRenderTargetEx(int,ITexture *,Rect_t *,Rect_t *)
  339. {
  340. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  341. }
  342. void SetFloatRenderingParameter(int,float)
  343. {
  344. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  345. }
  346. void SetIntRenderingParameter(int,int)
  347. {
  348. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  349. }
  350. void SetVectorRenderingParameter(int,const Vector &)
  351. {
  352. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  353. }
  354. void SetStencilEnable(bool)
  355. {
  356. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  357. }
  358. void SetStencilFailOperation(StencilOperation_t)
  359. {
  360. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  361. }
  362. void SetStencilZFailOperation(StencilOperation_t)
  363. {
  364. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  365. }
  366. void SetStencilPassOperation(StencilOperation_t)
  367. {
  368. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  369. }
  370. void SetStencilCompareFunction(StencilComparisonFunction_t)
  371. {
  372. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  373. }
  374. void SetStencilReferenceValue(int)
  375. {
  376. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  377. }
  378. void SetStencilTestMask(uint32)
  379. {
  380. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  381. }
  382. void SetStencilWriteMask(uint32)
  383. {
  384. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  385. }
  386. void ClearStencilBufferRectangle(int,int,int,int,int)
  387. {
  388. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  389. }
  390. void PushCustomClipPlane(const float *)
  391. {
  392. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  393. }
  394. void PopCustomClipPlane()
  395. {
  396. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  397. }
  398. void GetMaxToRender(IMesh *,bool,int *,int *)
  399. {
  400. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  401. }
  402. int GetMaxVerticesToRender(IMaterial *)
  403. {
  404. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  405. return 0;
  406. }
  407. int GetMaxIndicesToRender()
  408. {
  409. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  410. return 0;
  411. }
  412. void DisableAllLocalLights()
  413. {
  414. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  415. }
  416. int CompareMaterialCombos(IMaterial *,IMaterial *,int,int)
  417. {
  418. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  419. return 0;
  420. }
  421. IMesh *GetFlexMesh()
  422. {
  423. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  424. return NULL;
  425. }
  426. void SetFlashlightStateEx(const FlashlightState_t &,const VMatrix &,ITexture *)
  427. {
  428. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  429. }
  430. ITexture *GetLocalCubemap()
  431. {
  432. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  433. return NULL;
  434. }
  435. void ClearBuffersObeyStencil(bool,bool)
  436. {
  437. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  438. }
  439. void ClearBuffersObeyStencilEx( bool bClearColor, bool bClearAlpha, bool bClearDepth )
  440. {
  441. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  442. }
  443. void PerformFullScreenStencilOperation( void )
  444. {
  445. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  446. }
  447. bool GetUserClipTransform(VMatrix &)
  448. {
  449. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  450. return true;
  451. }
  452. void GetFogDistances(float *,float *,float *)
  453. {
  454. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  455. }
  456. void BeginPIXEvent(unsigned long,const char *)
  457. {
  458. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  459. }
  460. void EndPIXEvent()
  461. {
  462. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  463. }
  464. void SetPIXMarker(unsigned long,const char *)
  465. {
  466. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  467. }
  468. void BeginBatch(IMesh *)
  469. {
  470. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  471. }
  472. void BindBatch(IMesh *,IMaterial *)
  473. {
  474. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  475. }
  476. void DrawBatch(int,int)
  477. {
  478. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  479. }
  480. void EndBatch()
  481. {
  482. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  483. }
  484. void SetToneMappingScaleLinear(const Vector &)
  485. {
  486. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  487. }
  488. float GetFloatRenderingParameter(int) const
  489. {
  490. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  491. return 0;
  492. }
  493. int GetIntRenderingParameter(int) const
  494. {
  495. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  496. return 0;
  497. }
  498. Vector GetVectorRenderingParameter(int) const
  499. {
  500. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  501. return Vector(0,0,0);
  502. }
  503. void SwapBuffers()
  504. {
  505. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  506. }
  507. void ForceDepthFuncEquals(bool)
  508. {
  509. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  510. }
  511. bool InFlashlightMode() const
  512. {
  513. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  514. return true;
  515. }
  516. void BindStandardTexture(TextureStage_t,StandardTextureId_t)
  517. {
  518. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  519. }
  520. void GetLightmapDimensions(int *,int *)
  521. {
  522. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  523. }
  524. MorphFormat_t GetBoundMorphFormat()
  525. {
  526. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  527. return 0;
  528. }
  529. void DrawClearBufferQuad(unsigned char,unsigned char,unsigned char,unsigned char,bool,bool,bool)
  530. {
  531. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  532. }
  533. bool OnDrawMesh(IMesh *,CPrimList *,int)
  534. {
  535. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  536. return true;
  537. }
  538. bool OnDrawMesh(IMesh *,int,int)
  539. {
  540. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  541. return true;
  542. }
  543. bool OnSetFlexMesh(IMesh *,IMesh *,int)
  544. {
  545. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  546. return true;
  547. }
  548. bool OnSetColorMesh(IMesh *,IMesh *,int)
  549. {
  550. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  551. return true;
  552. }
  553. bool OnSetPrimitiveType(IMesh *,MaterialPrimitiveType_t)
  554. {
  555. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  556. return true;
  557. }
  558. bool OnFlushBufferedPrimitives()
  559. {
  560. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  561. return true;
  562. }
  563. void ForceHardwareSync()
  564. {
  565. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  566. }
  567. void BeginFrame()
  568. {
  569. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  570. }
  571. void EndFrame()
  572. {
  573. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  574. }
  575. void AsyncCreateTextureFromRenderTarget( ITexture* pSrcRt, const char* pDstName, ImageFormat dstFmt, bool bGenMips, int nAdditionalCreationFlags, IAsyncTextureOperationReceiver* pRecipient, void* pExtraArgs ) OVERRIDE
  576. {
  577. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  578. }
  579. virtual void AsyncMap( ITextureInternal* pTexToMap, IAsyncTextureOperationReceiver* pRecipient, void* pExtraArgs ) OVERRIDE
  580. {
  581. }
  582. virtual void AsyncUnmap( ITextureInternal* pTexToUnmap ) OVERRIDE
  583. {
  584. }
  585. virtual void AsyncCopyRenderTargetToStagingTexture( ITexture* pDst, ITexture* pSrc, IAsyncTextureOperationReceiver* pRecipient, void* pExtraArgs ) OVERRIDE
  586. {
  587. }
  588. void SetShadowDepthBiasFactors( float fSlopeScaleDepthBias, float fDepthBias )
  589. {
  590. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  591. }
  592. void BindStandardTexture( Sampler_t, StandardTextureId_t )
  593. {
  594. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  595. }
  596. // ------------ New Vertex/Index Buffer interface ----------------------------
  597. // Do we need support for bForceTempMesh and bSoftwareVertexShader?
  598. // I don't think we use bSoftwareVertexShader anymore. .need to look into bForceTempMesh.
  599. IVertexBuffer *CreateStaticVertexBuffer( VertexFormat_t fmt, int nVertexCount, const char *pBudgetGroup )
  600. {
  601. Assert( 0 );
  602. return NULL;
  603. }
  604. IIndexBuffer *CreateStaticIndexBuffer( MaterialIndexFormat_t fmt, int nIndexCount, const char *pBudgetGroup )
  605. {
  606. Assert( 0 );
  607. return NULL;
  608. }
  609. void DestroyVertexBuffer( IVertexBuffer * )
  610. {
  611. Assert( 0 );
  612. }
  613. void DestroyIndexBuffer( IIndexBuffer * )
  614. {
  615. Assert( 0 );
  616. }
  617. // Do we need to specify the stream here in the case of locking multiple dynamic VBs on different streams?
  618. IVertexBuffer *GetDynamicVertexBuffer( int streamID, VertexFormat_t vertexFormat, bool bBufferedtrue )
  619. {
  620. Assert( 0 );
  621. return NULL;
  622. }
  623. IIndexBuffer *GetDynamicIndexBuffer( MaterialIndexFormat_t fmt, bool bBufferedtrue )
  624. {
  625. Assert( 0 );
  626. return NULL;
  627. }
  628. void BindVertexBuffer( int streamID, IVertexBuffer *pVertexBuffer, int nOffsetInBytes, int nFirstVertex, int nVertexCount, VertexFormat_t fmt, int nRepetitions1 )
  629. {
  630. Assert( 0 );
  631. }
  632. void BindIndexBuffer( IIndexBuffer *pIndexBuffer, int nOffsetInBytes )
  633. {
  634. Assert( 0 );
  635. }
  636. void Draw( MaterialPrimitiveType_t primitiveType, int firstIndex, int numIndices )
  637. {
  638. Assert( 0 );
  639. }
  640. virtual void BeginMorphAccumulation()
  641. {
  642. Assert( 0 );
  643. }
  644. virtual void EndMorphAccumulation()
  645. {
  646. Assert( 0 );
  647. }
  648. virtual void AccumulateMorph( IMorph* pMorph, int nMorphCount, const MorphWeight_t* pWeights )
  649. {
  650. Assert( 0 );
  651. }
  652. virtual bool GetMorphAccumulatorTexCoord( Vector2D *pTexCoord, IMorph *pMorph, int nVertex )
  653. {
  654. Assert(0);
  655. pTexCoord->Init();
  656. return false;
  657. }
  658. virtual void SetFlexWeights( int nFirstWeight, int nCount, const MorphWeight_t* pWeights ) {}
  659. virtual void FogMaxDensity( float flMaxDensity )
  660. {
  661. AssertMsg( 0, "CMatNullRenderContext only provides base features, not a stub (right now)" );
  662. }
  663. virtual void EnableColorCorrection( bool bEnable ) {}
  664. virtual ColorCorrectionHandle_t AddLookup( const char *pName ) { return 0; }
  665. virtual bool RemoveLookup( ColorCorrectionHandle_t handle ) { return true; }
  666. virtual void LockLookup( ColorCorrectionHandle_t handle ) {}
  667. virtual void LoadLookup( ColorCorrectionHandle_t handle, const char *pLookupName ) {}
  668. virtual void UnlockLookup( ColorCorrectionHandle_t handle ) {}
  669. virtual void SetLookupWeight( ColorCorrectionHandle_t handle, float flWeight ) {}
  670. virtual void ResetLookupWeights( ) {}
  671. virtual void SetResetable( ColorCorrectionHandle_t handle, bool bResetable ) {}
  672. virtual void SetFullScreenDepthTextureValidityFlag( bool bIsValid ) {}
  673. virtual void SetNonInteractivePacifierTexture( ITexture *pTexture, float flNormalizedX, float flNormalizedY, float flNormalizedSize ) {}
  674. virtual void SetNonInteractiveTempFullscreenBuffer( ITexture *pTexture, MaterialNonInteractiveMode_t mode ) {}
  675. virtual void EnableNonInteractiveMode( MaterialNonInteractiveMode_t mode ) {}
  676. virtual void RefreshFrontBufferNonInteractive() {}
  677. #if defined( _X360 )
  678. virtual void PushVertexShaderGPRAllocation( int iVertexShaderCount = 64 )
  679. {
  680. Assert( 0 );
  681. }
  682. virtual void PopVertexShaderGPRAllocation( void )
  683. {
  684. Assert( 0 );
  685. }
  686. #endif
  687. #ifdef DX_TO_GL_ABSTRACTION
  688. void DoStartupShaderPreloading( void ) {};
  689. #endif
  690. void TextureManagerUpdate( void ) { }
  691. int m_WidthBackBuffer, m_HeightBackBuffer;
  692. };
  693. CMatRenderContextBase *CreateNullRenderContext()
  694. {
  695. return new CMatNullRenderContext;
  696. }