glsl: remove glsl ir optimisation loop from linker

We no longer need to call this here and can depend on the glsl_to_nir
pass to call it and clean up anything it cannot handle. Everything
else can now depend on the nir optimisation passes.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
This commit is contained in:
Timothy Arceri
2023-06-22 14:33:53 +10:00
committed by Marge Bot
parent ed3fe89562
commit ac2b3cf7ef
5 changed files with 9 additions and 12 deletions

View File

@@ -210,6 +210,12 @@ glsl_to_nir(const struct gl_constants *consts,
MESA_TRACE_FUNC();
/* NIR cannot handle instructions after a break so we use the GLSL IR do
* lower jumps pass to clean those up for now.
*/
do_lower_jumps(sh->ir, true, true, gl_options->EmitNoMainReturn,
gl_options->EmitNoCont);
/* glsl_to_nir can only handle converting certain function paramaters
* to NIR. If we find something we can't handle then we get the GLSL IR
* opts to remove it before we continue on.

View File

@@ -3667,10 +3667,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (!interstage_cross_validate_uniform_blocks(prog, true))
goto done;
/* Do common optimization before assigning storage for attributes,
* uniforms, and varyings. Later optimization could possibly make
* some of that unused.
*/
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;
@@ -3703,11 +3699,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
}
}
/* Run it just once, since NIR will do the real optimizaiton. */
do_common_optimization(prog->_LinkedShaders[i]->ir, true,
&consts->ShaderCompilerOptions[i],
consts->NativeIntegers);
}
/* Check and validate stream emissions in geometry shaders */

View File

@@ -444,7 +444,7 @@ TEST_F(gl_nir_lower_mediump_test, func_args_in_mediump)
}
)"));
EXPECT_PRED_FORMAT2(glsl_ir_contains, fs_ir, "expression float16_t * (expression float16_t f2fmp (var_ref a) ) (expression float16_t f2fmp (var_ref b) ) )");
EXPECT_PRED_FORMAT2(glsl_ir_contains, fs_ir, "expression float f162f (expression float16_t * (expression float16_t f2fmp (var_ref x) ) (expression float16_t f2fmp (var_ref y) ) )");
/* NIR optimization will notice that we downconvert the highp to mediump just
* to multiply and cast back up, and just multiply in highp instead.

View File

@@ -132,7 +132,7 @@ traces:
checksum: db43c733f3f3d5253e263838e58d9111
paraview/pv-waveletvolume-v2.trace:
gl-vmware-llvmpipe:
checksum: f4af4067b37c00861fa5911e4c0a6629
checksum: 7e0fc4f2f8c635e571793ed8fa705f85
pathfinder/canvas_moire-v2.trace:
gl-vmware-llvmpipe:
checksum: 25ba8f18274126670311bd3ffe058f74

View File

@@ -81,7 +81,7 @@ traces:
label: [crash]
paraview/pv-waveletvolume-v2.trace:
gl-virgl:
checksum: f4af4067b37c00861fa5911e4c0a6629
checksum: 7e0fc4f2f8c635e571793ed8fa705f85
supertuxkart/supertuxkart-mansion-egl-gles-v2.trace:
gl-virgl:
checksum: 4ac8b872bfa701632d76801a3f77c5db