summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorGrigori Goronzy <[email protected]>2017-06-29 04:39:22 +0200
committerGrigori Goronzy <[email protected]>2017-07-14 21:23:40 +0200
commit2bbe235053ca28334eaf4ed7214e2f35b9733bd8 (patch)
treef8d540ccb6556b52b992d61db6eb36b6cf712908 /src/mesa
parent7299e82fa444c86f4c5e22593424715454182e9a (diff)
st/mesa: Add support for KHR_no_error flag
Add a new context flag and plumb it through the various layers of the context creation code to set up dispatch tables for the no-error mode. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_context.c10
-rw-r--r--src/mesa/state_tracker/st_context.h3
-rw-r--r--src/mesa/state_tracker/st_manager.c6
3 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 0b353551da3..560d94ecd23 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -289,7 +289,7 @@ static void st_init_driver_flags(struct st_context *st);
static struct st_context *
st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
- const struct st_config_options *options)
+ const struct st_config_options *options, bool no_error)
{
struct pipe_screen *screen = pipe->screen;
uint i;
@@ -370,6 +370,9 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
+ if (no_error)
+ ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
+
st->has_stencil_export =
screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT);
st->has_shader_model3 = screen->get_param(screen, PIPE_CAP_SM3);
@@ -536,7 +539,8 @@ static void st_init_driver_flags(struct st_context *st)
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
const struct gl_config *visual,
struct st_context *share,
- const struct st_config_options *options)
+ const struct st_config_options *options,
+ bool no_error)
{
struct gl_context *ctx;
struct gl_context *shareCtx = share ? share->ctx : NULL;
@@ -567,7 +571,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
if (debug_get_option_mesa_mvp_dp4())
ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE;
- st = st_create_context_priv(ctx, pipe, options);
+ st = st_create_context_priv(ctx, pipe, options, no_error);
if (!st) {
_mesa_destroy_context(ctx);
}
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 43c8b0853bf..4c742ca8dde 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -398,7 +398,8 @@ extern struct st_context *
st_create_context(gl_api api, struct pipe_context *pipe,
const struct gl_config *visual,
struct st_context *share,
- const struct st_config_options *options);
+ const struct st_config_options *options,
+ bool no_error);
extern void
st_destroy_context(struct st_context *st);
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index d910eec00a1..cb816de8025 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -679,6 +679,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
struct pipe_context *pipe;
struct gl_config mode;
gl_api api;
+ bool no_error = false;
unsigned ctx_flags = PIPE_CONTEXT_PREFER_THREADED;
if (!(stapi->profile_mask & (1 << attribs->profile)))
@@ -705,6 +706,9 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
if (attribs->flags & ST_CONTEXT_FLAG_ROBUST_ACCESS)
ctx_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
+ if (attribs->flags & ST_CONTEXT_FLAG_NO_ERROR)
+ no_error = true;
+
pipe = smapi->screen->context_create(smapi->screen, NULL, ctx_flags);
if (!pipe) {
*error = ST_CONTEXT_ERROR_NO_MEMORY;
@@ -712,7 +716,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
}
st_visual_to_context_mode(&attribs->visual, &mode);
- st = st_create_context(api, pipe, &mode, shared_ctx, &attribs->options);
+ st = st_create_context(api, pipe, &mode, shared_ctx, &attribs->options, no_error);
if (!st) {
*error = ST_CONTEXT_ERROR_NO_MEMORY;
pipe->destroy(pipe);