diff options
-rw-r--r-- | docs/GL3.txt | 2 | ||||
-rw-r--r-- | docs/relnotes/11.3.0.html | 1 | ||||
-rw-r--r-- | src/mapi/glapi/gen/KHR_robustness.xml | 66 | ||||
-rw-r--r-- | src/mapi/glapi/gen/KHR_robustness_es.xml | 63 | ||||
-rw-r--r-- | src/mapi/glapi/gen/Makefile.am | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/es_EXT.xml | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_API.xml | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_reset.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_batchbuffer.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_extensions.c | 1 | ||||
-rw-r--r-- | src/mesa/main/context.c | 1 | ||||
-rw-r--r-- | src/mesa/main/context.h | 2 | ||||
-rw-r--r-- | src/mesa/main/extensions_table.h | 1 | ||||
-rw-r--r-- | src/mesa/main/getstring.c | 82 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 7 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 13 |
17 files changed, 268 insertions, 3 deletions
diff --git a/docs/GL3.txt b/docs/GL3.txt index b5f03af245d..21ab46aae95 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -218,7 +218,7 @@ GL 4.5, GLSL 4.50: GL_ARB_shader_texture_image_samples DONE (i965, nv50, nvc0, r600, radeonsi) GL_ARB_texture_barrier DONE (i965, nv50, nvc0, r600, radeonsi) GL_KHR_context_flush_control DONE (all - but needs GLX/EGL extension to be useful) - GL_KHR_robustness not started (90% done with the ARB variant) + GL_KHR_robustness DONE (i965) GL_EXT_shader_integer_mix DONE (all drivers that support GLSL) These are the extensions cherry-picked to make GLES 3.1 diff --git a/docs/relnotes/11.3.0.html b/docs/relnotes/11.3.0.html index e6ed538b3ef..53e453a5518 100644 --- a/docs/relnotes/11.3.0.html +++ b/docs/relnotes/11.3.0.html @@ -60,6 +60,7 @@ Note: some of the new features are only available with certain drivers. <li>GL_ATI_fragment_shader on all Gallium drivers</li> <li>GL_EXT_base_instance on all drivers that support GL_ARB_base_instance</li> <li>GL_EXT_clip_cull_distance on all drivers that support GL_ARB_cull_distance</li> +<li>GL_KHR_robustness on i965</li> <li>GL_OES_draw_buffers_indexed and GL_EXT_draw_buffers_indexed on all drivers that support GL_ARB_draw_buffers_blend</li> <li>GL_OES_gpu_shader5 and GL_EXT_gpu_shader5 on all drivers that support GL_ARB_gpu_shader5</li> <li>GL_OES_sample_shading on i965, nvc0, r600, radeonsi</li> diff --git a/src/mapi/glapi/gen/KHR_robustness.xml b/src/mapi/glapi/gen/KHR_robustness.xml new file mode 100644 index 00000000000..56bcfcc519a --- /dev/null +++ b/src/mapi/glapi/gen/KHR_robustness.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + + +<OpenGLAPI> + +<category name="GL_KHR_robustness" number="170"> + + <enum name="GUILTY_CONTEXT_RESET" value="0x8253"/> + <enum name="INNOCENT_CONTEXT_RESET" value="0x8254"/> + <enum name="UNKNOWN_CONTEXT_RESET" value="0x8255"/> + + <enum name="RESET_NOTIFICATION_STRATEGY" count="1" value="0x8256"> + <size name="Get" mode="get"/> + </enum> + <enum name="LOSE_CONTEXT_ON_RESET" value="0x8252"/> + <enum name="NO_RESET_NOTIFICATION" value="0x8261"/> + + <enum name="CONTEXT_FLAG_ROBUST_ACCESS_BIT" value="0x00000004"/> + + <!-- This extension applies to both GL and ES. GL entrypoints have + no suffix, ES entrypoints have the KHR suffix. This file + defines entry points for GL. --> + + <!-- GL definitions --> + <function name="GetGraphicsResetStatus" alias="GetGraphicsResetStatusARB"> + <return type="GLenum"/> + </function> + + <function name="ReadnPixels" alias="ReadnPixelsARB"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="bufSize" type="GLsizei"/> + <param name="data" type="GLvoid *" output="true"/> + </function> + + <function name="GetnUniformfv" alias="GetnUniformfvARB"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="bufSize" type="GLsizei"/> + <param name="params" type="GLfloat *" output="true"/> + </function> + + <function name="GetnUniformiv" alias="GetnUniformivARB"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="bufSize" type="GLsizei"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="GetnUniformuiv" alias="GetnUniformuivARB"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="bufSize" type="GLsizei"/> + <param name="params" type="GLuint *" output="true"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/src/mapi/glapi/gen/KHR_robustness_es.xml b/src/mapi/glapi/gen/KHR_robustness_es.xml new file mode 100644 index 00000000000..84f6fd2cdb9 --- /dev/null +++ b/src/mapi/glapi/gen/KHR_robustness_es.xml @@ -0,0 +1,63 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<OpenGLAPI> + +<category name="GL_KHR_robustness" number="190"> + + <enum name="GUILTY_CONTEXT_RESET_KHR" value="0x8253"/> + <enum name="INNOCENT_CONTEXT_RESET_KHR" value="0x8254"/> + <enum name="UNKNOWN_CONTEXT_RESET_KHR" value="0x8255"/> + + <enum name="RESET_NOTIFICATION_STRATEGY_KHR" count="1" value="0x8256"> + <size name="Get" mode="get"/> + </enum> + <enum name="LOSE_CONTEXT_ON_RESET_KHR" value="0x8252"/> + <enum name="NO_RESET_NOTIFICATION_KHR" value="0x8261"/> + + <enum name="CONTEXT_FLAG_ROBUST_ACCESS_BIT_KHR" value="0x00000004"/> + + <!-- This extension applies to both GL and ES. GL entrypoints have + no suffix, ES entrypoints have the KHR suffix. This file + defines entry points for ES. --> + + <function name="GetGraphicsResetStatusKHR" + alias="GetGraphicsResetStatusARB" es2="2.0"> + <return type="GLenum"/> + </function> + + <function name="ReadnPixelsKHR" alias="ReadnPixelsARB" es2="2.0"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="bufSize" type="GLsizei"/> + <param name="data" type="GLvoid *" output="true"/> + </function> + + <function name="GetnUniformfvKHR" alias="GetnUniformfvARB" es2="2.0"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="bufSize" type="GLsizei"/> + <param name="params" type="GLfloat *" output="true"/> + </function> + + <function name="GetnUniformivKHR" alias="GetnUniformivARB" es2="2.0"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="bufSize" type="GLsizei"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="GetnUniformuivKHR" alias="GetnUniformuivARB" es2="2.0"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="bufSize" type="GLsizei"/> + <param name="params" type="GLuint *" output="true"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am index 0759819a4cd..c511de932eb 100644 --- a/src/mapi/glapi/gen/Makefile.am +++ b/src/mapi/glapi/gen/Makefile.am @@ -192,6 +192,8 @@ API_XML = \ INTEL_performance_query.xml \ KHR_debug.xml \ KHR_context_flush_control.xml \ + KHR_robustness.xml \ + KHR_robustness_es.xml \ KHR_texture_compression_astc.xml \ NV_conditional_render.xml \ NV_primitive_restart.xml \ diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml index ce4c4c49bed..6886dab2fd1 100644 --- a/src/mapi/glapi/gen/es_EXT.xml +++ b/src/mapi/glapi/gen/es_EXT.xml @@ -924,6 +924,8 @@ </category> +<xi:include href="KHR_robustness_es.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <category name="GL_EXT_base_instance" number="203"> <function name="DrawArraysInstancedBaseInstanceEXT" es2="3.0" diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 2fcba0bd057..766fe3c8098 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8288,6 +8288,9 @@ <xi:include href="KHR_context_flush_control.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<!-- ARB extension 170 --> +<xi:include href="KHR_robustness.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <!-- ARB extension 171 --> <xi:include href="ARB_pipeline_statistics_query.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 51554757f5b..4b2220126a1 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1704,6 +1704,8 @@ gen7_emit_urb_state(struct brw_context *brw, /* brw_reset.c */ extern GLenum brw_get_graphics_reset_status(struct gl_context *ctx); +void +brw_check_for_reset(struct brw_context *brw); /* brw_compute.c */ extern void diff --git a/src/mesa/drivers/dri/i965/brw_reset.c b/src/mesa/drivers/dri/i965/brw_reset.c index e3182b1474f..df734e5f0fb 100644 --- a/src/mesa/drivers/dri/i965/brw_reset.c +++ b/src/mesa/drivers/dri/i965/brw_reset.c @@ -20,6 +20,9 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#include "main/context.h" + #include "brw_context.h" /** @@ -73,3 +76,20 @@ brw_get_graphics_reset_status(struct gl_context *ctx) return GL_NO_ERROR; } + +void +brw_check_for_reset(struct brw_context *brw) +{ + uint32_t reset_count; + uint32_t active; + uint32_t pending; + int err; + + err = drm_intel_get_reset_stats(brw->hw_ctx, &reset_count, &active, + &pending); + if (err) + return; + + if (active > 0 || pending > 0) + _mesa_set_context_lost_dispatch(&brw->ctx); +} diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index f220311842a..5a0db9f5db3 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -368,6 +368,9 @@ do_flush_locked(struct brw_context *brw) if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) do_batch_dump(brw); + if (brw->ctx.Const.ResetStrategy == GL_LOSE_CONTEXT_ON_RESET_ARB) + brw_check_for_reset(brw); + if (ret != 0) { fprintf(stderr, "intel_do_flush_locked failed: %s\n", strerror(-ret)); exit(1); diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index feea6cac5f2..b8d75170d94 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -246,6 +246,7 @@ intelInitExtensions(struct gl_context *ctx) ctx->Extensions.EXT_texture_sRGB_decode = true; ctx->Extensions.EXT_texture_swizzle = true; ctx->Extensions.EXT_vertex_array_bgra = true; + ctx->Extensions.KHR_robustness = true; ctx->Extensions.AMD_seamless_cubemap_per_texture = true; ctx->Extensions.APPLE_object_purgeable = true; ctx->Extensions.ATI_separate_stencil = true; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7c0a6ef340a..172c8548be9 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1367,6 +1367,7 @@ _mesa_free_context_data( struct gl_context *ctx ) free(ctx->BeginEnd); free(ctx->OutsideBeginEnd); free(ctx->Save); + free(ctx->ContextLost); /* Shared context state (display lists, textures, etc) */ _mesa_reference_shared_state(ctx, &ctx->Shared, NULL); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 46444d2c427..ef19cc68d2d 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -158,6 +158,8 @@ _mesa_notifySwapBuffers(struct gl_context *gc); extern struct _glapi_table * _mesa_get_dispatch(struct gl_context *ctx); +extern void +_mesa_set_context_lost_dispatch(struct gl_context *ctx); extern GLboolean _mesa_valid_to_render(struct gl_context *ctx, const char *where); diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index a809023dcfe..e3c91ef427b 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -279,6 +279,7 @@ EXT(INTEL_performance_query , INTEL_performance_query EXT(KHR_context_flush_control , dummy_true , GLL, GLC, x , ES2, 2014) EXT(KHR_debug , dummy_true , GLL, GLC, 11, ES2, 2012) 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) EXT(KHR_texture_compression_astc_ldr , KHR_texture_compression_astc_ldr , GLL, GLC, x , ES2, 2012) diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 92f8a389cd9..125b03aeca6 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -31,7 +31,8 @@ #include "enums.h" #include "extensions.h" #include "mtypes.h" - +#include "macros.h" +#include "main/dispatch.h" /* for _gloffset_COUNT */ /** * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. @@ -310,6 +311,82 @@ _mesa_GetError( void ) return e; } +static void +_context_lost_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, + GLint *values) +{ + GET_CURRENT_CONTEXT(ctx); + if (ctx) + _mesa_error(ctx, GL_CONTEXT_LOST, "GetSynciv(invalid call)"); + + if (pname == GL_SYNC_STATUS && bufSize >= 1) + *values = GL_SIGNALED; +} + +static void +_context_lost_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params) +{ + GET_CURRENT_CONTEXT(ctx); + if (ctx) + _mesa_error(ctx, GL_CONTEXT_LOST, "GetQueryObjectuiv(context lost)"); + + if (pname == GL_QUERY_RESULT_AVAILABLE) + *params = GL_TRUE; +} + +static int +context_lost_nop_handler(void) +{ + GET_CURRENT_CONTEXT(ctx); + if (ctx) + _mesa_error(ctx, GL_CONTEXT_LOST, "context lost"); + + return 0; +} + +void +_mesa_set_context_lost_dispatch(struct gl_context *ctx) +{ + if (ctx->ContextLost == NULL) { + int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT); + + ctx->ContextLost = malloc(numEntries * sizeof(_glapi_proc)); + if (!ctx->ContextLost) + return; + + _glapi_proc *entry = (_glapi_proc *) ctx->ContextLost; + unsigned i; + for (i = 0; i < numEntries; i++) + entry[i] = (_glapi_proc) context_lost_nop_handler; + + /* The ARB_robustness specification says: + * + * "* GetError and GetGraphicsResetStatus behave normally following a + * graphics reset, so that the application can determine a reset + * has occurred, and when it is safe to destroy and recreate the + * context. + * + * * Any commands which might cause a polling application to block + * indefinitely will generate a CONTEXT_LOST error, but will also + * return a value indicating completion to the application. Such + * commands include: + * + * + GetSynciv with <pname> SYNC_STATUS ignores the other + * parameters and returns SIGNALED in <values>. + * + * + GetQueryObjectuiv with <pname> QUERY_RESULT_AVAILABLE + * ignores the other parameters and returns TRUE in <params>." + */ + SET_GetError(ctx->ContextLost, _mesa_GetError); + SET_GetGraphicsResetStatusARB(ctx->ContextLost, _mesa_GetGraphicsResetStatusARB); + SET_GetSynciv(ctx->ContextLost, _context_lost_GetSynciv); + SET_GetQueryObjectuiv(ctx->ContextLost, _context_lost_GetQueryObjectuiv); + } + + ctx->CurrentDispatch = ctx->ContextLost; + _glapi_set_dispatch(ctx->CurrentDispatch); +} + /** * Returns an error code specified by GL_ARB_robustness, or GL_NO_ERROR. * \return current context status @@ -358,6 +435,9 @@ _mesa_GetGraphicsResetStatusARB( void ) mtx_unlock(&ctx->Shared->Mutex); } + if (status != GL_NO_ERROR) + _mesa_set_context_lost_dispatch(ctx); + if (!ctx->Driver.GetGraphicsResetStatus && (MESA_VERBOSE & VERBOSE_API)) _mesa_debug(ctx, "glGetGraphicsResetStatusARB always returns GL_NO_ERROR " diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b7b3ede57f1..e16663d2880 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3899,6 +3899,7 @@ struct gl_extensions GLboolean ATI_separate_stencil; GLboolean GREMEDY_string_marker; GLboolean INTEL_performance_query; + GLboolean KHR_robustness; GLboolean KHR_texture_compression_astc_hdr; GLboolean KHR_texture_compression_astc_ldr; GLboolean MESA_pack_invert; @@ -4302,7 +4303,11 @@ struct gl_context */ struct _glapi_table *BeginEnd; /** - * Tracks the current dispatch table out of the 3 above, so that it can be + * Dispatch table for when a graphics reset has happened. + */ + struct _glapi_table *ContextLost; + /** + * Tracks the current dispatch table out of the 4 above, so that it can be * re-set on glXMakeCurrent(). */ struct _glapi_table *CurrentDispatch; diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index c85bc54fe35..e81aaa26064 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -852,6 +852,12 @@ const struct function common_desktop_functions_possible[] = { // { "glTextureStorage3DMultisampleEXT", 43, -1 }, // XXX: Add to xml /* GL 4.5 */ + /* aliased versions checked above */ + //{ "glGetGraphicsResetStatus", 45, -1 }, + //{ "glReadnPixels", 45, -1 }, + //{ "glGetnUniformfv", 45, -1 }, + //{ "glGetnUniformiv", 45, -1 }, + //{ "glGetnUniformuiv", 45, -1 }, { "glMemoryBarrierByRegion", 45, -1 }, /* GL_ARB_internalformat_query */ @@ -2306,6 +2312,13 @@ const struct function gles2_functions_possible[] = { /* GL_EXT_polygon_offset_clamp */ { "glPolygonOffsetClampEXT", 11, -1 }, + /* GL_KHR_robustness */ + { "glGetGraphicsResetStatusKHR", 20, -1 }, + { "glReadnPixelsKHR", 20, -1 }, + { "glGetnUniformfvKHR", 20, -1 }, + { "glGetnUniformivKHR", 20, -1 }, + { "glGetnUniformuivKHR", 20, -1 }, + { NULL, 0, -1 } }; |