MCPcopy Create free account
hub / github.com/defold/defold / NullInitialize

Function NullInitialize

engine/graphics/src/null/graphics_null.cpp:183–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181 }
182
183 static bool NullInitialize(HContext _context, const ContextParams& params)
184 {
185 assert(_context);
186
187 NullContext* context = (NullContext*) _context;
188 uint32_t buffer_size = 4 * dmPlatform::GetWindowWidth(context->m_BaseContext.m_Window) * dmPlatform::GetWindowHeight(context->m_BaseContext.m_Window);
189
190 context->m_MainFrameBuffer.m_ColorBuffer[0] = new char[buffer_size];
191 context->m_MainFrameBuffer.m_ColorBufferSize[0] = buffer_size;
192 context->m_MainFrameBuffer.m_DepthBuffer = new char[buffer_size];
193 context->m_MainFrameBuffer.m_StencilBuffer = new char[buffer_size];
194 context->m_MainFrameBuffer.m_DepthBufferSize = buffer_size;
195 context->m_MainFrameBuffer.m_StencilBufferSize = buffer_size;
196 context->m_CurrentFrameBuffer = &context->m_MainFrameBuffer;
197 context->m_Program = 0x0;
198 context->m_PipelineState = GetDefaultPipelineState();
199 context->m_AsyncProcessingSupport = context->m_JobContext && dmThread::PlatformHasThreadSupport();
200
201 context->m_ContextFeatures |= 1 << CONTEXT_FEATURE_MULTI_TARGET_RENDERING;
202 context->m_ContextFeatures |= 1 << CONTEXT_FEATURE_TEXTURE_ARRAY;
203 context->m_ContextFeatures |= 1 << CONTEXT_FEATURE_COMPUTE_SHADER;
204 context->m_ContextFeatures |= 1 << CONTEXT_FEATURE_INSTANCING;
205 context->m_ContextFeatures |= 1 << CONTEXT_FEATURE_3D_TEXTURES;
206 context->m_ContextFeatures |= 1 << CONTEXT_FEATURE_BLEND_EQUATION_MIN_MAX;
207
208 if (context->m_AsyncProcessingSupport)
209 {
210 context->m_BaseContext.m_AssetHandleContainerMutex = dmMutex::New();
211 InitializeSetTextureAsyncState(context->m_SetTextureAsyncState);
212 }
213
214 if (context->m_BaseContext.m_PrintDeviceInfo)
215 {
216 dmLogInfo("Device: null");
217 }
218
219 SetSwapInterval((HContext) context, params.m_SwapInterval);
220
221 return true;
222 }
223
224 static void NullCloseWindow(HContext _context)
225 {

Callers 1

NullNewContextFunction · 0.85

Calls 8

GetDefaultPipelineStateFunction · 0.85
PlatformHasThreadSupportFunction · 0.85
assertFunction · 0.50
GetWindowWidthFunction · 0.50
GetWindowHeightFunction · 0.50
NewFunction · 0.50
SetSwapIntervalFunction · 0.50

Tested by

no test coverage detected