Skip to content

Commit 4aa10d8

Browse files
authored
Merge pull request #1 from GPUOpen-LibrariesAndSDKs/master
Fork sync
2 parents 021b15b + 5f63b20 commit 4aa10d8

28 files changed

Lines changed: 1932 additions & 149 deletions

include/misc/buffer_create_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace Anvil
104104
VkDeviceSize in_start_offset,
105105
VkDeviceSize in_size);
106106

107-
const void* const get_client_data() const
107+
const void* get_client_data() const
108108
{
109109
return m_client_data_ptr;
110110
}
@@ -287,4 +287,4 @@ namespace Anvil
287287
ANVIL_DISABLE_COPY_CONSTRUCTOR(BufferCreateInfo);
288288
};
289289
}; /* namespace Anvil */
290-
#endif /* MISC_BUFFER_CREATE_INFO_H */
290+
#endif /* MISC_BUFFER_CREATE_INFO_H */

include/misc/extensions.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ namespace Anvil
5151
ValueType ext_debug_marker;
5252
ValueType ext_depth_range_unrestricted;
5353
ValueType ext_descriptor_indexing;
54+
ValueType ext_pci_bus_info;
5455
ValueType ext_external_memory_host;
5556
ValueType ext_hdr_metadata;
5657
ValueType ext_sample_locations;
@@ -138,6 +139,7 @@ namespace Anvil
138139
{ExtensionData(VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, &ext_descriptor_indexing)},
139140
{ExtensionData(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME, &ext_external_memory_host)},
140141
{ExtensionData(VK_EXT_HDR_METADATA_EXTENSION_NAME, &ext_hdr_metadata)},
142+
{ExtensionData(VK_EXT_PCI_BUS_INFO_EXTENSION_NAME, &ext_pci_bus_info)},
141143
{ExtensionData(VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, &ext_sample_locations)},
142144
{ExtensionData(VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, &ext_sampler_filter_minmax)},
143145
{ExtensionData(VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME, &ext_shader_stencil_export)},
@@ -309,6 +311,7 @@ namespace Anvil
309311
virtual ValueType ext_descriptor_indexing () const = 0;
310312
virtual ValueType ext_external_memory_host () const = 0;
311313
virtual ValueType ext_hdr_metadata () const = 0;
314+
virtual ValueType ext_pci_bus_info () const = 0;
312315
virtual ValueType ext_sample_locations () const = 0;
313316
virtual ValueType ext_sampler_filter_minmax () const = 0;
314317
virtual ValueType ext_shader_stencil_export () const = 0;
@@ -615,6 +618,13 @@ namespace Anvil
615618
return m_device_extensions_ptr->ext_hdr_metadata;
616619
}
617620

621+
ValueType ext_pci_bus_info() const final
622+
{
623+
anvil_assert(m_expose_device_extensions);
624+
625+
return m_device_extensions_ptr->ext_pci_bus_info;
626+
}
627+
618628
ValueType ext_sampler_filter_minmax() const final
619629
{
620630
anvil_assert(m_expose_device_extensions);
@@ -918,7 +928,6 @@ namespace Anvil
918928
return m_instance_extensions_ptr->khr_surface;
919929
}
920930

921-
922931
#ifdef _WIN32
923932
#if defined(ANVIL_INCLUDE_WIN3264_WINDOW_SYSTEM_SUPPORT)
924933
ValueType khr_win32_surface() const final

include/misc/formats.h

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ namespace Anvil
9191
/** Returns bit layout for the specified format.
9292
*
9393
* NOTE: Only non-compressed formats are supported.
94+
* NOTE: YUV KHR formats are NOT supported for this function.
9495
* NOTE: Components not used by the specified format have start and end bit indices set to UINT32_MAX.
9596
*
9697
* @param in_format Non-compressed format to use for the query.
@@ -125,15 +126,39 @@ namespace Anvil
125126
uint32_t* out_opt_stencil_component_start_bit_index_ptr = nullptr,
126127
uint32_t* out_opt_stencil_component_end_bit_index_ptr = nullptr);
127128

128-
/** Tells what component layout is used by @param in_format. */
129+
/** Tells what component layout is used by @param in_format.
130+
*
131+
* NOTE: This function does NOT support YUV KHR format. Please check the overloaded function if
132+
* you would like to use for YUV KHR format.
133+
*/
129134
static ComponentLayout get_format_component_layout(Anvil::Format in_format);
130135

