formats: Always use the VIRGL_FORMAT enums in vrend code

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 5 years ago
parent 10a0622a44
commit dcd429bb23
  1. 76
      src/vrend_formats.c
  2. 4
      src/vrend_renderer.c

@ -435,12 +435,12 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
binding = VIRGL_BIND_SAMPLER_VIEW | VIRGL_BIND_RENDER_TARGET;
switch (table[i].format) {
case PIPE_FORMAT_A8_UNORM:
case VIRGL_FORMAT_A8_UNORM:
entry = &rg_base_formats[0];
swizzle[0] = swizzle[1] = swizzle[2] = PIPE_SWIZZLE_ZERO;
swizzle[3] = PIPE_SWIZZLE_RED;
break;
case PIPE_FORMAT_A16_UNORM:
case VIRGL_FORMAT_A16_UNORM:
entry = &rg_base_formats[2];
swizzle[0] = swizzle[1] = swizzle[2] = PIPE_SWIZZLE_ZERO;
swizzle[3] = PIPE_SWIZZLE_RED;
@ -697,43 +697,43 @@ static int format_uncompressed_compressed_copy_compatible(enum pipe_format src,
enum pipe_format dst)
{
switch (src) {
case PIPE_FORMAT_R32G32B32A32_UINT:
case PIPE_FORMAT_R32G32B32A32_SINT:
case PIPE_FORMAT_R32G32B32A32_FLOAT:
case PIPE_FORMAT_R32G32B32A32_SNORM:
case PIPE_FORMAT_R32G32B32A32_UNORM:
case VIRGL_FORMAT_R32G32B32A32_UINT:
case VIRGL_FORMAT_R32G32B32A32_SINT:
case VIRGL_FORMAT_R32G32B32A32_FLOAT:
case VIRGL_FORMAT_R32G32B32A32_SNORM:
case VIRGL_FORMAT_R32G32B32A32_UNORM:
switch (dst) {
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT3_SRGBA:
case PIPE_FORMAT_DXT5_RGBA:
case PIPE_FORMAT_DXT5_SRGBA:
case PIPE_FORMAT_RGTC2_UNORM:
case PIPE_FORMAT_RGTC2_SNORM:
case PIPE_FORMAT_BPTC_RGBA_UNORM:
case PIPE_FORMAT_BPTC_SRGBA:
case PIPE_FORMAT_BPTC_RGB_FLOAT:
case PIPE_FORMAT_BPTC_RGB_UFLOAT:
case VIRGL_FORMAT_DXT3_RGBA:
case VIRGL_FORMAT_DXT3_SRGBA:
case VIRGL_FORMAT_DXT5_RGBA:
case VIRGL_FORMAT_DXT5_SRGBA:
case VIRGL_FORMAT_RGTC2_UNORM:
case VIRGL_FORMAT_RGTC2_SNORM:
case VIRGL_FORMAT_BPTC_RGBA_UNORM:
case VIRGL_FORMAT_BPTC_SRGBA:
case VIRGL_FORMAT_BPTC_RGB_FLOAT:
case VIRGL_FORMAT_BPTC_RGB_UFLOAT:
return 1;
default:
return -1;
}
case PIPE_FORMAT_R16G16B16A16_UINT:
case PIPE_FORMAT_R16G16B16A16_SINT:
case PIPE_FORMAT_R16G16B16A16_FLOAT:
case PIPE_FORMAT_R16G16B16A16_SNORM:
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R32G32_UINT:
case PIPE_FORMAT_R32G32_SINT:
case PIPE_FORMAT_R32G32_FLOAT:
case PIPE_FORMAT_R32G32_UNORM:
case PIPE_FORMAT_R32G32_SNORM:
case VIRGL_FORMAT_R16G16B16A16_UINT:
case VIRGL_FORMAT_R16G16B16A16_SINT:
case VIRGL_FORMAT_R16G16B16A16_FLOAT:
case VIRGL_FORMAT_R16G16B16A16_SNORM:
case VIRGL_FORMAT_R16G16B16A16_UNORM:
case VIRGL_FORMAT_R32G32_UINT:
case VIRGL_FORMAT_R32G32_SINT:
case VIRGL_FORMAT_R32G32_FLOAT:
case VIRGL_FORMAT_R32G32_UNORM:
case VIRGL_FORMAT_R32G32_SNORM:
switch (dst) {
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT1_SRGBA:
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_SRGB:
case PIPE_FORMAT_RGTC1_UNORM:
case PIPE_FORMAT_RGTC1_SNORM:
case VIRGL_FORMAT_DXT1_RGBA:
case VIRGL_FORMAT_DXT1_SRGBA:
case VIRGL_FORMAT_DXT1_RGB:
case VIRGL_FORMAT_DXT1_SRGB:
case VIRGL_FORMAT_RGTC1_UNORM:
case VIRGL_FORMAT_RGTC1_SNORM:
return 1;
default:
return -1;
@ -743,12 +743,12 @@ static int format_uncompressed_compressed_copy_compatible(enum pipe_format src,
}
}
static boolean format_compressed_compressed_copy_compatible(enum pipe_format src, enum pipe_format dst)
static boolean format_compressed_compressed_copy_compatible(enum virgl_formats src, enum virgl_formats dst)
{
if ((src == PIPE_FORMAT_RGTC1_UNORM && dst == PIPE_FORMAT_RGTC1_SNORM) ||
(src == PIPE_FORMAT_RGTC2_UNORM && dst == PIPE_FORMAT_RGTC2_SNORM) ||
(src == PIPE_FORMAT_BPTC_RGBA_UNORM && dst == PIPE_FORMAT_BPTC_SRGBA) ||
(src == PIPE_FORMAT_BPTC_RGB_FLOAT && dst == PIPE_FORMAT_BPTC_RGB_UFLOAT))
if ((src == VIRGL_FORMAT_RGTC1_UNORM && dst == VIRGL_FORMAT_RGTC1_SNORM) ||
(src == VIRGL_FORMAT_RGTC2_UNORM && dst == VIRGL_FORMAT_RGTC2_SNORM) ||
(src == VIRGL_FORMAT_BPTC_RGBA_UNORM && dst == VIRGL_FORMAT_BPTC_SRGBA) ||
(src == VIRGL_FORMAT_BPTC_RGB_FLOAT && dst == VIRGL_FORMAT_BPTC_RGB_UFLOAT))
return true;
return false;
}

@ -1048,9 +1048,9 @@ vrend_format_replace_emulated(uint32_t bind, enum pipe_format format)
vrend_check_texture_storage(tex_conv_table);
vrend_state.bgra_srgb_emulation_loaded = true;
}
if (format == PIPE_FORMAT_B8G8R8A8_UNORM)
if (format == VIRGL_FORMAT_B8G8R8A8_UNORM)
retval = VIRGL_FORMAT_B8G8R8A8_UNORM_EMULATED;
else if (format == PIPE_FORMAT_B8G8R8X8_UNORM)
else if (format == VIRGL_FORMAT_B8G8R8X8_UNORM)
retval = VIRGL_FORMAT_B8G8R8X8_UNORM_EMULATED;
VREND_DEBUG_NOCTX(dbg_tweak, vrend_state.current_ctx,

Loading…
Cancel
Save