Commit f3df3d4c authored by Emma Anholt's avatar Emma Anholt Committed by Marge Bot
Browse files

glsl: Make all drivers take the GLSLOptimizeConservatively path.



Now that all consumers of GLSL use NIR, make the remaining drivers take
the path that relies on NIR to really do optimization.

nouveau steam shader-db runtime -6.69631% +/- 1.29235% (n=12).
No change on shader-db there.
Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
Reviewed-by: Karol Herbst's avatarKarol Herbst <kherbst@redhat.com>
Reviewed-by: Rob Clark's avatarRob Clark <robdclark@chromium.org>
Reviewed-by: Timothy Arceri's avatarTimothy Arceri <tarceri@itsqueeze.com>
Part-of: <!16364>
parent d100c07c
Pipeline #581920 waiting for manual action with stages
in 3 minutes and 27 seconds
......@@ -412,9 +412,6 @@ The integer capabilities:
ARB_transform_feedback3.
* ``PIPE_CAP_SHADER_CAN_READ_OUTPUTS``: Whether every TGSI shader stage can read
from the output file.
* ``PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY``: Tell the GLSL compiler to use
the minimum amount of optimizations just to be able to do all the linking
and lowering.
* ``PIPE_CAP_FBFETCH``: The number of render targets whose value in the
current framebuffer can be read in the shader. 0 means framebuffer fetch
is not supported. 1 means that only the first render target can be read,
......
......@@ -2109,18 +2109,12 @@ opt_shader_and_create_symbol_table(const struct gl_constants *consts,
&consts->ShaderCompilerOptions[shader->Stage];
/* Do some optimization at compile time to reduce shader IR size
* and reduce later work if the same shader is linked multiple times
* and reduce later work if the same shader is linked multiple times.
*
* Run it just once, since NIR will do the real optimization.
*/
if (consts->GLSLOptimizeConservatively) {
/* Run it just once. */
do_common_optimization(shader->ir, false, false, options,
consts->NativeIntegers);
} else {
/* Repeat it until it stops making changes. */
while (do_common_optimization(shader->ir, false, false, options,
consts->NativeIntegers))
;
}
do_common_optimization(shader->ir, false, false, options,
consts->NativeIntegers);
validate_ir_tree(shader->ir);
......@@ -2470,12 +2464,8 @@ do_common_optimization(exec_list *ir, bool linked,
delete ls;
}
/* If the PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY cap is set, this pass will
* only be called once rather than repeatedly until no further progress is
* made.
*
* If an optimization pass fails to preserve the invariant flag, calling
* the pass only once may result in incorrect code generation. Always call
/* If an optimization pass fails to preserve the invariant flag, calling
* the pass only once earlier may result in incorrect code generation. Always call
* propagate_invariance() last to avoid this possibility.
*/
OPT(propagate_invariance, ir);
......
......@@ -4188,18 +4188,10 @@ static void
linker_optimisation_loop(const struct gl_constants *consts, exec_list *ir,
unsigned stage)
{
if (consts->GLSLOptimizeConservatively) {
/* Run it just once. */
do_common_optimization(ir, true, false,
&consts->ShaderCompilerOptions[stage],
consts->NativeIntegers);
} else {
/* Repeat it until it stops making changes. */
while (do_common_optimization(ir, true, false,
&consts->ShaderCompilerOptions[stage],
consts->NativeIntegers))
;
}
/* Run it just once, since NIR will do the real optimizaiton. */
do_common_optimization(ir, true, false,
&consts->ShaderCompilerOptions[stage],
consts->NativeIntegers);
}
void
......
......@@ -1268,7 +1268,7 @@ TESTS = [
color2 = y + 1;
}
""",
r'assign \(x\) \(var_ref x\) \(expression float f162f'),
r'assign \(x\) \(var_ref x@2\) \(expression float f162f'),
Test("ldexp",
"""
#version 310 es
......
......@@ -294,7 +294,6 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_RASTERIZER_SUBPIXEL_BITS:
return 4; /* GLES 2.0 minimum value */
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_PREFER_BACK_BUFFER_REUSE:
return 1;
......
......@@ -254,9 +254,6 @@ d3d12_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_PCI_FUNCTION:
return 0; /* TODO: figure these out */
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
return 0; /* not sure */
case PIPE_CAP_FLATSHADE:
case PIPE_CAP_ALPHA_TEST:
case PIPE_CAP_TWO_SIDED_COLOR:
......
......@@ -185,7 +185,6 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
/* Unsupported features. */
case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
case PIPE_CAP_TEXRECT:
return 0;
......
......@@ -408,7 +408,6 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 64 * 1024 * 1024;
case PIPE_CAP_SHAREABLE_SHADERS:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
if (is_ir3(screen))
return 1;
return 0;
......
......@@ -410,7 +410,6 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_PCI_FUNCTION:
return 0;
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
return 0;
......
......@@ -329,7 +329,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_PCI_BUS:
case PIPE_CAP_PCI_DEVICE:
case PIPE_CAP_PCI_FUNCTION:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
return 0;
......
......@@ -218,7 +218,6 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_SHADER_ARRAY_COMPONENTS:
case PIPE_CAP_SHADER_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_FBFETCH:
case PIPE_CAP_TGSI_MUL_ZERO_WINS:
case PIPE_CAP_DOUBLES:
......
......@@ -338,7 +338,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
case PIPE_CAP_SHADER_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_FBFETCH:
case PIPE_CAP_DOUBLES:
case PIPE_CAP_INT64:
......
......@@ -384,7 +384,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_PCI_FUNCTION:
case PIPE_CAP_SHADER_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE:
case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
case PIPE_CAP_MEMOBJ:
......
......@@ -176,8 +176,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_VERTEX_SHADER_SATURATE:
return is_r500 ? 1 : 0;
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
return 0;
case PIPE_CAP_SHAREABLE_SHADERS:
return 0;
......
......@@ -411,9 +411,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
return 8;
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
return 0;
case PIPE_CAP_INT64:
case PIPE_CAP_DOUBLES:
if (rscreen->b.family == CHIP_ARUBA ||
......
......@@ -128,7 +128,6 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_CULL_DISTANCE:
case PIPE_CAP_SHADER_ARRAY_COMPONENTS:
case PIPE_CAP_SHADER_CAN_READ_OUTPUTS:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
case PIPE_CAP_DOUBLES:
......
......@@ -450,7 +450,6 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_DOUBLES:
return sws->have_sm5;
case PIPE_CAP_UMA:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
return 0;
case PIPE_CAP_TGSI_DIV:
......
......@@ -315,7 +315,6 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_PCI_BUS:
case PIPE_CAP_PCI_DEVICE:
case PIPE_CAP_PCI_FUNCTION:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
return 0;
case PIPE_CAP_CLEAR_TEXTURE:
......
......@@ -684,9 +684,6 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
return screen->info.props.limits.viewportSubPixelBits;
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
return 0; /* not sure */
case PIPE_CAP_MAX_GS_INVOCATIONS:
return screen->info.props.limits.maxGeometryShaderInvocations;
......
......@@ -888,7 +888,6 @@ enum pipe_cap
PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
PIPE_CAP_SHADER_CAN_READ_OUTPUTS,
PIPE_CAP_NATIVE_FENCE_FD,
PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY,
PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS,
PIPE_CAP_FBFETCH,
PIPE_CAP_TGSI_MUL_ZERO_WINS,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment