Added a spinlock template as well as a thread work pool class.

Also, optimized shader compilation to happen on threads.
This commit is contained in:
Juan Linietsky
2019-07-29 12:59:18 -03:00
parent 4fe3ee1730
commit c613ead5fa
37 changed files with 458 additions and 192 deletions

View File

@@ -140,9 +140,6 @@ static PoolVector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_s
ERR_FAIL_COND_V(p_language==RenderingDevice::SHADER_LANGUAGE_HLSL,ret);
// initialize in case it's not initialized. This is done once per thread
// and it's safe to call multiple times
glslang::InitializeProcess();
EShLanguage stages[RenderingDevice::SHADER_STAGE_MAX] = {
EShLangVertex,
EShLangFragment,
@@ -229,6 +226,9 @@ static PoolVector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_s
}
void preregister_glslang_types() {
// initialize in case it's not initialized. This is done once per thread
// and it's safe to call multiple times
glslang::InitializeProcess();
RenderingDevice::shader_set_compile_function(_compile_shader_glsl);
}
@@ -236,5 +236,5 @@ void register_glslang_types() {
}
void unregister_glslang_types() {
glslang::FinalizeProcess();
}