VideoState.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #include "Common/ChunkFile.h"
  5. #include "VideoCommon/BoundingBox.h"
  6. #include "VideoCommon/BPMemory.h"
  7. #include "VideoCommon/CommandProcessor.h"
  8. #include "VideoCommon/CPMemory.h"
  9. #include "VideoCommon/Fifo.h"
  10. #include "VideoCommon/GeometryShaderManager.h"
  11. #include "VideoCommon/PixelEngine.h"
  12. #include "VideoCommon/PixelShaderManager.h"
  13. #include "VideoCommon/TextureDecoder.h"
  14. #include "VideoCommon/VertexManagerBase.h"
  15. #include "VideoCommon/VertexShaderManager.h"
  16. #include "VideoCommon/VideoState.h"
  17. #include "VideoCommon/XFMemory.h"
  18. static void DoState(PointerWrap &p)
  19. {
  20. // BP Memory
  21. p.Do(bpmem);
  22. p.DoMarker("BP Memory");
  23. // CP Memory
  24. DoCPState(p);
  25. // XF Memory
  26. p.Do(xfmem);
  27. p.DoMarker("XF Memory");
  28. // Texture decoder
  29. p.DoArray(texMem, TMEM_SIZE);
  30. p.DoMarker("texMem");
  31. // FIFO
  32. Fifo_DoState(p);
  33. p.DoMarker("Fifo");
  34. CommandProcessor::DoState(p);
  35. p.DoMarker("CommandProcessor");
  36. PixelEngine::DoState(p);
  37. p.DoMarker("PixelEngine");
  38. // the old way of replaying current bpmem as writes to push side effects to pixel shader manager doesn't really work.
  39. PixelShaderManager::DoState(p);
  40. p.DoMarker("PixelShaderManager");
  41. VertexShaderManager::DoState(p);
  42. p.DoMarker("VertexShaderManager");
  43. GeometryShaderManager::DoState(p);
  44. p.DoMarker("GeometryShaderManager");
  45. VertexManager::DoState(p);
  46. p.DoMarker("VertexManager");
  47. BoundingBox::DoState(p);
  48. p.DoMarker("BoundingBox");
  49. // TODO: search for more data that should be saved and add it here
  50. }
  51. void VideoCommon_DoState(PointerWrap &p)
  52. {
  53. DoState(p);
  54. }
  55. void VideoCommon_RunLoop(bool enable)
  56. {
  57. EmulatorState(enable);
  58. }
  59. void VideoCommon_Init()
  60. {
  61. memset(&g_main_cp_state, 0, sizeof(g_main_cp_state));
  62. memset(&g_preprocess_cp_state, 0, sizeof(g_preprocess_cp_state));
  63. memset(texMem, 0, TMEM_SIZE);
  64. }