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.

86 lines
1.9 KiB

  1. //========= Copyright 2010, Valve Corporation, All rights reserved. ============//
  2. #ifndef ERRORRENDERLOOP_HDR
  3. #define ERRORRENDERLOOP_HDR
  4. #include <assert.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <sys/timer.h>
  9. #include <sys/return_code.h>
  10. #include <cell/gcm.h>
  11. #include <stddef.h>
  12. #include <math.h>
  13. #include <sys/memory.h>
  14. #include <sysutil/sysutil_sysparam.h>
  15. #include "ps3/ps3_helpers.h"
  16. class ErrorRenderLoop
  17. {
  18. public:
  19. typedef struct
  20. {
  21. float x, y, z;
  22. float nx, ny, nz;
  23. uint32_t rgba;
  24. } Vertex_t;
  25. ErrorRenderLoop();
  26. int Run( void );
  27. protected:
  28. void *localMemoryAlloc(const uint32_t size) ;
  29. void *localMemoryAlign(const uint32_t alignment,
  30. const uint32_t size);
  31. void setRenderState(void);
  32. void setDrawEnv(void);
  33. int32_t setRenderObject(void);
  34. int32_t initDisplay(void);
  35. void initShader(void);
  36. void setRenderTarget(const uint32_t Index);
  37. void flip(void);
  38. void setVertex(Vertex_t* vertex_buffer);
  39. void setTransforms(float *tm);
  40. public:
  41. /* double buffering */
  42. enum ConstEnum_t{ COLOR_BUFFER_NUM = 2, HOST_SIZE = (1*1024*1024) };
  43. bool m_keepRunning;
  44. uint32_t m_nLocalMemHeap;
  45. uint32_t display_width;
  46. uint32_t display_height;
  47. float display_aspect_ratio;
  48. uint32_t color_pitch;
  49. uint32_t depth_pitch;
  50. uint32_t color_offset[COLOR_BUFFER_NUM];
  51. uint32_t depth_offset;
  52. uint32_t frame_index;
  53. unsigned char *vertex_program_ptr;
  54. unsigned char *fragment_program_ptr;
  55. CGprogram vertex_program;
  56. CGprogram fragment_program;
  57. CGparameter model_view_projection;
  58. void *vertex_program_ucode;
  59. void *fragment_program_ucode;
  60. uint32_t fragment_offset;
  61. uint32_t m_nVertPositionOffset, m_nVertNormalOffset, m_nVertColorOffset, m_nIndexBufferLocalMemoryOffset;
  62. uint32_t color_index ;
  63. uint32_t position_index ;
  64. uint32_t normal_index;
  65. float MVP[16];
  66. Vertex_t *m_pVertexBuffer;
  67. uint16_t *m_pIndexBuffer;
  68. };
  69. extern PS3_GcmSharedData g_gcmSharedData;
  70. #endif