• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © Microsoft Corporation
2# SPDX-License-Identifier: MIT
3
4libd3d12_compiler_args = []
5
6libd3d12_compiler_args += cc.get_supported_arguments([
7    '/we4267',
8    '/we4996',
9    '/we4146',
10    '/we4244',
11    '/we4389',
12    '/we4838',
13    '/we4302',
14    '/we4018',
15  ])
16
17_with_gallium_d3d12_graphics = get_option('gallium-d3d12-graphics')
18with_gallium_d3d12_graphics = false
19if not _with_gallium_d3d12_graphics.disabled()
20  with_gallium_d3d12_graphics = true
21  libd3d12_compiler_args += '-DHAVE_GALLIUM_D3D12_GRAPHICS'
22endif
23
24if not with_gallium_d3d12_video and not with_gallium_d3d12_graphics
25  error('d3d12 gallium driver must have at least one of gallium-d3d12-video or gallium-d3d12-graphics enabled.')
26endif
27
28files_libd3d12 = files(
29  'd3d12_batch.cpp',
30  'd3d12_copy.cpp',
31  'd3d12_bufmgr.cpp',
32  'd3d12_context_common.cpp',
33  'd3d12_fence.cpp',
34  'd3d12_format.c',
35  'd3d12_residency.cpp',
36  'd3d12_resource.cpp',
37  'd3d12_resource_state.cpp',
38  'd3d12_screen.cpp',
39)
40
41if with_gallium_d3d12_graphics
42  files_libd3d12 += [
43    'd3d12_blit.cpp',
44    'd3d12_draw.cpp',
45    'd3d12_surface.cpp',
46    'd3d12_context_graphics.cpp',
47    'd3d12_cmd_signature.cpp',
48    'd3d12_compiler.cpp',
49    'd3d12_compute_transforms.cpp',
50    'd3d12_descriptor_pool.cpp',
51    'd3d12_nir_passes.c',
52    'd3d12_pipeline_state.cpp',
53    'd3d12_query.cpp',
54    'd3d12_root_signature.cpp',
55    'd3d12_gs_variant.cpp',
56    'd3d12_lower_image_casts.c',
57    'd3d12_lower_point_sprite.c',
58    'd3d12_tcs_variant.cpp',
59  ]
60endif
61
62if with_gallium_d3d12_video
63  files_libd3d12 += [
64    'd3d12_video_dec.cpp',
65    'd3d12_video_dec_references_mgr.cpp',
66    'd3d12_video_buffer.cpp',
67    'd3d12_video_enc.cpp',
68    'd3d12_video_encoder_bitstream.cpp',
69    'd3d12_video_texture_array_dpb_manager.cpp',
70    'd3d12_video_array_of_textures_dpb_manager.cpp',
71    'd3d12_video_screen.cpp',
72    'd3d12_video_proc.cpp',
73  ]
74
75if _codecs.contains('h264dec')
76  files_libd3d12 += [
77    'd3d12_video_dec_h264.cpp',
78  ]
79endif
80
81if _codecs.contains('h265dec')
82  files_libd3d12 += [
83    'd3d12_video_dec_hevc.cpp',
84  ]
85endif
86
87if _codecs.contains('av1dec')
88  files_libd3d12 += [
89    'd3d12_video_dec_av1.cpp',
90  ]
91endif
92
93if _codecs.contains('vp9dec')
94  files_libd3d12 += [
95    'd3d12_video_dec_vp9.cpp',
96  ]
97endif
98
99if _codecs.contains('h264enc')
100  files_libd3d12 += [
101    'd3d12_video_enc_h264.cpp',
102    'd3d12_video_encoder_references_manager_h264.cpp',
103    'd3d12_video_encoder_nalu_writer_h264.cpp',
104    'd3d12_video_encoder_bitstream_builder_h264.cpp',
105  ]
106endif
107
108if _codecs.contains('h265enc')
109  files_libd3d12 += [
110    'd3d12_video_enc_hevc.cpp',
111    'd3d12_video_encoder_bitstream_builder_hevc.cpp',
112    'd3d12_video_encoder_nalu_writer_hevc.cpp',
113    'd3d12_video_encoder_references_manager_hevc.cpp',
114  ]
115endif
116
117if _codecs.contains('av1enc')
118  files_libd3d12 += [
119    'd3d12_video_enc_av1.cpp',
120    'd3d12_video_encoder_references_manager_av1.cpp',
121    'd3d12_video_encoder_bitstream_builder_av1.cpp',
122  ]
123endif
124
125endif # with_gallium_d3d12_video
126
127is_xbox = target_machine.system().startswith('Gaming.Xbox')
128if host_machine.system() == 'windows'
129  if is_xbox
130    files_libd3d12 += files('d3d12_dxgi_xbox_screen.cpp')
131  else
132    files_libd3d12 += files('d3d12_dxgi_screen.cpp')
133  endif
134endif
135if is_xbox == false
136  files_libd3d12 += files('d3d12_dxcore_screen.cpp')
137endif
138
139libd3d12 = static_library(
140  'd3d12',
141  [files_libd3d12, sha1_h],
142  gnu_symbol_visibility : 'hidden',
143  include_directories : [inc_include, inc_src, inc_mesa, inc_gallium, inc_gallium_aux],
144  dependencies: [idep_nir_headers, idep_libdxil_compiler, dep_dxheaders, idep_mesautil],
145  c_args: libd3d12_compiler_args,
146  cpp_args: libd3d12_compiler_args,
147)
148
149driver_d3d12 = declare_dependency(
150  compile_args : '-DGALLIUM_D3D12',
151  link_with : [libd3d12],
152)
153