Counter Strike : Global Offensive Source Code
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.

984 lines
27 KiB

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