This makes MESA_NO_ERROR and mesa_no_error via drirc do the same thing.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14701>
#include "state_tracker/st_context.h"
#include "util/u_memory.h"
+#include "util/debug.h"
GLboolean
dri_create_context(gl_api api, const struct gl_config * visual,
ctx->cPriv = cPriv;
ctx->sPriv = sPriv;
- if (driQueryOptionb(&screen->dev->option_cache, "mesa_no_error"))
- attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
+ /* KHR_no_error is likely to crash, overflow memory, etc if an application
+ * has errors so don't enable it for setuid processes.
+ */
+ if (env_var_as_boolean("MESA_NO_ERROR", false) ||
+ driQueryOptionb(&screen->dev->option_cache, "mesa_no_error"))
+#if !defined(_WIN32)
+ if (geteuid() == getuid())
+#endif
+ attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
attribs.options = screen->options;
dri_fill_st_visual(&attribs.visual, screen, visual);
GLboolean
_mesa_initialize_context(struct gl_context *ctx,
gl_api api,
+ bool no_error,
const struct gl_config *visual,
struct gl_context *share_list,
const struct dd_function_table *driverFunctions)
if (!init_attrib_groups( ctx ))
goto fail;
- /* KHR_no_error is likely to crash, overflow memory, etc if an application
- * has errors so don't enable it for setuid processes.
- */
- if (env_var_as_boolean("MESA_NO_ERROR", false)) {
-#if !defined(_WIN32)
- if (geteuid() == getuid())
-#endif
- ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
- }
+ if (no_error)
+ ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
/* setup the API dispatch tables with all nop functions */
ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table(false);
extern GLboolean
_mesa_initialize_context( struct gl_context *ctx,
gl_api api,
+ bool no_error,
const struct gl_config *visual,
struct gl_context *share_list,
const struct dd_function_table *driverFunctions);
static struct st_context *
st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
- const struct st_config_options *options, bool no_error)
+ const struct st_config_options *options)
{
struct pipe_screen *screen = pipe->screen;
uint i;
st->util_velems.velems[2].src_format = PIPE_FORMAT_R32G32_FLOAT;
}
- if (no_error)
- ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
-
ctx->Const.PackedDriverUniformStorage =
screen->get_param(screen, PIPE_CAP_PACKED_UNIFORMS);
ctx->pipe = pipe;
ctx->screen = pipe->screen;
- if (!_mesa_initialize_context(ctx, api, visual, shareCtx, &funcs)) {
+ if (!_mesa_initialize_context(ctx, api, no_error, visual, shareCtx, &funcs)) {
align_free(ctx);
return NULL;
}
if (pipe->screen->get_param(pipe->screen, PIPE_CAP_INVALIDATE_BUFFER))
ctx->has_invalidate_buffer = true;
- st = st_create_context_priv(ctx, pipe, options, no_error);
+ st = st_create_context_priv(ctx, pipe, options);
if (!st) {
_mesa_free_context_data(ctx, true);
align_free(ctx);