compiler/glsl: call util_cpu_detect from glsl_type_singleton_init_or_ref

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Closes: #4393
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9457>
This commit is contained in:
Iago Toral Quiroga
2021-03-08 08:34:50 +01:00
parent 1e4abf1fe3
commit f29de817eb
3 changed files with 6 additions and 4 deletions

View File

@@ -398,8 +398,6 @@ standalone_compile_shader(const struct standalone_options *_options,
int status = EXIT_SUCCESS;
bool glsl_es = false;
util_cpu_detect();
options = _options;
switch (options->glsl_version) {

View File

@@ -26,6 +26,7 @@
#include "compiler/glsl/glsl_parser_extras.h"
#include "glsl_types.h"
#include "util/hash_table.h"
#include "util/u_cpu_detect.h"
#include "util/u_string.h"
@@ -518,6 +519,11 @@ hash_free_type_function(struct hash_entry *entry)
void
glsl_type_singleton_init_or_ref()
{
/* This is required for _mesa_half_to_float() which is
* required for constant-folding 16-bit float ops.
*/
util_cpu_detect();
mtx_lock(&glsl_type::hash_mutex);
glsl_type_users++;
mtx_unlock(&glsl_type::hash_mutex);

View File

@@ -36,7 +36,6 @@ protected:
const_value_negative_equal_test()
{
glsl_type_singleton_init_or_ref();
util_cpu_detect();
memset(c1, 0, sizeof(c1));
memset(c2, 0, sizeof(c2));
@@ -56,7 +55,6 @@ protected:
alu_srcs_negative_equal_test()
{
glsl_type_singleton_init_or_ref();
util_cpu_detect();
static const nir_shader_compiler_options options = { };
bld = nir_builder_init_simple_shader(MESA_SHADER_VERTEX, &options,