| 2876 | } |
| 2877 | |
| 2878 | void Context::rendererExecCommands(CommandBuffer& _cmdbuf) |
| 2879 | { |
| 2880 | _cmdbuf.reset(); |
| 2881 | |
| 2882 | bool end = false; |
| 2883 | |
| 2884 | if (NULL == m_renderCtx) |
| 2885 | { |
| 2886 | uint8_t command; |
| 2887 | _cmdbuf.read(command); |
| 2888 | |
| 2889 | switch (command) |
| 2890 | { |
| 2891 | case CommandBuffer::RendererShutdownEnd: |
| 2892 | m_exit = true; |
| 2893 | return; |
| 2894 | |
| 2895 | case CommandBuffer::End: |
| 2896 | return; |
| 2897 | |
| 2898 | default: |
| 2899 | { |
| 2900 | BX_ASSERT(CommandBuffer::RendererInit == command |
| 2901 | , "RendererInit must be the first command in command buffer before initialization. Unexpected command %d?" |
| 2902 | , command |
| 2903 | ); |
| 2904 | BX_ASSERT(!m_rendererInitialized, "This shouldn't happen! Bad synchronization?"); |
| 2905 | |
| 2906 | Init init; |
| 2907 | _cmdbuf.read(init); |
| 2908 | |
| 2909 | m_renderCtx = rendererCreate(init); |
| 2910 | |
| 2911 | m_rendererInitialized = NULL != m_renderCtx; |
| 2912 | |
| 2913 | if (!m_rendererInitialized) |
| 2914 | { |
| 2915 | _cmdbuf.read(command); |
| 2916 | BX_ASSERT(CommandBuffer::End == command, "Unexpected command %d?" |
| 2917 | , command |
| 2918 | ); |
| 2919 | return; |
| 2920 | } |
| 2921 | } |
| 2922 | break; |
| 2923 | } |
| 2924 | } |
| 2925 | |
| 2926 | do |
| 2927 | { |
| 2928 | uint8_t command; |
| 2929 | _cmdbuf.read(command); |
| 2930 | |
| 2931 | switch (command) |
| 2932 | { |
| 2933 | case CommandBuffer::RendererShutdownBegin: |
| 2934 | { |
| 2935 | BX_ASSERT(m_rendererInitialized, "This shouldn't happen! Bad synchronization?"); |
nothing calls this directly
no test coverage detected