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

Function AsyncProcessCallback

engine/graphics/src/opengl/graphics_opengl.cpp:4896–4921  ·  view source on GitHub ↗

Called on worker thread

Source from the content-addressed store, hash-verified

4894
4895 // Called on worker thread
4896 static int AsyncProcessCallback(HJobContext, HJob job, void* _context, void* data)
4897 {
4898 OpenGLContext* context = (OpenGLContext*) _context;
4899 uint16_t param_array_index = (uint16_t) (size_t) data;
4900 SetTextureAsyncParams ap = GetSetTextureAsyncParams(context->m_SetTextureAsyncState, param_array_index);
4901
4902 if (dmAtomicGet32(&context->m_DeleteContextRequested))
4903 {
4904 return 0;
4905 }
4906
4907 // TODO: If we use multiple workers, we either need more secondary contexts,
4908 // or we need to guard this call with a mutex.
4909 // The window handle (pointer) isn't protected by a mutex either,
4910 // but it is currently not used with our GLFW version (yet) so
4911 // we don't necessarily need to guard it right now.
4912 SetTexture((HContext) _context, ap.m_Texture, ap.m_Params);
4913 glFlush();
4914
4915 DM_MUTEX_OPTIONAL_SCOPED_LOCK(context->m_BaseContext.m_AssetHandleContainerMutex);
4916 OpenGLTexture* tex = GetAssetFromContainer<OpenGLTexture>(context->m_BaseContext.m_AssetHandleContainer, ap.m_Texture);
4917 int32_t data_state = dmAtomicGet32(&tex->m_Base.m_DataState);
4918 data_state &= ~(1<<ap.m_Params.m_MipMap);
4919 dmAtomicStore32(&tex->m_Base.m_DataState, data_state);
4920 return 0;
4921 }
4922
4923 // Called on thread where we update (which should be the main thread)
4924 static void AsyncCompleteCallback(HJobContext, HJob job, JobSystemStatus status, void* _context, void* data, int result)

Callers

nothing calls this directly

Calls 4

GetSetTextureAsyncParamsFunction · 0.85
dmAtomicGet32Function · 0.85
dmAtomicStore32Function · 0.85
SetTextureFunction · 0.50

Tested by

no test coverage detected