mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
glsl: use pipe caps in opt_shader
do_algebraic doesn't use any options Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36582>
This commit is contained in:
parent
0de5e8cd59
commit
0c14420169
3 changed files with 15 additions and 26 deletions
|
|
@ -2181,7 +2181,8 @@ do_late_parsing_checks(struct _mesa_glsl_parse_state *state)
|
|||
}
|
||||
|
||||
static void
|
||||
opt_shader(const struct gl_constants *consts,
|
||||
opt_shader(const struct pipe_screen *screen,
|
||||
const struct gl_constants *consts,
|
||||
const struct gl_extensions *exts,
|
||||
struct gl_shader *shader,
|
||||
linear_ctx *linalloc)
|
||||
|
|
@ -2189,15 +2190,12 @@ opt_shader(const struct gl_constants *consts,
|
|||
assert(shader->CompileStatus != COMPILE_FAILURE &&
|
||||
!shader->ir->is_empty());
|
||||
|
||||
const struct gl_shader_compiler_options *options =
|
||||
&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.
|
||||
*
|
||||
* Run it just once, since NIR will do the real optimization.
|
||||
*/
|
||||
do_common_optimization(shader->ir, false, options, consts->NativeIntegers);
|
||||
do_common_optimization(shader->ir, false, shader->Stage, screen);
|
||||
|
||||
validate_ir_tree(shader->ir);
|
||||
|
||||
|
|
@ -2403,7 +2401,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
|
|||
lower_builtins(shader->ir);
|
||||
assign_subroutine_indexes(state);
|
||||
lower_subroutine(shader->ir, state);
|
||||
opt_shader(&ctx->Const, &ctx->Extensions, shader, state->linalloc);
|
||||
opt_shader(ctx->screen, &ctx->Const, &ctx->Extensions, shader,
|
||||
state->linalloc);
|
||||
}
|
||||
|
||||
if (!force_recompile) {
|
||||
|
|
@ -2483,9 +2482,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
|
|||
* integers in floating point registers).
|
||||
*/
|
||||
bool
|
||||
do_common_optimization(ir_exec_list *ir, bool linked,
|
||||
const struct gl_shader_compiler_options *options,
|
||||
bool native_integers)
|
||||
do_common_optimization(ir_exec_list *ir, bool linked, mesa_shader_stage stage,
|
||||
const struct pipe_screen *screen)
|
||||
{
|
||||
const bool debug = false;
|
||||
bool progress = false;
|
||||
|
|
@ -2512,8 +2510,8 @@ do_common_optimization(ir_exec_list *ir, bool linked,
|
|||
OPT(do_tree_grafting, ir);
|
||||
OPT(do_minmax_prune, ir);
|
||||
OPT(do_rebalance_tree, ir);
|
||||
OPT(do_algebraic, ir, native_integers, options);
|
||||
OPT(do_lower_jumps, ir, true, options->EmitNoCont);
|
||||
OPT(do_algebraic, ir);
|
||||
OPT(do_lower_jumps, ir, true, !screen->shader_caps[stage].cont_supported);
|
||||
|
||||
/* If an optimization pass fails to preserve the invariant flag, calling
|
||||
* the pass only once earlier may result in incorrect code generation. Always call
|
||||
|
|
|
|||
|
|
@ -34,13 +34,11 @@ struct gl_shader;
|
|||
struct gl_linked_shader;
|
||||
struct gl_shader_program;
|
||||
|
||||
bool do_common_optimization(ir_exec_list *ir, bool linked,
|
||||
const struct gl_shader_compiler_options *options,
|
||||
bool native_integers);
|
||||
bool do_common_optimization(ir_exec_list *ir, bool linked, mesa_shader_stage stage,
|
||||
const struct pipe_screen *screen);
|
||||
|
||||
bool do_rebalance_tree(ir_exec_list *instructions);
|
||||
bool do_algebraic(ir_exec_list *instructions, bool native_integers,
|
||||
const struct gl_shader_compiler_options *options);
|
||||
bool do_algebraic(ir_exec_list *instructions);
|
||||
bool do_dead_code(ir_exec_list *instructions);
|
||||
bool do_dead_code_local(ir_exec_list *instructions);
|
||||
bool do_dead_code_unlinked(ir_exec_list *instructions);
|
||||
|
|
|
|||
|
|
@ -46,12 +46,9 @@ namespace {
|
|||
|
||||
class ir_algebraic_visitor : public ir_rvalue_visitor {
|
||||
public:
|
||||
ir_algebraic_visitor(bool native_integers,
|
||||
const struct gl_shader_compiler_options *options)
|
||||
: options(options)
|
||||
ir_algebraic_visitor()
|
||||
{
|
||||
this->progress = false;
|
||||
this->native_integers = native_integers;
|
||||
}
|
||||
|
||||
virtual ~ir_algebraic_visitor()
|
||||
|
|
@ -73,9 +70,6 @@ public:
|
|||
ir_rvalue *swizzle_if_required(ir_expression *expr,
|
||||
ir_rvalue *operand);
|
||||
|
||||
const struct gl_shader_compiler_options *options;
|
||||
|
||||
bool native_integers;
|
||||
bool progress;
|
||||
};
|
||||
|
||||
|
|
@ -403,10 +397,9 @@ ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue)
|
|||
}
|
||||
|
||||
bool
|
||||
do_algebraic(ir_exec_list *instructions, bool native_integers,
|
||||
const struct gl_shader_compiler_options *options)
|
||||
do_algebraic(ir_exec_list *instructions)
|
||||
{
|
||||
ir_algebraic_visitor v(native_integers, options);
|
||||
ir_algebraic_visitor v;
|
||||
|
||||
visit_list_elements(&v, instructions);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue