From 27829d7ffe46b9e85f6052b9b0f589ae385f82d5 Mon Sep 17 00:00:00 2001 From: Sil Vilerino Date: Mon, 3 Feb 2025 07:57:27 -0500 Subject: [PATCH] d3d12: Do not build microsoft/compiler when graphics, gl or vk disabled Reviewed-By: Pohsiang Hsu Part-of: --- src/gallium/drivers/d3d12/d3d12_context.h | 2 ++ .../drivers/d3d12/d3d12_context_common.cpp | 13 +++++------ src/gallium/drivers/d3d12/d3d12_copy.cpp | 4 ---- src/gallium/drivers/d3d12/d3d12_screen.cpp | 11 ++++++---- src/gallium/drivers/d3d12/d3d12_screen.h | 4 ++++ src/gallium/drivers/d3d12/meson.build | 7 +++++- src/microsoft/meson.build | 22 ++++++++++--------- 7 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/d3d12/d3d12_context.h b/src/gallium/drivers/d3d12/d3d12_context.h index 68822cc30aa..991fc8801e6 100644 --- a/src/gallium/drivers/d3d12/d3d12_context.h +++ b/src/gallium/drivers/d3d12/d3d12_context.h @@ -28,7 +28,9 @@ #include "d3d12_descriptor_pool.h" #include "d3d12_pipeline_state.h" +#ifdef HAVE_GALLIUM_D3D12_GRAPHICS #include "dxil_nir_lower_int_samplers.h" +#endif // HAVE_GALLIUM_D3D12_GRAPHICS #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/drivers/d3d12/d3d12_context_common.cpp b/src/gallium/drivers/d3d12/d3d12_context_common.cpp index d741a0a7fa3..75bafe5496a 100644 --- a/src/gallium/drivers/d3d12/d3d12_context_common.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context_common.cpp @@ -24,8 +24,14 @@ #include "d3d12_blit.h" #include "d3d12_cmd_signature.h" #include "d3d12_context.h" +#ifdef HAVE_GALLIUM_D3D12_GRAPHICS #include "d3d12_compiler.h" #include "d3d12_compute_transforms.h" +#include "nir_to_dxil.h" +#ifdef _WIN32 +#include "dxil_validator.h" +#endif +#endif // HAVE_GALLIUM_D3D12_GRAPHICS #include "d3d12_debug.h" #include "d3d12_fence.h" #include "d3d12_format.h" @@ -52,16 +58,9 @@ #include "util/u_pstipple.h" #include "util/u_sample_positions.h" #include "util/u_dl.h" -#include "nir_to_dxil.h" - #include - #include -#ifdef _WIN32 -#include "dxil_validator.h" -#endif - static void d3d12_context_destroy(struct pipe_context *pctx) { diff --git a/src/gallium/drivers/d3d12/d3d12_copy.cpp b/src/gallium/drivers/d3d12/d3d12_copy.cpp index af27a437530..ef96d4a1df7 100644 --- a/src/gallium/drivers/d3d12/d3d12_copy.cpp +++ b/src/gallium/drivers/d3d12/d3d12_copy.cpp @@ -22,7 +22,6 @@ */ #include "d3d12_context.h" -#include "d3d12_compiler.h" #include "d3d12_debug.h" #include "d3d12_format.h" #include "d3d12_query.h" @@ -32,9 +31,6 @@ #include "util/u_blitter.h" #include "util/format/u_format.h" -#include "nir_to_dxil.h" -#include "nir_builder.h" - static void copy_buffer_region_no_barriers(struct d3d12_context *ctx, struct d3d12_resource *dst, diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp index 9881cbc2d87..4d9f1d4500c 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp @@ -24,7 +24,12 @@ #include "d3d12_screen.h" #include "d3d12_bufmgr.h" +#ifdef HAVE_GALLIUM_D3D12_GRAPHICS #include "d3d12_compiler.h" +#include "d3d12_nir_passes.h" +#include "nir.h" +#include "nir_to_dxil.h" +#endif // HAVE_GALLIUM_D3D12_GRAPHICS #include "d3d12_context.h" #include "d3d12_debug.h" #include "d3d12_fence.h" @@ -35,8 +40,6 @@ #include "d3d12_interop_public.h" #include "d3d12_residency.h" #include "d3d12_resource.h" -#include "d3d12_nir_passes.h" - #include "pipebuffer/pb_bufmgr.h" #include "util/u_debug.h" #include "util/u_math.h" @@ -45,10 +48,8 @@ #include "util/u_dl.h" #include "util/mesa-sha1.h" -#include "nir.h" #include "frontend/sw_winsys.h" -#include "nir_to_dxil.h" #include "git_sha1.h" #ifndef _GAMING_XBOX @@ -427,8 +428,10 @@ d3d12_init_screen_caps(struct d3d12_screen *screen) caps->max_line_width = caps->max_line_width_aa = 1.0f; /* no clue */ +#ifdef HAVE_GALLIUM_D3D12_GRAPHICS caps->max_point_size = caps->max_point_size_aa = D3D12_MAX_POINT_SIZE; +#endif // HAVE_GALLIUM_D3D12_GRAPHICS caps->max_texture_anisotropy = D3D12_MAX_MAXANISOTROPY; diff --git a/src/gallium/drivers/d3d12/d3d12_screen.h b/src/gallium/drivers/d3d12/d3d12_screen.h index b7083cbe3ba..ba667f053c2 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.h +++ b/src/gallium/drivers/d3d12/d3d12_screen.h @@ -30,7 +30,9 @@ #include "d3d12_descriptor_pool.h" #include "nir.h" +#ifdef HAVE_GALLIUM_D3D12_GRAPHICS #include "dxil_versions.h" +#endif // HAVE_GALLIUM_D3D12_GRAPHICS #include "d3d12_common.h" @@ -118,7 +120,9 @@ struct d3d12_screen { /* capabilities */ D3D_FEATURE_LEVEL max_feature_level; +#ifdef HAVE_GALLIUM_D3D12_GRAPHICS enum dxil_shader_model max_shader_model; +#endif // HAVE_GALLIUM_D3D12_GRAPHICS D3D12_FEATURE_DATA_ARCHITECTURE architecture; D3D12_FEATURE_DATA_D3D12_OPTIONS opts; D3D12_FEATURE_DATA_D3D12_OPTIONS1 opts1; diff --git a/src/gallium/drivers/d3d12/meson.build b/src/gallium/drivers/d3d12/meson.build index da379cea7cd..2176d5b41cd 100644 --- a/src/gallium/drivers/d3d12/meson.build +++ b/src/gallium/drivers/d3d12/meson.build @@ -148,12 +148,17 @@ if is_xbox == false files_libd3d12 += files('d3d12_dxcore_screen.cpp') endif +libd3d12_deps = [idep_nir_headers, dep_dxheaders, idep_mesautil] +if with_gallium_d3d12_graphics + libd3d12_deps += [idep_libdxil_compiler] +endif + libd3d12 = static_library( 'd3d12', [files_libd3d12, sha1_h], gnu_symbol_visibility : 'hidden', include_directories : [inc_include, inc_src, inc_mesa, inc_gallium, inc_gallium_aux], - dependencies: [idep_nir_headers, idep_libdxil_compiler, dep_dxheaders, idep_mesautil], + dependencies: libd3d12_deps, c_args: libd3d12_compiler_args, cpp_args: libd3d12_compiler_args, ) diff --git a/src/microsoft/meson.build b/src/microsoft/meson.build index fa7a8999612..43f6a488861 100644 --- a/src/microsoft/meson.build +++ b/src/microsoft/meson.build @@ -1,13 +1,15 @@ # Copyright © Microsoft Corporation # SPDX-License-Identifier: MIT -subdir('compiler') -if with_microsoft_clc - subdir('clc') -endif -if with_spirv_to_dxil or with_microsoft_vk - subdir('spirv_to_dxil') -endif -if with_microsoft_vk - subdir('vulkan') -endif +if with_microsoft_clc or with_spirv_to_dxil or with_microsoft_vk or (with_gallium_d3d12 and not get_option('gallium-d3d12-graphics').disabled()) + subdir('compiler') + if with_microsoft_clc + subdir('clc') + endif + if with_spirv_to_dxil or with_microsoft_vk + subdir('spirv_to_dxil') + endif + if with_microsoft_vk + subdir('vulkan') + endif +endif \ No newline at end of file