131-
/** Tells the number of components used by @param in_format */
136+
/** Tells what component layout is used by @param in_format at specified subresource @param in_aspect.
137+
*
138+
* NOTE: Only YUV KHR formats are supported.
139+
*/
140+
static ComponentLayout get_format_component_layout(Anvil::Format in_format,
141+
Anvil::ImageAspectFlagBits in_aspect);
142+
143+
/** Tells the number of components used by @param in_format
144+
*
145+
* NOTE: This function does NOT support YUV KHR format. Please check the overloaded function if
146+
* you would like to use for YUV KHR format.
147+
*/
132148
static uint32_t get_format_n_components(Anvil::Format in_format);
133149

150+
/** Tells the number of components used by @param in_format under specified subresource @param in_aspect.
151+
*
152+
* NOTE: Only YUV KHR formats are supported.
153+
*/
154+
static uint32_t get_format_n_components(Anvil::Format in_format,
155+
Anvil::ImageAspectFlagBits in_aspect);
156+
134157
/* Tells the number of bits used for each component in case of Vulkan format specified
135158
* under @param in_format.
136159
*
160+
* NOTE: This function does NOT support YUV KHR format. Please check the overloaded function if
161+
* you would like to use for YUV KHR format.
137162
* NOTE: Number of bits reported for each component uses ordering as reported for the format
138163
* via get_format_component_layout(). This is especially important in the context of packed formats.
139164
*
@@ -153,23 +178,87 @@ namespace Anvil
153178
uint32_t* out_channel2_bits_ptr,
154179
uint32_t* out_channel3_bits_ptr);
155180

181+
/* Tells the number of bits used for each component in case of Vulkan format specified
182+
* under @param in_format at subresource @param in_aspect.
183+
*
184+
* NOTE: Only YUV KHR fromats are supported.
185+
* NOTE: Number of bits reported for each component uses ordering as reported for the format
186+
* via get_format_component_layout(). This is especially important in the context of packed formats.
187+
*
188+
* @param in_format Vulkan format to use for the query.
189+
* @param out_channel0_bits_ptr Deref will be set to the number of bits used for channel 0. Must
190+
* not be nullptr.
191+
* @param out_channel1_bits_ptr Deref will be set to the number of bits used for channel 1. Must
192+
* not be nullptr.
193+
* @param out_channel2_bits_ptr Deref will be set to the number of bits used for channel 2. Must
194+
* not be nullptr.
195+
* @param out_channel3_bits_ptr Deref will be set to the number of bits used for channel 3. Must
196+
* not be nullptr.
197+
*/
198+
static void get_format_n_component_bits(Anvil::Format in_format,
199+
Anvil::ImageAspectFlagBits in_aspect,
200+
uint32_t* out_channel0_bits_ptr,
201+
uint32_t* out_channel1_bits_ptr,
202+
uint32_t* out_channel2_bits_ptr,
203+
uint32_t* out_channel3_bits_ptr);
204+
156205
/* Returns a raw C string for specified format, or NULL if the format is unknown. */
157206
static const char* get_format_name(Anvil::Format in_format);
158207

159208
/** Tells the format type used by @param in_format. */
160209
static FormatType get_format_type(Anvil::Format in_format);
161210

162-
/** Tells whether @param in_format includes a depth aspect */
211+
/** Returns the extent of subresource @param in_aspect with specified format @param in_format.
212+
*
213+
* NOTE: Only YUV KHR formats are supported.
214+
*
215+
* @param in_format VUlkan format.
216+
* @param in_aspect Image aspect for specific subresource of the format.
217+
* @param in_image_extent Image extent specified when creating image.
218+
* @param out_plane_extent_ptr Deref will be set to the extent of the specified subresource.
219+
* Must not be nullptr.
220+
*/
221+
static void get_yuv_format_plane_extent(Anvil::Format in_format,
222+
Anvil::ImageAspectFlagBits in_aspect,
223+
VkExtent3D in_image_extent,
224+
VkExtent3D* out_plane_extent_ptr);
225+
/** Tells whether @param in_format includes a depth aspect.
226+
*
227+
* NOTE: YUV KHR formats are NOT supported.
228+
*/
163229
static bool has_depth_aspect(Anvil::Format in_format);
164230

165-
/** Tells whether @param in_format includes a stencil aspect */
231+
/** Tells whether @param in_format includes a stencil aspect.
232+
*
233+
* NOTE: YUV KHR formats are NOT supported.
234+
*/
166235
static bool has_stencil_aspect(Anvil::Format in_format);
167236

168237
/** Tells whether @param in_format format is a block format. */
169238
static bool is_format_compressed(Anvil::Format in_format);
170239

