meson: always define {,DRAW_}LLVM_AVAILABLE one way or the other
With the usual benefits of `#if` instead of `#ifdef` (mostly the fact that typos can be build failures instead of silently being interpreted as if 0). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3863>
This commit is contained in:

committed by
Marge Bot

parent
ac5a27917d
commit
7e8db6aedf
@@ -1754,13 +1754,10 @@ if _llvm.allowed()
|
||||
with_llvm = dep_llvm.found()
|
||||
endif
|
||||
if with_llvm
|
||||
pre_args += '-DLLVM_AVAILABLE'
|
||||
pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version())
|
||||
pre_args += '-DLLVM_IS_SHARED=@0@'.format(_shared_llvm.to_int())
|
||||
|
||||
if draw_with_llvm
|
||||
pre_args += '-DDRAW_LLVM_AVAILABLE'
|
||||
elif with_swrast_vk
|
||||
if with_swrast_vk and not draw_with_llvm
|
||||
error('Lavapipe requires LLVM draw support.')
|
||||
endif
|
||||
|
||||
@@ -1802,6 +1799,8 @@ elif with_clc
|
||||
else
|
||||
draw_with_llvm = false
|
||||
endif
|
||||
pre_args += '-DLLVM_AVAILABLE=' + (with_llvm ? '1' : '0')
|
||||
pre_args += '-DDRAW_LLVM_AVAILABLE=' + (with_llvm and draw_with_llvm ? '1' : '0')
|
||||
|
||||
with_opencl_spirv = (_opencl != 'disabled' and get_option('opencl-spirv')) or with_clc
|
||||
if with_opencl_spirv
|
||||
|
@@ -98,7 +98,7 @@ get_disasm_string(aco::Program* program, std::vector<uint32_t>& code, unsigned e
|
||||
aco::print_asm(program, code, exec_size / 4u, memf);
|
||||
} else {
|
||||
fprintf(memf, "Shader disassembly is not supported in the current configuration"
|
||||
#ifndef LLVM_AVAILABLE
|
||||
#if !LLVM_AVAILABLE
|
||||
" (LLVM not available)"
|
||||
#endif
|
||||
", falling back to print_program.\n\n");
|
||||
|
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#if defined(_MSC_VER) && defined(restrict)
|
||||
#undef restrict
|
||||
#endif
|
||||
@@ -266,7 +266,7 @@ fail:
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
std::pair<bool, size_t>
|
||||
disasm_instr(amd_gfx_level gfx_level, LLVMDisasmContextRef disasm, uint32_t* binary,
|
||||
unsigned exec_size, size_t pos, char* outline, unsigned outline_size)
|
||||
@@ -391,7 +391,7 @@ print_asm_llvm(Program* program, std::vector<uint32_t>& binary, unsigned exec_si
|
||||
bool
|
||||
check_print_asm_support(Program* program)
|
||||
{
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (program->gfx_level >= GFX8) {
|
||||
/* LLVM disassembler only supports GFX8+ */
|
||||
const char* name = ac_get_llvm_processor_name(program->family);
|
||||
@@ -422,7 +422,7 @@ check_print_asm_support(Program* program)
|
||||
bool
|
||||
print_asm(Program* program, std::vector<uint32_t>& binary, unsigned exec_size, FILE* output)
|
||||
{
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (program->gfx_level >= GFX8) {
|
||||
return print_asm_llvm(program, binary, exec_size, output);
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ typedef void *drmDevicePtr;
|
||||
#include "vk_sync.h"
|
||||
#include "vk_sync_dummy.h"
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#include "ac_llvm_util.h"
|
||||
#endif
|
||||
|
||||
|
@@ -49,7 +49,7 @@ typedef void *drmDevicePtr;
|
||||
#include "winsys/null/radv_null_winsys_public.h"
|
||||
#include "git_sha1.h"
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#include "ac_llvm_util.h"
|
||||
#endif
|
||||
|
||||
@@ -132,7 +132,7 @@ radv_device_get_cache_uuid(struct radv_physical_device *pdevice, void *uuid)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (pdevice->use_llvm && !disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, &ctx))
|
||||
return -1;
|
||||
#endif
|
||||
@@ -1125,7 +1125,7 @@ radv_get_compiler_string(struct radv_physical_device *pdevice)
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
return " (LLVM " MESA_LLVM_VERSION_STRING ")";
|
||||
#else
|
||||
unreachable("LLVM is not available");
|
||||
@@ -1855,7 +1855,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
|
||||
device->ws->query_info(device->ws, &device->rad_info);
|
||||
|
||||
device->use_llvm = instance->debug_flags & RADV_DEBUG_LLVM;
|
||||
#ifndef LLVM_AVAILABLE
|
||||
#if !LLVM_AVAILABLE
|
||||
if (device->use_llvm) {
|
||||
fprintf(stderr, "ERROR: LLVM compiler backend selected for radv, but LLVM support was not "
|
||||
"enabled at build time.\n");
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include "bvh/bvh.h"
|
||||
#include "radv_debug.h"
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
#endif
|
||||
|
||||
|
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "aco_shader_info.h"
|
||||
#include "radv_aco_shader_info.h"
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#include "ac_llvm_util.h"
|
||||
#endif
|
||||
|
||||
@@ -2481,7 +2481,7 @@ shader_compile(struct radv_device *device, struct nir_shader *const *shaders, in
|
||||
|
||||
struct radv_shader_binary *binary = NULL;
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (radv_use_llvm_for_stage(device, stage) || options->dump_shader || options->record_ir)
|
||||
ac_init_llvm_once();
|
||||
|
||||
@@ -2630,7 +2630,7 @@ radv_create_rt_prolog(struct radv_device *device)
|
||||
radv_declare_rt_shader_args(options.info->gfx_level, &out_args);
|
||||
info.user_sgprs_locs = in_args.user_sgprs_locs;
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (options.dump_shader || options.record_ir)
|
||||
ac_init_llvm_once();
|
||||
#endif
|
||||
@@ -2693,7 +2693,7 @@ radv_create_vs_prolog(struct radv_device *device, const struct radv_vs_prolog_ke
|
||||
info.user_sgprs_locs = args.user_sgprs_locs;
|
||||
info.inline_push_constant_mask = args.ac.inline_push_const_mask;
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (options.dump_shader || options.record_ir)
|
||||
ac_init_llvm_once();
|
||||
#endif
|
||||
@@ -2746,7 +2746,7 @@ radv_create_ps_epilog(struct radv_device *device, const struct radv_ps_epilog_ke
|
||||
|
||||
radv_declare_ps_epilog_args(device, key, &args);
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (options.dump_shader || options.record_ir)
|
||||
ac_init_llvm_once();
|
||||
#endif
|
||||
@@ -2804,7 +2804,7 @@ radv_create_tcs_epilog(struct radv_device *device, const struct radv_tcs_epilog_
|
||||
|
||||
radv_declare_tcs_epilog_args(device, key, &args);
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (options.dump_shader || options.record_ir)
|
||||
ac_init_llvm_once();
|
||||
#endif
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include "draw_tess.h"
|
||||
#include "draw_mesh.h"
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
#include "gallivm/lp_bld_init.h"
|
||||
#include "gallivm/lp_bld_limits.h"
|
||||
#include "draw_llvm.h"
|
||||
@@ -56,7 +56,7 @@
|
||||
bool
|
||||
draw_get_option_use_llvm(void)
|
||||
{
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
return debug_get_bool_option("DRAW_USE_LLVM", true);
|
||||
#else
|
||||
return false;
|
||||
@@ -75,7 +75,7 @@ draw_create_context(struct pipe_context *pipe, void *context,
|
||||
if (!draw)
|
||||
goto err_out;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (try_llvm && draw_get_option_use_llvm()) {
|
||||
draw->llvm = draw_llvm_create(draw, (LLVMContextRef)context);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ draw_create(struct pipe_context *pipe)
|
||||
}
|
||||
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
struct draw_context *
|
||||
draw_create_with_llvm_context(struct pipe_context *pipe,
|
||||
void *context)
|
||||
@@ -222,7 +222,7 @@ draw_destroy(struct draw_context *draw)
|
||||
draw_pt_destroy(draw);
|
||||
draw_vs_destroy(draw);
|
||||
draw_gs_destroy(draw);
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm)
|
||||
draw_llvm_destroy(draw->llvm);
|
||||
#endif
|
||||
@@ -1083,7 +1083,7 @@ draw_set_samplers(struct draw_context *draw,
|
||||
|
||||
draw->num_samplers[shader_stage] = num;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm)
|
||||
draw_llvm_set_sampler_state(draw, shader_stage);
|
||||
#endif
|
||||
@@ -1123,7 +1123,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 DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm)
|
||||
draw_llvm_set_mapped_texture(draw,
|
||||
shader_stage,
|
||||
@@ -1146,7 +1146,7 @@ draw_set_mapped_image(struct draw_context *draw,
|
||||
uint32_t num_samples,
|
||||
uint32_t sample_stride)
|
||||
{
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm)
|
||||
draw_llvm_set_mapped_image(draw,
|
||||
shader_stage,
|
||||
@@ -1186,7 +1186,7 @@ draw_get_shader_param_no_llvm(enum pipe_shader_type shader,
|
||||
int
|
||||
draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param)
|
||||
{
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw_get_option_use_llvm()) {
|
||||
switch(shader) {
|
||||
case PIPE_SHADER_VERTEX:
|
||||
|
@@ -93,7 +93,7 @@ struct draw_prim_info {
|
||||
|
||||
struct draw_context *draw_create(struct pipe_context *pipe);
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_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 DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
#include "draw_llvm.h"
|
||||
#endif
|
||||
|
||||
@@ -225,7 +225,7 @@ tgsi_gs_run(struct draw_geometry_shader *shader,
|
||||
}
|
||||
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
|
||||
/*
|
||||
* Fetch the vertex attribute values for one primitive.
|
||||
@@ -639,7 +639,7 @@ draw_geometry_shader_run(struct draw_geometry_shader *shader,
|
||||
shader->input = input;
|
||||
shader->input_info = input_info;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (shader->draw->llvm) {
|
||||
for (int i = 0; i < shader->num_vertex_streams; i++) {
|
||||
shader->gs_output[i] = output_verts[i].verts;
|
||||
@@ -776,13 +776,13 @@ struct draw_geometry_shader *
|
||||
draw_create_geometry_shader(struct draw_context *draw,
|
||||
const struct pipe_shader_state *state)
|
||||
{
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
bool use_llvm = draw->llvm != NULL;
|
||||
struct llvm_geometry_shader *llvm_gs = NULL;
|
||||
#endif
|
||||
struct draw_geometry_shader *gs;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (use_llvm) {
|
||||
llvm_gs = CALLOC_STRUCT(llvm_geometry_shader);
|
||||
|
||||
@@ -826,7 +826,7 @@ draw_create_geometry_shader(struct draw_context *draw,
|
||||
/* setup the defaults */
|
||||
gs->max_out_prims = 0;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (use_llvm) {
|
||||
/* TODO: change the input array to handle the following
|
||||
vector length, instead of the currently hardcoded
|
||||
@@ -886,7 +886,7 @@ draw_create_geometry_shader(struct draw_context *draw,
|
||||
|
||||
gs->machine = draw->gs.tgsi.machine;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (use_llvm) {
|
||||
int vector_size = gs->vector_length * sizeof(float);
|
||||
gs->gs_input = align_malloc(sizeof(struct draw_gs_inputs), 16);
|
||||
@@ -949,7 +949,7 @@ draw_delete_geometry_shader(struct draw_context *draw,
|
||||
if (!dgs) {
|
||||
return;
|
||||
}
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm) {
|
||||
struct llvm_geometry_shader *shader = llvm_geometry_shader(dgs);
|
||||
struct draw_gs_llvm_variant_list_item *li, *next;
|
||||
@@ -987,7 +987,7 @@ draw_delete_geometry_shader(struct draw_context *draw,
|
||||
}
|
||||
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
void
|
||||
draw_gs_set_current_variant(struct draw_geometry_shader *shader,
|
||||
struct draw_gs_llvm_variant *variant)
|
||||
|
@@ -37,7 +37,7 @@
|
||||
|
||||
struct draw_context;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
struct draw_gs_jit_context;
|
||||
struct draw_gs_llvm_variant;
|
||||
|
||||
@@ -98,7 +98,7 @@ struct draw_geometry_shader {
|
||||
|
||||
unsigned num_invocations;
|
||||
unsigned invocation_id;
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
struct draw_gs_inputs *gs_input;
|
||||
struct draw_gs_jit_context *jit_context;
|
||||
struct lp_jit_resources *jit_resources;
|
||||
@@ -153,7 +153,7 @@ int
|
||||
draw_gs_max_output_vertices(struct draw_geometry_shader *shader,
|
||||
unsigned pipe_prim);
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
void
|
||||
draw_gs_set_current_variant(struct draw_geometry_shader *shader,
|
||||
struct draw_gs_llvm_variant *variant);
|
||||
|
@@ -47,7 +47,7 @@
|
||||
|
||||
#include "draw_vertex_header.h"
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
struct gallivm_state;
|
||||
#endif
|
||||
|
||||
|
@@ -205,7 +205,7 @@ draw_pt_init(struct draw_context *draw)
|
||||
if (!draw->pt.middle.general)
|
||||
return false;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm) {
|
||||
draw->pt.middle.llvm = draw_pt_fetch_pipeline_or_emit_llvm(draw);
|
||||
draw->pt.middle.mesh = draw_pt_mesh_pipeline_or_emit(draw);
|
||||
@@ -595,7 +595,7 @@ draw_vbo(struct draw_context *draw,
|
||||
draw->pt.vertex_element,
|
||||
draw->pt.nr_vertex_elements,
|
||||
use_info);
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (!draw->llvm)
|
||||
#endif
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
#include "draw_tess.h"
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
#include "draw_llvm.h"
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/ralloc.h"
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
static inline int
|
||||
draw_tes_get_input_index(int semantic, int index,
|
||||
const struct tgsi_shader_info *input_info)
|
||||
@@ -187,7 +187,7 @@ int draw_tess_ctrl_shader_run(struct draw_tess_ctrl_shader *shader,
|
||||
if (shader->draw->collect_statistics) {
|
||||
shader->draw->statistics.hs_invocations += num_patches;
|
||||
}
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
unsigned first_patch = input_prim->start / shader->draw->pt.vertices_per_patch;
|
||||
for (unsigned i = 0; i < num_patches; i++) {
|
||||
uint32_t vert_start = output_verts->count;
|
||||
@@ -212,7 +212,7 @@ int draw_tess_ctrl_shader_run(struct draw_tess_ctrl_shader *shader,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
#define DEBUG_INPUTS 0
|
||||
static void
|
||||
llvm_fetch_tes_input(struct draw_tess_eval_shader *shader,
|
||||
@@ -350,7 +350,7 @@ int draw_tess_eval_shader_run(struct draw_tess_eval_shader *shader,
|
||||
shader->input_vertex_stride = input_stride;
|
||||
shader->input_info = input_info;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
struct pipe_tessellation_factors factors;
|
||||
struct pipe_tessellator_data data = { 0 };
|
||||
struct pipe_tessellator *ptess = p_tess_init(shader->prim_mode,
|
||||
@@ -415,13 +415,13 @@ struct draw_tess_ctrl_shader *
|
||||
draw_create_tess_ctrl_shader(struct draw_context *draw,
|
||||
const struct pipe_shader_state *state)
|
||||
{
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
bool use_llvm = draw->llvm != NULL;
|
||||
struct llvm_tess_ctrl_shader *llvm_tcs = NULL;
|
||||
#endif
|
||||
struct draw_tess_ctrl_shader *tcs;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (use_llvm) {
|
||||
llvm_tcs = CALLOC_STRUCT(llvm_tess_ctrl_shader);
|
||||
|
||||
@@ -447,7 +447,7 @@ draw_create_tess_ctrl_shader(struct draw_context *draw,
|
||||
|
||||
tcs->vector_length = 4;
|
||||
tcs->vertices_out = tcs->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT];
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (use_llvm) {
|
||||
|
||||
tcs->tcs_input = align_malloc(sizeof(struct draw_tcs_inputs), 16);
|
||||
@@ -484,7 +484,7 @@ void draw_delete_tess_ctrl_shader(struct draw_context *draw,
|
||||
if (!dtcs)
|
||||
return;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm) {
|
||||
struct llvm_tess_ctrl_shader *shader = llvm_tess_ctrl_shader(dtcs);
|
||||
|
||||
@@ -505,7 +505,7 @@ void draw_delete_tess_ctrl_shader(struct draw_context *draw,
|
||||
FREE(dtcs);
|
||||
}
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
void draw_tcs_set_current_variant(struct draw_tess_ctrl_shader *shader,
|
||||
struct draw_tcs_llvm_variant *variant)
|
||||
{
|
||||
@@ -517,13 +517,13 @@ struct draw_tess_eval_shader *
|
||||
draw_create_tess_eval_shader(struct draw_context *draw,
|
||||
const struct pipe_shader_state *state)
|
||||
{
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
bool use_llvm = draw->llvm != NULL;
|
||||
struct llvm_tess_eval_shader *llvm_tes = NULL;
|
||||
#endif
|
||||
struct draw_tess_eval_shader *tes;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (use_llvm) {
|
||||
llvm_tes = CALLOC_STRUCT(llvm_tess_eval_shader);
|
||||
|
||||
@@ -575,7 +575,7 @@ draw_create_tess_eval_shader(struct draw_context *draw,
|
||||
if (!found_clipvertex)
|
||||
tes->clipvertex_output = tes->position_output;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (use_llvm) {
|
||||
|
||||
tes->tes_input = align_malloc(sizeof(struct draw_tes_inputs), 16);
|
||||
@@ -612,7 +612,7 @@ void draw_delete_tess_eval_shader(struct draw_context *draw,
|
||||
if (!dtes)
|
||||
return;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (draw->llvm) {
|
||||
struct llvm_tess_eval_shader *shader = llvm_tess_eval_shader(dtes);
|
||||
struct draw_tes_llvm_variant_list_item *li, *next;
|
||||
@@ -630,7 +630,7 @@ void draw_delete_tess_eval_shader(struct draw_context *draw,
|
||||
FREE(dtes);
|
||||
}
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
void draw_tes_set_current_variant(struct draw_tess_eval_shader *shader,
|
||||
struct draw_tes_llvm_variant *variant)
|
||||
{
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "tgsi/tgsi_scan.h"
|
||||
|
||||
struct draw_context;
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
|
||||
#define NUM_PATCH_INPUTS 32
|
||||
#define NUM_TCS_INPUTS (PIPE_MAX_SHADER_INPUTS - NUM_PATCH_INPUTS)
|
||||
@@ -66,7 +66,7 @@ struct draw_tess_ctrl_shader {
|
||||
unsigned input_vertex_stride;
|
||||
const float (*input)[4];
|
||||
const struct tgsi_shader_info *input_info;
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
struct draw_tcs_inputs *tcs_input;
|
||||
struct draw_tcs_outputs *tcs_output;
|
||||
struct lp_jit_resources *jit_resources;
|
||||
@@ -94,7 +94,7 @@ struct draw_tess_eval_shader {
|
||||
const float (*input)[4];
|
||||
const struct tgsi_shader_info *input_info;
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
struct draw_tes_inputs *tes_input;
|
||||
struct lp_jit_resources *jit_resources;
|
||||
struct draw_tes_llvm_variant *current_variant;
|
||||
@@ -119,7 +119,7 @@ int draw_tess_eval_shader_run(struct draw_tess_eval_shader *shader,
|
||||
struct draw_prim_info *output_prims,
|
||||
uint16_t **elts_out);
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
void draw_tcs_set_current_variant(struct draw_tess_ctrl_shader *shader,
|
||||
struct draw_tcs_llvm_variant *variant);
|
||||
void draw_tes_set_current_variant(struct draw_tess_eval_shader *shader,
|
||||
|
@@ -65,7 +65,7 @@ draw_create_vertex_shader(struct draw_context *draw,
|
||||
tgsi_dump(shader->tokens, 0);
|
||||
}
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
bool is_allocated = false;
|
||||
if (draw->pt.middle.llvm) {
|
||||
struct pipe_screen *screen = draw->pipe->screen;
|
||||
@@ -84,7 +84,7 @@ draw_create_vertex_shader(struct draw_context *draw,
|
||||
vs = draw_create_vs_exec(draw, &state);
|
||||
}
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
if (is_allocated) {
|
||||
ureg_free_tokens(state.tokens);
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ struct draw_vertex_shader *
|
||||
draw_create_vs_exec(struct draw_context *draw,
|
||||
const struct pipe_shader_state *templ);
|
||||
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_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 DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
void nir_tgsi_scan_shader(const struct nir_shader *nir,
|
||||
struct tgsi_shader_info *info,
|
||||
bool need_texcoord);
|
||||
|
@@ -43,7 +43,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#include <llvm-c/TargetMachine.h>
|
||||
#endif
|
||||
|
||||
@@ -1272,7 +1272,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
|
||||
")",
|
||||
|
@@ -1325,7 +1325,7 @@ static void si_init_renderer_string(struct si_screen *sscreen)
|
||||
snprintf(kernel_version, sizeof(kernel_version), ", %s", uname_data.release);
|
||||
|
||||
const char *compiler_name =
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
!sscreen->use_aco ? "LLVM " MESA_LLVM_VERSION_STRING :
|
||||
#endif
|
||||
"ACO";
|
||||
|
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "aco_interface.h"
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#include "ac_llvm_util.h"
|
||||
#endif
|
||||
|
||||
@@ -135,7 +135,7 @@ static const struct debug_named_value test_options[] = {
|
||||
|
||||
struct ac_llvm_compiler *si_create_llvm_compiler(struct si_screen *sscreen)
|
||||
{
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
struct ac_llvm_compiler *compiler = CALLOC_STRUCT(ac_llvm_compiler);
|
||||
if (!compiler)
|
||||
return NULL;
|
||||
@@ -179,7 +179,7 @@ void si_init_aux_async_compute_ctx(struct si_screen *sscreen)
|
||||
|
||||
static void si_destroy_llvm_compiler(struct ac_llvm_compiler *compiler)
|
||||
{
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
ac_destroy_llvm_compiler(compiler);
|
||||
FREE(compiler);
|
||||
#endif
|
||||
@@ -1133,7 +1133,7 @@ static void si_disk_cache_create(struct si_screen *sscreen)
|
||||
* the LLVM function identifier. ACO is a built-in component in mesa, so no need
|
||||
* to add aco function here.
|
||||
*/
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
if (!sscreen->use_aco &&
|
||||
!disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, &ctx))
|
||||
return;
|
||||
@@ -1207,7 +1207,7 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
|
||||
if (sscreen->debug_flags & DBG(SHADOW_REGS))
|
||||
sscreen->info.register_shadowing_required = true;
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
sscreen->use_aco = (sscreen->debug_flags & DBG(USE_ACO));
|
||||
#else
|
||||
sscreen->use_aco = true;
|
||||
@@ -1555,7 +1555,7 @@ struct pipe_screen *radeonsi_screen_create(int fd, const struct pipe_screen_conf
|
||||
if (!version)
|
||||
return NULL;
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
/* LLVM must be initialized before util_queue because both u_queue and LLVM call atexit,
|
||||
* and LLVM must call it first because its atexit handler executes C++ destructors,
|
||||
* which must be done after our compiler threads using LLVM in u_queue are finished
|
||||
|
@@ -2661,7 +2661,7 @@ si_nir_generate_gs_copy_shader(struct si_screen *sscreen,
|
||||
}
|
||||
|
||||
bool ok =
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
!sscreen->use_aco ? si_llvm_compile_shader(sscreen, compiler, shader, &args, debug, nir) :
|
||||
#endif
|
||||
si_aco_compile_shader(shader, &args, nir, debug);
|
||||
@@ -2931,7 +2931,7 @@ bool si_compile_shader(struct si_screen *sscreen, struct ac_llvm_compiler *compi
|
||||
float_mode &= ~V_00B028_FP_16_64_DENORMS;
|
||||
|
||||
ret =
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
!sscreen->use_aco ? si_llvm_compile_shader(sscreen, compiler, shader, &args, debug, nir) :
|
||||
#endif
|
||||
si_aco_compile_shader(shader, &args, nir, debug);
|
||||
@@ -3097,7 +3097,7 @@ si_get_shader_part(struct si_screen *sscreen, struct si_shader_part **list,
|
||||
result->key = *key;
|
||||
|
||||
bool ok =
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
!sscreen->use_aco ? si_llvm_build_shader_part(sscreen, stage, prolog, compiler, debug, name, result) :
|
||||
#endif
|
||||
si_aco_build_shader_part(sscreen, stage, prolog, debug, name, result);
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#if LLVM_AVAILABLE
|
||||
#include "ac_llvm_util.h"
|
||||
#endif
|
||||
|
||||
|
@@ -101,7 +101,7 @@ svga_get_name( struct pipe_screen *pscreen )
|
||||
#else
|
||||
build = "build: RELEASE;";
|
||||
#endif
|
||||
#ifdef DRAW_LLVM_AVAILABLE
|
||||
#if DRAW_LLVM_AVAILABLE
|
||||
llvm = "LLVM;";
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user