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