240+
/** Tells whether @param in_format format is a multiplanar format. */
241+
static bool is_format_multiplanar(Anvil::Format in_format);
242+
243+
/** Tells whether @param in_format is a KHR YUV format */
244+
static bool is_format_yuv_khr(Anvil::Format in_format);
245+
171246
/** Tells whether @param in_format is a packed format */
172247
static bool is_format_packed(Anvil::Format in_format);
248+
249+
private:
250+
/** Returns the index of subresource info by given @param in_format and @param in_aspect.
251+
*
252+
* NOTE: Only YUV KHR formats are supported.
253+
*/
254+
static uint32_t get_yuv_format_plane_index(Anvil::Format in_format,
255+
Anvil::ImageAspectFlagBits in_aspect);
256+
257+
/** Returns the number of subresources by given @param in_format.
258+
*
259+
* NOTE: Only YUV KHR formats are supported.
260+
*/
261+
static uint32_t get_yuv_format_n_planes(Anvil::Format in_format);
173262
};
174263
};
175264

include/misc/glsl_to_spirv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ namespace Anvil
305305
}
306306

307307
/** Returns the number of bytes the SPIR-V blob, accessible via get_spirv_blob(), takes. */
308-
const uint32_t get_spirv_blob_size() const
308+
uint32_t get_spirv_blob_size() const
309309
{
310310
if (m_spirv_blob.size() == 0)
311311
{

include/misc/image_view_create_info.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ namespace Anvil
295295
}
296296

297297
/** Returns image view's format */
298-
const Anvil::Format get_format() const
298+
Anvil::Format get_format() const
299299
{
300300
return m_format;
301301
}
@@ -330,7 +330,7 @@ namespace Anvil
330330
}
331331

332332
/** Returns image view type of the image view instance */
333-
const Anvil::ImageViewType get_type() const
333+
Anvil::ImageViewType get_type() const
334334
{
335335
return m_type;
336336
}
@@ -443,4 +443,4 @@ namespace Anvil
443443

444444
}; /* namespace Anvil */
445445

446-
#endif/* MISC_IMAGE_VIEW_CREATE_INFO_H */
446+
#endif/* MISC_IMAGE_VIEW_CREATE_INFO_H */

include/misc/semaphore_create_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ namespace Anvil
130130

131131
private:
132132
/* Private functions */
133-
SemaphoreCreateInfo(const Anvil::BaseDevice* in_device_ptr,
134-
MTSafety in_mt_safety);
133+
SemaphoreCreateInfo(const Anvil::BaseDevice* in_device_ptr,
134+
MTSafety in_mt_safety);
135135

136136
/* Private variables */
137137
const Anvil::BaseDevice* m_device_ptr;

include/misc/struct_chainer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace Anvil
7979
struct_chain_ptrs.push_back(std::move(inout_struct_chain_ptr) );
8080
}
8181

82-
const uint32_t get_n_structs() const
82+
uint32_t get_n_structs() const
8383
{
8484
return static_cast<uint32_t>(root_structs.size() );
8585
}
@@ -307,4 +307,4 @@ namespace Anvil
307307
};
308308
};
309309

310-
#endif /* MISC_STRUCT_CHAINER_H */
310+
#endif /* MISC_STRUCT_CHAINER_H */

include/misc/types_enums.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,16 @@ namespace Anvil
628628
/* NOTE: If the ordering used below needs to be changed, make sure to also update formats.cpp::layout_to_n_components */
629629
ABGR,
630630
ARGB,
631+
B,
631632
BGR,
632633
BGRA,
634+
BGRG,
635+
BR,
633636
D,
634637
DS,
635638
EBGR,
639+
G,
640+
GBGR,
636641
R,
637642
RG,
638643
RGB,
@@ -966,6 +971,42 @@ namespace Anvil
966971
ASTC_12x12_UNORM_BLOCK = VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
967972
ASTC_12x12_SRGB_BLOCK = VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
968973

