glsl/st: use nir pass to lower indirect rather than GLSL IR

Will allow us to drop more GLSL IR code in future once we switch
all drivers to NIR. Also stops the need for all drivers to call
this pass to remove indirect temps that may have been added during
the NIR varying linking lowering/optimisations.

This patch fixes some tests on i915, d3d12, lima and vc4.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15871>
This commit is contained in:
Timothy Arceri
2022-04-12 11:23:31 +10:00
committed by Marge Bot
parent 619e6d44eb
commit 20ab7046c0
6 changed files with 28 additions and 58 deletions
-10
View File
@@ -1557,8 +1557,6 @@ spec@glsl-1.10@execution@samplers@glsl-fs-sampler-numbering-2,Fail
spec@glsl-1.10@execution@samplers@glsl-fs-sampler-numbering-3,Fail
spec@glsl-1.10@execution@samplers@in-parameter-array,Fail
spec@glsl-1.10@execution@texture3d,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.20@built-in constants,Fail
spec@glsl-1.20@built-in constants@gl_MaxVertexAttribs,Fail
spec@glsl-1.20@execution@fs-nan-builtin-max,Fail
@@ -1589,14 +1587,6 @@ spec@glsl-1.20@execution@tex-miplevel-selection gl2:textureproj(bias) 2d,Fail
spec@glsl-1.20@execution@tex-miplevel-selection gl2:textureproj(bias) 2d_projvec4,Fail
spec@glsl-1.20@execution@tex-miplevel-selection gl2:textureproj(bias) 2dshadow,Fail
spec@glsl-1.20@execution@tex-miplevel-selection gl2:textureproj(bias) 3d,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat4-index-col-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat4-index-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat4-index-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-col-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-wr,Fail
spec@glsl-1.20@execution@vs-nan-builtin-max,Fail
spec@glsl-1.20@execution@vs-nan-builtin-min,Fail
spec@intel_performance_query@intel_performance_query-issue_2235,Fail
@@ -1,4 +1,3 @@
shaders/glsl-predication-on-large-array: fail
spec/amd_shader_trinary_minmax/execution/built-in-functions/cs-max3-float-float-float: skip
spec/amd_shader_trinary_minmax/execution/built-in-functions/cs-max3-int-int-int: skip
spec/amd_shader_trinary_minmax/execution/built-in-functions/cs-max3-ivec2-ivec2-ivec2: skip
@@ -274,14 +273,9 @@ spec/arb_gl_spirv/execution/xfb/vs_two_sets_struct: skip
spec/arb_gl_spirv/linker/uniform/multisampler: skip
spec/arb_gl_spirv/linker/uniform/multisampler-array: skip
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatcentroid-array-of-structs: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatcentroid-block-array: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatcentroid-struct: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatcentroid-struct2: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatoffset-block-array: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatoffset-struct: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatsample-array-nonuniform: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatsample-array-of-array: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatsample-block-array: crash
spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatsample-struct: crash
spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nested-struct-arrays-nonconst: fail
spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers: fail
@@ -320,7 +314,6 @@ spec/arb_gpu_shader_fp64/execution/conversion/vert-conversion-explicit-double-ui
spec/arb_gpu_shader_fp64/execution/conversion/vert-conversion-explicit-dvec2-uvec2: fail
spec/arb_gpu_shader_fp64/execution/conversion/vert-conversion-explicit-dvec3-uvec3: fail
spec/arb_gpu_shader_fp64/execution/conversion/vert-conversion-explicit-dvec4-uvec4: fail
spec/arb_gpu_shader_fp64/execution/fs-indirect-temp-double-dst: fail
spec/arb_gpu_shader_fp64/execution/inout/vs-out-fs-in-s1/2-s2/2-s3/2-double-location-0: crash
spec/arb_gpu_shader_fp64/execution/vs-fs-explicit-locations: crash
spec/arb_gpu_shader_int64/execution/built-in-functions/cs-abs-i64vec2: skip
@@ -611,10 +604,6 @@ spec/arb_tessellation_shader/execution/tcs-output-unmatched: crash
spec/arb_tessellation_shader/execution/tcs-tes-max-in-out-patch-components: crash
spec/arb_tessellation_shader/execution/tes-primitiveid: fail
spec/arb_tessellation_shader/execution/variable-indexing/tcs-input-array-dvec4-index-rd: crash
spec/arb_tessellation_shader/execution/variable-indexing/tcs-input-array-float-index-rd: crash
spec/arb_tessellation_shader/execution/variable-indexing/tcs-input-array-vec2-index-rd: crash
spec/arb_tessellation_shader/execution/variable-indexing/tcs-input-array-vec3-index-rd: crash
spec/arb_tessellation_shader/execution/variable-indexing/tcs-input-array-vec4-index-rd: crash
spec/arb_tessellation_shader/execution/variable-indexing/tcs-output-array-dvec4-index-wr: crash
spec/arb_tessellation_shader/execution/variable-indexing/tcs-output-array-float-index-rd-after-barrier: crash
spec/arb_tessellation_shader/execution/variable-indexing/tcs-output-array-float-index-wr-before-barrier: crash
@@ -4107,9 +4096,9 @@ spec/oes_viewport_array/viewport-gs-writes-out-of-range: skip
summary:
name: results
---- --------
pass: 16135
fail: 1053
crash: 103
pass: 16146
fail: 1051
crash: 94
skip: 2925
timeout: 0
warn: 25
@@ -164,8 +164,6 @@ shaders@glsl-uniform-interstage-limits@520 vs- 1 fs,Fail
shaders@glsl-uniform-interstage-limits@subdivide 5,Fail
shaders@glsl-uniform-interstage-limits@subdivide 5- statechanges,Fail
shaders@glsl-predication-on-large-array,Fail
shaders@ssa@fs-if-def-else-break,Fail
shaders@ssa@fs-lost-copy-problem,Fail
shaders@ssa@fs-swap-problem,Fail
@@ -894,6 +892,7 @@ spec@glsl-1.10@execution@variable-indexing@fs-input-array-vec2-index-rd,Fail
spec@glsl-1.10@execution@variable-indexing@fs-input-array-vec3-index-rd,Fail
spec@glsl-1.10@execution@variable-indexing@fs-input-array-vec4-index-rd,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-array-mat3-index-col-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-array-mat3-index-col-wr,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-array-mat4-index-col-wr,Fail
spec@glsl-1.10@execution@variable-indexing@fs-uniform-array-mat4-index-col-row-rd,Fail
@@ -1057,8 +1056,6 @@ spec@glsl-1.20@execution@built-in-functions@fs-outerproduct-vec3-vec4,Fail
spec@glsl-1.20@execution@built-in-functions@fs-outerproduct-vec4-vec2,Fail
spec@glsl-1.20@execution@built-in-functions@fs-outerproduct-vec4-vec3,Fail
spec@glsl-1.20@execution@built-in-functions@fs-outerproduct-vec4-vec4,Fail
spec@glsl-1.20@execution@fs-const-array-of-struct,Fail
spec@glsl-1.20@execution@fs-const-array-of-struct-of-array,Fail
spec@glsl-1.20@execution@fs-function-inout-array-of-structs,Fail
spec@glsl-1.20@execution@fs-nan-builtin-max,Fail
spec@glsl-1.20@execution@fs-nan-builtin-min,Fail
@@ -1110,7 +1107,6 @@ spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat3-index-col-row-wr,F
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat3-index-col-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat4-index-col-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-array-mat4-index-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-uniform-array-mat4-index-col-row-rd,Fail
spec@glsl-1.20@execution@variable-indexing@fs-varying-array-mat3-index-col-rd,Fail
spec@glsl-1.20@execution@variable-indexing@fs-varying-array-mat3-index-col-row-rd,Fail
@@ -28,25 +28,6 @@ dEQP-GLES2.functional.fragment_ops.depth_stencil.random.7,Fail
dEQP-GLES2.functional.fragment_ops.depth_stencil.random.8,Fail
dEQP-GLES2.functional.fragment_ops.depth_stencil.random.9,Fail
dEQP-GLES2.functional.fragment_ops.depth_stencil.write_mask.stencil,Fail
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_dynamic_loop_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_dynamic_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_static_loop_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_static_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec3_dynamic_loop_write_dynamic_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec3_dynamic_loop_write_static_loop_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec3_dynamic_loop_write_static_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec4_dynamic_loop_write_dynamic_loop_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec4_dynamic_loop_write_dynamic_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec4_dynamic_loop_write_static_loop_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec4_dynamic_loop_write_static_read_vertex,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec3_dynamic_loop_write_dynamic_loop_read,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec3_dynamic_loop_write_dynamic_read,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec3_dynamic_loop_write_static_loop_read,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec3_dynamic_loop_write_static_read,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_dynamic_loop_read,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_dynamic_read,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_static_loop_read,Fail
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_static_read,Fail
dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2d_bias,Fail
dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2dproj_vec3_bias,Fail
dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2dproj_vec4_bias,Fail
@@ -442,10 +423,6 @@ spec@glsl-1.10@execution@variable-indexing@fs-temp-mat4-col-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-mat4-col-wr,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-mat4-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@fs-temp-mat4-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-temp-array-mat4-index-col-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-temp-array-mat4-index-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-temp-array-mat4-index-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-varying-array-mat2-col-row-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-varying-array-mat2-col-wr,Fail
spec@glsl-1.10@execution@variable-indexing@vs-varying-array-mat2-index-col-row-wr,Fail
@@ -537,10 +514,6 @@ spec@glsl-1.20@execution@variable-indexing@fs-temp-mat4-col-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-mat4-col-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-mat4-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@fs-temp-mat4-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-col-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-col-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-temp-array-mat4-index-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-varying-array-mat2-col-row-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-varying-array-mat2-col-wr,Fail
spec@glsl-1.20@execution@variable-indexing@vs-varying-array-mat2-index-col-row-wr,Fail
+3 -2
View File
@@ -82,8 +82,9 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
/* If there are forms of indirect addressing that the driver
* cannot handle, perform the lowering pass.
*/
if (options->EmitNoIndirectInput || options->EmitNoIndirectOutput ||
options->EmitNoIndirectTemp || options->EmitNoIndirectUniform) {
if (!use_nir &&
(options->EmitNoIndirectInput || options->EmitNoIndirectOutput ||
options->EmitNoIndirectTemp || options->EmitNoIndirectUniform)) {
lower_variable_index_to_cond_assign(stage, ir,
options->EmitNoIndirectInput,
options->EmitNoIndirectOutput,
+21
View File
@@ -788,6 +788,27 @@ st_link_nir(struct gl_context *ctx,
for (unsigned i = 0; i < num_shaders; i++) {
struct gl_linked_shader *shader = linked_shader[i];
nir_shader *nir = shader->Program->nir;
gl_shader_stage stage = shader->Stage;
const struct gl_shader_compiler_options *options =
&ctx->Const.ShaderCompilerOptions[stage];
/* If there are forms of indirect addressing that the driver
* cannot handle, perform the lowering pass.
*/
if (options->EmitNoIndirectInput || options->EmitNoIndirectOutput ||
options->EmitNoIndirectTemp || options->EmitNoIndirectUniform) {
nir_variable_mode mode = options->EmitNoIndirectInput ?
nir_var_shader_in : (nir_variable_mode)0;
mode |= options->EmitNoIndirectOutput ?
nir_var_shader_out : (nir_variable_mode)0;
mode |= options->EmitNoIndirectTemp ?
nir_var_function_temp : (nir_variable_mode)0;
mode |= options->EmitNoIndirectUniform ?
nir_var_uniform | nir_var_mem_ubo | nir_var_mem_ssbo :
(nir_variable_mode)0;
nir_lower_indirect_derefs(nir, mode, UINT32_MAX);
}
/* don't infer ACCESS_NON_READABLE so that Program->sh.ImageAccess is
* correct: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3278