DDraceNetwork Docs
graphics_threaded.h
Go to the documentation of this file.
1#ifndef ENGINE_CLIENT_GRAPHICS_THREADED_H
2#define ENGINE_CLIENT_GRAPHICS_THREADED_H
3
4#include <base/system.h>
5#include <engine/graphics.h>
7
8#include <cstddef>
9#include <string>
10#include <vector>
11
12constexpr int CMD_BUFFER_DATA_BUFFER_SIZE = 1024 * 1024 * 2;
13constexpr int CMD_BUFFER_CMD_BUFFER_SIZE = 1024 * 256;
14
16{
17 class CBuffer
18 {
19 unsigned char *m_pData;
20 unsigned m_Size;
21 unsigned m_Used;
22
23 public:
24 CBuffer(unsigned BufferSize)
25 {
26 m_Size = BufferSize;
27 m_pData = new unsigned char[m_Size];
28 m_Used = 0;
29 }
30
32 {
33 delete[] m_pData;
34 m_pData = 0x0;
35 m_Used = 0;
36 m_Size = 0;
37 }
38
39 void Reset()
40 {
41 m_Used = 0;
42 }
43
44 void *Alloc(unsigned Requested, unsigned Alignment = alignof(std::max_align_t))
45 {
46 size_t Offset = reinterpret_cast<uintptr_t>(m_pData + m_Used) % Alignment;
47 if(Offset)
48 Offset = Alignment - Offset;
49
50 if(Requested + Offset + m_Used > m_Size)
51 return 0;
52
53 void *pPtr = &m_pData[m_Used + Offset];
54 m_Used += Requested + Offset;
55 return pPtr;
56 }
57
58 unsigned char *DataPtr() { return m_pData; }
59 unsigned DataSize() const { return m_Size; }
60 unsigned DataUsed() const { return m_Used; }
61 };
62
63public:
65 size_t m_CommandCount = 0;
67
69
70 enum
71 {
72 MAX_TEXTURES = 1024 * 8,
73 MAX_VERTICES = 32 * 1024,
74 };
75
77 {
78 // command groups
79 CMDGROUP_CORE = 0, // commands that everyone has to implement
80 CMDGROUP_PLATFORM_GL = 10000, // commands specific to a platform
82
83 //
86
87 //
89
90 // synchronization
92
93 // texture commands
99
100 // rendering
104
105 // opengl 2.0+ commands (some are just emulated and only exist in opengl 3.3+)
109 CMD_COPY_BUFFER_OBJECT, // copy vbo to another
111
115
116 CMD_INDICES_REQUIRED_NUM_NOTIFY, // create indices that are required
117
118 CMD_RENDER_TILE_LAYER, // render a tilelayer
119 CMD_RENDER_BORDER_TILE, // render one tile multiple times
120 CMD_RENDER_QUAD_LAYER, // render a quad layer
121 CMD_RENDER_TEXT, // render text
122 CMD_RENDER_QUAD_CONTAINER, // render a quad buffer container
123 CMD_RENDER_QUAD_CONTAINER_EX, // render a quad buffer container with extended parameters
124 CMD_RENDER_QUAD_CONTAINER_SPRITE_MULTIPLE, // render a quad buffer container as sprite multiple times
125
126 // swap
128
129 // misc
135
136 // in Android a window that minimizes gets destroyed
139
141 };
142
143 enum
144 {
147
152 };
153
154 enum
155 {
156 //
161 };
162
163 enum
164 {
168 };
169
170 enum
171 {
174 };
175
176 typedef vec2 SPoint;
183
184 struct SCommand
185 {
186 public:
187 SCommand(unsigned Cmd) :
188 m_Cmd(Cmd), m_pNext(nullptr) {}
189 unsigned m_Cmd;
191 };
194
195 struct SState
196 {
202
203 // clip
209 };
210
211 struct SCommand_Clear : public SCommand
212 {
217 };
218
219 struct SCommand_Signal : public SCommand
220 {
224 };
225
227 {
231 };
232
233 struct SCommand_Render : public SCommand
234 {
238 unsigned m_PrimType;
239 unsigned m_PrimCount;
240 SVertex *m_pVertices; // you should use the command buffer data to allocate vertices for this command
241 };
242
244 {
248 unsigned m_PrimType;
249 unsigned m_PrimCount;
250 SVertexTex3DStream *m_pVertices; // you should use the command buffer data to allocate vertices for this command
251 };
252
254 {
257
259
263
264 int m_Flags; // @see EBufferObjectCreateFlags
265 };
266
268 {
271
273
277
278 int m_Flags; // @see EBufferObjectCreateFlags
279 };
280
282 {
285
287
292 };
293
295 {
298
301
305 };
306
308 {
311
313 };
314
316 {
319
321
324
327 };
328
330 {
333
335
338
341 };
342
344 {
347
350 };
351
353 {
356
358 };
359
361 {
365 SColorf m_Color; // the color of the whole tilelayer -- already enveloped
366
367 // the char offset of all indices that should be rendered, and the amount of renders
369 unsigned int *m_pDrawCount;
370
373 };
374
376 {
380 SColorf m_Color; // the color of the whole tilelayer -- already enveloped
382 uint32_t m_DrawNum;
384
387 };
388
390 {
394
397 size_t m_QuadNum;
399 };
400
402 {
406
409
412
416 };
417
419 {
423
425
426 unsigned int m_DrawNum;
428 };
429
431 {
435
437
440
442
443 unsigned int m_DrawNum;
445 };
446
448 {
452
454
456
459
460 unsigned int m_DrawNum;
461 unsigned int m_DrawCount;
463 };
464
466 {
470 SColorf *m_pColor; // processor will fill this out
471 bool *m_pSwapped; // processor may set this to true, must be initialized to false by the caller
472 };
473
475 {
478 CImageInfo *m_pImage; // processor will fill this out, the one who adds this command must free the data as well
479 bool *m_pSwapped; // processor may set this to true, must be initialized to false by the caller
480 };
481
482 struct SCommand_Swap : public SCommand
483 {
486 };
487
488 struct SCommand_VSync : public SCommand
489 {
492
494 bool *m_pRetOk;
495 };
496
498 {
501
504 bool *m_pRetOk;
505 };
506
508 {
511
512 int m_X;
513 int m_Y;
516 bool m_ByResize; // resized by an resize event.. a hint to make clear that the viewport update can be deferred if wanted
517 };
518
520 {
523
524 // texture information
526
527 size_t m_Width;
528 size_t m_Height;
530 // data must be in RGBA format
531 uint8_t *m_pData; // will be freed by the command processor
532 };
533
535 {
538
539 // texture information
541 };
542
544 {
547
548 // texture information
551
552 size_t m_Width;
553 size_t m_Height;
554
555 uint8_t *m_pTextData; // will be freed by the command processor
556 uint8_t *m_pTextOutlineData; // will be freed by the command processor
557 };
558
560 {
563
564 // texture information
567 };
568
570 {
573
574 // texture information
576
577 int m_X;
578 int m_Y;
579 size_t m_Width;
580 size_t m_Height;
581 uint8_t *m_pData; // will be freed by the command processor
582 };
583
585 {
588
589 uint32_t m_WindowId;
590 };
591
593 {
596
597 uint32_t m_WindowId;
598 };
599
600 //
601 CCommandBuffer(unsigned CmdBufferSize, unsigned DataBufferSize) :
602 m_CmdBuffer(CmdBufferSize), m_DataBuffer(DataBufferSize), m_pCmdBufferHead(nullptr), m_pCmdBufferTail(nullptr)
603 {
604 }
605
606 void *AllocData(unsigned WantedSize)
607 {
608 return m_DataBuffer.Alloc(WantedSize);
609 }
610
611 template<class T>
612 bool AddCommandUnsafe(const T &Command)
613 {
614 // make sure that we don't do something stupid like ->AddCommand(&Cmd);
615 (void)static_cast<const SCommand *>(&Command);
616
617 // allocate and copy the command into the buffer
618 T *pCmd = (T *)m_CmdBuffer.Alloc(sizeof(*pCmd), alignof(T));
619 if(!pCmd)
620 return false;
621 *pCmd = Command;
622 pCmd->m_pNext = nullptr;
623
627 m_pCmdBufferHead = pCmd;
628 m_pCmdBufferTail = pCmd;
629
631
632 return true;
633 }
634
636 {
637 return m_pCmdBufferHead;
638 }
639
640 void Reset()
641 {
645
646 m_CommandCount = 0;
648 }
649
650 void AddRenderCalls(size_t RenderCallCountToAdd)
651 {
652 m_RenderCallCount += RenderCallCountToAdd;
653 }
654};
655
657{
667};
668
669// interface for the graphics backend
670// all these functions are called on the main thread
672{
673public:
674 enum
675 {
682 };
683
684 virtual ~IGraphicsBackend() = default;
685
686 virtual int Init(const char *pName, int *pScreen, int *pWidth, int *pHeight, int *pRefreshRate, int *pFsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight, int *pCurrentWidth, int *pCurrentHeight, class IStorage *pStorage) = 0;
687 virtual int Shutdown() = 0;
688
689 virtual uint64_t TextureMemoryUsage() const = 0;
690 virtual uint64_t BufferMemoryUsage() const = 0;
691 virtual uint64_t StreamedMemoryUsage() const = 0;
692 virtual uint64_t StagingMemoryUsage() const = 0;
693
694 virtual const TTwGraphicsGpuList &GetGpus() const = 0;
695
696 virtual void GetVideoModes(CVideoMode *pModes, int MaxModes, int *pNumModes, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int Screen) = 0;
697 virtual void GetCurrentVideoMode(CVideoMode &CurMode, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int Screen) = 0;
698
699 virtual int GetNumScreens() const = 0;
700 virtual const char *GetScreenName(int Screen) const = 0;
701
702 virtual void Minimize() = 0;
703 virtual void Maximize() = 0;
704 virtual void SetWindowParams(int FullscreenMode, bool IsBorderless) = 0;
705 virtual bool SetWindowScreen(int Index) = 0;
706 virtual bool UpdateDisplayMode(int Index) = 0;
707 virtual int GetWindowScreen() = 0;
708 virtual int WindowActive() = 0;
709 virtual int WindowOpen() = 0;
710 virtual void SetWindowGrab(bool Grab) = 0;
711 // returns true, if the video mode changed
712 virtual bool ResizeWindow(int w, int h, int RefreshRate) = 0;
713 virtual void GetViewportSize(int &w, int &h) = 0;
714 virtual void NotifyWindow() = 0;
715
716 virtual void WindowDestroyNtf(uint32_t WindowId) = 0;
717 virtual void WindowCreateNtf(uint32_t WindowId) = 0;
718
719 virtual void RunBuffer(CCommandBuffer *pBuffer) = 0;
721 virtual bool IsIdle() const = 0;
722 virtual void WaitForIdle() = 0;
723
724 virtual bool GetDriverVersion(EGraphicsDriverAgeType DriverAgeType, int &Major, int &Minor, int &Patch, const char *&pName, EBackendType BackendType) = 0;
725 // checks if the current values of the config are a graphics modern API
726 virtual bool IsConfigModernAPI() { return false; }
727 virtual bool UseTrianglesAsQuad() { return false; }
728 virtual bool HasTileBuffering() { return false; }
729 virtual bool HasQuadBuffering() { return false; }
730 virtual bool HasTextBuffering() { return false; }
731 virtual bool HasQuadContainerBuffering() { return false; }
732 virtual bool Uses2DTextureArrays() { return false; }
733 virtual bool HasTextureArraysSupport() { return false; }
734 virtual const char *GetErrorString() { return NULL; }
735
736 virtual const char *GetVendorString() = 0;
737 virtual const char *GetVersionString() = 0;
738 virtual const char *GetRendererString() = 0;
739
740 // be aware that this function should only be called from the graphics thread, and even then you should really know what you are doing
742
743 virtual bool GetWarning(std::vector<std::string> &WarningStrings) = 0;
744
745 // returns true if the error msg was shown
746 virtual bool ShowMessageBox(unsigned Type, const char *pTitle, const char *pMsg) = 0;
747};
748
750{
751 enum
752 {
754
758 };
759
769
773
774 //
778
780
784
787
789
794
796
797 std::vector<int> m_vTextureIndices;
800
802
803 std::vector<SWarning> m_vWarnings;
804
805 // is a non full windowed (in a sense that the viewport won't include the whole window),
806 // forced viewport, so that it justifies our UI ratio needs
807 bool m_IsForcedViewport = false;
808
810 {
812 m_FreeIndex(-1) {}
813 // keep a reference to it, so we can free the ID
815
817 };
818 std::vector<SVertexArrayInfo> m_vVertexArrayInfo;
820
821 std::vector<int> m_vBufferObjectIndices;
823
825 {
826 SQuadContainer(bool AutomaticUpload = true)
827 {
828 m_vQuads.clear();
830 m_FreeIndex = -1;
831
832 m_AutomaticUpload = AutomaticUpload;
833 }
834
835 struct SQuad
836 {
838 };
839
840 std::vector<SQuad> m_vQuads;
841
844
846
848 };
849 std::vector<SQuadContainer> m_vQuadContainers;
851
852 std::vector<WINDOW_RESIZE_FUNC> m_vResizeListeners;
853 std::vector<WINDOW_PROPS_CHANGED_FUNC> m_vPropChangeListeners;
854
855 void *AllocCommandBufferData(size_t AllocSize);
856
857 void AddVertices(int Count);
858 void AddVertices(int Count, CCommandBuffer::SVertex *pVertices);
859 void AddVertices(int Count, CCommandBuffer::SVertexTex3DStream *pVertices);
860
861 template<typename TName>
862 void Rotate(const CCommandBuffer::SPoint &rCenter, TName *pPoints, int NumPoints)
863 {
864 float c = std::cos(m_Rotation);
865 float s = std::sin(m_Rotation);
866 float x, y;
867 int i;
868
869 TName *pVertices = pPoints;
870 for(i = 0; i < NumPoints; i++)
871 {
872 x = pVertices[i].m_Pos.x - rCenter.x;
873 y = pVertices[i].m_Pos.y - rCenter.y;
874 pVertices[i].m_Pos.x = x * c - y * s + rCenter.x;
875 pVertices[i].m_Pos.y = x * s + y * c + rCenter.y;
876 }
877 }
878
879 template<typename TName>
880 void AddCmd(
881 TName &Cmd, std::function<bool()> FailFunc = [] { return true; })
882 {
884 return;
885
886 // kick command buffer and try again
888
889 if(!FailFunc())
890 {
891 char aError[256];
892 str_format(aError, sizeof(aError), "graphics: failed to run fail handler for command '%s'", typeid(TName).name());
893 dbg_assert(false, aError);
894 }
895
897 {
898 char aError[256];
899 str_format(aError, sizeof(aError), "graphics: failed to add command '%s' to command buffer", typeid(TName).name());
900 dbg_assert(false, aError);
901 }
902 }
903
904 void KickCommandBuffer();
905
907
908 void AdjustViewport(bool SendViewportChangeToBackend);
909
912 void ReadPixelDirect(bool *pSwapped);
913 void ScreenshotDirect(bool *pSwapped);
914
915 int IssueInit();
916 int InitWindow();
917
918public:
920
921 void ClipEnable(int x, int y, int w, int h) override;
922 void ClipDisable() override;
923
924 void BlendNone() override;
925 void BlendNormal() override;
926 void BlendAdditive() override;
927
928 void WrapNormal() override;
929 void WrapClamp() override;
930
931 uint64_t TextureMemoryUsage() const override;
932 uint64_t BufferMemoryUsage() const override;
933 uint64_t StreamedMemoryUsage() const override;
934 uint64_t StagingMemoryUsage() const override;
935
936 const TTwGraphicsGpuList &GetGpus() const override;
937
938 void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY) override;
939 void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY) override;
940
941 void LinesBegin() override;
942 void LinesEnd() override;
943 void LinesDraw(const CLineItem *pArray, int Num) override;
944
946 void FreeTextureIndex(CTextureHandle *pIndex);
947 void UnloadTexture(IGraphics::CTextureHandle *pIndex) override;
948 IGraphics::CTextureHandle LoadTextureRaw(const CImageInfo &Image, int Flags, const char *pTexName = nullptr) override;
949 IGraphics::CTextureHandle LoadTextureRawMove(CImageInfo &Image, int Flags, const char *pTexName = nullptr) override;
950
951 bool LoadTextTextures(size_t Width, size_t Height, CTextureHandle &TextTexture, CTextureHandle &TextOutlineTexture, uint8_t *pTextData, uint8_t *pTextOutlineData) override;
952 bool UnloadTextTextures(CTextureHandle &TextTexture, CTextureHandle &TextOutlineTexture) override;
953 bool UpdateTextTexture(CTextureHandle TextureId, int x, int y, size_t Width, size_t Height, uint8_t *pData, bool IsMovedPointer) override;
954
955 CTextureHandle LoadSpriteTexture(const CImageInfo &FromImageInfo, const struct CDataSprite *pSprite) override;
956
957 bool IsImageSubFullyTransparent(const CImageInfo &FromImageInfo, int x, int y, int w, int h) override;
958 bool IsSpriteTextureFullyTransparent(const CImageInfo &FromImageInfo, const struct CDataSprite *pSprite) override;
959
960 // simple uncompressed RGBA loaders
961 IGraphics::CTextureHandle LoadTexture(const char *pFilename, int StorageType, int Flags = 0) override;
962 bool LoadPng(CImageInfo &Image, const char *pFilename, int StorageType) override;
963 bool LoadPng(CImageInfo &Image, const uint8_t *pData, size_t DataSize, const char *pContextName) override;
964
965 bool CheckImageDivisibility(const char *pContextName, CImageInfo &Image, int DivX, int DivY, bool AllowResize) override;
966 bool IsImageFormatRgba(const char *pContextName, const CImageInfo &Image) override;
967
968 void TextureSet(CTextureHandle TextureId) override;
969
970 void Clear(float r, float g, float b, bool ForceClearNow = false) override;
971
972 void QuadsBegin() override;
973 void QuadsEnd() override;
974 void QuadsTex3DBegin() override;
975 void QuadsTex3DEnd() override;
976 void TrianglesBegin() override;
977 void TrianglesEnd() override;
978 void QuadsEndKeepVertices() override;
979 void QuadsDrawCurrentVertices(bool KeepVertices = true) override;
980 void QuadsSetRotation(float Angle) override;
981
982 template<typename TName>
983 void SetColor(TName *pVertex, int ColorIndex)
984 {
985 TName *pVert = pVertex;
986 pVert->m_Color = m_aColor[ColorIndex];
987 }
988
989 void SetColorVertex(const CColorVertex *pArray, size_t Num) override;
990 void SetColor(float r, float g, float b, float a) override;
991 void SetColor(ColorRGBA Color) override;
992 void SetColor4(ColorRGBA TopLeft, ColorRGBA TopRight, ColorRGBA BottomLeft, ColorRGBA BottomRight) override;
993
994 // go through all vertices and change their color (only works for quads)
995 void ChangeColorOfCurrentQuadVertices(float r, float g, float b, float a) override;
996 void ChangeColorOfQuadVertices(size_t QuadOffset, unsigned char r, unsigned char g, unsigned char b, unsigned char a) override;
997
998 void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV) override;
1000 float x0, float y0, float x1, float y1,
1001 float x2, float y2, float x3, float y3, int Index = -1) override;
1002
1003 void QuadsDraw(CQuadItem *pArray, int Num) override;
1004
1005 template<typename TName>
1006 void QuadsDrawTLImpl(TName *pVertices, const CQuadItem *pArray, int Num)
1007 {
1009
1010 dbg_assert(m_Drawing == DRAWING_QUADS, "called Graphics()->QuadsDrawTL without begin");
1011
1012 if(g_Config.m_GfxQuadAsTriangle && !m_GLUseTrianglesAsQuad)
1013 {
1014 for(int i = 0; i < Num; ++i)
1015 {
1016 // first triangle
1017 pVertices[m_NumVertices + 6 * i].m_Pos.x = pArray[i].m_X;
1018 pVertices[m_NumVertices + 6 * i].m_Pos.y = pArray[i].m_Y;
1019 pVertices[m_NumVertices + 6 * i].m_Tex = m_aTexture[0];
1020 SetColor(&pVertices[m_NumVertices + 6 * i], 0);
1021
1022 pVertices[m_NumVertices + 6 * i + 1].m_Pos.x = pArray[i].m_X + pArray[i].m_Width;
1023 pVertices[m_NumVertices + 6 * i + 1].m_Pos.y = pArray[i].m_Y;
1024 pVertices[m_NumVertices + 6 * i + 1].m_Tex = m_aTexture[1];
1025 SetColor(&pVertices[m_NumVertices + 6 * i + 1], 1);
1026
1027 pVertices[m_NumVertices + 6 * i + 2].m_Pos.x = pArray[i].m_X + pArray[i].m_Width;
1028 pVertices[m_NumVertices + 6 * i + 2].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height;
1029 pVertices[m_NumVertices + 6 * i + 2].m_Tex = m_aTexture[2];
1030 SetColor(&pVertices[m_NumVertices + 6 * i + 2], 2);
1031
1032 // second triangle
1033 pVertices[m_NumVertices + 6 * i + 3].m_Pos.x = pArray[i].m_X;
1034 pVertices[m_NumVertices + 6 * i + 3].m_Pos.y = pArray[i].m_Y;
1035 pVertices[m_NumVertices + 6 * i + 3].m_Tex = m_aTexture[0];
1036 SetColor(&pVertices[m_NumVertices + 6 * i + 3], 0);
1037
1038 pVertices[m_NumVertices + 6 * i + 4].m_Pos.x = pArray[i].m_X + pArray[i].m_Width;
1039 pVertices[m_NumVertices + 6 * i + 4].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height;
1040 pVertices[m_NumVertices + 6 * i + 4].m_Tex = m_aTexture[2];
1041 SetColor(&pVertices[m_NumVertices + 6 * i + 4], 2);
1042
1043 pVertices[m_NumVertices + 6 * i + 5].m_Pos.x = pArray[i].m_X;
1044 pVertices[m_NumVertices + 6 * i + 5].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height;
1045 pVertices[m_NumVertices + 6 * i + 5].m_Tex = m_aTexture[3];
1046 SetColor(&pVertices[m_NumVertices + 6 * i + 5], 3);
1047
1048 if(m_Rotation != 0)
1049 {
1050 Center.x = pArray[i].m_X + pArray[i].m_Width / 2;
1051 Center.y = pArray[i].m_Y + pArray[i].m_Height / 2;
1052
1053 Rotate(Center, &pVertices[m_NumVertices + 6 * i], 6);
1054 }
1055 }
1056
1057 AddVertices(3 * 2 * Num, pVertices);
1058 }
1059 else
1060 {
1061 for(int i = 0; i < Num; ++i)
1062 {
1063 pVertices[m_NumVertices + 4 * i].m_Pos.x = pArray[i].m_X;
1064 pVertices[m_NumVertices + 4 * i].m_Pos.y = pArray[i].m_Y;
1065 pVertices[m_NumVertices + 4 * i].m_Tex = m_aTexture[0];
1066 SetColor(&pVertices[m_NumVertices + 4 * i], 0);
1067
1068 pVertices[m_NumVertices + 4 * i + 1].m_Pos.x = pArray[i].m_X + pArray[i].m_Width;
1069 pVertices[m_NumVertices + 4 * i + 1].m_Pos.y = pArray[i].m_Y;
1070 pVertices[m_NumVertices + 4 * i + 1].m_Tex = m_aTexture[1];
1071 SetColor(&pVertices[m_NumVertices + 4 * i + 1], 1);
1072
1073 pVertices[m_NumVertices + 4 * i + 2].m_Pos.x = pArray[i].m_X + pArray[i].m_Width;
1074 pVertices[m_NumVertices + 4 * i + 2].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height;
1075 pVertices[m_NumVertices + 4 * i + 2].m_Tex = m_aTexture[2];
1076 SetColor(&pVertices[m_NumVertices + 4 * i + 2], 2);
1077
1078 pVertices[m_NumVertices + 4 * i + 3].m_Pos.x = pArray[i].m_X;
1079 pVertices[m_NumVertices + 4 * i + 3].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height;
1080 pVertices[m_NumVertices + 4 * i + 3].m_Tex = m_aTexture[3];
1081 SetColor(&pVertices[m_NumVertices + 4 * i + 3], 3);
1082
1083 if(m_Rotation != 0)
1084 {
1085 Center.x = pArray[i].m_X + pArray[i].m_Width / 2;
1086 Center.y = pArray[i].m_Y + pArray[i].m_Height / 2;
1087
1088 Rotate(Center, &pVertices[m_NumVertices + 4 * i], 4);
1089 }
1090 }
1091
1092 AddVertices(4 * Num, pVertices);
1093 }
1094 }
1095
1096 void QuadsDrawTL(const CQuadItem *pArray, int Num) override;
1097
1098 void QuadsTex3DDrawTL(const CQuadItem *pArray, int Num) override;
1099
1100 void QuadsDrawFreeform(const CFreeformItem *pArray, int Num) override;
1101 void QuadsText(float x, float y, float Size, const char *pText) override;
1102
1103 void DrawRectExt(float x, float y, float w, float h, float r, int Corners) override;
1104 void DrawRectExt4(float x, float y, float w, float h, ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, float r, int Corners) override;
1105 int CreateRectQuadContainer(float x, float y, float w, float h, float r, int Corners) override;
1106 void DrawRect(float x, float y, float w, float h, ColorRGBA Color, int Corners, float Rounding) override;
1107 void DrawRect4(float x, float y, float w, float h, ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, int Corners, float Rounding) override;
1108 void DrawCircle(float CenterX, float CenterY, float Radius, int Segments) override;
1109
1111 {
1112 return m_aTexture;
1113 }
1114
1115 const GL_SColor *GetCurColor() override
1116 {
1117 return m_aColor;
1118 }
1119
1120 int CreateQuadContainer(bool AutomaticUpload = true) override;
1121 void QuadContainerChangeAutomaticUpload(int ContainerIndex, bool AutomaticUpload) override;
1122 void QuadContainerUpload(int ContainerIndex) override;
1123 int QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num) override;
1124 int QuadContainerAddQuads(int ContainerIndex, CFreeformItem *pArray, int Num) override;
1125 void QuadContainerReset(int ContainerIndex) override;
1126 void DeleteQuadContainer(int &ContainerIndex) override;
1127 void RenderQuadContainer(int ContainerIndex, int QuadDrawNum) override;
1128 void RenderQuadContainer(int ContainerIndex, int QuadOffset, int QuadDrawNum, bool ChangeWrapMode = true) override;
1129 void RenderQuadContainerEx(int ContainerIndex, int QuadOffset, int QuadDrawNum, float X, float Y, float ScaleX = 1.f, float ScaleY = 1.f) override;
1130 void RenderQuadContainerAsSprite(int ContainerIndex, int QuadOffset, float X, float Y, float ScaleX = 1.f, float ScaleY = 1.f) override;
1131 void RenderQuadContainerAsSpriteMultiple(int ContainerIndex, int QuadOffset, int DrawCount, SRenderSpriteInfo *pRenderInfo) override;
1132
1133 template<typename TName>
1134 void FlushVerticesImpl(bool KeepVertices, int &PrimType, size_t &PrimCount, size_t &NumVerts, TName &Command, size_t VertSize)
1135 {
1136 Command.m_pVertices = nullptr;
1137 if(m_NumVertices == 0)
1138 return;
1139
1140 NumVerts = m_NumVertices;
1141
1142 if(!KeepVertices)
1143 m_NumVertices = 0;
1144
1146 {
1147 if(g_Config.m_GfxQuadAsTriangle && !m_GLUseTrianglesAsQuad)
1148 {
1150 PrimCount = NumVerts / 3;
1151 }
1152 else
1153 {
1155 PrimCount = NumVerts / 4;
1156 }
1157 }
1158 else if(m_Drawing == DRAWING_LINES)
1159 {
1161 PrimCount = NumVerts / 2;
1162 }
1163 else if(m_Drawing == DRAWING_TRIANGLES)
1164 {
1166 PrimCount = NumVerts / 3;
1167 }
1168 else
1169 return;
1170
1171 Command.m_pVertices = (decltype(Command.m_pVertices))AllocCommandBufferData(VertSize * NumVerts);
1172 Command.m_State = m_State;
1173
1174 Command.m_PrimType = PrimType;
1175 Command.m_PrimCount = PrimCount;
1176
1177 AddCmd(Command, [&] {
1178 Command.m_pVertices = (decltype(Command.m_pVertices))m_pCommandBuffer->AllocData(VertSize * NumVerts);
1179 return Command.m_pVertices != nullptr;
1180 });
1181
1183 }
1184
1185 void FlushVertices(bool KeepVertices = false) override;
1186 void FlushVerticesTex3D() override;
1187
1188 void RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *pIndicedVertexDrawNum, size_t NumIndicesOffset) override;
1189 virtual void RenderBorderTiles(int BufferContainerIndex, const ColorRGBA &Color, char *pIndexBufferOffset, const vec2 &Offset, const vec2 &Scale, uint32_t DrawNum) override;
1190 void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo *pQuadInfo, size_t QuadNum, int QuadOffset) override;
1191 void RenderText(int BufferContainerIndex, int TextQuadNum, int TextureSize, int TextureTextIndex, int TextureTextOutlineIndex, const ColorRGBA &TextColor, const ColorRGBA &TextOutlineColor) override;
1192
1193 // modern GL functions
1194 int CreateBufferObject(size_t UploadDataSize, void *pUploadData, int CreateFlags, bool IsMovedPointer = false) override;
1195 void RecreateBufferObject(int BufferIndex, size_t UploadDataSize, void *pUploadData, int CreateFlags, bool IsMovedPointer = false) override;
1196 void UpdateBufferObjectInternal(int BufferIndex, size_t UploadDataSize, void *pUploadData, void *pOffset, bool IsMovedPointer = false);
1197 void CopyBufferObjectInternal(int WriteBufferIndex, int ReadBufferIndex, size_t WriteOffset, size_t ReadOffset, size_t CopyDataSize);
1198 void DeleteBufferObject(int BufferIndex) override;
1199
1200 int CreateBufferContainer(SBufferContainerInfo *pContainerInfo) override;
1201 // destroying all buffer objects means, that all referenced VBOs are destroyed automatically, so the user does not need to save references to them
1202 void DeleteBufferContainer(int &ContainerIndex, bool DestroyAllBO = true) override;
1203 void UpdateBufferContainerInternal(int ContainerIndex, SBufferContainerInfo *pContainerInfo);
1204 void IndicesNumRequiredNotify(unsigned int RequiredIndicesCount) override;
1205
1206 int GetNumScreens() const override;
1207 const char *GetScreenName(int Screen) const override;
1208
1209 void Minimize() override;
1210 void Maximize() override;
1211 void WarnPngliteIncompatibleImages(bool Warn) override;
1212 void SetWindowParams(int FullscreenMode, bool IsBorderless) override;
1213 bool SetWindowScreen(int Index) override;
1214 void Move(int x, int y) override;
1215 bool Resize(int w, int h, int RefreshRate) override;
1216 void ResizeToScreen() override;
1217 void GotResized(int w, int h, int RefreshRate) override;
1218 void UpdateViewport(int X, int Y, int W, int H, bool ByResize) override;
1219 void AddWindowResizeListener(WINDOW_RESIZE_FUNC pFunc) override;
1221 int GetWindowScreen() override;
1222
1223 void WindowDestroyNtf(uint32_t WindowId) override;
1224 void WindowCreateNtf(uint32_t WindowId) override;
1225
1226 int WindowActive() override;
1227 int WindowOpen() override;
1228
1229 void SetWindowGrab(bool Grab) override;
1230 void NotifyWindow() override;
1231
1232 int Init() override;
1233 void Shutdown() override;
1234
1235 void ReadPixel(ivec2 Position, ColorRGBA *pColor) override;
1236 void TakeScreenshot(const char *pFilename) override;
1237 void TakeCustomScreenshot(const char *pFilename) override;
1238 void Swap() override;
1239 bool SetVSync(bool State) override;
1240 bool SetMultiSampling(uint32_t ReqMultiSamplingCount, uint32_t &MultiSamplingCountBackend) override;
1241
1242 int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen) override;
1243 void GetCurrentVideoMode(CVideoMode &CurMode, int Screen) override;
1244
1245 virtual int GetDesktopScreenWidth() const { return g_Config.m_GfxDesktopWidth; }
1246 virtual int GetDesktopScreenHeight() const { return g_Config.m_GfxDesktopHeight; }
1247
1248 // synchronization
1249 void InsertSignal(CSemaphore *pSemaphore) override;
1250 bool IsIdle() const override;
1251 void WaitForIdle() override;
1252
1253 SWarning *GetCurWarning() override;
1254 bool ShowMessageBox(unsigned Type, const char *pTitle, const char *pMsg) override;
1255 bool IsBackendInitialized() override;
1256
1257 bool GetDriverVersion(EGraphicsDriverAgeType DriverAgeType, int &Major, int &Minor, int &Patch, const char *&pName, EBackendType BackendType) override { return m_pBackend->GetDriverVersion(DriverAgeType, Major, Minor, Patch, pName, BackendType); }
1258 bool IsConfigModernAPI() override { return m_pBackend->IsConfigModernAPI(); }
1265
1266 const char *GetVendorString() override;
1267 const char *GetVersionString() override;
1268 const char *GetRendererString() override;
1269
1271};
1272
1273typedef std::function<const char *(const char *, const char *)> TTranslateFunc;
1275
1276#endif // ENGINE_CLIENT_GRAPHICS_THREADED_H
Definition: graphics_threaded.h:18
unsigned char * m_pData
Definition: graphics_threaded.h:19
~CBuffer()
Definition: graphics_threaded.h:31
unsigned m_Used
Definition: graphics_threaded.h:21
void Reset()
Definition: graphics_threaded.h:39
unsigned DataSize() const
Definition: graphics_threaded.h:59
CBuffer(unsigned BufferSize)
Definition: graphics_threaded.h:24
void * Alloc(unsigned Requested, unsigned Alignment=alignof(std::max_align_t))
Definition: graphics_threaded.h:44
unsigned DataUsed() const
Definition: graphics_threaded.h:60
unsigned char * DataPtr()
Definition: graphics_threaded.h:58
unsigned m_Size
Definition: graphics_threaded.h:20
Definition: graphics_threaded.h:16
SCommand * Head()
Definition: graphics_threaded.h:635
GL_SVertexTex3D SVertexTex3D
Definition: graphics_threaded.h:181
bool AddCommandUnsafe(const T &Command)
Definition: graphics_threaded.h:612
void * AllocData(unsigned WantedSize)
Definition: graphics_threaded.h:606
vec2 STexCoord
Definition: graphics_threaded.h:177
SCommand * m_pCmdBufferHead
Definition: graphics_threaded.h:192
@ MAX_VERTICES
Definition: graphics_threaded.h:73
@ MAX_TEXTURES
Definition: graphics_threaded.h:72
ECommandBufferCMD
Definition: graphics_threaded.h:77
@ CMD_MULTISAMPLING
Definition: graphics_threaded.h:130
@ CMD_COPY_BUFFER_OBJECT
Definition: graphics_threaded.h:109
@ CMD_RECREATE_BUFFER_OBJECT
Definition: graphics_threaded.h:107
@ CMD_VSYNC
Definition: graphics_threaded.h:131
@ CMD_TEXT_TEXTURES_DESTROY
Definition: graphics_threaded.h:97
@ CMD_RENDER_BORDER_TILE
Definition: graphics_threaded.h:119
@ CMD_RENDER_QUAD_CONTAINER_SPRITE_MULTIPLE
Definition: graphics_threaded.h:124
@ CMD_TEXTURE_DESTROY
Definition: graphics_threaded.h:95
@ CMD_UPDATE_VIEWPORT
Definition: graphics_threaded.h:134
@ CMD_INDICES_REQUIRED_NUM_NOTIFY
Definition: graphics_threaded.h:116
@ CMD_UPDATE_BUFFER_OBJECT
Definition: graphics_threaded.h:108
@ CMD_TEXTURE_CREATE
Definition: graphics_threaded.h:94
@ CMDGROUP_PLATFORM_GL
Definition: graphics_threaded.h:80
@ CMD_RENDER_TEX3D
Definition: graphics_threaded.h:103
@ CMD_SIGNAL
Definition: graphics_threaded.h:91
@ CMD_RUNBUFFER
Definition: graphics_threaded.h:88
@ CMD_RENDER_QUAD_CONTAINER_EX
Definition: graphics_threaded.h:123
@ CMD_WINDOW_CREATE_NTF
Definition: graphics_threaded.h:137
@ CMDGROUP_CORE
Definition: graphics_threaded.h:79
@ CMD_RENDER_QUAD_CONTAINER
Definition: graphics_threaded.h:122
@ CMD_RENDER_TEXT
Definition: graphics_threaded.h:121
@ CMD_RENDER
Definition: graphics_threaded.h:102
@ CMD_UPDATE_BUFFER_CONTAINER
Definition: graphics_threaded.h:114
@ CMD_WINDOW_DESTROY_NTF
Definition: graphics_threaded.h:138
@ CMD_RENDER_TILE_LAYER
Definition: graphics_threaded.h:118
@ CMD_CLEAR
Definition: graphics_threaded.h:101
@ CMD_TEXT_TEXTURE_UPDATE
Definition: graphics_threaded.h:98
@ CMD_TRY_SWAP_AND_READ_PIXEL
Definition: graphics_threaded.h:132
@ CMD_SWAP
Definition: graphics_threaded.h:127
@ CMD_RENDER_QUAD_LAYER
Definition: graphics_threaded.h:120
@ CMDGROUP_PLATFORM_SDL
Definition: graphics_threaded.h:81
@ CMD_COUNT
Definition: graphics_threaded.h:140
@ CMD_NOP
Definition: graphics_threaded.h:85
@ CMD_FIRST
Definition: graphics_threaded.h:84
@ CMD_CREATE_BUFFER_OBJECT
Definition: graphics_threaded.h:106
@ CMD_DELETE_BUFFER_CONTAINER
Definition: graphics_threaded.h:113
@ CMD_DELETE_BUFFER_OBJECT
Definition: graphics_threaded.h:110
@ CMD_TRY_SWAP_AND_SCREENSHOT
Definition: graphics_threaded.h:133
@ CMD_TEXT_TEXTURES_CREATE
Definition: graphics_threaded.h:96
@ CMD_CREATE_BUFFER_CONTAINER
Definition: graphics_threaded.h:112
@ BLEND_NONE
Definition: graphics_threaded.h:165
@ BLEND_ALPHA
Definition: graphics_threaded.h:166
@ BLEND_ADDITIVE
Definition: graphics_threaded.h:167
@ WRAP_REPEAT
Definition: graphics_threaded.h:172
@ WRAP_CLAMP
Definition: graphics_threaded.h:173
size_t m_CommandCount
Definition: graphics_threaded.h:65
GL_SVertex SVertex
Definition: graphics_threaded.h:180
vec2 SPoint
Definition: graphics_threaded.h:176
GL_SColorf SColorf
Definition: graphics_threaded.h:178
SCommand * m_pCmdBufferTail
Definition: graphics_threaded.h:193
GL_SColor SColor
Definition: graphics_threaded.h:179
@ TEXFLAG_NOMIPMAPS
Definition: graphics_threaded.h:148
@ TEXFLAG_NO_2D_TEXTURE
Definition: graphics_threaded.h:151
@ TEXFORMAT_INVALID
Definition: graphics_threaded.h:145
@ TEXFLAG_TO_3D_TEXTURE
Definition: graphics_threaded.h:149
@ TEXFORMAT_RGBA
Definition: graphics_threaded.h:146
@ TEXFLAG_TO_2D_ARRAY_TEXTURE
Definition: graphics_threaded.h:150
void Reset()
Definition: graphics_threaded.h:640
GL_SVertexTex3DStream SVertexTex3DStream
Definition: graphics_threaded.h:182
CCommandBuffer(unsigned CmdBufferSize, unsigned DataBufferSize)
Definition: graphics_threaded.h:601
size_t m_RenderCallCount
Definition: graphics_threaded.h:66
void AddRenderCalls(size_t RenderCallCountToAdd)
Definition: graphics_threaded.h:650
CBuffer m_CmdBuffer
Definition: graphics_threaded.h:64
CBuffer m_DataBuffer
Definition: graphics_threaded.h:68
@ PRIMTYPE_TRIANGLES
Definition: graphics_threaded.h:160
@ PRIMTYPE_QUADS
Definition: graphics_threaded.h:159
@ PRIMTYPE_LINES
Definition: graphics_threaded.h:158
@ PRIMTYPE_INVALID
Definition: graphics_threaded.h:157
Definition: graphics_threaded.h:750
SWarning * GetCurWarning() override
Definition: graphics_threaded.cpp:2793
void AddVertices(int Count)
Definition: graphics_threaded.cpp:88
void Move(int x, int y) override
Definition: graphics_threaded.cpp:2519
ivec2 m_ReadPixelPosition
Definition: graphics_threaded.h:910
int Init() override
Definition: graphics_threaded.cpp:2362
void DrawRectExt(float x, float y, float w, float h, float r, int Corners) override
Definition: graphics_threaded.cpp:1015
void WindowCreateNtf(uint32_t WindowId) override
Definition: graphics_threaded.cpp:2635
bool IsBackendInitialized() override
Definition: graphics_threaded.cpp:2812
int m_TextureMemoryUsage
Definition: graphics_threaded.h:799
std::vector< WINDOW_PROPS_CHANGED_FUNC > m_vPropChangeListeners
Definition: graphics_threaded.h:853
int CreateBufferObject(size_t UploadDataSize, void *pUploadData, int CreateFlags, bool IsMovedPointer=false) override
Definition: graphics_threaded.cpp:1905
void CopyBufferObjectInternal(int WriteBufferIndex, int ReadBufferIndex, size_t WriteOffset, size_t ReadOffset, size_t CopyDataSize)
Definition: graphics_threaded.cpp:2037
int WindowOpen() override
Definition: graphics_threaded.cpp:2653
void DeleteQuadContainer(int &ContainerIndex) override
Definition: graphics_threaded.cpp:1619
void RenderQuadContainerAsSprite(int ContainerIndex, int QuadOffset, float X, float Y, float ScaleX=1.f, float ScaleY=1.f) override
Definition: graphics_threaded.cpp:1814
bool m_GLHasTextureArraysSupport
Definition: graphics_threaded.h:767
void DrawRect(float x, float y, float w, float h, ColorRGBA Color, int Corners, float Rounding) override
Definition: graphics_threaded.cpp:1290
bool GetDriverVersion(EGraphicsDriverAgeType DriverAgeType, int &Major, int &Minor, int &Patch, const char *&pName, EBackendType BackendType) override
Definition: graphics_threaded.h:1257
void QuadsTex3DEnd() override
Definition: graphics_threaded.cpp:742
int CreateQuadContainer(bool AutomaticUpload=true) override
Definition: graphics_threaded.cpp:1440
int WindowActive() override
Definition: graphics_threaded.cpp:2648
void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY) override
Definition: graphics_threaded.cpp:216
void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo *pQuadInfo, size_t QuadNum, int QuadOffset) override
Definition: graphics_threaded.cpp:1397
CCommandBuffer::SVertexTex3DStream m_aVerticesTex3D[CCommandBuffer::MAX_VERTICES]
Definition: graphics_threaded.h:782
void TakeScreenshot(const char *pFilename) override
Definition: graphics_threaded.cpp:2694
void QuadsBegin() override
Definition: graphics_threaded.cpp:720
CCommandBuffer::SState m_State
Definition: graphics_threaded.h:760
const char * GetVersionString() override
Definition: graphics_threaded.cpp:2822
void ReadPixelDirect(bool *pSwapped)
Definition: graphics_threaded.cpp:2677
const TTwGraphicsGpuList & GetGpus() const override
Definition: graphics_threaded.cpp:211
int InitWindow()
Definition: graphics_threaded.cpp:2235
void LinesBegin() override
Definition: graphics_threaded.cpp:232
IGraphics::CTextureHandle LoadTextureRawMove(CImageInfo &Image, int Flags, const char *pTexName=nullptr) override
Definition: graphics_threaded.cpp:409
const GL_SColor * GetCurColor() override
Definition: graphics_threaded.h:1115
const char * GetRendererString() override
Definition: graphics_threaded.cpp:2827
bool CheckImageDivisibility(const char *pContextName, CImageInfo &Image, int DivX, int DivY, bool AllowResize) override
Definition: graphics_threaded.cpp:567
int m_CurIndex
Definition: graphics_threaded.h:779
void QuadsEnd() override
Definition: graphics_threaded.cpp:730
IGraphicsBackend * m_pBackend
Definition: graphics_threaded.h:761
void SetColor4(ColorRGBA TopLeft, ColorRGBA TopRight, ColorRGBA BottomLeft, ColorRGBA BottomRight) override
Definition: graphics_threaded.cpp:823
virtual void RenderBorderTiles(int BufferContainerIndex, const ColorRGBA &Color, char *pIndexBufferOffset, const vec2 &Offset, const vec2 &Scale, uint32_t DrawNum) override
Definition: graphics_threaded.cpp:1376
std::vector< SWarning > m_vWarnings
Definition: graphics_threaded.h:803
void WindowDestroyNtf(uint32_t WindowId) override
Definition: graphics_threaded.cpp:2622
void AddBackEndWarningIfExists()
Definition: graphics_threaded.cpp:2224
void FlushVerticesTex3D() override
Definition: graphics_threaded.cpp:75
void LinesEnd() override
Definition: graphics_threaded.cpp:239
void UnloadTexture(IGraphics::CTextureHandle *pIndex) override
Definition: graphics_threaded.cpp:291
void TrianglesBegin() override
Definition: graphics_threaded.cpp:749
void BlendNormal() override
Definition: graphics_threaded.cpp:171
char m_aScreenshotName[IO_MAX_PATH_LENGTH]
Definition: graphics_threaded.h:793
void TrianglesEnd() override
Definition: graphics_threaded.cpp:759
void QuadsDrawFreeform(const CFreeformItem *pArray, int Num) override
Definition: graphics_threaded.cpp:916
CCommandBuffer::STexCoord m_aTexture[4]
Definition: graphics_threaded.h:786
void DeleteBufferContainer(int &ContainerIndex, bool DestroyAllBO=true) override
Definition: graphics_threaded.cpp:2096
bool SetMultiSampling(uint32_t ReqMultiSamplingCount, uint32_t &MultiSamplingCountBackend) override
Definition: graphics_threaded.cpp:2756
void QuadsSetSubsetFree(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, int Index=-1) override
Definition: graphics_threaded.cpp:869
bool Uses2DTextureArrays() override
Definition: graphics_threaded.h:1263
int m_FirstFreeVertexArrayInfo
Definition: graphics_threaded.h:819
void TextureSet(CTextureHandle TextureId) override
Definition: graphics_threaded.cpp:702
void QuadsDrawTL(const CQuadItem *pArray, int Num) override
Definition: graphics_threaded.cpp:895
void QuadContainerUpload(int ContainerIndex) override
Definition: graphics_threaded.cpp:1464
bool SetVSync(bool State) override
Definition: graphics_threaded.cpp:2738
bool Resize(int w, int h, int RefreshRate) override
Definition: graphics_threaded.cpp:2537
void ResizeToScreen() override
Definition: graphics_threaded.cpp:2558
bool m_WarnPngliteIncompatibleImages
Definition: graphics_threaded.h:801
std::vector< WINDOW_RESIZE_FUNC > m_vResizeListeners
Definition: graphics_threaded.h:852
void WaitForIdle() override
Definition: graphics_threaded.cpp:2788
IGraphics::CTextureHandle LoadTexture(const char *pFilename, int StorageType, int Flags=0) override
Definition: graphics_threaded.cpp:434
class IStorage * m_pStorage
Definition: graphics_threaded.h:775
void Swap() override
Definition: graphics_threaded.cpp:2709
CTextureHandle m_NullTexture
Definition: graphics_threaded.h:795
void Shutdown() override
Definition: graphics_threaded.cpp:2448
size_t m_FirstFreeTexture
Definition: graphics_threaded.h:798
void QuadsEndKeepVertices() override
Definition: graphics_threaded.cpp:766
void ClipEnable(int x, int y, int w, int h) override
Definition: graphics_threaded.cpp:142
void BlendNone() override
Definition: graphics_threaded.cpp:166
TGLBackendReadPresentedImageData & GetReadPresentedImageDataFuncUnsafe() override
Definition: graphics_threaded.cpp:2832
bool IsConfigModernAPI() override
Definition: graphics_threaded.h:1258
void Maximize() override
Definition: graphics_threaded.cpp:2478
void RenderQuadContainer(int ContainerIndex, int QuadDrawNum) override
Definition: graphics_threaded.cpp:1632
void RenderText(int BufferContainerIndex, int TextQuadNum, int TextureSize, int TextureTextIndex, int TextureTextOutlineIndex, const ColorRGBA &TextColor, const ColorRGBA &TextOutlineColor) override
Definition: graphics_threaded.cpp:1420
ColorRGBA * m_pReadPixelColor
Definition: graphics_threaded.h:911
int m_Drawing
Definition: graphics_threaded.h:791
CGraphics_Threaded()
Definition: graphics_threaded.cpp:107
void AddWindowResizeListener(WINDOW_RESIZE_FUNC pFunc) override
Definition: graphics_threaded.cpp:2607
void KickCommandBuffer()
Definition: graphics_threaded.cpp:620
bool IsTextBufferingEnabled() override
Definition: graphics_threaded.h:1261
void RenderQuadContainerEx(int ContainerIndex, int QuadOffset, int QuadDrawNum, float X, float Y, float ScaleX=1.f, float ScaleY=1.f) override
Definition: graphics_threaded.cpp:1694
CCommandBuffer::SColor m_aColor[4]
Definition: graphics_threaded.h:785
class IConsole * m_pConsole
Definition: graphics_threaded.h:776
const GL_STexCoord * GetCurTextureCoordinates() override
Definition: graphics_threaded.h:1110
void FlushVertices(bool KeepVertices=false) override
Definition: graphics_threaded.cpp:62
float m_Rotation
Definition: graphics_threaded.h:790
void BlendAdditive() override
Definition: graphics_threaded.cpp:176
void Clear(float r, float g, float b, bool ForceClearNow=false) override
Definition: graphics_threaded.cpp:709
@ DRAWING_LINES
Definition: graphics_threaded.h:756
@ NUM_CMDBUFFERS
Definition: graphics_threaded.h:753
@ DRAWING_TRIANGLES
Definition: graphics_threaded.h:757
@ DRAWING_QUADS
Definition: graphics_threaded.h:755
bool m_GLUses2DTextureArrays
Definition: graphics_threaded.h:766
void DrawRectExt4(float x, float y, float w, float h, ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, float r, int Corners) override
Definition: graphics_threaded.cpp:1084
int m_FirstFreeBufferObjectIndex
Definition: graphics_threaded.h:822
void RenderQuadContainerAsSpriteMultiple(int ContainerIndex, int QuadOffset, int DrawCount, SRenderSpriteInfo *pRenderInfo) override
Definition: graphics_threaded.cpp:1819
void DeleteBufferObject(int BufferIndex) override
Definition: graphics_threaded.cpp:2048
void QuadsSetRotation(float Angle) override
Definition: graphics_threaded.cpp:780
int m_NumVertices
Definition: graphics_threaded.h:783
bool m_RenderEnable
Definition: graphics_threaded.h:788
bool IsQuadBufferingEnabled() override
Definition: graphics_threaded.h:1260
void WrapClamp() override
Definition: graphics_threaded.cpp:186
CCommandBuffer * m_pCommandBuffer
Definition: graphics_threaded.h:771
void ReadPixel(ivec2 Position, ColorRGBA *pColor) override
Definition: graphics_threaded.cpp:2668
int GetNumScreens() const override
Definition: graphics_threaded.cpp:2460
int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen) override
Definition: graphics_threaded.cpp:2837
std::vector< int > m_vTextureIndices
Definition: graphics_threaded.h:797
void QuadsDrawCurrentVertices(bool KeepVertices=true) override
Definition: graphics_threaded.cpp:773
void QuadContainerChangeAutomaticUpload(int ContainerIndex, bool AutomaticUpload) override
Definition: graphics_threaded.cpp:1458
void RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *pIndicedVertexDrawNum, size_t NumIndicesOffset) override
Definition: graphics_threaded.cpp:1332
void WrapNormal() override
Definition: graphics_threaded.cpp:181
const char * GetScreenName(int Screen) const override
Definition: graphics_threaded.cpp:2465
bool m_GLQuadBufferingEnabled
Definition: graphics_threaded.h:763
bool UpdateTextTexture(CTextureHandle TextureId, int x, int y, size_t Width, size_t Height, uint8_t *pData, bool IsMovedPointer) override
Definition: graphics_threaded.cpp:487
bool m_GLTileBufferingEnabled
Definition: graphics_threaded.h:762
bool m_DoScreenshot
Definition: graphics_threaded.h:792
bool SetWindowScreen(int Index) override
Definition: graphics_threaded.cpp:2503
void ScreenshotDirect(bool *pSwapped)
Definition: graphics_threaded.cpp:678
void RecreateBufferObject(int BufferIndex, size_t UploadDataSize, void *pUploadData, int CreateFlags, bool IsMovedPointer=false) override
Definition: graphics_threaded.cpp:1965
void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV) override
Definition: graphics_threaded.cpp:856
void UpdateBufferContainerInternal(int ContainerIndex, SBufferContainerInfo *pContainerInfo)
Definition: graphics_threaded.cpp:2125
void WarnPngliteIncompatibleImages(bool Warn) override
Definition: graphics_threaded.cpp:2487
uint64_t TextureMemoryUsage() const override
Definition: graphics_threaded.cpp:191
unsigned m_CurrentCommandBuffer
Definition: graphics_threaded.h:772
void * AllocCommandBufferData(size_t AllocSize)
Definition: graphics_threaded.cpp:1886
CCommandBuffer * m_apCommandBuffers[NUM_CMDBUFFERS]
Definition: graphics_threaded.h:770
const char * GetVendorString() override
Definition: graphics_threaded.cpp:2817
int GetWindowScreen() override
Definition: graphics_threaded.cpp:2617
void DrawRect4(float x, float y, float w, float h, ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, int Corners, float Rounding) override
Definition: graphics_threaded.cpp:1299
std::vector< int > m_vBufferObjectIndices
Definition: graphics_threaded.h:821
bool m_GLQuadContainerBufferingEnabled
Definition: graphics_threaded.h:765
void UpdateBufferObjectInternal(int BufferIndex, size_t UploadDataSize, void *pUploadData, void *pOffset, bool IsMovedPointer=false)
Definition: graphics_threaded.cpp:2011
bool HasTextureArraysSupport() override
Definition: graphics_threaded.h:1264
bool IsIdle() const override
Definition: graphics_threaded.cpp:2783
bool IsTileBufferingEnabled() override
Definition: graphics_threaded.h:1259
void GetCurrentVideoMode(CVideoMode &CurMode, int Screen) override
Definition: graphics_threaded.cpp:2851
uint64_t StreamedMemoryUsage() const override
Definition: graphics_threaded.cpp:201
uint64_t StagingMemoryUsage() const override
Definition: graphics_threaded.cpp:206
bool LoadTextTextures(size_t Width, size_t Height, CTextureHandle &TextTexture, CTextureHandle &TextOutlineTexture, uint8_t *pTextData, uint8_t *pTextOutlineData) override
Definition: graphics_threaded.cpp:453
void UpdateViewport(int X, int Y, int W, int H, bool ByResize) override
Definition: graphics_threaded.cpp:2213
bool IsSpriteTextureFullyTransparent(const CImageInfo &FromImageInfo, const struct CDataSprite *pSprite) override
Definition: graphics_threaded.cpp:342
void ClipDisable() override
Definition: graphics_threaded.cpp:161
void QuadsDraw(CQuadItem *pArray, int Num) override
Definition: graphics_threaded.cpp:884
bool m_GLTextBufferingEnabled
Definition: graphics_threaded.h:764
bool ShowMessageBox(unsigned Type, const char *pTitle, const char *pMsg) override
Definition: graphics_threaded.cpp:2804
bool IsImageFormatRgba(const char *pContextName, const CImageInfo &Image) override
Definition: graphics_threaded.cpp:605
int CreateBufferContainer(SBufferContainerInfo *pContainerInfo) override
Definition: graphics_threaded.cpp:2062
int CreateRectQuadContainer(float x, float y, float w, float h, float r, int Corners) override
Definition: graphics_threaded.cpp:1202
void FlushVerticesImpl(bool KeepVertices, int &PrimType, size_t &PrimCount, size_t &NumVerts, TName &Command, size_t VertSize)
Definition: graphics_threaded.h:1134
void IndicesNumRequiredNotify(unsigned int RequiredIndicesCount) override
Definition: graphics_threaded.cpp:2144
void AddCmd(TName &Cmd, std::function< bool()> FailFunc=[] { return true;})
Definition: graphics_threaded.h:880
void SetWindowGrab(bool Grab) override
Definition: graphics_threaded.cpp:2658
bool LoadPng(CImageInfo &Image, const char *pFilename, int StorageType) override
Definition: graphics_threaded.cpp:536
void AdjustViewport(bool SendViewportChangeToBackend)
Definition: graphics_threaded.cpp:2193
CCommandBuffer::SVertex m_aVertices[CCommandBuffer::MAX_VERTICES]
Definition: graphics_threaded.h:781
int m_FirstFreeQuadContainer
Definition: graphics_threaded.h:850
int QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num) override
Definition: graphics_threaded.cpp:1516
std::vector< SQuadContainer > m_vQuadContainers
Definition: graphics_threaded.h:849
void QuadsDrawTLImpl(TName *pVertices, const CQuadItem *pArray, int Num)
Definition: graphics_threaded.h:1006
void AddWindowPropChangeListener(WINDOW_PROPS_CHANGED_FUNC pFunc) override
Definition: graphics_threaded.cpp:2612
bool m_GLUseTrianglesAsQuad
Definition: graphics_threaded.h:768
class IEngine * m_pEngine
Definition: graphics_threaded.h:777
void FreeTextureIndex(CTextureHandle *pIndex)
Definition: graphics_threaded.cpp:281
void QuadsText(float x, float y, float Size, const char *pText) override
Definition: graphics_threaded.cpp:986
virtual int GetDesktopScreenHeight() const
Definition: graphics_threaded.h:1246
void ChangeColorOfCurrentQuadVertices(float r, float g, float b, float a) override
Definition: graphics_threaded.cpp:833
void SetColor(TName *pVertex, int ColorIndex)
Definition: graphics_threaded.h:983
void TakeCustomScreenshot(const char *pFilename) override
Definition: graphics_threaded.cpp:2703
bool UnloadTextTextures(CTextureHandle &TextTexture, CTextureHandle &TextOutlineTexture) override
Definition: graphics_threaded.cpp:473
bool m_IsForcedViewport
Definition: graphics_threaded.h:807
void SetColorVertex(const CColorVertex *pArray, size_t Num) override
Definition: graphics_threaded.cpp:790
IGraphics::CTextureHandle LoadTextureRaw(const CImageInfo &Image, int Flags, const char *pTexName=nullptr) override
Definition: graphics_threaded.cpp:386
void LinesDraw(const CLineItem *pArray, int Num) override
Definition: graphics_threaded.cpp:246
void SetWindowParams(int FullscreenMode, bool IsBorderless) override
Definition: graphics_threaded.cpp:2492
IGraphics::CTextureHandle FindFreeTextureIndex()
Definition: graphics_threaded.cpp:266
void GotResized(int w, int h, int RefreshRate) override
Definition: graphics_threaded.cpp:2569
std::vector< SVertexArrayInfo > m_vVertexArrayInfo
Definition: graphics_threaded.h:818
bool IsImageSubFullyTransparent(const CImageInfo &FromImageInfo, int x, int y, int w, int h) override
Definition: graphics_threaded.cpp:321
void NotifyWindow() override
Definition: graphics_threaded.cpp:2663
CTextureHandle LoadSpriteTexture(const CImageInfo &FromImageInfo, const struct CDataSprite *pSprite) override
Definition: graphics_threaded.cpp:303
int IssueInit()
Definition: graphics_threaded.cpp:2151
void QuadContainerReset(int ContainerIndex) override
Definition: graphics_threaded.cpp:1607
uint64_t BufferMemoryUsage() const override
Definition: graphics_threaded.cpp:196
void Rotate(const CCommandBuffer::SPoint &rCenter, TName *pPoints, int NumPoints)
Definition: graphics_threaded.h:862
void ChangeColorOfQuadVertices(size_t QuadOffset, unsigned char r, unsigned char g, unsigned char b, unsigned char a) override
Definition: graphics_threaded.cpp:846
void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY) override
Definition: graphics_threaded.cpp:224
void QuadsTex3DBegin() override
Definition: graphics_threaded.cpp:737
void QuadsTex3DDrawTL(const CQuadItem *pArray, int Num) override
Definition: graphics_threaded.cpp:900
bool IsQuadContainerBufferingEnabled() override
Definition: graphics_threaded.h:1262
virtual int GetDesktopScreenWidth() const
Definition: graphics_threaded.h:1245
void DrawCircle(float CenterX, float CenterY, float Radius, int Segments) override
Definition: graphics_threaded.cpp:1307
void Minimize() override
Definition: graphics_threaded.cpp:2470
void InsertSignal(CSemaphore *pSemaphore) override
Definition: graphics_threaded.cpp:2776
Definition: image.h:12
Definition: threading.h:8
Definition: graphics.h:72
Definition: color.h:210
Definition: console.h:18
Definition: graphics.h:501
Definition: engine.h:15
Definition: graphics_threaded.h:672
virtual int WindowActive()=0
virtual bool HasTextureArraysSupport()
Definition: graphics_threaded.h:733
virtual bool HasTileBuffering()
Definition: graphics_threaded.h:728
virtual const char * GetErrorString()
Definition: graphics_threaded.h:734
@ INITFLAG_BORDERLESS
Definition: graphics_threaded.h:679
@ INITFLAG_FULLSCREEN
Definition: graphics_threaded.h:676
@ INITFLAG_DESKTOP_FULLSCREEN
Definition: graphics_threaded.h:681
@ INITFLAG_VSYNC
Definition: graphics_threaded.h:677
@ INITFLAG_RESIZABLE
Definition: graphics_threaded.h:678
@ INITFLAG_HIGHDPI
Definition: graphics_threaded.h:680
virtual bool ShowMessageBox(unsigned Type, const char *pTitle, const char *pMsg)=0
virtual bool UpdateDisplayMode(int Index)=0
virtual bool GetWarning(std::vector< std::string > &WarningStrings)=0
virtual bool IsConfigModernAPI()
Definition: graphics_threaded.h:726
virtual uint64_t StagingMemoryUsage() const =0
virtual void GetViewportSize(int &w, int &h)=0
virtual int GetWindowScreen()=0
virtual const char * GetVendorString()=0
virtual const char * GetScreenName(int Screen) const =0
virtual void WindowCreateNtf(uint32_t WindowId)=0
virtual int Shutdown()=0
virtual void RunBuffer(CCommandBuffer *pBuffer)=0
virtual bool ResizeWindow(int w, int h, int RefreshRate)=0
virtual void NotifyWindow()=0
virtual void GetCurrentVideoMode(CVideoMode &CurMode, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int Screen)=0
virtual bool UseTrianglesAsQuad()
Definition: graphics_threaded.h:727
virtual bool HasQuadContainerBuffering()
Definition: graphics_threaded.h:731
virtual void Minimize()=0
virtual void SetWindowGrab(bool Grab)=0
virtual uint64_t StreamedMemoryUsage() const =0
virtual const char * GetRendererString()=0
virtual void RunBufferSingleThreadedUnsafe(CCommandBuffer *pBuffer)=0
virtual const char * GetVersionString()=0
virtual int Init(const char *pName, int *pScreen, int *pWidth, int *pHeight, int *pRefreshRate, int *pFsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight, int *pCurrentWidth, int *pCurrentHeight, class IStorage *pStorage)=0
virtual void WindowDestroyNtf(uint32_t WindowId)=0
virtual bool GetDriverVersion(EGraphicsDriverAgeType DriverAgeType, int &Major, int &Minor, int &Patch, const char *&pName, EBackendType BackendType)=0
virtual ~IGraphicsBackend()=default
virtual int WindowOpen()=0
virtual uint64_t TextureMemoryUsage() const =0
virtual void Maximize()=0
virtual void WaitForIdle()=0
virtual bool Uses2DTextureArrays()
Definition: graphics_threaded.h:732
virtual bool SetWindowScreen(int Index)=0
virtual void SetWindowParams(int FullscreenMode, bool IsBorderless)=0
virtual uint64_t BufferMemoryUsage() const =0
virtual bool HasTextBuffering()
Definition: graphics_threaded.h:730
virtual void GetVideoModes(CVideoMode *pModes, int MaxModes, int *pNumModes, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int Screen)=0
virtual TGLBackendReadPresentedImageData & GetReadPresentedImageDataFuncUnsafe()=0
virtual int GetNumScreens() const =0
virtual const TTwGraphicsGpuList & GetGpus() const =0
virtual bool IsIdle() const =0
virtual bool HasQuadBuffering()
Definition: graphics_threaded.h:729
Definition: graphics.h:200
Definition: storage.h:20
T x
Definition: vmath.h:19
T y
Definition: vmath.h:23
CConfig g_Config
Definition: config.cpp:12
static SHA256_DIGEST s(const char *pSha256)
Definition: mapbugs.cpp:37
EBackendType
Definition: graphics.h:142
EGraphicsDriverAgeType
Definition: graphics.h:133
std::function< bool(uint32_t &Width, uint32_t &Height, CImageInfo::EImageFormat &Format, std::vector< uint8_t > &vDstData)> TGLBackendReadPresentedImageData
Definition: graphics.h:180
std::function< void()> WINDOW_RESIZE_FUNC
Definition: graphics.h:177
std::function< void()> WINDOW_PROPS_CHANGED_FUNC
Definition: graphics.h:178
std::function< const char *(const char *, const char *)> TTranslateFunc
Definition: graphics_threaded.h:1273
constexpr int CMD_BUFFER_DATA_BUFFER_SIZE
Definition: graphics_threaded.h:12
IGraphicsBackend * CreateGraphicsBackend(TTranslateFunc &&TranslateFunc)
Definition: backend_sdl.cpp:1647
constexpr int CMD_BUFFER_CMD_BUFFER_SIZE
Definition: graphics_threaded.h:13
EGraphicsBackendErrorCodes
Definition: graphics_threaded.h:657
@ GRAPHICS_BACKEND_ERROR_CODE_SDL_SCREEN_INFO_REQUEST_FAILED
Definition: graphics_threaded.h:664
@ GRAPHICS_BACKEND_ERROR_CODE_SDL_INIT_FAILED
Definition: graphics_threaded.h:662
@ GRAPHICS_BACKEND_ERROR_CODE_SDL_SCREEN_RESOLUTION_REQUEST_FAILED
Definition: graphics_threaded.h:665
@ GRAPHICS_BACKEND_ERROR_CODE_NONE
Definition: graphics_threaded.h:659
@ GRAPHICS_BACKEND_ERROR_CODE_SDL_WINDOW_CREATE_FAILED
Definition: graphics_threaded.h:666
@ GRAPHICS_BACKEND_ERROR_CODE_SDL_SCREEN_REQUEST_FAILED
Definition: graphics_threaded.h:663
@ GRAPHICS_BACKEND_ERROR_CODE_GL_VERSION_FAILED
Definition: graphics_threaded.h:661
@ GRAPHICS_BACKEND_ERROR_CODE_GL_CONTEXT_FAILED
Definition: graphics_threaded.h:660
@ GRAPHICS_BACKEND_ERROR_CODE_UNKNOWN
Definition: graphics_threaded.h:658
#define dbg_assert(test, msg)
Definition: system.h:76
Definition: graphics_threaded.h:212
SColorf m_Color
Definition: graphics_threaded.h:215
SCommand_Clear()
Definition: graphics_threaded.h:213
bool m_ForceClear
Definition: graphics_threaded.h:216
Definition: graphics_threaded.h:295
SCommand_CopyBufferObject()
Definition: graphics_threaded.h:296
size_t m_WriteOffset
Definition: graphics_threaded.h:303
int m_WriteBufferIndex
Definition: graphics_threaded.h:299
int m_ReadBufferIndex
Definition: graphics_threaded.h:300
size_t m_ReadOffset
Definition: graphics_threaded.h:302
size_t m_CopySize
Definition: graphics_threaded.h:304
Definition: graphics_threaded.h:316
SCommand_CreateBufferContainer()
Definition: graphics_threaded.h:317
int m_Stride
Definition: graphics_threaded.h:322
int m_VertBufferBindingIndex
Definition: graphics_threaded.h:323
int m_BufferContainerIndex
Definition: graphics_threaded.h:320
size_t m_AttrCount
Definition: graphics_threaded.h:325
SBufferContainerInfo::SAttribute * m_pAttributes
Definition: graphics_threaded.h:326
Definition: graphics_threaded.h:254
size_t m_DataSize
Definition: graphics_threaded.h:262
void * m_pUploadData
Definition: graphics_threaded.h:261
int m_BufferIndex
Definition: graphics_threaded.h:258
bool m_DeletePointer
Definition: graphics_threaded.h:260
SCommand_CreateBufferObject()
Definition: graphics_threaded.h:255
int m_Flags
Definition: graphics_threaded.h:264
Definition: graphics_threaded.h:344
int m_BufferContainerIndex
Definition: graphics_threaded.h:348
bool m_DestroyAllBO
Definition: graphics_threaded.h:349
SCommand_DeleteBufferContainer()
Definition: graphics_threaded.h:345
Definition: graphics_threaded.h:308
SCommand_DeleteBufferObject()
Definition: graphics_threaded.h:309
int m_BufferIndex
Definition: graphics_threaded.h:312
Definition: graphics_threaded.h:353
SCommand_IndicesRequiredNumNotify()
Definition: graphics_threaded.h:354
unsigned int m_RequiredIndicesNum
Definition: graphics_threaded.h:357
Definition: graphics_threaded.h:498
SCommand_MultiSampling()
Definition: graphics_threaded.h:499
bool * m_pRetOk
Definition: graphics_threaded.h:504
uint32_t * m_pRetMultiSamplingCount
Definition: graphics_threaded.h:503
uint32_t m_RequestedMultiSamplingCount
Definition: graphics_threaded.h:502
Definition: graphics_threaded.h:268
void * m_pUploadData
Definition: graphics_threaded.h:275
int m_BufferIndex
Definition: graphics_threaded.h:272
int m_Flags
Definition: graphics_threaded.h:278
size_t m_DataSize
Definition: graphics_threaded.h:276
bool m_DeletePointer
Definition: graphics_threaded.h:274
SCommand_RecreateBufferObject()
Definition: graphics_threaded.h:269
Definition: graphics_threaded.h:376
SState m_State
Definition: graphics_threaded.h:379
uint32_t m_DrawNum
Definition: graphics_threaded.h:382
char * m_pIndicesOffset
Definition: graphics_threaded.h:381
vec2 m_Offset
Definition: graphics_threaded.h:385
SColorf m_Color
Definition: graphics_threaded.h:380
SCommand_RenderBorderTile()
Definition: graphics_threaded.h:377
int m_BufferContainerIndex
Definition: graphics_threaded.h:383
vec2 m_Scale
Definition: graphics_threaded.h:386
SCommand_RenderQuadContainerAsSpriteMultiple()
Definition: graphics_threaded.h:449
SPoint m_Center
Definition: graphics_threaded.h:457
int m_BufferContainerIndex
Definition: graphics_threaded.h:453
unsigned int m_DrawNum
Definition: graphics_threaded.h:460
unsigned int m_DrawCount
Definition: graphics_threaded.h:461
SState m_State
Definition: graphics_threaded.h:451
void * m_pOffset
Definition: graphics_threaded.h:462
IGraphics::SRenderSpriteInfo * m_pRenderInfo
Definition: graphics_threaded.h:455
SColorf m_VertexColor
Definition: graphics_threaded.h:458
Definition: graphics_threaded.h:431
int m_BufferContainerIndex
Definition: graphics_threaded.h:436
void * m_pOffset
Definition: graphics_threaded.h:444
SPoint m_Center
Definition: graphics_threaded.h:439
SState m_State
Definition: graphics_threaded.h:434
float m_Rotation
Definition: graphics_threaded.h:438
SCommand_RenderQuadContainerEx()
Definition: graphics_threaded.h:432
unsigned int m_DrawNum
Definition: graphics_threaded.h:443
SColorf m_VertexColor
Definition: graphics_threaded.h:441
Definition: graphics_threaded.h:419
unsigned int m_DrawNum
Definition: graphics_threaded.h:426
SCommand_RenderQuadContainer()
Definition: graphics_threaded.h:420
void * m_pOffset
Definition: graphics_threaded.h:427
int m_BufferContainerIndex
Definition: graphics_threaded.h:424
SState m_State
Definition: graphics_threaded.h:422
Definition: graphics_threaded.h:390
int m_QuadOffset
Definition: graphics_threaded.h:398
SCommand_RenderQuadLayer()
Definition: graphics_threaded.h:391
SState m_State
Definition: graphics_threaded.h:393
int m_BufferContainerIndex
Definition: graphics_threaded.h:395
SQuadRenderInfo * m_pQuadInfo
Definition: graphics_threaded.h:396
size_t m_QuadNum
Definition: graphics_threaded.h:397
Definition: graphics_threaded.h:244
unsigned m_PrimCount
Definition: graphics_threaded.h:249
SVertexTex3DStream * m_pVertices
Definition: graphics_threaded.h:250
SCommand_RenderTex3D()
Definition: graphics_threaded.h:245
unsigned m_PrimType
Definition: graphics_threaded.h:248
SState m_State
Definition: graphics_threaded.h:247
Definition: graphics_threaded.h:402
ColorRGBA m_TextOutlineColor
Definition: graphics_threaded.h:415
ColorRGBA m_TextColor
Definition: graphics_threaded.h:414
SCommand_RenderText()
Definition: graphics_threaded.h:403
int m_TextureSize
Definition: graphics_threaded.h:408
int m_DrawNum
Definition: graphics_threaded.h:413
int m_TextOutlineTextureIndex
Definition: graphics_threaded.h:411
int m_TextTextureIndex
Definition: graphics_threaded.h:410
SState m_State
Definition: graphics_threaded.h:405
int m_BufferContainerIndex
Definition: graphics_threaded.h:407
Definition: graphics_threaded.h:361
int m_BufferContainerIndex
Definition: graphics_threaded.h:372
SColorf m_Color
Definition: graphics_threaded.h:365
char ** m_pIndicesOffsets
Definition: graphics_threaded.h:368
int m_IndicesDrawNum
Definition: graphics_threaded.h:371
SState m_State
Definition: graphics_threaded.h:364
SCommand_RenderTileLayer()
Definition: graphics_threaded.h:362
unsigned int * m_pDrawCount
Definition: graphics_threaded.h:369
Definition: graphics_threaded.h:234
SVertex * m_pVertices
Definition: graphics_threaded.h:240
SState m_State
Definition: graphics_threaded.h:237
unsigned m_PrimCount
Definition: graphics_threaded.h:239
SCommand_Render()
Definition: graphics_threaded.h:235
unsigned m_PrimType
Definition: graphics_threaded.h:238
Definition: graphics_threaded.h:227
CCommandBuffer * m_pOtherBuffer
Definition: graphics_threaded.h:230
SCommand_RunBuffer()
Definition: graphics_threaded.h:228
Definition: graphics_threaded.h:220
SCommand_Signal()
Definition: graphics_threaded.h:221
CSemaphore * m_pSemaphore
Definition: graphics_threaded.h:223
Definition: graphics_threaded.h:483
SCommand_Swap()
Definition: graphics_threaded.h:484
Definition: graphics_threaded.h:570
uint8_t * m_pData
Definition: graphics_threaded.h:581
SCommand_TextTexture_Update()
Definition: graphics_threaded.h:571
size_t m_Width
Definition: graphics_threaded.h:579
int m_Slot
Definition: graphics_threaded.h:575
int m_X
Definition: graphics_threaded.h:577
int m_Y
Definition: graphics_threaded.h:578
size_t m_Height
Definition: graphics_threaded.h:580
Definition: graphics_threaded.h:544
SCommand_TextTextures_Create()
Definition: graphics_threaded.h:545
int m_SlotOutline
Definition: graphics_threaded.h:550
size_t m_Width
Definition: graphics_threaded.h:552
uint8_t * m_pTextData
Definition: graphics_threaded.h:555
uint8_t * m_pTextOutlineData
Definition: graphics_threaded.h:556
size_t m_Height
Definition: graphics_threaded.h:553
int m_Slot
Definition: graphics_threaded.h:549
Definition: graphics_threaded.h:560
int m_Slot
Definition: graphics_threaded.h:565
int m_SlotOutline
Definition: graphics_threaded.h:566
SCommand_TextTextures_Destroy()
Definition: graphics_threaded.h:561
Definition: graphics_threaded.h:520
SCommand_Texture_Create()
Definition: graphics_threaded.h:521
size_t m_Height
Definition: graphics_threaded.h:528
uint8_t * m_pData
Definition: graphics_threaded.h:531
size_t m_Width
Definition: graphics_threaded.h:527
int m_Flags
Definition: graphics_threaded.h:529
int m_Slot
Definition: graphics_threaded.h:525
Definition: graphics_threaded.h:535
SCommand_Texture_Destroy()
Definition: graphics_threaded.h:536
int m_Slot
Definition: graphics_threaded.h:540
Definition: graphics_threaded.h:466
ivec2 m_Position
Definition: graphics_threaded.h:469
bool * m_pSwapped
Definition: graphics_threaded.h:471
SColorf * m_pColor
Definition: graphics_threaded.h:470
SCommand_TrySwapAndReadPixel()
Definition: graphics_threaded.h:467
Definition: graphics_threaded.h:475
CImageInfo * m_pImage
Definition: graphics_threaded.h:478
SCommand_TrySwapAndScreenshot()
Definition: graphics_threaded.h:476
bool * m_pSwapped
Definition: graphics_threaded.h:479
Definition: graphics_threaded.h:330
SBufferContainerInfo::SAttribute * m_pAttributes
Definition: graphics_threaded.h:340
int m_VertBufferBindingIndex
Definition: graphics_threaded.h:337
int m_BufferContainerIndex
Definition: graphics_threaded.h:334
SCommand_UpdateBufferContainer()
Definition: graphics_threaded.h:331
int m_Stride
Definition: graphics_threaded.h:336
size_t m_AttrCount
Definition: graphics_threaded.h:339
Definition: graphics_threaded.h:282
SCommand_UpdateBufferObject()
Definition: graphics_threaded.h:283
size_t m_DataSize
Definition: graphics_threaded.h:291
void * m_pUploadData
Definition: graphics_threaded.h:290
int m_BufferIndex
Definition: graphics_threaded.h:286
bool m_DeletePointer
Definition: graphics_threaded.h:288
void * m_pOffset
Definition: graphics_threaded.h:289
Definition: graphics_threaded.h:508
SCommand_Update_Viewport()
Definition: graphics_threaded.h:509
int m_Height
Definition: graphics_threaded.h:515
int m_X
Definition: graphics_threaded.h:512
bool m_ByResize
Definition: graphics_threaded.h:516
int m_Width
Definition: graphics_threaded.h:514
int m_Y
Definition: graphics_threaded.h:513
Definition: graphics_threaded.h:489
int m_VSync
Definition: graphics_threaded.h:493
SCommand_VSync()
Definition: graphics_threaded.h:490
bool * m_pRetOk
Definition: graphics_threaded.h:494
Definition: graphics_threaded.h:585
uint32_t m_WindowId
Definition: graphics_threaded.h:589
SCommand_WindowCreateNtf()
Definition: graphics_threaded.h:586
Definition: graphics_threaded.h:593
SCommand_WindowDestroyNtf()
Definition: graphics_threaded.h:594
uint32_t m_WindowId
Definition: graphics_threaded.h:597
Definition: graphics_threaded.h:185
SCommand(unsigned Cmd)
Definition: graphics_threaded.h:187
SCommand * m_pNext
Definition: graphics_threaded.h:190
unsigned m_Cmd
Definition: graphics_threaded.h:189
Definition: graphics_threaded.h:196
bool m_ClipEnable
Definition: graphics_threaded.h:204
int m_Texture
Definition: graphics_threaded.h:199
int m_WrapMode
Definition: graphics_threaded.h:198
int m_ClipW
Definition: graphics_threaded.h:207
SPoint m_ScreenTL
Definition: graphics_threaded.h:200
int m_BlendMode
Definition: graphics_threaded.h:197
SPoint m_ScreenBR
Definition: graphics_threaded.h:201
int m_ClipY
Definition: graphics_threaded.h:206
int m_ClipH
Definition: graphics_threaded.h:208
int m_ClipX
Definition: graphics_threaded.h:205
Definition: client_data.h:29
Definition: graphics_threaded.h:836
CCommandBuffer::SVertex m_aVertices[4]
Definition: graphics_threaded.h:837
Definition: graphics_threaded.h:825
int m_FreeIndex
Definition: graphics_threaded.h:845
int m_QuadBufferObjectIndex
Definition: graphics_threaded.h:842
std::vector< SQuad > m_vQuads
Definition: graphics_threaded.h:840
int m_QuadBufferContainerIndex
Definition: graphics_threaded.h:843
bool m_AutomaticUpload
Definition: graphics_threaded.h:847
SQuadContainer(bool AutomaticUpload=true)
Definition: graphics_threaded.h:826
Definition: graphics_threaded.h:810
SVertexArrayInfo()
Definition: graphics_threaded.h:811
int m_AssociatedBufferObjectIndex
Definition: graphics_threaded.h:814
int m_FreeIndex
Definition: graphics_threaded.h:816
Definition: graphics.h:123
Definition: graphics.h:116
Definition: graphics.h:109
Definition: graphics.h:336
Definition: graphics.h:367
float m_Y
Definition: graphics.h:368
float m_Height
Definition: graphics.h:368
float m_X
Definition: graphics.h:368
float m_Width
Definition: graphics.h:368
Definition: graphics.h:406
Definition: graphics.h:31
Definition: graphics.h:25
Definition: graphics.h:44
Definition: graphics.h:154
Definition: warning.h:5
#define str_format
Definition: system.cpp:2789
@ IO_MAX_PATH_LENGTH
Definition: types.h:43
vector2_base< int > ivec2
Definition: vmath.h:160