From a853de0c95d5dce7aee983efd243377ffe3a6e91 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 23 Dec 2019 11:37:57 +1100 Subject: glsl: use nir linker to link atomics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Alejandro PiƱeiro --- src/mesa/state_tracker/st_context.c | 5 +++++ src/mesa/state_tracker/st_glsl_to_nir.cpp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 992f9fe00c9..72e1a50bca3 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -765,6 +765,11 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].PositionAlwaysInvariant = options->vs_position_always_invariant; + enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir) + screen->get_shader_param(screen, PIPE_SHADER_VERTEX, + PIPE_SHADER_CAP_PREFERRED_IR); + ctx->Const.UseNIRGLSLLinker = preferred_ir == PIPE_SHADER_IR_NIR; + if (ctx->Const.GLSLVersion < 400) { for (i = 0; i < MESA_SHADER_STAGES; i++) ctx->Const.ShaderCompilerOptions[i].EmitNoIndirectSampler = true; diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 11b6db490b9..c92b1c365a7 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -736,8 +736,12 @@ st_link_nir(struct gl_context *ctx, if (num_shaders == 1) st_nir_opts(linked_shader[0]->Program->nir); - if (!shader_program->data->spirv) + if (!shader_program->data->spirv) { + if (!gl_nir_link_glsl(ctx, shader_program)) + return GL_FALSE; + nir_build_program_resource_list(ctx, shader_program, false); + } for (unsigned i = 0; i < num_shaders; i++) { struct gl_linked_shader *shader = linked_shader[i]; -- cgit v1.2.3