From: Timothy Arceri Date: Wed, 30 Oct 2019 00:24:37 +0000 (+1100) Subject: glsl: just use NIR to lower outputs when driver can't read outputs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0e186c18ba1157ae9dc6c1d6256925ceeab00344;p=mesa.git glsl: just use NIR to lower outputs when driver can't read outputs This will allow us to stop lowering gl_FragData in GLSL IR for NIR drivers which means we won't need the special GLSL IR type handling for building the resource list in a NIR based linker. i965 has been doing this since b828f7a27b2b. Reviewed-by: Marek Olšák --- diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 0e249377ce6..d0ca8b0877b 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -340,6 +340,7 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog, struct gl_shader_program *shader_program, gl_shader_stage stage) { + struct pipe_screen *screen = st->pipe->screen; const nir_shader_compiler_options *options = st->ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions; assert(options); @@ -376,7 +377,8 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog, NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, true); - } else if (nir->info.stage == MESA_SHADER_FRAGMENT) { + } else if (nir->info.stage == MESA_SHADER_FRAGMENT || + !screen->get_param(screen, PIPE_CAP_TGSI_CAN_READ_OUTPUTS)) { NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, false); @@ -660,7 +662,6 @@ st_link_nir(struct gl_context *ctx, struct gl_shader_program *shader_program) { struct st_context *st = st_context(ctx); - struct pipe_screen *screen = st->pipe->screen; unsigned num_linked_shaders = 0; unsigned last_stage = 0; @@ -691,10 +692,6 @@ st_link_nir(struct gl_context *ctx, _mesa_generate_parameters_list_for_uniforms(ctx, shader_program, shader, prog->Parameters); - /* Remove reads from output registers. */ - if (!screen->get_param(screen, PIPE_CAP_TGSI_CAN_READ_OUTPUTS)) - lower_output_reads(shader->Stage, shader->ir); - if (ctx->_Shader->Flags & GLSL_DUMP) { _mesa_log("\n"); _mesa_log("GLSL IR for linked %s program %d:\n",