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.

55 lines
1.9 KiB

  1. //================ Copyright (c) 1996-2010 Valve Corporation. All Rights Reserved. =================
  2. #ifndef PS3GCMFUNC_H
  3. #define PS3GCMFUNC_H
  4. // this is the buffer that all PPU GCM functions assume is the normal command buffer,
  5. // but it is not in IO-mapped memory and it's the SPU that picks up and submits it to RSX.
  6. // it's a level of indirection necessary to interleave SPU and PPU calls to GCM
  7. #define GCM_CTX gCellGcmCurrentContext
  8. #if GCM_CTX_UNSAFE_MODE
  9. #error "This mode is not supported any more. Use SPU draw mode."
  10. #endif
  11. extern int32_t SpuGcmCommandBufferReserveCallback( struct CellGcmContextData *context, uint32_t nCount );
  12. #define GCM_CTX_RESERVE( WORDS ) SpuGcmCommandBufferReserveCallback( GCM_CTX, WORDS )
  13. #define GCM_FUNC_NOINLINE( GCM_FUNCTION, ...) GCM_FUNCTION( GCM_CTX, ##__VA_ARGS__ )
  14. #ifdef _CERT
  15. #define GCM_PERF_RANGE( NAME )
  16. #define GCM_PERF_PUSH_MARKER( NAME )
  17. #define GCM_PERF_POP_MARKER( )
  18. #define GCM_PERF_MARKER( NAME )
  19. #else
  20. class CGcmPerfAutoRange
  21. {
  22. public:
  23. CGcmPerfAutoRange( const char * pName ){ GCM_FUNC_NOINLINE( cellGcmSetPerfMonPushMarker, pName ); }
  24. ~CGcmPerfAutoRange( ){ GCM_FUNC_NOINLINE( cellGcmSetPerfMonPopMarker ); }
  25. };
  26. #define GCM_PERF_RANGE( NAME ) CGcmPerfAutoRange _gcmAutoRange( NAME )
  27. #define GCM_PERF_PUSH_MARKER( NAME ) GCM_FUNC_NOINLINE( cellGcmSetPerfMonPushMarker, NAME )
  28. #define GCM_PERF_POP_MARKER( ) GCM_FUNC_NOINLINE( cellGcmSetPerfMonPopMarker )
  29. #define GCM_PERF_MARKER( NAME ) GCM_FUNC_NOINLINE( cellGcmSetPerfMonMarker, ( NAME ) )
  30. #endif
  31. #define GCM_FUNC( GCM_FUNCTION, ...) \
  32. { \
  33. uint nReserveWords = GCM_FUNCTION ## MeasureSizeInline( 0, ##__VA_ARGS__ ); \
  34. GCM_CTX_RESERVE( nReserveWords ); \
  35. GCM_FUNCTION ## UnsafeInline( GCM_CTX, ##__VA_ARGS__ ); \
  36. }
  37. extern void SpuGcmCommandBufferFlush();
  38. #define GCM_CTX_FLUSH_CHECKPOINT() void SpuGcmCommandBufferFlush()
  39. #define cellGcmFlush must_use_____g_ps3gcmGlobalState_CmdBufferFlush
  40. #endif