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