@@ -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
0 commit comments