diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2012-01-03 22:01:37 +0100 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2012-01-03 22:01:37 +0100 |
| commit | 2991f4071e50cca641044376dc2196d9dcfff80d (patch) | |
| tree | b578297bed74be8d4221f8608d83747c548e7601 /src/engine/client/graphics_threaded.h | |
| parent | 50d872531aae6640f57da98e8dcf6dbae1f9cd82 (diff) | |
| download | zcatch-2991f4071e50cca641044376dc2196d9dcfff80d.tar.gz zcatch-2991f4071e50cca641044376dc2196d9dcfff80d.zip | |
fixed kicking of command buffer if it's full when rendering. fixed compile error on windows
Diffstat (limited to 'src/engine/client/graphics_threaded.h')
| -rw-r--r-- | src/engine/client/graphics_threaded.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index 9f5f442d..51148f0f 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -46,9 +46,10 @@ class CCommandBuffer unsigned DataUsed() { return m_Used; } }; +public: CBuffer m_CmdBuffer; CBuffer m_DataBuffer; -public: + enum { MAX_TEXTURES=1024*4, @@ -251,7 +252,7 @@ public: } template<class T> - void AddCommand(const T &Command) + bool AddCommand(const T &Command) { // make sure that we don't do something stupid like ->AddCommand(&Cmd); (void)static_cast<const SCommand *>(&Command); @@ -259,9 +260,10 @@ public: // allocate and copy the command into the buffer SCommand *pCmd = (SCommand *)m_CmdBuffer.Alloc(sizeof(Command)); if(!pCmd) - return; + return false; mem_copy(pCmd, &Command, sizeof(Command)); pCmd->m_Size = sizeof(Command); + return true; } SCommand *GetCommand(unsigned *pIndex) @@ -278,7 +280,7 @@ public: { m_CmdBuffer.Reset(); m_DataBuffer.Reset(); - } + } }; // interface for the graphics backend @@ -308,10 +310,21 @@ public: class CGraphics_Threaded : public IEngineGraphics { + enum + { + NUM_CMDBUFFERS = 2, + + MAX_VERTICES = 32*1024, + MAX_TEXTURES = 1024*4, + + DRAWING_QUADS=1, + DRAWING_LINES=2 + }; + CCommandBuffer::SState m_State; IGraphicsBackend *m_pBackend; - CCommandBuffer *m_apCommandBuffers[2]; + CCommandBuffer *m_apCommandBuffers[NUM_CMDBUFFERS]; CCommandBuffer *m_pCommandBuffer; unsigned m_CurrentCommandBuffer; @@ -319,15 +332,6 @@ class CGraphics_Threaded : public IEngineGraphics class IStorage *m_pStorage; class IConsole *m_pConsole; - enum - { - MAX_VERTICES = 32*1024, - MAX_TEXTURES = 1024*4, - - DRAWING_QUADS=1, - DRAWING_LINES=2 - }; - CCommandBuffer::SVertex m_aVertices[MAX_VERTICES]; int m_NumVertices; |