974+
/* VK_KHR_sampler_ycbcr_conversion */
975+
G8B8G8R8_422_UNORM = VK_FORMAT_G8B8G8R8_422_UNORM_KHR,
976+
B8G8R8G8_422_UNORM = VK_FORMAT_B8G8R8G8_422_UNORM_KHR,
977+
G8_B8_R8_3PLANE_420_UNORM = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR,
978+
G8_B8R8_2PLANE_420_UNORM = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR,
979+
G8_B8_R8_3PLANE_422_UNORM = VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR,
980+
G8_B8R8_2PLANE_422_UNORM = VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR,
981+
G8_B8_R8_3PLANE_444_UNORM = VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR,
982+
R10X6_UNORM_PACK16 = VK_FORMAT_R10X6_UNORM_PACK16_KHR,
983+
R10X6G10X6_UNORM_2PACK16 = VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR,
984+
R10X6G10X6B10X6A10X6_UNORM_4PACK16 = VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR,
985+
G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR,
986+
B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR,
987+
G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR,
988+
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR,
989+
G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR,
990+
G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR,
991+
G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR,
992+
R12X4_UNORM_PACK16 = VK_FORMAT_R12X4_UNORM_PACK16_KHR,
993+
R12X4G12X4_UNORM_2PACK16 = VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR,
994+
R12X4G12X4B12X4A12X4_UNORM_4PACK16 = VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR,
995+
G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR,
996+
B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR,
997+
G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR,
998+
G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR,
999+
G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR,
1000+
G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR,
1001+
G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR,
1002+
G16B16G16R16_422_UNORM = VK_FORMAT_G16B16G16R16_422_UNORM_KHR,
1003+
B16G16R16G16_422_UNORM = VK_FORMAT_B16G16R16G16_422_UNORM_KHR,
1004+
G16_B16_R16_3PLANE_420_UNORM = VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR,
1005+
G16_B16R16_2PLANE_420_UNORM = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR,
1006+
G16_B16_R16_3PLANE_422_UNORM = VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR,
1007+
G16_B16R16_2PLANE_422_UNORM = VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR,
1008+
G16_B16_R16_3PLANE_444_UNORM = VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR,
1009+
9691010
/* Other .. */
9701011
UNKNOWN = VK_FORMAT_UNDEFINED,
9711012
};
@@ -1006,6 +1047,11 @@ namespace Anvil
10061047
METADATA_BIT = VK_IMAGE_ASPECT_METADATA_BIT,
10071048
STENCIL_BIT = VK_IMAGE_ASPECT_STENCIL_BIT,
10081049

1050+
/* VK_KHR_sampler_ycbcr_conversion aspects */
1051+
PLANE_0_BIT = VK_IMAGE_ASPECT_PLANE_0_BIT_KHR,
1052+
PLANE_1_BIT = VK_IMAGE_ASPECT_PLANE_1_BIT_KHR,
1053+
PLANE_2_BIT = VK_IMAGE_ASPECT_PLANE_2_BIT_KHR,
1054+
10091055
NONE = 0
10101056
};
10111057
typedef Anvil::Bitfield<Anvil::ImageAspectFlagBits, VkImageAspectFlags> ImageAspectFlags;

include/misc/types_struct.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,19 @@ namespace Anvil
603603
bool operator==(const EXTExternalMemoryHostProperties& in_props) const;
604604
} EXTExternalMemoryHostProperties;
605605

606+
typedef struct EXTPCIBusInfoProperties
607+
{
608+
uint8_t pci_bus;
609+
uint8_t pci_device;
610+
uint16_t pci_domain;
611+
uint8_t pci_function;
612+
613+
EXTPCIBusInfoProperties();
614+
EXTPCIBusInfoProperties(const VkPhysicalDevicePCIBusInfoPropertiesEXT& in_props);
615+
616+
bool operator==(const EXTPCIBusInfoProperties& in_props) const;
617+
} EXTPCIBusInfoProperties;
618+
606619
typedef struct EXTSampleLocationsProperties
607620
{
608621
VkExtent2D max_sample_location_grid_size;
@@ -2104,6 +2117,7 @@ namespace Anvil
21042117
const PhysicalDevicePropertiesCoreVK10* core_vk1_0_properties_ptr;
21052118
const EXTDescriptorIndexingProperties* ext_descriptor_indexing_properties_ptr;
21062119
const EXTExternalMemoryHostProperties* ext_external_memory_host_properties_ptr;
2120+
const EXTPCIBusInfoProperties* ext_pci_bus_info_properties_ptr;
21072121
const EXTSampleLocationsProperties* ext_sample_locations_properties_ptr;
21082122
const EXTSamplerFilterMinmaxProperties* ext_sampler_filter_minmax_properties_ptr;
21092123
const EXTVertexAttributeDivisorProperties* ext_vertex_attribute_divisor_properties_ptr;
@@ -2117,6 +2131,7 @@ namespace Anvil
21172131
const PhysicalDevicePropertiesCoreVK10* in_core_vk1_0_properties_ptr,
21182132
const EXTDescriptorIndexingProperties* in_ext_descriptor_indexing_properties_ptr,
21192133
const EXTExternalMemoryHostProperties* in_ext_external_memory_host_properties_ptr,
2134+
const EXTPCIBusInfoProperties* in_ext_pci_bus_info_properties_ptr,
21202135
const EXTSampleLocationsProperties* in_ext_sample_locations_properties_ptr,
21212136
const EXTSamplerFilterMinmaxProperties* in_ext_sampler_filter_minmax_properties_ptr,
21222137
const EXTVertexAttributeDivisorProperties* in_ext_vertex_attribute_divisor_properties_ptr,

0 commit comments

Comments
 (0)