summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/dd.h7
-rw-r--r--src/mesa/main/extensions_table.h2
-rw-r--r--src/mesa/main/get_hash_params.py3
-rw-r--r--src/mesa/main/hint.c12
-rw-r--r--src/mesa/main/hint.h4
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/shaderapi.c10
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp5
8 files changed, 44 insertions, 0 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 1214eeaa474..8251af3f667 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1298,6 +1298,13 @@ struct dd_function_table {
void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
struct gl_program *prog);
/*@}*/
+
+ /**
+ * \name Set the number of compiler threads for ARB_parallel_shader_compile
+ */
+ void (*SetMaxShaderCompilerThreads)(struct gl_context *ctx, unsigned count);
+ bool (*GetShaderProgramCompletionStatus)(struct gl_context *ctx,
+ struct gl_shader_program *shprog);
};
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index a9773f701b6..f7eb62108f2 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -99,6 +99,7 @@ EXT(ARB_multisample , dummy_true
EXT(ARB_multitexture , dummy_true , GLL, x , x , x , 1998)
EXT(ARB_occlusion_query , ARB_occlusion_query , GLL, x , x , x , 2001)
EXT(ARB_occlusion_query2 , ARB_occlusion_query2 , GLL, GLC, x , x , 2003)
+EXT(ARB_parallel_shader_compile , dummy_true , GLL, GLC, x , x , 2015)
EXT(ARB_pipeline_statistics_query , ARB_pipeline_statistics_query , GLL, GLC, x , x , 2014)
EXT(ARB_pixel_buffer_object , EXT_pixel_buffer_object , GLL, GLC, x , x , 2004)
EXT(ARB_point_parameters , EXT_point_parameters , GLL, x , x , x , 1997)
@@ -337,6 +338,7 @@ EXT(KHR_blend_equation_advanced_coherent , KHR_blend_equation_advanced_cohere
EXT(KHR_context_flush_control , dummy_true , GLL, GLC, x , ES2, 2014)
EXT(KHR_debug , dummy_true , GLL, GLC, 11, ES2, 2012)
EXT(KHR_no_error , dummy_true , GLL, GLC, ES1, ES2, 2015)
+EXT(KHR_parallel_shader_compile , dummy_true , GLL, GLC, x , ES2, 2017)
EXT(KHR_robust_buffer_access_behavior , ARB_robust_buffer_access_behavior , GLL, GLC, x , ES2, 2014)
EXT(KHR_robustness , KHR_robustness , GLL, GLC, x , ES2, 2012)
EXT(KHR_texture_compression_astc_hdr , KHR_texture_compression_astc_hdr , GLL, GLC, x , ES2, 2012)
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 8b351bcd2d2..60ec1a8598c 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -280,6 +280,9 @@ descriptor=[
# GL_ARB_draw_buffers
[ "MAX_DRAW_BUFFERS_ARB", "CONTEXT_INT(Const.MaxDrawBuffers), NO_EXTRA" ],
+# GL_ARB_parallel_shader_compile
+ [ "MAX_SHADER_COMPILER_THREADS_ARB", "CONTEXT_INT(Hint.MaxShaderCompilerThreads), NO_EXTRA" ],
+
# GL_EXT_framebuffer_object / GL_NV_fbo_color_attachments
[ "MAX_COLOR_ATTACHMENTS", "CONTEXT_INT(Const.MaxColorAttachments), NO_EXTRA" ],
diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c
index 5d0c15d35ab..2bcaeebc4aa 100644
--- a/src/mesa/main/hint.c
+++ b/src/mesa/main/hint.c
@@ -130,6 +130,17 @@ invalid_target:
return;
}
+/* GL_ARB_parallel_shader_compile */
+void GLAPIENTRY
+_mesa_MaxShaderCompilerThreadsKHR(GLuint count)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ ctx->Hint.MaxShaderCompilerThreads = count;
+
+ if (ctx->Driver.SetMaxShaderCompilerThreads)
+ ctx->Driver.SetMaxShaderCompilerThreads(ctx, count);
+}
/**********************************************************************/
/***** Initialization *****/
@@ -146,4 +157,5 @@ void _mesa_init_hint( struct gl_context * ctx )
ctx->Hint.TextureCompression = GL_DONT_CARE;
ctx->Hint.GenerateMipmap = GL_DONT_CARE;
ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE;
+ ctx->Hint.MaxShaderCompilerThreads = 0xffffffff;
}
diff --git a/src/mesa/main/hint.h b/src/mesa/main/hint.h
index 87febfeecc0..2d7c710af26 100644
--- a/src/mesa/main/hint.h
+++ b/src/mesa/main/hint.h
@@ -43,6 +43,10 @@ struct gl_context;
extern void GLAPIENTRY
_mesa_Hint( GLenum target, GLenum mode );
+/* GL_KHR_parallel_shader_compile */
+extern void GLAPIENTRY
+_mesa_MaxShaderCompilerThreadsKHR(GLuint count);
+
extern void
_mesa_init_hint( struct gl_context * ctx );
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 96f30d4a4d5..c1dc52b2ec4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -603,6 +603,7 @@ struct gl_hint_attrib
GLenum16 TextureCompression; /**< GL_ARB_texture_compression */
GLenum16 GenerateMipmap; /**< GL_SGIS_generate_mipmap */
GLenum16 FragmentShaderDerivative; /**< GL_ARB_fragment_shader */
+ GLuint MaxShaderCompilerThreads; /**< GL_ARB_parallel_shader_compile */
};
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 2ea8d965aba..01342c04e8f 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -689,6 +689,12 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
case GL_DELETE_STATUS:
*params = shProg->DeletePending;
return;
+ case GL_COMPLETION_STATUS_ARB:
+ if (ctx->Driver.GetShaderProgramCompletionStatus)
+ *params = ctx->Driver.GetShaderProgramCompletionStatus(ctx, shProg);
+ else
+ *params = GL_TRUE;
+ return;
case GL_LINK_STATUS:
*params = shProg->data->LinkStatus ? GL_TRUE : GL_FALSE;
return;
@@ -960,6 +966,10 @@ get_shaderiv(struct gl_context *ctx, GLuint name, GLenum pname, GLint *params)
case GL_DELETE_STATUS:
*params = shader->DeletePending;
break;
+ case GL_COMPLETION_STATUS_ARB:
+ /* _mesa_glsl_compile_shader is not offloaded to other threads. */
+ *params = GL_TRUE;
+ return;
case GL_COMPILE_STATUS:
*params = shader->CompileStatus ? GL_TRUE : GL_FALSE;
break;
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 672e4ce892a..37edfee587d 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1198,6 +1198,8 @@ const struct function common_desktop_functions_possible[] = {
{ "glRenderbufferStorageMultisampleAdvancedAMD", 11, -1 },
{ "glNamedRenderbufferStorageMultisampleAdvancedAMD", 11, -1 },
+ { "glMaxShaderCompilerThreadsKHR", 11, -1 },
+
{ NULL, 0, -1 }
};
@@ -2244,6 +2246,9 @@ const struct function gles2_functions_possible[] = {
{ "glRenderbufferStorageMultisampleEXT", 20, -1 },
{ "glFramebufferTexture2DMultisampleEXT", 20, -1 },
+ /* GL_KHR_parallel_shader_compile */
+ { "glMaxShaderCompilerThreadsKHR", 20, -1 },
+
{ NULL, 0, -1 }
};