Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_shader.c
| Show All 28 Lines | |||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLI_threads.h" | #include "BLI_threads.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "GPU_extensions.h" | |||||
| #include "GPU_material.h" | #include "GPU_material.h" | ||||
| #include "GPU_shader.h" | #include "GPU_shader.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "draw_manager.h" | #include "draw_manager.h" | ||||
| ▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | static void drw_deferred_shader_compilation_free(void *custom_data) | ||||
| MEM_freeN(comp); | MEM_freeN(comp); | ||||
| } | } | ||||
| static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred) | static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred) | ||||
| { | { | ||||
| /* Do not defer the compilation if we are rendering for image. | /* Do not defer the compilation if we are rendering for image. | ||||
| * deferred rendering is only possible when `evil_C` is available */ | * deferred rendering is only possible when `evil_C` is available */ | ||||
| if (DST.draw_ctx.evil_C == NULL || DRW_state_is_image_render() || !USE_DEFERRED_COMPILATION || | if (DST.draw_ctx.evil_C == NULL || DRW_state_is_image_render() || !USE_DEFERRED_COMPILATION || | ||||
| !deferred) { | !deferred || GPU_main_thread_workaround()) { | ||||
| /* Double checking that this GPUMaterial is not going to be | /* Double checking that this GPUMaterial is not going to be | ||||
| * compiled by another thread. */ | * compiled by another thread. */ | ||||
| DRW_deferred_shader_remove(mat); | DRW_deferred_shader_remove(mat); | ||||
| GPU_material_compile(mat); | GPU_material_compile(mat); | ||||
| return; | return; | ||||
| } | } | ||||
| DRWDeferredShader *dsh = MEM_callocN(sizeof(DRWDeferredShader), "Deferred Shader"); | DRWDeferredShader *dsh = MEM_callocN(sizeof(DRWDeferredShader), "Deferred Shader"); | ||||
| ▲ Show 20 Lines • Show All 441 Lines • Show Last 20 Lines | |||||