| 1 | #include "backend_null.h" |
|---|---|
| 2 | |
| 3 | #include <engine/client/backend_sdl.h> |
| 4 | |
| 5 | #if defined(CONF_PLATFORM_EMSCRIPTEN) |
| 6 | #include <emscripten/emscripten.h> |
| 7 | #endif |
| 8 | |
| 9 | ERunCommandReturnTypes CCommandProcessorFragment_Null::RunCommand(const CCommandBuffer::SCommand *pBaseCommand) |
| 10 | { |
| 11 | switch(pBaseCommand->m_Cmd) |
| 12 | { |
| 13 | case CCommandProcessorFragment_Null::CMD_INIT: |
| 14 | Cmd_Init(pCommand: static_cast<const SCommand_Init *>(pBaseCommand)); |
| 15 | break; |
| 16 | case CCommandBuffer::CMD_TEXTURE_CREATE: |
| 17 | Cmd_Texture_Create(pCommand: static_cast<const CCommandBuffer::SCommand_Texture_Create *>(pBaseCommand)); |
| 18 | break; |
| 19 | case CCommandBuffer::CMD_TEXT_TEXTURES_CREATE: |
| 20 | Cmd_TextTextures_Create(pCommand: static_cast<const CCommandBuffer::SCommand_TextTextures_Create *>(pBaseCommand)); |
| 21 | break; |
| 22 | case CCommandBuffer::CMD_TEXT_TEXTURE_UPDATE: |
| 23 | Cmd_TextTexture_Update(pCommand: static_cast<const CCommandBuffer::SCommand_TextTexture_Update *>(pBaseCommand)); |
| 24 | break; |
| 25 | case CCommandBuffer::CMD_SWAP: |
| 26 | Cmd_Swap(pCommand: static_cast<const CCommandBuffer::SCommand_Swap *>(pBaseCommand)); |
| 27 | break; |
| 28 | } |
| 29 | return ERunCommandReturnTypes::RUN_COMMAND_COMMAND_HANDLED; |
| 30 | } |
| 31 | |
| 32 | bool CCommandProcessorFragment_Null::Cmd_Init(const SCommand_Init *pCommand) |
| 33 | { |
| 34 | pCommand->m_pCapabilities->m_TileBuffering = false; |
| 35 | pCommand->m_pCapabilities->m_QuadBuffering = false; |
| 36 | pCommand->m_pCapabilities->m_TextBuffering = false; |
| 37 | pCommand->m_pCapabilities->m_QuadContainerBuffering = false; |
| 38 | |
| 39 | pCommand->m_pCapabilities->m_MipMapping = false; |
| 40 | pCommand->m_pCapabilities->m_NPOTTextures = false; |
| 41 | pCommand->m_pCapabilities->m_3DTextures = false; |
| 42 | pCommand->m_pCapabilities->m_2DArrayTextures = false; |
| 43 | pCommand->m_pCapabilities->m_2DArrayTexturesAsExtension = false; |
| 44 | pCommand->m_pCapabilities->m_ShaderSupport = false; |
| 45 | |
| 46 | pCommand->m_pCapabilities->m_TrianglesAsQuads = false; |
| 47 | |
| 48 | pCommand->m_pCapabilities->m_ContextMajor = 0; |
| 49 | pCommand->m_pCapabilities->m_ContextMinor = 0; |
| 50 | pCommand->m_pCapabilities->m_ContextPatch = 0; |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | void CCommandProcessorFragment_Null::Cmd_Texture_Create(const CCommandBuffer::SCommand_Texture_Create *pCommand) |
| 55 | { |
| 56 | free(ptr: pCommand->m_pData); |
| 57 | } |
| 58 | |
| 59 | void CCommandProcessorFragment_Null::Cmd_TextTextures_Create(const CCommandBuffer::SCommand_TextTextures_Create *pCommand) |
| 60 | { |
| 61 | free(ptr: pCommand->m_pTextData); |
| 62 | free(ptr: pCommand->m_pTextOutlineData); |
| 63 | } |
| 64 | |
| 65 | void CCommandProcessorFragment_Null::Cmd_TextTexture_Update(const CCommandBuffer::SCommand_TextTexture_Update *pCommand) |
| 66 | { |
| 67 | free(ptr: pCommand->m_pData); |
| 68 | } |
| 69 | |
| 70 | void CCommandProcessorFragment_Null::Cmd_Swap(const CCommandBuffer::SCommand_Swap *pCommand) |
| 71 | { |
| 72 | #if defined(CONF_PLATFORM_EMSCRIPTEN) |
| 73 | // Return control to the browser's main thread. This is normally done in SDL_GL_SwapWindow, |
| 74 | // but with headless graphics we do not have a GL context to call this function. |
| 75 | emscripten_sleep(0); |
| 76 | #endif |
| 77 | } |
| 78 |