1 /* 2 * Copyright © Microsoft Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 #ifndef D3D12_FORMATS_H 25 #define D3D12_FORMATS_H 26 27 #include "d3d12_common.h" 28 29 #include <directx/dxgiformat.h> 30 #include <directx/dxgicommon.h> 31 32 #include "util/format/u_formats.h" 33 #include "pipe/p_defines.h" 34 #include "pipe/p_video_enums.h" 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 DXGI_FORMAT 41 d3d12_get_format(enum pipe_format format); 42 43 DXGI_FORMAT 44 d3d12_get_typeless_format(enum pipe_format format); 45 46 const DXGI_FORMAT * 47 d3d12_get_format_cast_list(enum pipe_format format, uint32_t *num_formats); 48 49 /* These two are only used for importing external resources without a provided template */ 50 enum pipe_format 51 d3d12_get_pipe_format(DXGI_FORMAT format); 52 53 enum pipe_format 54 d3d12_get_default_pipe_format(DXGI_FORMAT format); 55 56 DXGI_FORMAT 57 d3d12_get_resource_srv_format(enum pipe_format f, enum pipe_texture_target target); 58 59 DXGI_FORMAT 60 d3d12_get_resource_rt_format(enum pipe_format f); 61 62 unsigned 63 d3d12_non_opaque_plane_count(DXGI_FORMAT f); 64 65 struct d3d12_format_info { 66 const enum pipe_swizzle *swizzle; 67 int plane_slice; 68 }; 69 70 struct d3d12_format_info 71 d3d12_get_format_info(enum pipe_format resource_format, enum pipe_format format, enum pipe_texture_target); 72 73 enum pipe_format 74 d3d12_emulated_vtx_format(enum pipe_format fmt); 75 76 unsigned 77 d3d12_get_format_start_plane(enum pipe_format fmt); 78 79 unsigned 80 d3d12_get_format_num_planes(enum pipe_format fmt); 81 82 DXGI_FORMAT 83 d3d12_convert_pipe_video_profile_to_dxgi_format(enum pipe_video_profile profile); 84 85 DXGI_COLOR_SPACE_TYPE 86 d3d12_convert_from_legacy_color_space(bool rgb, uint32_t bits_per_element, bool studio_rgb, bool p709, bool studio_yuv); 87 88 #ifdef __cplusplus 89 } 90 #endif 91 92 #endif 93