Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_gpu_display.cpp
| Show All 18 Lines | |||||
| #include "device/device.h" | #include "device/device.h" | ||||
| #include "util/util_logging.h" | #include "util/util_logging.h" | ||||
| #include "util/util_opengl.h" | #include "util/util_opengl.h" | ||||
| extern "C" { | extern "C" { | ||||
| bool DRW_opengl_context_release(); | bool DRW_opengl_context_release(); | ||||
| void DRW_opengl_context_activate(bool drw_state); | void DRW_opengl_context_activate(bool drw_state); | ||||
| void *WM_opengl_context_create(); | void *WM_opengl_context_create_from_thread(); | ||||
| void WM_opengl_context_activate(void *gl_context); | void WM_opengl_context_activate(void *gl_context); | ||||
| void WM_opengl_context_dispose(void *gl_context); | void WM_opengl_context_dispose(void *gl_context); | ||||
| void WM_opengl_context_release(void *context); | void WM_opengl_context_release(void *context); | ||||
| } | } | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| /* -------------------------------------------------------------------- | /* -------------------------------------------------------------------- | ||||
| ▲ Show 20 Lines • Show All 452 Lines • ▼ Show 20 Lines | void BlenderGPUDisplay::do_draw() | ||||
| gl_render_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); | gl_render_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); | ||||
| glFlush(); | glFlush(); | ||||
| } | } | ||||
| void BlenderGPUDisplay::gl_context_create() | void BlenderGPUDisplay::gl_context_create() | ||||
| { | { | ||||
| const bool drw_state = DRW_opengl_context_release(); | const bool drw_state = DRW_opengl_context_release(); | ||||
| gl_context_ = WM_opengl_context_create(); | gl_context_ = WM_opengl_context_create_from_thread(); | ||||
| if (!gl_context_) { | if (!gl_context_) { | ||||
| LOG(ERROR) << "Error creating OpenGL context."; | LOG(ERROR) << "Error creating OpenGL context."; | ||||
| } | } | ||||
| WM_opengl_context_release(gl_context_); | |||||
| DRW_opengl_context_activate(drw_state); | DRW_opengl_context_activate(drw_state); | ||||
| } | } | ||||
| bool BlenderGPUDisplay::gl_draw_resources_ensure() | bool BlenderGPUDisplay::gl_draw_resources_ensure() | ||||
| { | { | ||||
| if (!texture_.gl_id_) { | if (!texture_.gl_id_) { | ||||
| /* If there is no texture allocated, there is nothing to draw. Inform the draw call that it can | /* If there is no texture allocated, there is nothing to draw. Inform the draw call that it can | ||||
| * can not continue. Note that this is not an unrecoverable error, so once the texture is known | * can not continue. Note that this is not an unrecoverable error, so once the texture is known | ||||
| ▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines | |||||