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.

641 lines
40 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef CMATQUEUEDRENDERCONTEXT_H
  7. #define CMATQUEUEDRENDERCONTEXT_H
  8. #include "imatrendercontextinternal.h"
  9. #include "cmatrendercontext.h"
  10. #include "tier1/callqueue.h"
  11. #include "tier1/utlenvelope.h"
  12. #include "tier1/memstack.h"
  13. #include "mathlib/mathlib.h"
  14. #include "tier0/memdbgon.h"
  15. #if defined( _WIN32 )
  16. #pragma once
  17. #endif
  18. #ifndef MATSYS_INTERNAL
  19. #error "This file is private to the implementation of IMaterialSystem/IMaterialSystemInternal"
  20. #endif
  21. class CMaterialSystem;
  22. class CMatQueuedMesh;
  23. class CPrimList;
  24. //-----------------------------------------------------------------------------
  25. #define DEFINE_QUEUED_CALL_0( FuncName, ClassName, pObject ) void FuncName() { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)())&ClassName::FuncName); }
  26. #define DEFINE_QUEUED_CALL_1( FuncName, ArgType1, ClassName, pObject ) void FuncName( ArgType1 a1 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1))&ClassName::FuncName, a1 ); }
  27. #define DEFINE_QUEUED_CALL_2( FuncName, ArgType1, ArgType2, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2))&ClassName::FuncName, a1, a2 ); }
  28. #define DEFINE_QUEUED_CALL_3( FuncName, ArgType1, ArgType2, ArgType3, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3))&ClassName::FuncName, a1, a2, a3 ); }
  29. #define DEFINE_QUEUED_CALL_4( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4))&ClassName::FuncName, a1, a2, a3, a4 ); }
  30. #define DEFINE_QUEUED_CALL_5( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5))&ClassName::FuncName, a1, a2, a3, a4, a5 ); }
  31. #define DEFINE_QUEUED_CALL_6( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6))&ClassName::FuncName, a1, a2, a3, a4, a5, a6 ); }
  32. #define DEFINE_QUEUED_CALL_7( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7 ); }
  33. #define DEFINE_QUEUED_CALL_8( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8 ); }
  34. #define DEFINE_QUEUED_CALL_9( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8, ArgType9 a9 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8, a9 ); }
  35. #define DEFINE_QUEUED_CALL_11( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ArgType10, ArgType11, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8, ArgType9 a9, ArgType10 a10, ArgType11 a11 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ArgType10, ArgType11))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ); }
  36. #define DEFINE_QUEUED_CALL_12( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ArgType10, ArgType11, ArgType12, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8, ArgType9 a9, ArgType10 a10, ArgType11 a11, ArgType12 a12 ) { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ArgType10, ArgType11, ArgType12))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ); }
  37. #define DEFINE_QUEUED_CALL_0C( FuncName, ClassName, pObject ) void FuncName() const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)() const)ClassName::FuncName); }
  38. #define DEFINE_QUEUED_CALL_1C( FuncName, ArgType1, ClassName, pObject ) void FuncName( ArgType1 a1 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1) const)ClassName::FuncName, a1 ); }
  39. #define DEFINE_QUEUED_CALL_2C( FuncName, ArgType1, ArgType2, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2) const)ClassName::FuncName, a1, a2 ); }
  40. #define DEFINE_QUEUED_CALL_3C( FuncName, ArgType1, ArgType2, ArgType3, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3) const)ClassName::FuncName, a1, a2, a3 ); }
  41. #define DEFINE_QUEUED_CALL_4C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4) const)ClassName::FuncName, a1, a2, a3, a4 ); }
  42. #define DEFINE_QUEUED_CALL_5C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5) const)ClassName::FuncName, a1, a2, a3, a4, a5 ); }
  43. #define DEFINE_QUEUED_CALL_6C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6) const)ClassName::FuncName, a1, a2, a3, a4, a5, a6 ); }
  44. #define DEFINE_QUEUED_CALL_7C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7) const)ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7 ); }
  45. #define DEFINE_QUEUED_CALL_8C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8) const)ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8 ); }
  46. #define DEFINE_QUEUED_CALL_9C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8, ArgType9 a9 ) const { (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9) const)ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8, a9 ); }
  47. #define DEFINE_QUEUED_CALL_AFTER_BASE_0( FuncName, ClassName, pObject ) void FuncName() { BaseClass::FuncName(); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)())&ClassName::FuncName ); }
  48. #define DEFINE_QUEUED_CALL_AFTER_BASE_1( FuncName, ArgType1, ClassName, pObject ) void FuncName( ArgType1 a1 ) { BaseClass::FuncName( a1 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1))&ClassName::FuncName, a1 ); }
  49. #define DEFINE_QUEUED_CALL_AFTER_BASE_2( FuncName, ArgType1, ArgType2, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2 ) { BaseClass::FuncName( a1, a2 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2))&ClassName::FuncName, a1, a2 ); }
  50. #define DEFINE_QUEUED_CALL_AFTER_BASE_3( FuncName, ArgType1, ArgType2, ArgType3, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3 ) { BaseClass::FuncName( a1, a2, a3 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3))&ClassName::FuncName, a1, a2, a3 ); }
  51. #define DEFINE_QUEUED_CALL_AFTER_BASE_4( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4 ) { BaseClass::FuncName( a1, a2, a3, a4 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4))&ClassName::FuncName, a1, a2, a3, a4 ); }
  52. #define DEFINE_QUEUED_CALL_AFTER_BASE_5( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5 ) { BaseClass::FuncName( a1, a2, a3, a4, a5 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5))&ClassName::FuncName, a1, a2, a3, a4, a5 ); }
  53. #define DEFINE_QUEUED_CALL_AFTER_BASE_6( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6 ) { BaseClass::FuncName( a1, a2, a3, a4, a5, a6 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6))&ClassName::FuncName, a1, a2, a3, a4, a5, a6 ); }
  54. #define DEFINE_QUEUED_CALL_AFTER_BASE_7( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7 ) { BaseClass::FuncName( a1, a2, a3, a4, a5, a6, a7 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7 ); }
  55. #define DEFINE_QUEUED_CALL_AFTER_BASE_8( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8 ) { BaseClass::FuncName( a1, a2, a3, a4, a5, a6, a7, a8 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8 ); }
  56. #define DEFINE_QUEUED_CALL_AFTER_BASE_9( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8, ArgType9 a9 ) { BaseClass::FuncName( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8, a9 ); }
  57. #define DEFINE_QUEUED_CALL_AFTER_BASE_0C( FuncName, ClassName, pObject ) void FuncName() const { BaseClass::FuncName(); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)())&ClassName::FuncName ); }
  58. #define DEFINE_QUEUED_CALL_AFTER_BASE_1C( FuncName, ArgType1, ClassName, pObject ) void FuncName( ArgType1 a1 ) const { BaseClass::FuncName( a1 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1))&ClassName::FuncName, a1 ); }
  59. #define DEFINE_QUEUED_CALL_AFTER_BASE_2C( FuncName, ArgType1, ArgType2, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2 ) const { BaseClass::FuncName( a1, a2 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2))&ClassName::FuncName, a1, a2 ); }
  60. #define DEFINE_QUEUED_CALL_AFTER_BASE_3C( FuncName, ArgType1, ArgType2, ArgType3, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3 ) const { BaseClass::FuncName( a1, a2, a3 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3))&ClassName::FuncName, a1, a2, a3 ); }
  61. #define DEFINE_QUEUED_CALL_AFTER_BASE_4C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4 ) const { BaseClass::FuncName( a1, a2, a3, a4 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4))&ClassName::FuncName, a1, a2, a3, a4 ); }
  62. #define DEFINE_QUEUED_CALL_AFTER_BASE_5C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5 ) const { BaseClass::FuncName( a1, a2, a3, a4, a5 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5))&ClassName::FuncName, a1, a2, a3, a4, a5 ); }
  63. #define DEFINE_QUEUED_CALL_AFTER_BASE_6C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6 ) const { BaseClass::FuncName( a1, a2, a3, a4, a5, a6 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6))&ClassName::FuncName, a1, a2, a3, a4, a5, a6 ); }
  64. #define DEFINE_QUEUED_CALL_AFTER_BASE_7C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7 ) const { BaseClass::FuncName( a1, a2, a3, a4, a5, a6, a7 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7 ); }
  65. #define DEFINE_QUEUED_CALL_AFTER_BASE_8C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8 ) const { BaseClass::FuncName( a1, a2, a3, a4, a5, a6, a7, a8 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8 ); }
  66. #define DEFINE_QUEUED_CALL_AFTER_BASE_9C( FuncName, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9, ClassName, pObject ) void FuncName( ArgType1 a1, ArgType2 a2, ArgType3 a3, ArgType4 a4, ArgType5 a5, ArgType6 a6, ArgType7 a7, ArgType8 a8, ArgType9 a9 ) const { BaseClass::FuncName( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); (*(const_cast<CMatCallQueue *>(&m_queue))).QueueCall( pObject, (void (ClassName::*)(ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8, ArgType9))&ClassName::FuncName, a1, a2, a3, a4, a5, a6, a7, a8, a9 ); }
  67. //-----------------------------------------------------------------------------
  68. #define Unsupported( funcName ) ExecuteOnce( Msg( "CMatQueuedRenderContext: %s is unsupported\n", #funcName ) )
  69. #define FATAL_QUEUE 1
  70. #ifdef FATAL_QUEUE
  71. #define CannotSupport() ExecuteOnce( Msg( "Called function that cannot be supported\n" ) ); ExecuteOnce( DebuggerBreakIfDebugging() )
  72. #else
  73. #define CannotSupport() ExecuteOnce( Msg( "Called function that cannot be supported\n" ) )
  74. #endif
  75. //-----------------------------------------------------------------------------
  76. //
  77. //-----------------------------------------------------------------------------
  78. class CMatQueuedRenderContext : public CMatRenderContextBase
  79. {
  80. typedef CMatRenderContextBase BaseClass;
  81. public:
  82. CMatQueuedRenderContext()
  83. : m_pHardwareContext( NULL ),
  84. m_iRenderDepth( 0 ),
  85. m_pQueuedMesh( NULL ),
  86. m_WidthBackBuffer( 0 ),
  87. m_HeightBackBuffer( 0 ),
  88. m_FogMode( MATERIAL_FOG_NONE ),
  89. m_flFogStart( 0 ),
  90. m_flFogEnd( 0 ),
  91. m_flFogZ( 0 ),
  92. m_flFogMaxDensity( 1.0 )
  93. {
  94. memset( &m_FogColor, 0, sizeof(m_FogColor) );
  95. }
  96. bool Init( CMaterialSystem *pMaterialSystem, CMatRenderContextBase *pHardwareContext );
  97. void Shutdown();
  98. void Free();
  99. void CompactMemory();
  100. bool IsInitialized() const { return ( m_pHardwareContext != NULL ); }
  101. void BeginQueue( CMatRenderContextBase *pInitialState = NULL );
  102. void EndQueue( bool bCallQueued = false );
  103. void BeginRender();
  104. void EndRender();
  105. void CallQueued( bool bTermAfterCall = false );
  106. void FlushQueued();
  107. ICallQueue * GetCallQueue();
  108. CMatCallQueue * GetCallQueueInternal() { return &m_queue; }
  109. bool OnDrawMesh( IMesh *pMesh, int firstIndex, int numIndices );
  110. bool OnDrawMesh( IMesh *pMesh, CPrimList *pLists, int nLists );
  111. bool OnSetFlexMesh( IMesh *pStaticMesh, IMesh *pMesh, int nVertexOffsetInBytes );
  112. bool OnSetColorMesh( IMesh *pStaticMesh, IMesh *pMesh, int nVertexOffsetInBytes );
  113. bool OnSetPrimitiveType( IMesh *pMesh, MaterialPrimitiveType_t type );
  114. bool OnFlushBufferedPrimitives();
  115. DEFINE_QUEUED_CALL_1( Flush, bool, IMatRenderContext, m_pHardwareContext );
  116. DEFINE_QUEUED_CALL_0( SwapBuffers, IMatRenderContextInternal, m_pHardwareContext );
  117. void SetRenderTargetEx( int nRenderTargetID, ITexture *pTexture );
  118. void GetRenderTargetDimensions( int &, int &) const;
  119. void GetViewport( int& x, int& y, int& width, int& height ) const;
  120. void Bind( IMaterial *, void * );
  121. DEFINE_QUEUED_CALL_AFTER_BASE_1( BindLocalCubemap, ITexture *, IMatRenderContext, m_pHardwareContext );
  122. DEFINE_QUEUED_CALL_AFTER_BASE_1( BindLightmapPage, int, IMatRenderContext, m_pHardwareContext );
  123. DEFINE_QUEUED_CALL_2( DepthRange, float, float, IMatRenderContext, m_pHardwareContext );
  124. DEFINE_QUEUED_CALL_3( ClearBuffers, bool, bool, bool, IMatRenderContext, m_pHardwareContext );
  125. void ReadPixels( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat );
  126. DEFINE_QUEUED_CALL_3( SetAmbientLight, float, float, float, IMatRenderContext, m_pHardwareContext );
  127. void SetLight( int i, const LightDesc_t &desc );
  128. void SetLightingOrigin( Vector vLightingOrigin );
  129. void SetAmbientLightCube( LightCube_t cube );
  130. DEFINE_QUEUED_CALL_1( CopyRenderTargetToTexture, ITexture *, IMatRenderContext, m_pHardwareContext );
  131. DEFINE_QUEUED_CALL_AFTER_BASE_2( SetFrameBufferCopyTexture, ITexture *, int, IMatRenderContext, m_pHardwareContext );
  132. // matrix api
  133. void MatrixMode( MaterialMatrixMode_t);
  134. void PushMatrix();
  135. void PopMatrix();
  136. void LoadMatrix( const VMatrix& matrix );
  137. void LoadMatrix( const matrix3x4_t& matrix );
  138. void MultMatrix( const VMatrix& matrix );
  139. void MultMatrixLocal( const VMatrix& matrix );
  140. void MultMatrix( const matrix3x4_t& matrix );
  141. void MultMatrixLocal( const matrix3x4_t& matrix );
  142. void LoadIdentity();
  143. void Ortho( double, double, double, double, double, double);
  144. void PerspectiveX( double, double, double, double);
  145. void PerspectiveOffCenterX( double, double, double, double, double, double, double, double );
  146. void PickMatrix( int, int, int, int);
  147. void Rotate( float, float, float, float);
  148. void Translate( float, float, float);
  149. void Scale( float, float, float);
  150. // end matrix api
  151. void Viewport( int x, int y, int width, int height );
  152. DEFINE_QUEUED_CALL_1( CullMode, MaterialCullMode_t, IMatRenderContext, m_pHardwareContext );
  153. void FogMode( MaterialFogMode_t fogMode );
  154. void FogStart( float fStart );
  155. void FogEnd( float fEnd );
  156. void SetFogZ( float fogZ );
  157. MaterialFogMode_t GetFogMode( void );
  158. void GetFogDistances( float *fStart, float *fEnd, float *fFogZ );
  159. void FogMaxDensity( float flMaxDensity );
  160. void FogColor3f( float r, float g, float b );
  161. void FogColor3fv( float const* rgb );
  162. void FogColor3ub( unsigned char r, unsigned char g, unsigned char b );
  163. void FogColor3ubv( unsigned char const* rgb );
  164. void GetFogColor( unsigned char *rgb );
  165. int GetCurrentNumBones( ) const;
  166. void SetNumBoneWeights( int nBoneCount );
  167. DELEGATE_TO_OBJECT_3( IMesh *, CreateStaticMesh, VertexFormat_t, const char *, IMaterial *, m_pHardwareContext );
  168. DEFINE_QUEUED_CALL_1( DestroyStaticMesh, IMesh *, IMatRenderContext, m_pHardwareContext );
  169. IMesh * GetDynamicMesh(bool, IMesh *, IMesh *, IMaterial * );
  170. IMesh* GetDynamicMeshEx( VertexFormat_t, bool, IMesh*, IMesh*, IMaterial* );
  171. // ------------ New Vertex/Index Buffer interface ----------------------------
  172. DELEGATE_TO_OBJECT_3( IVertexBuffer *, CreateStaticVertexBuffer, VertexFormat_t, int, const char *, m_pHardwareContext );
  173. DELEGATE_TO_OBJECT_3( IIndexBuffer *, CreateStaticIndexBuffer, MaterialIndexFormat_t, int, const char *, m_pHardwareContext );
  174. DELEGATE_TO_OBJECT_1V( DestroyVertexBuffer, IVertexBuffer *, m_pHardwareContext );
  175. DELEGATE_TO_OBJECT_1V( DestroyIndexBuffer, IIndexBuffer *, m_pHardwareContext );
  176. DELEGATE_TO_OBJECT_3( IVertexBuffer *, GetDynamicVertexBuffer, int, VertexFormat_t, bool, m_pHardwareContext );
  177. DELEGATE_TO_OBJECT_2( IIndexBuffer *, GetDynamicIndexBuffer, MaterialIndexFormat_t, bool, m_pHardwareContext );
  178. DELEGATE_TO_OBJECT_7V( BindVertexBuffer, int, IVertexBuffer *, int, int, int, VertexFormat_t, int, m_pHardwareContext );
  179. DELEGATE_TO_OBJECT_2V( BindIndexBuffer, IIndexBuffer *, int, m_pHardwareContext );
  180. DELEGATE_TO_OBJECT_3V( Draw, MaterialPrimitiveType_t, int, int, m_pHardwareContext );
  181. // ------------ End ----------------------------
  182. int SelectionMode( bool )
  183. {
  184. CannotSupport();
  185. return 0;
  186. }
  187. void SelectionBuffer( unsigned int *, int )
  188. {
  189. CannotSupport();
  190. }
  191. DEFINE_QUEUED_CALL_0( ClearSelectionNames, IMatRenderContext, m_pHardwareContext );
  192. DEFINE_QUEUED_CALL_1( LoadSelectionName, int, IMatRenderContext, m_pHardwareContext );
  193. DEFINE_QUEUED_CALL_1( PushSelectionName, int, IMatRenderContext, m_pHardwareContext );
  194. DEFINE_QUEUED_CALL_0( PopSelectionName, IMatRenderContext, m_pHardwareContext );
  195. DEFINE_QUEUED_CALL_3( ClearColor3ub, unsigned char, unsigned char, unsigned char, IMatRenderContext, m_pHardwareContext );
  196. DEFINE_QUEUED_CALL_4( ClearColor4ub, unsigned char, unsigned char, unsigned char, unsigned char, IMatRenderContext, m_pHardwareContext );
  197. DEFINE_QUEUED_CALL_2( OverrideDepthEnable, bool, bool, IMatRenderContext, m_pHardwareContext );
  198. DEFINE_QUEUED_CALL_2( OverrideAlphaWriteEnable, bool, bool, IMatRenderContext, m_pHardwareContext );
  199. DEFINE_QUEUED_CALL_2( OverrideColorWriteEnable, bool, bool, IMatRenderContext, m_pHardwareContext );
  200. DEFINE_QUEUED_CALL_1( DrawScreenSpaceQuad, IMaterial *, IMatRenderContext, m_pHardwareContext );
  201. void SyncToken( const char *p );
  202. // Allocate and delete query objects.
  203. OcclusionQueryObjectHandle_t CreateOcclusionQueryObject();
  204. DEFINE_QUEUED_CALL_1( DestroyOcclusionQueryObject, OcclusionQueryObjectHandle_t, IMatRenderContext, m_pHardwareContext );
  205. DEFINE_QUEUED_CALL_1( BeginOcclusionQueryDrawing, OcclusionQueryObjectHandle_t, IMatRenderContext, m_pHardwareContext );
  206. DEFINE_QUEUED_CALL_1( EndOcclusionQueryDrawing, OcclusionQueryObjectHandle_t, IMatRenderContext, m_pHardwareContext );
  207. DEFINE_QUEUED_CALL_1( ResetOcclusionQueryObject, OcclusionQueryObjectHandle_t, IMatRenderContext, m_pHardwareContext );
  208. int OcclusionQuery_GetNumPixelsRendered( OcclusionQueryObjectHandle_t );
  209. void SetFlashlightState( const FlashlightState_t &s, const VMatrix &m );
  210. DEFINE_QUEUED_CALL_AFTER_BASE_1( SetHeightClipMode, MaterialHeightClipMode_t, IMatRenderContext, m_pHardwareContext );
  211. DEFINE_QUEUED_CALL_AFTER_BASE_1( SetHeightClipZ, float, IMatRenderContext, m_pHardwareContext );
  212. bool EnableClipping( bool bEnable );
  213. DEFINE_QUEUED_CALL_1( EnableUserClipTransformOverride, bool, IMatRenderContext, m_pHardwareContext );
  214. void UserClipTransform( const VMatrix &m );
  215. IMorph *CreateMorph( MorphFormat_t format, const char *pDebugName )
  216. {
  217. CannotSupport();
  218. return NULL;
  219. }
  220. DEFINE_QUEUED_CALL_1( DestroyMorph, IMorph *, IMatRenderContext, m_pHardwareContext );
  221. DEFINE_QUEUED_CALL_1( BindMorph, IMorph *, IMatRenderContext, m_pHardwareContext );
  222. void ReadPixelsAndStretch( Rect_t *pSrcRect, Rect_t *pDstRect, unsigned char *pBuffer, ImageFormat dstFormat, int nDstStride );
  223. void GetWindowSize( int &width, int &height ) const;
  224. void DrawScreenSpaceRectangle( IMaterial *pMaterial,
  225. int destx, int desty,
  226. int width, int height,
  227. float src_texture_x0, float src_texture_y0, // which texel you want to appear at
  228. // destx/y
  229. float src_texture_x1, float src_texture_y1, // which texel you want to appear at
  230. // destx+width-1, desty+height-1
  231. int src_texture_width, int src_texture_height, // needed for fixup
  232. void *pClientRenderable = NULL,
  233. int nXDice = 1,
  234. int nYDice = 1 );
  235. void LoadBoneMatrix( int i, const matrix3x4_t &m );
  236. DEFINE_QUEUED_CALL_AFTER_BASE_5( PushRenderTargetAndViewport, ITexture *, int, int, int, int, IMatRenderContext, m_pHardwareContext );
  237. DEFINE_QUEUED_CALL_AFTER_BASE_6( PushRenderTargetAndViewport, ITexture *, ITexture *, int, int, int, int, IMatRenderContext, m_pHardwareContext );
  238. DEFINE_QUEUED_CALL_AFTER_BASE_1( PushRenderTargetAndViewport, ITexture *, IMatRenderContext, m_pHardwareContext );
  239. DEFINE_QUEUED_CALL_AFTER_BASE_0( PushRenderTargetAndViewport, IMatRenderContext, m_pHardwareContext );
  240. DEFINE_QUEUED_CALL_AFTER_BASE_0( PopRenderTargetAndViewport, IMatRenderContext, m_pHardwareContext );
  241. DEFINE_QUEUED_CALL_1( BindLightmapTexture, ITexture *, IMatRenderContext, m_pHardwareContext );
  242. void CopyRenderTargetToTextureEx( ITexture *pTexture, int i, Rect_t *pSrc, Rect_t *pDst );
  243. void CopyTextureToRenderTargetEx( int i, ITexture *pTexture, Rect_t *pSrc, Rect_t *pDst );
  244. DEFINE_QUEUED_CALL_2( SetFloatRenderingParameter, int, float, IMatRenderContext, m_pHardwareContext );
  245. DEFINE_QUEUED_CALL_2( SetIntRenderingParameter, int, int, IMatRenderContext, m_pHardwareContext );
  246. void SetVectorRenderingParameter( int i, const Vector &v )
  247. {
  248. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::SetVectorRenderingParameter, i, RefToVal( v ) );
  249. }
  250. float GetFloatRenderingParameter(int parm_number) const
  251. {
  252. CannotSupport();
  253. return 0;
  254. }
  255. int GetIntRenderingParameter(int parm_number) const
  256. {
  257. CannotSupport();
  258. return 0;
  259. }
  260. Vector GetVectorRenderingParameter(int parm_number) const
  261. {
  262. CannotSupport();
  263. return Vector(0,0,0);
  264. }
  265. DEFINE_QUEUED_CALL_1( SetStencilEnable, bool, IMatRenderContext, m_pHardwareContext );
  266. DEFINE_QUEUED_CALL_1( SetStencilFailOperation, StencilOperation_t, IMatRenderContext, m_pHardwareContext );
  267. DEFINE_QUEUED_CALL_1( SetStencilZFailOperation, StencilOperation_t, IMatRenderContext, m_pHardwareContext );
  268. DEFINE_QUEUED_CALL_1( SetStencilPassOperation, StencilOperation_t, IMatRenderContext, m_pHardwareContext );
  269. DEFINE_QUEUED_CALL_1( SetStencilCompareFunction, StencilComparisonFunction_t, IMatRenderContext, m_pHardwareContext );
  270. DEFINE_QUEUED_CALL_1( SetStencilReferenceValue, int, IMatRenderContext, m_pHardwareContext );
  271. DEFINE_QUEUED_CALL_1( SetStencilTestMask, uint32, IMatRenderContext, m_pHardwareContext );
  272. DEFINE_QUEUED_CALL_1( SetStencilWriteMask, uint32, IMatRenderContext, m_pHardwareContext );
  273. DEFINE_QUEUED_CALL_5( ClearStencilBufferRectangle, int, int, int, int, int, IMatRenderContext, m_pHardwareContext );
  274. DEFINE_QUEUED_CALL_2( SetShadowDepthBiasFactors, float, float, IMatRenderContext, m_pHardwareContext );
  275. void PushCustomClipPlane( const float *p )
  276. {
  277. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::PushCustomClipPlane, CUtlEnvelope<float>( p, 4 ) );
  278. }
  279. DEFINE_QUEUED_CALL_0( PopCustomClipPlane, IMatRenderContext, m_pHardwareContext );
  280. virtual void GetMaxToRender( IMesh *pMesh, bool bMaxUntilFlush, int *pMaxVerts, int *pMaxIndices );
  281. virtual int GetMaxVerticesToRender( IMaterial *pMaterial );
  282. virtual int GetMaxIndicesToRender( )
  283. {
  284. return INDEX_BUFFER_SIZE;
  285. }
  286. DEFINE_QUEUED_CALL_0( DisableAllLocalLights, IMatRenderContext, m_pHardwareContext );
  287. int CompareMaterialCombos( IMaterial *pMaterial1, IMaterial *pMaterial2, int lightmapID1, int lightmapID2 )
  288. {
  289. CannotSupport();
  290. return 0;
  291. }
  292. IMesh *GetFlexMesh();
  293. void SetFlashlightStateEx( const FlashlightState_t &s, const VMatrix &m, ITexture *p )
  294. {
  295. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::SetFlashlightStateEx, RefToVal( s ), RefToVal( m ), p );
  296. }
  297. void SetScissorRect( const int nLeft, const int nTop, const int nRight, const int nBottom, const bool bEnableScissor )
  298. {
  299. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::SetScissorRect, nLeft, nTop, nRight, nBottom, bEnableScissor );
  300. }
  301. virtual void PushDeformation( const DeformationBase_t *pDef )
  302. {
  303. CannotSupport();
  304. }
  305. void PopDeformation( )
  306. {
  307. CannotSupport();
  308. }
  309. int GetNumActiveDeformations( ) const
  310. {
  311. return 0;
  312. }
  313. ITexture *GetLocalCubemap()
  314. {
  315. return m_pLocalCubemapTexture;
  316. }
  317. DEFINE_QUEUED_CALL_2( ClearBuffersObeyStencil, bool, bool, IMatRenderContext, m_pHardwareContext );
  318. DEFINE_QUEUED_CALL_3( ClearBuffersObeyStencilEx, bool, bool, bool, IMatRenderContext, m_pHardwareContext );
  319. DEFINE_QUEUED_CALL_0( PerformFullScreenStencilOperation, IMatRenderContext, m_pHardwareContext );
  320. virtual void AsyncCreateTextureFromRenderTarget( ITexture* pSrcRt, const char* pDstName, ImageFormat dstFmt, bool bGenMips, int nAdditionalCreationFlags, IAsyncTextureOperationReceiver* pRecipient, void* pExtraArgs ) OVERRIDE
  321. {
  322. OnAsyncCreateTextureFromRenderTarget( pSrcRt, &pDstName, pRecipient );
  323. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::AsyncCreateTextureFromRenderTarget, pSrcRt, pDstName, dstFmt, bGenMips, nAdditionalCreationFlags, pRecipient, pExtraArgs );
  324. }
  325. virtual void AsyncMap( ITextureInternal* pTexToMap, IAsyncTextureOperationReceiver* pRecipient, void* pExtraArgs ) OVERRIDE
  326. {
  327. OnAsyncMap( pTexToMap, pRecipient, pExtraArgs );
  328. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContextInternal::AsyncMap, pTexToMap, pRecipient, pExtraArgs );
  329. }
  330. virtual void AsyncUnmap( ITextureInternal* pTexToUnmap ) OVERRIDE
  331. {
  332. OnAsyncUnmap( pTexToUnmap );
  333. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContextInternal::AsyncUnmap, pTexToUnmap );
  334. }
  335. virtual void AsyncCopyRenderTargetToStagingTexture( ITexture* pDst, ITexture* pSrc, IAsyncTextureOperationReceiver* pRecipient, void* pExtraArgs ) OVERRIDE
  336. {
  337. OnAsyncCopyRenderTargetToStagingTexture( pDst, pSrc, pRecipient );
  338. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContextInternal::AsyncCopyRenderTargetToStagingTexture, pDst, pSrc, pRecipient, pExtraArgs );
  339. }
  340. DEFINE_QUEUED_CALL_0( TextureManagerUpdate, IMatRenderContextInternal, m_pHardwareContext );
  341. bool GetUserClipTransform( VMatrix &worldToView )
  342. {
  343. CannotSupport();
  344. return false;
  345. }
  346. bool InFlashlightMode( void ) const
  347. {
  348. CannotSupport();
  349. return false;
  350. }
  351. virtual void SetFlashlightMode( bool bEnable )
  352. {
  353. m_bFlashlightEnable = bEnable;
  354. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::SetFlashlightMode, bEnable );
  355. }
  356. virtual bool GetFlashlightMode( void ) const { return m_bFlashlightEnable; }
  357. void BeginPIXEvent( unsigned long color, const char *pszName )
  358. {
  359. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::BeginPIXEvent, color, CUtlEnvelope<const char *>( pszName ) );
  360. }
  361. DEFINE_QUEUED_CALL_0( EndPIXEvent, IMatRenderContext, m_pHardwareContext );
  362. void SetPIXMarker( unsigned long color, const char *pszName )
  363. {
  364. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::SetPIXMarker, color, CUtlEnvelope<const char *>( pszName ) );
  365. }
  366. DEFINE_QUEUED_CALL_0( ForceHardwareSync, IMatRenderContextInternal, m_pHardwareContext );
  367. DEFINE_QUEUED_CALL_0( BeginFrame, IMatRenderContextInternal, m_pHardwareContext );
  368. DEFINE_QUEUED_CALL_0( EndFrame, IMatRenderContextInternal, m_pHardwareContext );
  369. void SetFrameTime( float frameTime )
  370. {
  371. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContextInternal::SetFrameTime, frameTime );
  372. m_FrameTime = frameTime;
  373. }
  374. DEFINE_QUEUED_CALL_0( BeginMorphAccumulation, IMatRenderContextInternal, m_pHardwareContext );
  375. DEFINE_QUEUED_CALL_0( EndMorphAccumulation, IMatRenderContextInternal, m_pHardwareContext );
  376. virtual void AccumulateMorph( IMorph* pMorph, int nMorphCount, const MorphWeight_t* pWeights )
  377. {
  378. // FIXME: Must copy off the morph weights here. Not sure the pattern for this.
  379. Assert( 0 );
  380. }
  381. virtual bool GetMorphAccumulatorTexCoord( Vector2D *pTexCoord, IMorph *pIMorph, int nVertex )
  382. {
  383. // FIXME: We must assign morph ids in the queued mode
  384. // and pass the ids down to the morph mgr to get the texcoord
  385. Assert(0);
  386. pTexCoord->Init();
  387. return false;
  388. }
  389. virtual void SetFlexWeights( int nFirstWeight, int nCount, const MorphWeight_t* pWeights )
  390. {
  391. Assert(0);
  392. }
  393. //-------------------------------------------------------------------------
  394. DEFINE_QUEUED_CALL_AFTER_BASE_1( SetCurrentMaterialInternal, IMaterialInternal *, IMatRenderContextInternal, m_pHardwareContext );
  395. DEFINE_QUEUED_CALL_AFTER_BASE_1( SetCurrentProxy, void *, IMatRenderContextInternal, m_pHardwareContext );
  396. int GetLightmapPage()
  397. {
  398. CannotSupport();
  399. return 0;
  400. }
  401. void ForceDepthFuncEquals( bool )
  402. {
  403. CannotSupport();
  404. }
  405. void BindStandardTexture( Sampler_t, StandardTextureId_t )
  406. {
  407. CannotSupport();
  408. }
  409. void GetLightmapDimensions( int *, int * )
  410. {
  411. CannotSupport();
  412. }
  413. MorphFormat_t GetBoundMorphFormat()
  414. {
  415. CannotSupport();
  416. return (MorphFormat_t)0;
  417. }
  418. void DrawClearBufferQuad( unsigned char, unsigned char, unsigned char, unsigned char, bool, bool, bool )
  419. {
  420. CannotSupport();
  421. }
  422. void BeginBatch( IMesh* pIndices );
  423. void BindBatch( IMesh* pVertices, IMaterial *pAutoBind = NULL );
  424. void DrawBatch(int firstIndex, int numIndices );
  425. void EndBatch();
  426. // Color correction related methods..
  427. // Client cannot call IColorCorrectionSystem directly because it is not thread-safe
  428. // FIXME: Make IColorCorrectionSystem threadsafe?
  429. virtual ColorCorrectionHandle_t AddLookup( const char *pName );
  430. virtual void LockLookup( ColorCorrectionHandle_t handle );
  431. virtual void LoadLookup( ColorCorrectionHandle_t handle, const char *pLookupName );
  432. virtual void UnlockLookup( ColorCorrectionHandle_t handle );
  433. virtual bool RemoveLookup( ColorCorrectionHandle_t handle );
  434. DEFINE_QUEUED_CALL_1( EnableColorCorrection, bool, IColorCorrectionSystem, g_pColorCorrectionSystem );
  435. DEFINE_QUEUED_CALL_0( ResetLookupWeights, IColorCorrectionSystem, g_pColorCorrectionSystem );
  436. DEFINE_QUEUED_CALL_2( SetLookupWeight, ColorCorrectionHandle_t, float, IColorCorrectionSystem, g_pColorCorrectionSystem );
  437. DEFINE_QUEUED_CALL_2( SetResetable, ColorCorrectionHandle_t, bool, IColorCorrectionSystem, g_pColorCorrectionSystem );
  438. DEFINE_QUEUED_CALL_1( SetFullScreenDepthTextureValidityFlag, bool, IMatRenderContext, m_pHardwareContext );
  439. void SetToneMappingScaleLinear( const Vector &scale )
  440. {
  441. m_queue.QueueCall( m_pHardwareContext, &IMatRenderContext::SetToneMappingScaleLinear, RefToVal( scale ) );
  442. m_LastSetToneMapScale = Vector( scale );
  443. }
  444. void DeferredBeginBatch( uint16 *pIndexData, int nIndices );
  445. void DeferredDrawPrimList( IMesh *pMesh, CPrimList *pLists, int nLists );
  446. void DeferredSetFlexMesh( IMesh *pStaticMesh, int nVertexOffsetInBytes );
  447. #if defined( _X360 )
  448. DEFINE_QUEUED_CALL_1( PushVertexShaderGPRAllocation, int, IMatRenderContext, m_pHardwareContext );
  449. DEFINE_QUEUED_CALL_0( PopVertexShaderGPRAllocation, IMatRenderContext, m_pHardwareContext );
  450. #endif
  451. // A special path used to tick the front buffer while loading on the 360
  452. DEFINE_QUEUED_CALL_4( SetNonInteractivePacifierTexture, ITexture *, float, float, float, IMatRenderContext, m_pHardwareContext );
  453. DEFINE_QUEUED_CALL_2( SetNonInteractiveTempFullscreenBuffer, ITexture *, MaterialNonInteractiveMode_t, IMatRenderContext, m_pHardwareContext );
  454. DEFINE_QUEUED_CALL_1( EnableNonInteractiveMode, MaterialNonInteractiveMode_t, IMatRenderContext, m_pHardwareContext );
  455. DEFINE_QUEUED_CALL_0( RefreshFrontBufferNonInteractive, IMatRenderContext, m_pHardwareContext );
  456. //--------------------------------------------------------
  457. // Memory allocation calls for queued mesh, et. al.
  458. //--------------------------------------------------------
  459. byte *AllocVertices( int nVerts, int nVertexSize );
  460. uint16 *AllocIndices( int nIndices );
  461. CPrimList *AllocPrimLists( int nPrimLists );
  462. byte *ReallocVertices( byte *pVerts, int nVertsOld, int nVertsNew, int nVertexSize );
  463. uint16 *ReallocIndices( uint16 *pIndices, int nIndicesOld, int nIndicesNew );
  464. void FreeVertices( byte *pVerts, int nVerts, int nVertexSize );
  465. void FreeIndices( uint16 *pIndices, int nIndices );
  466. void FreePrimLists( CPrimList * );
  467. //--------------------------------------------------------
  468. // debug logging - no-op in queued context
  469. //--------------------------------------------------------
  470. virtual void Printf( PRINTF_FORMAT_STRING const char *fmt, ... ) {};
  471. virtual void PrintfVA( char *fmt, va_list vargs ){};
  472. virtual float Knob( char *knobname, float *setvalue=NULL ) { return 0.0f; };
  473. #ifdef DX_TO_GL_ABSTRACTION
  474. void DoStartupShaderPreloading( void ) {};
  475. #endif
  476. private:
  477. void QueueMatrixSync();
  478. //friend class CMatQueuedMesh;
  479. friend class CCallQueueExternal;
  480. CMatCallQueue m_queue;
  481. CMatQueuedMesh *m_pQueuedMesh;
  482. CMatRenderContextBase *m_pHardwareContext;
  483. int m_iRenderDepth;
  484. int m_WidthBackBuffer, m_HeightBackBuffer;
  485. int m_nBoneCount;
  486. MaterialFogMode_t m_FogMode;
  487. float m_flFogStart;
  488. float m_flFogEnd;
  489. float m_flFogZ;
  490. float m_flFogMaxDensity;
  491. color24 m_FogColor;
  492. CMemoryStack m_Vertices;
  493. CMemoryStack m_Indices;
  494. class CCallQueueExternal : public ICallQueue
  495. {
  496. void QueueFunctorInternal( CFunctor *pFunctor )
  497. {
  498. GET_OUTER( CMatQueuedRenderContext, m_CallQueueExternal )->m_queue.QueueFunctor( pFunctor );
  499. pFunctor->Release();
  500. }
  501. };
  502. CCallQueueExternal m_CallQueueExternal;
  503. };
  504. //-----------------------------------------------------------------------------
  505. #include "tier0/memdbgoff.h"
  506. #endif // CMATQUEUEDRENDERCONTEXT_H