Commit eddb7cd1 authored by Eric Engestrom's avatar Eric Engestrom 💤
Browse files

meson/android/scons/gallium: always define LLVM_AVAILABLE one way or the other



With the usual benefits of `#if` instead of `#ifdef`; mostly the fact
that typos are now build failures instead of silently being ignored.
Signed-off-by: Eric Engestrom's avatarEric Engestrom <eric@engestrom.ch>
parent f3ffcd9a
Pipeline #110031 passed with stages
in 17 minutes and 2 seconds
......@@ -45,7 +45,7 @@
#include "draw_vs.h"
#include "draw_gs.h"
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
#include "gallivm/lp_bld_init.h"
#include "gallivm/lp_bld_limits.h"
#include "draw_llvm.h"
......@@ -66,7 +66,7 @@ draw_get_option_use_llvm(void)
bool
draw_has_llvm(void)
{
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
return draw_get_option_use_llvm();
#else
return false;
......@@ -87,7 +87,7 @@ draw_create_context(struct pipe_context *pipe, void *context,
/* we need correct cpu caps for disabling denorms in draw_vbo() */
util_cpu_detect();
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (try_llvm && draw_get_option_use_llvm()) {
draw->llvm = draw_llvm_create(draw, (LLVMContextRef)context);
}
......@@ -121,7 +121,7 @@ draw_create(struct pipe_context *pipe)
}
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct draw_context *
draw_create_with_llvm_context(struct pipe_context *pipe,
void *context)
......@@ -229,7 +229,7 @@ void draw_destroy( struct draw_context *draw )
draw_pt_destroy( draw );
draw_vs_destroy( draw );
draw_gs_destroy( draw );
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw->llvm)
draw_llvm_destroy( draw->llvm );
#endif
......@@ -1036,7 +1036,7 @@ draw_set_samplers(struct draw_context *draw,
draw->num_samplers[shader_stage] = num;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw->llvm)
draw_llvm_set_sampler_state(draw, shader_stage);
#endif
......@@ -1074,7 +1074,7 @@ draw_set_mapped_texture(struct draw_context *draw,
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS])
{
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw->llvm)
draw_llvm_set_mapped_texture(draw,
shader_stage,
......@@ -1094,7 +1094,7 @@ draw_set_mapped_image(struct draw_context *draw,
uint32_t row_stride,
uint32_t img_stride)
{
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw->llvm)
draw_llvm_set_mapped_image(draw,
shader_stage,
......@@ -1132,7 +1132,7 @@ int
draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param)
{
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw_get_option_use_llvm()) {
switch(shader) {
case PIPE_SHADER_VERTEX:
......
......@@ -67,7 +67,7 @@ bool draw_has_llvm(void);
struct draw_context *draw_create( struct pipe_context *pipe );
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct draw_context *draw_create_with_llvm_context(struct pipe_context *pipe,
void *context);
#endif
......
......@@ -29,7 +29,7 @@
#include "draw_private.h"
#include "draw_context.h"
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
#include "draw_llvm.h"
#endif
......@@ -239,7 +239,7 @@ static void tgsi_gs_run(struct draw_geometry_shader *shader,
}
}
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
static void
llvm_fetch_gs_input(struct draw_geometry_shader *shader,
......@@ -636,7 +636,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
shader->input = input;
shader->input_info = input_info;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (shader->draw->llvm) {
for (i = 0; i < shader->num_vertex_streams; i++) {
shader->gs_output[i] = output_verts[i].verts;
......@@ -771,14 +771,14 @@ struct draw_geometry_shader *
draw_create_geometry_shader(struct draw_context *draw,
const struct pipe_shader_state *state)
{
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
boolean use_llvm = draw->llvm != NULL;
struct llvm_geometry_shader *llvm_gs = NULL;
#endif
struct draw_geometry_shader *gs;
unsigned i;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (use_llvm) {
llvm_gs = CALLOC_STRUCT(llvm_geometry_shader);
......@@ -814,7 +814,7 @@ draw_create_geometry_shader(struct draw_context *draw,
/* setup the defaults */
gs->max_out_prims = 0;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (use_llvm) {
/* TODO: change the input array to handle the following
vector length, instead of the currently hardcoded
......@@ -871,7 +871,7 @@ draw_create_geometry_shader(struct draw_context *draw,
gs->num_vertex_streams = gs->state.stream_output.output[i].stream + 1;
}
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (use_llvm) {
int vector_size = gs->vector_length * sizeof(float);
gs->gs_input = align_malloc(sizeof(struct draw_gs_inputs), 16);
......@@ -931,7 +931,7 @@ void draw_delete_geometry_shader(struct draw_context *draw,
if (!dgs) {
return;
}
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw->llvm) {
struct llvm_geometry_shader *shader = llvm_geometry_shader(dgs);
struct draw_gs_llvm_variant_list_item *li;
......@@ -967,7 +967,7 @@ void draw_delete_geometry_shader(struct draw_context *draw,
}
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
void draw_gs_set_current_variant(struct draw_geometry_shader *shader,
struct draw_gs_llvm_variant *variant)
{
......
......@@ -36,7 +36,7 @@
struct draw_context;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct draw_gs_jit_context;
struct draw_gs_llvm_variant;
......@@ -96,7 +96,7 @@ struct draw_geometry_shader {
unsigned num_invocations;
unsigned invocation_id;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct draw_gs_inputs *gs_input;
struct draw_gs_jit_context *jit_context;
struct draw_gs_llvm_variant *current_variant;
......@@ -146,7 +146,7 @@ void draw_geometry_shader_prepare(struct draw_geometry_shader *shader,
int draw_gs_max_output_vertices(struct draw_geometry_shader *shader,
unsigned pipe_prim);
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
void draw_gs_set_current_variant(struct draw_geometry_shader *shader,
struct draw_gs_llvm_variant *variant);
#endif
......
......@@ -323,7 +323,7 @@ fail:
static boolean
generate_aaline_fs_nir(struct aaline_stage *aaline)
{
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct pipe_context *pipe = aaline->stage.draw->pipe;
const struct pipe_shader_state *orig_fs = &aaline->fs->state;
struct pipe_shader_state aaline_fs;
......@@ -653,7 +653,7 @@ aaline_create_fs_state(struct pipe_context *pipe,
aafs->state.type = fs->type;
if (fs->type == PIPE_SHADER_IR_TGSI)
aafs->state.tokens = tgsi_dup_tokens(fs->tokens);
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
else
aafs->state.ir.nir = nir_shader_clone(NULL, fs->ir.nir);
#endif
......
......@@ -411,7 +411,7 @@ fail:
static boolean
generate_aapoint_fs_nir(struct aapoint_stage *aapoint)
{
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct pipe_context *pipe = aapoint->stage.draw->pipe;
const struct pipe_shader_state *orig_fs = &aapoint->fs->state;
struct pipe_shader_state aapoint_fs;
......@@ -748,7 +748,7 @@ aapoint_create_fs_state(struct pipe_context *pipe,
aafs->state.type = fs->type;
if (fs->type == PIPE_SHADER_IR_TGSI)
aafs->state.tokens = tgsi_dup_tokens(fs->tokens);
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
else
aafs->state.ir.nir = nir_shader_clone(NULL, fs->ir.nir);
#endif
......
......@@ -143,7 +143,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
if (pstip_fs.tokens == NULL)
return FALSE;
} else {
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
pstip_fs.ir.nir = nir_shader_clone(NULL, orig_fs->ir.nir);
nir_lower_pstipple_fs(pstip_fs.ir.nir,
&pstip->fs->sampler_unit, 0, wincoord_file == TGSI_FILE_SYSTEM_VALUE);
......
......@@ -46,7 +46,7 @@
#include "tgsi/tgsi_scan.h"
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct gallivm_state;
#endif
......
......@@ -191,7 +191,7 @@ boolean draw_pt_init( struct draw_context *draw )
if (!draw->pt.middle.general)
return FALSE;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw->llvm)
draw->pt.middle.llvm = draw_pt_fetch_pipeline_or_emit_llvm( draw );
#endif
......@@ -523,7 +523,7 @@ draw_vbo(struct draw_context *draw,
draw->pt.vertex_element,
draw->pt.nr_vertex_elements,
info);
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (!draw->llvm)
#endif
{
......
......@@ -59,7 +59,7 @@ draw_create_vertex_shader(struct draw_context *draw,
tgsi_dump(shader->tokens, 0);
}
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
if (draw->pt.middle.llvm) {
vs = draw_create_vs_llvm(draw, shader);
}
......
......@@ -164,7 +164,7 @@ draw_create_vs_exec(struct draw_context *draw,
struct draw_vs_variant_key;
struct draw_vertex_shader;
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
struct draw_vertex_shader *
draw_create_vs_llvm(struct draw_context *draw,
const struct pipe_shader_state *state);
......
......@@ -29,7 +29,7 @@ struct nir_shader;
struct tgsi_shader_info;
/* only llvmpipe uses this path, so handle draw not using llvm */
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
void nir_tgsi_scan_shader(const struct nir_shader *nir,
struct tgsi_shader_info *info,
bool need_texcoord);
......
......@@ -41,7 +41,7 @@
#include <sys/utsname.h>
#include <stdlib.h>
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
#include <llvm-c/TargetMachine.h>
#endif
......@@ -1225,7 +1225,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
snprintf(rscreen->renderer_string, sizeof(rscreen->renderer_string),
"%s (%sDRM %i.%i.%i%s"
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
", LLVM " MESA_LLVM_VERSION_STRING
#endif
")",
......
......@@ -94,7 +94,7 @@ svga_get_name( struct pipe_screen *pscreen )
#else
build = "build: RELEASE;";
#endif
#ifdef LLVM_AVAILABLE
#if LLVM_AVAILABLE
llvm = "LLVM;";
#endif
......
Markdown is supported
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