"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/gallium/frontends/lavapipe/lvp_formats.c" between
mesa-21.2.0-rc1.tar.xz and mesa-21.2.0-rc2.tar.xz

About: Mesa is an open-source implementation of the OpenGL specification - a system for rendering interactive 3D graphics (main library code). Release candidate.

lvp_formats.c  (mesa-21.2.0-rc1.tar.xz):lvp_formats.c  (mesa-21.2.0-rc2.tar.xz)
skipping to change at line 29 skipping to change at line 29
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
#include "lvp_private.h" #include "lvp_private.h"
#include "util/format/u_format.h" #include "util/format/u_format.h"
#include "util/u_math.h" #include "util/u_math.h"
#include "vk_util.h" #include "vk_util.h"
#define COMMON_NAME(x) [VK_FORMAT_##x] = PIPE_FORMAT_##x
#define FLOAT_NAME(x) [VK_FORMAT_##x##_SFLOAT] = PIPE_FORMAT_##x##_FLOAT
static enum pipe_format format_to_vk_table[VK_FORMAT_ASTC_12x12_SRGB_BLOCK + 1]
= {
COMMON_NAME(R8_UNORM),
COMMON_NAME(R8G8_UNORM),
COMMON_NAME(R8G8B8_UNORM),
COMMON_NAME(R8G8B8A8_UNORM),
COMMON_NAME(R8_SNORM),
COMMON_NAME(R8G8_SNORM),
COMMON_NAME(R8G8B8_SNORM),
COMMON_NAME(R8G8B8A8_SNORM),
// COMMON_NAME(R8_SRGB),
COMMON_NAME(R8G8B8_SRGB),
COMMON_NAME(R8G8B8A8_SRGB),
COMMON_NAME(B8G8R8A8_UNORM),
COMMON_NAME(B8G8R8A8_SRGB),
COMMON_NAME(R8_UINT),
COMMON_NAME(R8G8_UINT),
COMMON_NAME(R8G8B8_UINT),
COMMON_NAME(R8G8B8A8_UINT),
COMMON_NAME(R16_UINT),
COMMON_NAME(R16G16_UINT),
COMMON_NAME(R16G16B16_UINT),
COMMON_NAME(R16G16B16A16_UINT),
COMMON_NAME(R32_UINT),
COMMON_NAME(R32G32_UINT),
COMMON_NAME(R32G32B32_UINT),
COMMON_NAME(R32G32B32A32_UINT),
COMMON_NAME(R8_SINT),
COMMON_NAME(R8G8_SINT),
COMMON_NAME(R8G8B8_SINT),
COMMON_NAME(R8G8B8A8_SINT),
COMMON_NAME(R16_SINT),
COMMON_NAME(R16G16_SINT),
COMMON_NAME(R16G16B16_SINT),
COMMON_NAME(R16G16B16A16_SINT),
COMMON_NAME(R32_SINT),
COMMON_NAME(R32G32_SINT),
COMMON_NAME(R32G32B32_SINT),
COMMON_NAME(R32G32B32A32_SINT),
COMMON_NAME(R16_UNORM),
COMMON_NAME(R16G16_UNORM),
COMMON_NAME(R16G16B16_UNORM),
COMMON_NAME(R16G16B16A16_UNORM),
COMMON_NAME(R16_USCALED),
COMMON_NAME(R16G16_USCALED),
COMMON_NAME(R16G16B16_USCALED),
COMMON_NAME(R16G16B16A16_USCALED),
COMMON_NAME(R16_SNORM),
COMMON_NAME(R16G16_SNORM),
COMMON_NAME(R16G16B16_SNORM),
COMMON_NAME(R16G16B16A16_SNORM),
COMMON_NAME(R16_SSCALED),
COMMON_NAME(R16G16_SSCALED),
COMMON_NAME(R16G16B16_SSCALED),
COMMON_NAME(R16G16B16A16_SSCALED),
FLOAT_NAME(R16),
FLOAT_NAME(R16G16),
FLOAT_NAME(R16G16B16),
FLOAT_NAME(R16G16B16A16),
FLOAT_NAME(R32),
FLOAT_NAME(R32G32),
FLOAT_NAME(R32G32B32),
FLOAT_NAME(R32G32B32A32),
COMMON_NAME(S8_UINT),
[VK_FORMAT_UNDEFINED] = PIPE_FORMAT_NONE,
[VK_FORMAT_R5G6B5_UNORM_PACK16] = PIPE_FORMAT_B5G6R5_UNORM,
[VK_FORMAT_A1R5G5B5_UNORM_PACK16] = PIPE_FORMAT_B5G5R5A1_UNORM,
[VK_FORMAT_B4G4R4A4_UNORM_PACK16] = PIPE_FORMAT_A4R4G4B4_UNORM,
[VK_FORMAT_D16_UNORM] = PIPE_FORMAT_Z16_UNORM,
[VK_FORMAT_A8B8G8R8_UNORM_PACK32] = PIPE_FORMAT_R8G8B8A8_UNORM,
[VK_FORMAT_A8B8G8R8_SNORM_PACK32] = PIPE_FORMAT_R8G8B8A8_SNORM,
[VK_FORMAT_A8B8G8R8_UINT_PACK32] = PIPE_FORMAT_R8G8B8A8_UINT,
[VK_FORMAT_A8B8G8R8_SINT_PACK32] = PIPE_FORMAT_R8G8B8A8_SINT,
[VK_FORMAT_A8B8G8R8_SRGB_PACK32] = PIPE_FORMAT_R8G8B8A8_SRGB,
[VK_FORMAT_A2B10G10R10_UNORM_PACK32] = PIPE_FORMAT_R10G10B10A2_UNORM,
[VK_FORMAT_A2B10G10R10_SNORM_PACK32] = PIPE_FORMAT_R10G10B10A2_SNORM,
[VK_FORMAT_A2R10G10B10_UNORM_PACK32] = PIPE_FORMAT_B10G10R10A2_UNORM,
[VK_FORMAT_A2R10G10B10_SNORM_PACK32] = PIPE_FORMAT_B10G10R10A2_SNORM,
[VK_FORMAT_A2B10G10R10_UINT_PACK32] = PIPE_FORMAT_R10G10B10A2_UINT,
[VK_FORMAT_A2R10G10B10_UINT_PACK32] = PIPE_FORMAT_B10G10R10A2_UINT,
[VK_FORMAT_A2B10G10R10_USCALED_PACK32] = PIPE_FORMAT_R10G10B10A2_USCALED,
[VK_FORMAT_A2B10G10R10_SSCALED_PACK32] = PIPE_FORMAT_R10G10B10A2_SSCALED,
[VK_FORMAT_A2R10G10B10_USCALED_PACK32] = PIPE_FORMAT_B10G10R10A2_USCALED,
[VK_FORMAT_A2R10G10B10_SSCALED_PACK32] = PIPE_FORMAT_B10G10R10A2_SSCALED,
[VK_FORMAT_B10G11R11_UFLOAT_PACK32] = PIPE_FORMAT_R11G11B10_FLOAT,
[VK_FORMAT_E5B9G9R9_UFLOAT_PACK32] = PIPE_FORMAT_R9G9B9E5_FLOAT,
[VK_FORMAT_X8_D24_UNORM_PACK32] = PIPE_FORMAT_Z24X8_UNORM,
[VK_FORMAT_D32_SFLOAT] = PIPE_FORMAT_Z32_FLOAT,
[VK_FORMAT_D24_UNORM_S8_UINT] = PIPE_FORMAT_Z24_UNORM_S8_UINT,
[VK_FORMAT_D32_SFLOAT_S8_UINT] = PIPE_FORMAT_Z32_FLOAT_S8X24_UINT,
[VK_FORMAT_BC1_RGB_UNORM_BLOCK] = PIPE_FORMAT_DXT1_RGB,
[VK_FORMAT_BC1_RGBA_UNORM_BLOCK] = PIPE_FORMAT_DXT1_RGBA,
[VK_FORMAT_BC2_UNORM_BLOCK] = PIPE_FORMAT_DXT3_RGBA,
[VK_FORMAT_BC3_UNORM_BLOCK] = PIPE_FORMAT_DXT5_RGBA,
[VK_FORMAT_BC4_UNORM_BLOCK] = PIPE_FORMAT_RGTC1_UNORM,
[VK_FORMAT_BC5_UNORM_BLOCK] = PIPE_FORMAT_RGTC2_UNORM,
[VK_FORMAT_BC1_RGB_SRGB_BLOCK] = PIPE_FORMAT_DXT1_SRGB,
[VK_FORMAT_BC1_RGBA_SRGB_BLOCK] = PIPE_FORMAT_DXT1_SRGBA,
[VK_FORMAT_BC2_SRGB_BLOCK] = PIPE_FORMAT_DXT3_SRGBA,
[VK_FORMAT_BC3_SRGB_BLOCK] = PIPE_FORMAT_DXT5_SRGBA,
[VK_FORMAT_BC4_SNORM_BLOCK] = PIPE_FORMAT_RGTC1_SNORM,
[VK_FORMAT_BC5_SNORM_BLOCK] = PIPE_FORMAT_RGTC2_SNORM,
[VK_FORMAT_BC6H_UFLOAT_BLOCK] = PIPE_FORMAT_BPTC_RGB_UFLOAT,
[VK_FORMAT_BC6H_SFLOAT_BLOCK] = PIPE_FORMAT_BPTC_RGB_FLOAT,
[VK_FORMAT_BC7_UNORM_BLOCK] = PIPE_FORMAT_BPTC_RGBA_UNORM,
[VK_FORMAT_BC7_SRGB_BLOCK] = PIPE_FORMAT_BPTC_SRGBA,
};
enum pipe_format vk_format_to_pipe(VkFormat format)
{
if (format > VK_FORMAT_ASTC_12x12_SRGB_BLOCK)
return PIPE_FORMAT_NONE;
return format_to_vk_table[format];
}
static bool lvp_is_filter_minmax_format_supported(VkFormat format) static bool lvp_is_filter_minmax_format_supported(VkFormat format)
{ {
/* From the Vulkan spec 1.1.71: /* From the Vulkan spec 1.1.71:
* *
* "The following formats must support the * "The following formats must support the
* VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT feature with * VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT feature with
* VK_IMAGE_TILING_OPTIMAL, if they support * VK_IMAGE_TILING_OPTIMAL, if they support
* VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT." * VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT."
*/ */
/* TODO: enable more formats. */ /* TODO: enable more formats. */
skipping to change at line 207 skipping to change at line 63
default: default:
return false; return false;
} }
} }
static void static void
lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d evice, lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d evice,
VkFormat format, VkFormat format,
VkFormatProperties *out_properties) VkFormatProperties *out_properties)
{ {
enum pipe_format pformat = vk_format_to_pipe(format); enum pipe_format pformat = lvp_vk_format_to_pipe_format(format);
unsigned features = 0, buffer_features = 0; unsigned features = 0, buffer_features = 0;
if (pformat == PIPE_FORMAT_NONE) { if (pformat == PIPE_FORMAT_NONE) {
out_properties->linearTilingFeatures = 0; out_properties->linearTilingFeatures = 0;
out_properties->optimalTilingFeatures = 0; out_properties->optimalTilingFeatures = 0;
out_properties->bufferFeatures = 0; out_properties->bufferFeatures = 0;
return; return;
} }
if (physical_device->pscreen->is_format_supported(physical_device->pscreen, p format, if (physical_device->pscreen->is_format_supported(physical_device->pscreen, p format,
PIPE_TEXTURE_2D, 0, 0, PIPE _BIND_DEPTH_STENCIL)) { PIPE_TEXTURE_2D, 0, 0, PIPE _BIND_DEPTH_STENCIL)) {
skipping to change at line 325 skipping to change at line 181
static VkResult lvp_get_image_format_properties(struct lvp_physical_device *phys ical_device, static VkResult lvp_get_image_format_properties(struct lvp_physical_device *phys ical_device,
const VkPhysicalDeviceImageForm atInfo2 *info, const VkPhysicalDeviceImageForm atInfo2 *info,
VkImageFormatProperties *pImage FormatProperties) VkImageFormatProperties *pImage FormatProperties)
{ {
VkFormatProperties format_props; VkFormatProperties format_props;
VkFormatFeatureFlags format_feature_flags; VkFormatFeatureFlags format_feature_flags;
VkExtent3D maxExtent; VkExtent3D maxExtent;
uint32_t maxMipLevels; uint32_t maxMipLevels;
uint32_t maxArraySize; uint32_t maxArraySize;
VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT; VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT;
enum pipe_format pformat = vk_format_to_pipe(info->format); enum pipe_format pformat = lvp_vk_format_to_pipe_format(info->format);
lvp_physical_device_get_format_properties(physical_device, info->format, lvp_physical_device_get_format_properties(physical_device, info->format,
&format_props); &format_props);
if (info->tiling == VK_IMAGE_TILING_LINEAR) { if (info->tiling == VK_IMAGE_TILING_LINEAR) {
format_feature_flags = format_props.linearTilingFeatures; format_feature_flags = format_props.linearTilingFeatures;
} else if (info->tiling == VK_IMAGE_TILING_OPTIMAL) { } else if (info->tiling == VK_IMAGE_TILING_OPTIMAL) {
format_feature_flags = format_props.optimalTilingFeatures; format_feature_flags = format_props.optimalTilingFeatures;
} else { } else {
unreachable("bad VkImageTiling"); unreachable("bad VkImageTiling");
} }
 End of changes. 3 change blocks. 
147 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)