nir/spirv: guard macros in case of redefinition

On some systems, these macros are already defined, and being defined
slightly differently causes them to emit redefinition-warnings.

Let's wrap them in ifdefs to avoid the warnings.

Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15084>
This commit is contained in:
Erik Faye-Lund 2022-02-18 18:29:34 +01:00 committed by Marge Bot
parent 694fe73976
commit 2cd0779f83
2 changed files with 12 additions and 0 deletions

View file

@ -85,9 +85,15 @@
#include "builtin_functions.h"
#include "util/hash_table.h"
#ifndef M_PIf
#define M_PIf ((float) M_PI)
#endif
#ifndef M_PI_2f
#define M_PI_2f ((float) M_PI_2)
#endif
#ifndef M_PI_4f
#define M_PI_4f ((float) M_PI_4)
#endif
using namespace ir_builder;

View file

@ -32,9 +32,15 @@
#include "vtn_private.h"
#include "GLSL.std.450.h"
#ifndef M_PIf
#define M_PIf ((float) M_PI)
#endif
#ifndef M_PI_2f
#define M_PI_2f ((float) M_PI_2)
#endif
#ifndef M_PI_4f
#define M_PI_4f ((float) M_PI_4)
#endif
static nir_ssa_def *build_det(nir_builder *b, nir_ssa_def **col, unsigned cols);