glsl/standalone: Add an option to lower the precision
Adds a --lower-precision option that just sets the LowerPrecision compiler option. That way it can be used in unit tests to test the precision lowering pass. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3885>
This commit is contained in:
parent
b83f4b9fa2
commit
32cd3bd850
|
@ -46,6 +46,7 @@ const struct option compiler_opts[] = {
|
||||||
{ "dump-builder", no_argument, &options.dump_builder, 1 },
|
{ "dump-builder", no_argument, &options.dump_builder, 1 },
|
||||||
{ "link", no_argument, &options.do_link, 1 },
|
{ "link", no_argument, &options.do_link, 1 },
|
||||||
{ "just-log", no_argument, &options.just_log, 1 },
|
{ "just-log", no_argument, &options.just_log, 1 },
|
||||||
|
{ "lower-precision", no_argument, &options.lower_precision, 1 },
|
||||||
{ "version", required_argument, NULL, 'v' },
|
{ "version", required_argument, NULL, 'v' },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
|
@ -446,6 +446,14 @@ standalone_compile_shader(const struct standalone_options *_options,
|
||||||
initialize_context(ctx, options->glsl_version > 130 ? API_OPENGL_CORE : API_OPENGL_COMPAT);
|
initialize_context(ctx, options->glsl_version > 130 ? API_OPENGL_CORE : API_OPENGL_COMPAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options->lower_precision) {
|
||||||
|
for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
|
||||||
|
struct gl_shader_compiler_options *options =
|
||||||
|
&ctx->Const.ShaderCompilerOptions[i];
|
||||||
|
options->LowerPrecision = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct gl_shader_program *whole_program;
|
struct gl_shader_program *whole_program;
|
||||||
|
|
||||||
whole_program = rzalloc (NULL, struct gl_shader_program);
|
whole_program = rzalloc (NULL, struct gl_shader_program);
|
||||||
|
|
|
@ -36,6 +36,7 @@ struct standalone_options {
|
||||||
int dump_builder;
|
int dump_builder;
|
||||||
int do_link;
|
int do_link;
|
||||||
int just_log;
|
int just_log;
|
||||||
|
int lower_precision;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gl_shader_program;
|
struct gl_shader_program;
|
||||||
|
|
Loading…
Reference in New Issue