mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-27 01:20:36 +00:00
vulkan: Move common format function to vulkan/util/vk_format.h
Moving duplicate vk_format helper functions to common vulkan/util/vk_format.h and also renaming vk_format_get_component_size_in_bits to match how amd and freedreno name the same function. Not moving this function to common code as freedreno's implementation is a bit different. Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15696>
This commit is contained in:
parent
9f6571e80a
commit
d5405c1608
@ -32,15 +32,6 @@
|
||||
#include <vulkan/util/vk_format.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
/**
|
||||
* Return total bits needed for the pixel format per block.
|
||||
*/
|
||||
static inline unsigned
|
||||
vk_format_get_blocksizebits(VkFormat format)
|
||||
{
|
||||
return util_format_get_blocksizebits(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the index of the first non-void channel
|
||||
* -1 if no non-void channels
|
||||
|
@ -34,12 +34,6 @@
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
static inline bool
|
||||
vk_format_has_alpha(VkFormat format)
|
||||
{
|
||||
return util_format_has_alpha(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
vk_format_get_component_bits(VkFormat format,
|
||||
enum util_format_colorspace colorspace,
|
||||
|
@ -84,14 +84,14 @@ void pvr_pbe_get_src_format_and_gamma(VkFormat vk_format,
|
||||
/* F16 source for gamma'd formats. */
|
||||
*src_format_out = PVRX(PBESTATE_SOURCE_FORMAT_F16_PER_CHANNEL);
|
||||
} else if (vk_format_has_depth(vk_format) &&
|
||||
vk_format_get_component_size_in_bits(vk_format,
|
||||
UTIL_FORMAT_COLORSPACE_ZS,
|
||||
0) > 16) {
|
||||
vk_format_get_component_bits(vk_format,
|
||||
UTIL_FORMAT_COLORSPACE_ZS,
|
||||
0) > 16) {
|
||||
*src_format_out = PVRX(PBESTATE_SOURCE_FORMAT_8_PER_CHANNEL);
|
||||
} else if (vk_format_has_stencil(vk_format) &&
|
||||
vk_format_get_component_size_in_bits(vk_format,
|
||||
UTIL_FORMAT_COLORSPACE_ZS,
|
||||
1) > 0) {
|
||||
vk_format_get_component_bits(vk_format,
|
||||
UTIL_FORMAT_COLORSPACE_ZS,
|
||||
1) > 0) {
|
||||
*src_format_out = PVRX(PBESTATE_SOURCE_FORMAT_8_PER_CHANNEL);
|
||||
} else if (chan_0_width > 16) {
|
||||
*src_format_out = PVRX(PBESTATE_SOURCE_FORMAT_8_PER_CHANNEL);
|
||||
|
@ -54,24 +54,12 @@ vk_format_is_alpha_on_msb(VkFormat vk_format)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
vk_format_has_alpha(VkFormat vk_format)
|
||||
{
|
||||
return util_format_has_alpha(vk_format_to_pipe_format(vk_format));
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
vk_format_is_pure_integer(VkFormat vk_format)
|
||||
{
|
||||
return util_format_is_pure_integer(vk_format_to_pipe_format(vk_format));
|
||||
}
|
||||
|
||||
static inline uint
|
||||
vk_format_get_blocksizebits(VkFormat vk_format)
|
||||
{
|
||||
return util_format_get_blocksizebits(vk_format_to_pipe_format(vk_format));
|
||||
}
|
||||
|
||||
static inline uint
|
||||
vk_format_get_channel_width(VkFormat vk_format, uint32_t channel)
|
||||
{
|
||||
@ -96,9 +84,9 @@ vk_format_has_32bit_component(VkFormat vk_format)
|
||||
}
|
||||
|
||||
static inline uint
|
||||
vk_format_get_component_size_in_bits(VkFormat vk_format,
|
||||
enum util_format_colorspace colorspace,
|
||||
uint32_t component)
|
||||
vk_format_get_component_bits(VkFormat vk_format,
|
||||
enum util_format_colorspace colorspace,
|
||||
uint32_t component)
|
||||
{
|
||||
return util_format_get_component_bits(vk_format_to_pipe_format(vk_format),
|
||||
colorspace,
|
||||
|
@ -170,6 +170,18 @@ vk_format_get_nr_components(VkFormat format)
|
||||
return util_format_get_nr_components(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
vk_format_has_alpha(VkFormat format)
|
||||
{
|
||||
return util_format_has_alpha(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
vk_format_get_blocksizebits(VkFormat format)
|
||||
{
|
||||
return util_format_get_blocksizebits(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user