1bf215546Sopenharmony_ci/********************************************************** 2bf215546Sopenharmony_ci * Copyright 2011 VMware, Inc. All rights reserved. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person 5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation 6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without 7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy, 8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies 9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is 10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions: 11bf215546Sopenharmony_ci * 12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be 13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22bf215546Sopenharmony_ci * SOFTWARE. 23bf215546Sopenharmony_ci * 24bf215546Sopenharmony_ci **********************************************************/ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#include "pipe/p_format.h" 28bf215546Sopenharmony_ci#include "util/u_debug.h" 29bf215546Sopenharmony_ci#include "util/format/u_format.h" 30bf215546Sopenharmony_ci#include "util/u_memory.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#include "svga_winsys.h" 33bf215546Sopenharmony_ci#include "svga_screen.h" 34bf215546Sopenharmony_ci#include "svga_format.h" 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ci/** Describes mapping from gallium formats to SVGA vertex/pixel formats */ 38bf215546Sopenharmony_cistruct vgpu10_format_entry 39bf215546Sopenharmony_ci{ 40bf215546Sopenharmony_ci SVGA3dSurfaceFormat vertex_format; 41bf215546Sopenharmony_ci SVGA3dSurfaceFormat pixel_format; 42bf215546Sopenharmony_ci SVGA3dSurfaceFormat view_format; /* view format for texture buffer */ 43bf215546Sopenharmony_ci unsigned flags; 44bf215546Sopenharmony_ci}; 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_cistruct format_compat_entry 47bf215546Sopenharmony_ci{ 48bf215546Sopenharmony_ci enum pipe_format pformat; 49bf215546Sopenharmony_ci const SVGA3dSurfaceFormat *compat_format; 50bf215546Sopenharmony_ci}; 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ci 53bf215546Sopenharmony_ci/** 54bf215546Sopenharmony_ci * Table mapping Gallium formats to SVGA3d vertex/pixel formats. 55bf215546Sopenharmony_ci * Note: the table is ordered according to PIPE_FORMAT_x order. 56bf215546Sopenharmony_ci */ 57bf215546Sopenharmony_cistatic const struct vgpu10_format_entry format_conversion_table[] = 58bf215546Sopenharmony_ci{ 59bf215546Sopenharmony_ci /* Gallium format SVGA3D vertex format SVGA3D pixel format SVGA3D texbuf view format Flags */ 60bf215546Sopenharmony_ci [ PIPE_FORMAT_B8G8R8A8_UNORM ] = { SVGA3D_B8G8R8A8_UNORM, SVGA3D_B8G8R8A8_UNORM, SVGA3D_B8G8R8A8_UNORM, TF_GEN_MIPS }, 61bf215546Sopenharmony_ci [ PIPE_FORMAT_B8G8R8X8_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_B8G8R8X8_UNORM, SVGA3D_B8G8R8X8_UNORM, TF_GEN_MIPS }, 62bf215546Sopenharmony_ci [ PIPE_FORMAT_B5G5R5A1_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_B5G5R5A1_UNORM, SVGA3D_B5G5R5A1_UNORM, TF_GEN_MIPS }, 63bf215546Sopenharmony_ci [ PIPE_FORMAT_B5G6R5_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_B5G6R5_UNORM, SVGA3D_B5G6R5_UNORM, TF_GEN_MIPS }, 64bf215546Sopenharmony_ci [ PIPE_FORMAT_R10G10B10A2_UNORM ] = { SVGA3D_R10G10B10A2_UNORM, SVGA3D_R10G10B10A2_UNORM, SVGA3D_R10G10B10A2_UNORM, TF_GEN_MIPS | TF_UAV }, 65bf215546Sopenharmony_ci [ PIPE_FORMAT_L8_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_UNORM, TF_XXX1 }, 66bf215546Sopenharmony_ci [ PIPE_FORMAT_A8_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_A8_UNORM, SVGA3D_R8_UNORM, TF_GEN_MIPS | TF_000X | TF_UAV }, 67bf215546Sopenharmony_ci [ PIPE_FORMAT_I8_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_UNORM, TF_XXXX }, 68bf215546Sopenharmony_ci [ PIPE_FORMAT_L8A8_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8G8_UNORM, TF_XXXY }, 69bf215546Sopenharmony_ci [ PIPE_FORMAT_L16_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_UNORM, TF_XXX1 }, 70bf215546Sopenharmony_ci [ PIPE_FORMAT_Z16_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_D16_UNORM, SVGA3D_D16_UNORM, 0 }, 71bf215546Sopenharmony_ci [ PIPE_FORMAT_Z32_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_D32_FLOAT, SVGA3D_D32_FLOAT, 0 }, 72bf215546Sopenharmony_ci [ PIPE_FORMAT_Z24_UNORM_S8_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_D24_UNORM_S8_UINT, SVGA3D_D24_UNORM_S8_UINT, 0 }, 73bf215546Sopenharmony_ci [ PIPE_FORMAT_Z24X8_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_D24_UNORM_S8_UINT, SVGA3D_D24_UNORM_S8_UINT, 0 }, 74bf215546Sopenharmony_ci [ PIPE_FORMAT_R32_FLOAT ] = { SVGA3D_R32_FLOAT, SVGA3D_R32_FLOAT, SVGA3D_R32_FLOAT, TF_GEN_MIPS | TF_UAV }, 75bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32_FLOAT ] = { SVGA3D_R32G32_FLOAT, SVGA3D_R32G32_FLOAT, SVGA3D_R32G32_FLOAT, TF_GEN_MIPS | TF_UAV }, 76bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32_FLOAT ] = { SVGA3D_R32G32B32_FLOAT, SVGA3D_R32G32B32_FLOAT, SVGA3D_R32G32B32_FLOAT, TF_GEN_MIPS }, 77bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32A32_FLOAT ] = { SVGA3D_R32G32B32A32_FLOAT, SVGA3D_R32G32B32A32_FLOAT, SVGA3D_R32G32B32A32_FLOAT, TF_GEN_MIPS | TF_UAV }, 78bf215546Sopenharmony_ci [ PIPE_FORMAT_R32_USCALED ] = { SVGA3D_R32_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 79bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32_USCALED ] = { SVGA3D_R32G32_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 80bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32_USCALED ] = { SVGA3D_R32G32B32_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 81bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32A32_USCALED ] = { SVGA3D_R32G32B32A32_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 82bf215546Sopenharmony_ci [ PIPE_FORMAT_R32_SSCALED ] = { SVGA3D_R32_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 83bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32_SSCALED ] = { SVGA3D_R32G32_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 84bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32_SSCALED ] = { SVGA3D_R32G32B32_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 85bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32A32_SSCALED ] = { SVGA3D_R32G32B32A32_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 86bf215546Sopenharmony_ci [ PIPE_FORMAT_R16_UNORM ] = { SVGA3D_R16_UNORM, SVGA3D_R16_UNORM, SVGA3D_R16_UNORM, TF_GEN_MIPS | TF_UAV }, 87bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16_UNORM ] = { SVGA3D_R16G16_UNORM, SVGA3D_R16G16_UNORM, SVGA3D_R16G16_UNORM, TF_GEN_MIPS | TF_UAV }, 88bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16_UNORM ] = { SVGA3D_R16G16B16A16_UNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 89bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16A16_UNORM ] = { SVGA3D_R16G16B16A16_UNORM, SVGA3D_R16G16B16A16_UNORM, SVGA3D_R16G16B16A16_UNORM, TF_GEN_MIPS | TF_UAV }, 90bf215546Sopenharmony_ci [ PIPE_FORMAT_R16_USCALED ] = { SVGA3D_R16_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 91bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16_USCALED ] = { SVGA3D_R16G16_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 92bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16_USCALED ] = { SVGA3D_R16G16B16A16_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 | VF_U_TO_F_CAST }, 93bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16A16_USCALED ] = { SVGA3D_R16G16B16A16_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 94bf215546Sopenharmony_ci [ PIPE_FORMAT_R16_SNORM ] = { SVGA3D_R16_SNORM, SVGA3D_R16_SNORM, SVGA3D_R16_SNORM, TF_UAV }, 95bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16_SNORM ] = { SVGA3D_R16G16_SNORM, SVGA3D_R16G16_SNORM, SVGA3D_R16G16_SNORM, TF_UAV }, 96bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16_SNORM ] = { SVGA3D_R16G16B16A16_SNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 97bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16A16_SNORM ] = { SVGA3D_R16G16B16A16_SNORM, SVGA3D_R16G16B16A16_SNORM, SVGA3D_R16G16B16A16_SNORM, TF_UAV }, 98bf215546Sopenharmony_ci [ PIPE_FORMAT_R16_SSCALED ] = { SVGA3D_R16_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 99bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16_SSCALED ] = { SVGA3D_R16G16_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 100bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16_SSCALED ] = { SVGA3D_R16G16B16A16_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 | VF_I_TO_F_CAST }, 101bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16A16_SSCALED ] = { SVGA3D_R16G16B16A16_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 102bf215546Sopenharmony_ci [ PIPE_FORMAT_R8_UNORM ] = { SVGA3D_R8_UNORM, SVGA3D_R8_UNORM, SVGA3D_R8_UNORM, TF_GEN_MIPS | TF_UAV }, 103bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8_UNORM ] = { SVGA3D_R8G8_UNORM, SVGA3D_R8G8_UNORM, SVGA3D_R8G8_UNORM, TF_GEN_MIPS | TF_UAV }, 104bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8_UNORM ] = { SVGA3D_R8G8B8A8_UNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 105bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8A8_UNORM ] = { SVGA3D_R8G8B8A8_UNORM, SVGA3D_R8G8B8A8_UNORM, SVGA3D_R8G8B8A8_UNORM, TF_GEN_MIPS | TF_UAV }, 106bf215546Sopenharmony_ci [ PIPE_FORMAT_R8_USCALED ] = { SVGA3D_R8_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 107bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8_USCALED ] = { SVGA3D_R8G8_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 108bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8_USCALED ] = { SVGA3D_R8G8B8A8_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 | VF_U_TO_F_CAST }, 109bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8A8_USCALED ] = { SVGA3D_R8G8B8A8_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_U_TO_F_CAST }, 110bf215546Sopenharmony_ci [ PIPE_FORMAT_R8_SNORM ] = { SVGA3D_R8_SNORM, SVGA3D_R8_SNORM, SVGA3D_R8_SNORM, TF_UAV }, 111bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8_SNORM ] = { SVGA3D_R8G8_SNORM, SVGA3D_R8G8_SNORM, SVGA3D_R8G8_SNORM, TF_UAV }, 112bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8_SNORM ] = { SVGA3D_R8G8B8A8_SNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 113bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8A8_SNORM ] = { SVGA3D_R8G8B8A8_SNORM, SVGA3D_R8G8B8A8_SNORM, SVGA3D_R8G8B8A8_SNORM, TF_UAV }, 114bf215546Sopenharmony_ci [ PIPE_FORMAT_R8_SSCALED ] = { SVGA3D_R8_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 115bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8_SSCALED ] = { SVGA3D_R8G8_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 116bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8_SSCALED ] = { SVGA3D_R8G8B8A8_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 | VF_I_TO_F_CAST }, 117bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8A8_SSCALED ] = { SVGA3D_R8G8B8A8_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_I_TO_F_CAST }, 118bf215546Sopenharmony_ci [ PIPE_FORMAT_R16_FLOAT ] = { SVGA3D_R16_FLOAT, SVGA3D_R16_FLOAT, SVGA3D_R16_FLOAT, TF_GEN_MIPS | TF_UAV }, 119bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16_FLOAT ] = { SVGA3D_R16G16_FLOAT, SVGA3D_R16G16_FLOAT, SVGA3D_R16G16_FLOAT, TF_GEN_MIPS | TF_UAV }, 120bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16_FLOAT ] = { SVGA3D_R16G16B16A16_FLOAT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 121bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16A16_FLOAT ] = { SVGA3D_R16G16B16A16_FLOAT, SVGA3D_R16G16B16A16_FLOAT, SVGA3D_R16G16B16A16_FLOAT, TF_GEN_MIPS | TF_UAV }, 122bf215546Sopenharmony_ci [ PIPE_FORMAT_B8G8R8A8_SRGB ] = { SVGA3D_FORMAT_INVALID, SVGA3D_B8G8R8A8_UNORM_SRGB, SVGA3D_FORMAT_INVALID, TF_GEN_MIPS }, 123bf215546Sopenharmony_ci [ PIPE_FORMAT_B8G8R8X8_SRGB ] = { SVGA3D_FORMAT_INVALID, SVGA3D_B8G8R8X8_UNORM_SRGB, SVGA3D_FORMAT_INVALID, TF_GEN_MIPS }, 124bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8A8_SRGB ] = { SVGA3D_FORMAT_INVALID, SVGA3D_R8G8B8A8_UNORM_SRGB, SVGA3D_FORMAT_INVALID, TF_GEN_MIPS }, 125bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT1_RGB ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC1_UNORM, SVGA3D_FORMAT_INVALID, 0 }, 126bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT1_RGBA ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC1_UNORM, SVGA3D_FORMAT_INVALID, 0 }, 127bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT3_RGBA ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC2_UNORM, SVGA3D_FORMAT_INVALID, 0 }, 128bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT5_RGBA ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC3_UNORM, SVGA3D_FORMAT_INVALID, 0 }, 129bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT1_SRGB ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC1_UNORM_SRGB, SVGA3D_FORMAT_INVALID, 0 }, 130bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT1_SRGBA ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC1_UNORM_SRGB, SVGA3D_FORMAT_INVALID, 0 }, 131bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT3_SRGBA ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC2_UNORM_SRGB, SVGA3D_FORMAT_INVALID, 0 }, 132bf215546Sopenharmony_ci [ PIPE_FORMAT_DXT5_SRGBA ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC3_UNORM_SRGB, SVGA3D_FORMAT_INVALID, 0 }, 133bf215546Sopenharmony_ci [ PIPE_FORMAT_RGTC1_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC4_UNORM, SVGA3D_FORMAT_INVALID, 0 }, 134bf215546Sopenharmony_ci [ PIPE_FORMAT_RGTC1_SNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC4_SNORM, SVGA3D_FORMAT_INVALID, 0 }, 135bf215546Sopenharmony_ci [ PIPE_FORMAT_RGTC2_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC5_UNORM, SVGA3D_FORMAT_INVALID, 0 }, 136bf215546Sopenharmony_ci [ PIPE_FORMAT_RGTC2_SNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC5_SNORM, SVGA3D_FORMAT_INVALID, 0 }, 137bf215546Sopenharmony_ci [ PIPE_FORMAT_R10G10B10A2_USCALED ] = { SVGA3D_R10G10B10A2_UNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_PUINT_TO_USCALED }, 138bf215546Sopenharmony_ci [ PIPE_FORMAT_R11G11B10_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_R11G11B10_FLOAT, SVGA3D_R11G11B10_FLOAT, TF_GEN_MIPS | TF_UAV }, 139bf215546Sopenharmony_ci [ PIPE_FORMAT_R9G9B9E5_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_R9G9B9E5_SHAREDEXP, SVGA3D_FORMAT_INVALID, 0 }, 140bf215546Sopenharmony_ci [ PIPE_FORMAT_Z32_FLOAT_S8X24_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_D32_FLOAT_S8X24_UINT, SVGA3D_FORMAT_INVALID, 0 }, 141bf215546Sopenharmony_ci [ PIPE_FORMAT_B10G10R10A2_UNORM ] = { SVGA3D_R10G10B10A2_UNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_BGRA }, 142bf215546Sopenharmony_ci [ PIPE_FORMAT_L16A16_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16G16_UNORM, TF_XXXY }, 143bf215546Sopenharmony_ci [ PIPE_FORMAT_A16_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_UNORM, TF_000X }, 144bf215546Sopenharmony_ci [ PIPE_FORMAT_I16_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_UNORM, TF_XXXX }, 145bf215546Sopenharmony_ci [ PIPE_FORMAT_A16_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_FLOAT, TF_000X }, 146bf215546Sopenharmony_ci [ PIPE_FORMAT_L16_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_FLOAT, TF_XXX1 }, 147bf215546Sopenharmony_ci [ PIPE_FORMAT_L16A16_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16G16_FLOAT, TF_XXXY }, 148bf215546Sopenharmony_ci [ PIPE_FORMAT_I16_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_FLOAT, TF_XXXX }, 149bf215546Sopenharmony_ci [ PIPE_FORMAT_A32_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_FLOAT, TF_000X }, 150bf215546Sopenharmony_ci [ PIPE_FORMAT_L32_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_FLOAT, TF_XXX1 }, 151bf215546Sopenharmony_ci [ PIPE_FORMAT_L32A32_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32G32_FLOAT, TF_XXXY }, 152bf215546Sopenharmony_ci [ PIPE_FORMAT_I32_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_FLOAT, TF_XXXX }, 153bf215546Sopenharmony_ci [ PIPE_FORMAT_R10G10B10A2_SSCALED ] = { SVGA3D_R32_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_PUINT_TO_SSCALED }, 154bf215546Sopenharmony_ci [ PIPE_FORMAT_R10G10B10A2_SNORM ] = { SVGA3D_R10G10B10A2_UNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_PUINT_TO_SNORM }, 155bf215546Sopenharmony_ci [ PIPE_FORMAT_B10G10R10A2_USCALED ] = { SVGA3D_R10G10B10A2_UNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_BGRA | VF_PUINT_TO_USCALED }, 156bf215546Sopenharmony_ci [ PIPE_FORMAT_B10G10R10A2_SSCALED ] = { SVGA3D_R32_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_BGRA | VF_PUINT_TO_SSCALED }, 157bf215546Sopenharmony_ci [ PIPE_FORMAT_B10G10R10A2_SNORM ] = { SVGA3D_R10G10B10A2_UNORM, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_BGRA | VF_PUINT_TO_SNORM }, 158bf215546Sopenharmony_ci [ PIPE_FORMAT_R8_UINT ] = { SVGA3D_R8_UINT, SVGA3D_R8_UINT, SVGA3D_R8_UINT, TF_UAV }, 159bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8_UINT ] = { SVGA3D_R8G8_UINT, SVGA3D_R8G8_UINT, SVGA3D_R8G8_UINT, TF_UAV }, 160bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8_UINT ] = { SVGA3D_R8G8B8A8_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 161bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8A8_UINT ] = { SVGA3D_R8G8B8A8_UINT, SVGA3D_R8G8B8A8_UINT, SVGA3D_R8G8B8A8_UINT, TF_UAV }, 162bf215546Sopenharmony_ci [ PIPE_FORMAT_R8_SINT ] = { SVGA3D_R8_SINT, SVGA3D_R8_SINT, SVGA3D_R8_SINT, TF_UAV }, 163bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8_SINT ] = { SVGA3D_R8G8_SINT, SVGA3D_R8G8_SINT, SVGA3D_R8G8_SINT, TF_UAV }, 164bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8_SINT ] = { SVGA3D_R8G8B8A8_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 165bf215546Sopenharmony_ci [ PIPE_FORMAT_R8G8B8A8_SINT ] = { SVGA3D_R8G8B8A8_SINT, SVGA3D_R8G8B8A8_SINT, SVGA3D_R8G8B8A8_SINT, TF_UAV }, 166bf215546Sopenharmony_ci [ PIPE_FORMAT_R16_UINT ] = { SVGA3D_R16_UINT, SVGA3D_R16_UINT, SVGA3D_R16_UINT, TF_UAV }, 167bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16_UINT ] = { SVGA3D_R16G16_UINT, SVGA3D_R16G16_UINT, SVGA3D_R16G16_UINT, TF_UAV }, 168bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16_UINT ] = { SVGA3D_R16G16B16A16_UINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 169bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16A16_UINT ] = { SVGA3D_R16G16B16A16_UINT, SVGA3D_R16G16B16A16_UINT, SVGA3D_R16G16B16A16_UINT, TF_UAV }, 170bf215546Sopenharmony_ci [ PIPE_FORMAT_R16_SINT ] = { SVGA3D_R16_SINT, SVGA3D_R16_SINT, SVGA3D_R16_SINT, TF_UAV }, 171bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16_SINT ] = { SVGA3D_R16G16_SINT, SVGA3D_R16G16_SINT, SVGA3D_R16G16_SINT, TF_UAV }, 172bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16_SINT ] = { SVGA3D_R16G16B16A16_SINT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, VF_W_TO_1 }, 173bf215546Sopenharmony_ci [ PIPE_FORMAT_R16G16B16A16_SINT ] = { SVGA3D_R16G16B16A16_SINT, SVGA3D_R16G16B16A16_SINT, SVGA3D_R16G16B16A16_SINT, TF_UAV }, 174bf215546Sopenharmony_ci [ PIPE_FORMAT_R32_UINT ] = { SVGA3D_R32_UINT, SVGA3D_R32_UINT, SVGA3D_R32_UINT, TF_UAV }, 175bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32_UINT ] = { SVGA3D_R32G32_UINT, SVGA3D_R32G32_UINT, SVGA3D_R32G32_UINT, TF_UAV }, 176bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32_UINT ] = { SVGA3D_R32G32B32_UINT, SVGA3D_R32G32B32_UINT, SVGA3D_R32G32B32_UINT, 0 }, 177bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32A32_UINT ] = { SVGA3D_R32G32B32A32_UINT, SVGA3D_R32G32B32A32_UINT, SVGA3D_R32G32B32A32_UINT, TF_UAV }, 178bf215546Sopenharmony_ci [ PIPE_FORMAT_R32_SINT ] = { SVGA3D_R32_SINT, SVGA3D_R32_SINT, SVGA3D_R32_SINT, TF_UAV }, 179bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32_SINT ] = { SVGA3D_R32G32_SINT, SVGA3D_R32G32_SINT, SVGA3D_R32G32_SINT, TF_UAV }, 180bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32_SINT ] = { SVGA3D_R32G32B32_SINT, SVGA3D_R32G32B32_SINT, SVGA3D_R32G32B32_SINT, 0 }, 181bf215546Sopenharmony_ci [ PIPE_FORMAT_R32G32B32A32_SINT ] = { SVGA3D_R32G32B32A32_SINT, SVGA3D_R32G32B32A32_SINT, SVGA3D_R32G32B32A32_SINT, TF_UAV }, 182bf215546Sopenharmony_ci [ PIPE_FORMAT_A8_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_UINT, TF_000X }, 183bf215546Sopenharmony_ci [ PIPE_FORMAT_I8_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_UINT, TF_XXXX }, 184bf215546Sopenharmony_ci [ PIPE_FORMAT_L8_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_UINT, TF_XXX1 }, 185bf215546Sopenharmony_ci [ PIPE_FORMAT_L8A8_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8G8_UINT, TF_XXXY }, 186bf215546Sopenharmony_ci [ PIPE_FORMAT_A8_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_SINT, TF_000X }, 187bf215546Sopenharmony_ci [ PIPE_FORMAT_I8_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_SINT, TF_XXXX }, 188bf215546Sopenharmony_ci [ PIPE_FORMAT_L8_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8_SINT, TF_XXX1 }, 189bf215546Sopenharmony_ci [ PIPE_FORMAT_L8A8_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R8G8_SINT, TF_XXXY }, 190bf215546Sopenharmony_ci [ PIPE_FORMAT_A16_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_UINT, TF_000X }, 191bf215546Sopenharmony_ci [ PIPE_FORMAT_I16_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_UINT, TF_XXXX }, 192bf215546Sopenharmony_ci [ PIPE_FORMAT_L16_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_UINT, TF_XXX1 }, 193bf215546Sopenharmony_ci [ PIPE_FORMAT_L16A16_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16G16_UINT, TF_XXXY }, 194bf215546Sopenharmony_ci [ PIPE_FORMAT_A16_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_SINT, TF_000X }, 195bf215546Sopenharmony_ci [ PIPE_FORMAT_I16_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_SINT, TF_XXXX }, 196bf215546Sopenharmony_ci [ PIPE_FORMAT_L16_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16_SINT, TF_XXX1 }, 197bf215546Sopenharmony_ci [ PIPE_FORMAT_L16A16_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R16G16_SINT, TF_XXXY }, 198bf215546Sopenharmony_ci [ PIPE_FORMAT_A32_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_UINT, TF_000X }, 199bf215546Sopenharmony_ci [ PIPE_FORMAT_I32_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_UINT, TF_XXXX }, 200bf215546Sopenharmony_ci [ PIPE_FORMAT_L32_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_UINT, TF_XXX1 }, 201bf215546Sopenharmony_ci [ PIPE_FORMAT_L32A32_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32G32_UINT, TF_XXXY }, 202bf215546Sopenharmony_ci [ PIPE_FORMAT_A32_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_SINT, TF_000X }, 203bf215546Sopenharmony_ci [ PIPE_FORMAT_I32_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_SINT, TF_XXXX }, 204bf215546Sopenharmony_ci [ PIPE_FORMAT_L32_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32_SINT, TF_XXX1 }, 205bf215546Sopenharmony_ci [ PIPE_FORMAT_L32A32_SINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_R32G32_SINT, TF_XXXY }, 206bf215546Sopenharmony_ci [ PIPE_FORMAT_R10G10B10A2_UINT ] = { SVGA3D_R10G10B10A2_UINT, SVGA3D_R10G10B10A2_UINT, SVGA3D_R10G10B10A2_UINT, TF_UAV }, 207bf215546Sopenharmony_ci [ PIPE_FORMAT_BPTC_RGBA_UNORM ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC7_UNORM, SVGA3D_FORMAT_INVALID, TF_SM5 }, 208bf215546Sopenharmony_ci [ PIPE_FORMAT_BPTC_SRGBA ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC7_UNORM_SRGB, SVGA3D_FORMAT_INVALID, TF_SM5 }, 209bf215546Sopenharmony_ci [ PIPE_FORMAT_BPTC_RGB_FLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC6H_SF16, SVGA3D_FORMAT_INVALID, TF_SM5 }, 210bf215546Sopenharmony_ci [ PIPE_FORMAT_BPTC_RGB_UFLOAT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_BC6H_UF16, SVGA3D_FORMAT_INVALID, TF_SM5 }, 211bf215546Sopenharmony_ci [ PIPE_FORMAT_X24S8_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_X24_G8_UINT, SVGA3D_FORMAT_INVALID, 0 }, 212bf215546Sopenharmony_ci [ PIPE_FORMAT_X32_S8X24_UINT ] = { SVGA3D_FORMAT_INVALID, SVGA3D_X32_G8X24_UINT, SVGA3D_FORMAT_INVALID, 0 }, 213bf215546Sopenharmony_ci /* Must specify following entry to give the sense of size of format_conversion_table[] */ 214bf215546Sopenharmony_ci [ PIPE_FORMAT_COUNT ] = {SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, 0 }, 215bf215546Sopenharmony_ci}; 216bf215546Sopenharmony_ci 217bf215546Sopenharmony_ci 218bf215546Sopenharmony_cistatic const struct vgpu10_format_entry * 219bf215546Sopenharmony_cisvga_format_entry(enum pipe_format format) 220bf215546Sopenharmony_ci{ 221bf215546Sopenharmony_ci /* Sparse filling of the table requires this. */ 222bf215546Sopenharmony_ci STATIC_ASSERT(SVGA3D_FORMAT_INVALID == 0); 223bf215546Sopenharmony_ci assert(format < ARRAY_SIZE(format_conversion_table)); 224bf215546Sopenharmony_ci if (format >= ARRAY_SIZE(format_conversion_table)) 225bf215546Sopenharmony_ci return &format_conversion_table[PIPE_FORMAT_NONE]; 226bf215546Sopenharmony_ci else 227bf215546Sopenharmony_ci return &format_conversion_table[format]; 228bf215546Sopenharmony_ci} 229bf215546Sopenharmony_ci 230bf215546Sopenharmony_ci/** 231bf215546Sopenharmony_ci * Translate a gallium vertex format to a vgpu10 vertex format. 232bf215546Sopenharmony_ci * Also, return any special vertex format flags. 233bf215546Sopenharmony_ci */ 234bf215546Sopenharmony_civoid 235bf215546Sopenharmony_cisvga_translate_vertex_format_vgpu10(enum pipe_format format, 236bf215546Sopenharmony_ci SVGA3dSurfaceFormat *svga_format, 237bf215546Sopenharmony_ci unsigned *vf_flags) 238bf215546Sopenharmony_ci{ 239bf215546Sopenharmony_ci const struct vgpu10_format_entry *entry = svga_format_entry(format); 240bf215546Sopenharmony_ci 241bf215546Sopenharmony_ci *svga_format = entry->vertex_format; 242bf215546Sopenharmony_ci *vf_flags = entry->flags; 243bf215546Sopenharmony_ci} 244bf215546Sopenharmony_ci 245bf215546Sopenharmony_ci 246bf215546Sopenharmony_ci/** 247bf215546Sopenharmony_ci * Translate a gallium pixel format to a vgpu10 format 248bf215546Sopenharmony_ci * to be used in a shader resource view for a texture buffer. 249bf215546Sopenharmony_ci * Also return any special texture format flags such as 250bf215546Sopenharmony_ci * any special swizzle mask. 251bf215546Sopenharmony_ci */ 252bf215546Sopenharmony_civoid 253bf215546Sopenharmony_cisvga_translate_texture_buffer_view_format(enum pipe_format format, 254bf215546Sopenharmony_ci SVGA3dSurfaceFormat *svga_format, 255bf215546Sopenharmony_ci unsigned *tf_flags) 256bf215546Sopenharmony_ci{ 257bf215546Sopenharmony_ci const struct vgpu10_format_entry *entry = svga_format_entry(format); 258bf215546Sopenharmony_ci 259bf215546Sopenharmony_ci *svga_format = entry->view_format; 260bf215546Sopenharmony_ci *tf_flags = entry->flags; 261bf215546Sopenharmony_ci} 262bf215546Sopenharmony_ci 263bf215546Sopenharmony_ci 264bf215546Sopenharmony_ci/** 265bf215546Sopenharmony_ci * Translate a gallium scanout format to a svga format valid 266bf215546Sopenharmony_ci * for screen target surface. 267bf215546Sopenharmony_ci */ 268bf215546Sopenharmony_cistatic SVGA3dSurfaceFormat 269bf215546Sopenharmony_cisvga_translate_screen_target_format_vgpu10(enum pipe_format format) 270bf215546Sopenharmony_ci{ 271bf215546Sopenharmony_ci switch (format) { 272bf215546Sopenharmony_ci case PIPE_FORMAT_B8G8R8A8_UNORM: 273bf215546Sopenharmony_ci return SVGA3D_B8G8R8A8_UNORM; 274bf215546Sopenharmony_ci case PIPE_FORMAT_B8G8R8X8_UNORM: 275bf215546Sopenharmony_ci return SVGA3D_B8G8R8X8_UNORM; 276bf215546Sopenharmony_ci case PIPE_FORMAT_B5G6R5_UNORM: 277bf215546Sopenharmony_ci return SVGA3D_R5G6B5; 278bf215546Sopenharmony_ci case PIPE_FORMAT_B5G5R5A1_UNORM: 279bf215546Sopenharmony_ci return SVGA3D_A1R5G5B5; 280bf215546Sopenharmony_ci default: 281bf215546Sopenharmony_ci debug_printf("Invalid format %s specified for screen target\n", 282bf215546Sopenharmony_ci svga_format_name(format)); 283bf215546Sopenharmony_ci return SVGA3D_FORMAT_INVALID; 284bf215546Sopenharmony_ci } 285bf215546Sopenharmony_ci} 286bf215546Sopenharmony_ci 287bf215546Sopenharmony_ci/* 288bf215546Sopenharmony_ci * Translate from gallium format to SVGA3D format. 289bf215546Sopenharmony_ci */ 290bf215546Sopenharmony_ciSVGA3dSurfaceFormat 291bf215546Sopenharmony_cisvga_translate_format(const struct svga_screen *ss, 292bf215546Sopenharmony_ci enum pipe_format format, 293bf215546Sopenharmony_ci unsigned bind) 294bf215546Sopenharmony_ci{ 295bf215546Sopenharmony_ci const struct vgpu10_format_entry *entry = svga_format_entry(format); 296bf215546Sopenharmony_ci 297bf215546Sopenharmony_ci if (ss->sws->have_vgpu10) { 298bf215546Sopenharmony_ci if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) { 299bf215546Sopenharmony_ci return entry->vertex_format; 300bf215546Sopenharmony_ci } 301bf215546Sopenharmony_ci else if (bind & PIPE_BIND_SCANOUT) { 302bf215546Sopenharmony_ci return svga_translate_screen_target_format_vgpu10(format); 303bf215546Sopenharmony_ci } 304bf215546Sopenharmony_ci else if (bind & PIPE_BIND_SHADER_IMAGE) { 305bf215546Sopenharmony_ci if (format_conversion_table[format].flags & TF_UAV) 306bf215546Sopenharmony_ci return format_conversion_table[format].pixel_format; 307bf215546Sopenharmony_ci else 308bf215546Sopenharmony_ci return SVGA3D_FORMAT_INVALID; 309bf215546Sopenharmony_ci } 310bf215546Sopenharmony_ci else { 311bf215546Sopenharmony_ci if ((format_conversion_table[format].flags & TF_SM5) && 312bf215546Sopenharmony_ci !ss->sws->have_sm5) 313bf215546Sopenharmony_ci return SVGA3D_FORMAT_INVALID; 314bf215546Sopenharmony_ci else 315bf215546Sopenharmony_ci return entry->pixel_format; 316bf215546Sopenharmony_ci } 317bf215546Sopenharmony_ci } 318bf215546Sopenharmony_ci 319bf215546Sopenharmony_ci switch(format) { 320bf215546Sopenharmony_ci case PIPE_FORMAT_B8G8R8A8_UNORM: 321bf215546Sopenharmony_ci return SVGA3D_A8R8G8B8; 322bf215546Sopenharmony_ci case PIPE_FORMAT_B8G8R8X8_UNORM: 323bf215546Sopenharmony_ci return SVGA3D_X8R8G8B8; 324bf215546Sopenharmony_ci 325bf215546Sopenharmony_ci /* sRGB required for GL2.1 */ 326bf215546Sopenharmony_ci case PIPE_FORMAT_B8G8R8A8_SRGB: 327bf215546Sopenharmony_ci return SVGA3D_A8R8G8B8; 328bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_SRGB: 329bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_SRGBA: 330bf215546Sopenharmony_ci return SVGA3D_DXT1; 331bf215546Sopenharmony_ci case PIPE_FORMAT_DXT3_SRGBA: 332bf215546Sopenharmony_ci return SVGA3D_DXT3; 333bf215546Sopenharmony_ci case PIPE_FORMAT_DXT5_SRGBA: 334bf215546Sopenharmony_ci return SVGA3D_DXT5; 335bf215546Sopenharmony_ci 336bf215546Sopenharmony_ci case PIPE_FORMAT_B5G6R5_UNORM: 337bf215546Sopenharmony_ci return SVGA3D_R5G6B5; 338bf215546Sopenharmony_ci case PIPE_FORMAT_B5G5R5A1_UNORM: 339bf215546Sopenharmony_ci return SVGA3D_A1R5G5B5; 340bf215546Sopenharmony_ci case PIPE_FORMAT_B4G4R4A4_UNORM: 341bf215546Sopenharmony_ci return SVGA3D_A4R4G4B4; 342bf215546Sopenharmony_ci 343bf215546Sopenharmony_ci case PIPE_FORMAT_R16G16B16A16_UNORM: 344bf215546Sopenharmony_ci return SVGA3D_A16B16G16R16; 345bf215546Sopenharmony_ci 346bf215546Sopenharmony_ci case PIPE_FORMAT_Z16_UNORM: 347bf215546Sopenharmony_ci assert(!ss->sws->have_vgpu10); 348bf215546Sopenharmony_ci return bind & PIPE_BIND_SAMPLER_VIEW ? ss->depth.z16 : SVGA3D_Z_D16; 349bf215546Sopenharmony_ci case PIPE_FORMAT_S8_UINT_Z24_UNORM: 350bf215546Sopenharmony_ci assert(!ss->sws->have_vgpu10); 351bf215546Sopenharmony_ci return bind & PIPE_BIND_SAMPLER_VIEW ? ss->depth.s8z24 : SVGA3D_Z_D24S8; 352bf215546Sopenharmony_ci case PIPE_FORMAT_X8Z24_UNORM: 353bf215546Sopenharmony_ci assert(!ss->sws->have_vgpu10); 354bf215546Sopenharmony_ci return bind & PIPE_BIND_SAMPLER_VIEW ? ss->depth.x8z24 : SVGA3D_Z_D24X8; 355bf215546Sopenharmony_ci 356bf215546Sopenharmony_ci case PIPE_FORMAT_A8_UNORM: 357bf215546Sopenharmony_ci return SVGA3D_ALPHA8; 358bf215546Sopenharmony_ci case PIPE_FORMAT_L8_UNORM: 359bf215546Sopenharmony_ci return SVGA3D_LUMINANCE8; 360bf215546Sopenharmony_ci 361bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_RGB: 362bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_RGBA: 363bf215546Sopenharmony_ci return SVGA3D_DXT1; 364bf215546Sopenharmony_ci case PIPE_FORMAT_DXT3_RGBA: 365bf215546Sopenharmony_ci return SVGA3D_DXT3; 366bf215546Sopenharmony_ci case PIPE_FORMAT_DXT5_RGBA: 367bf215546Sopenharmony_ci return SVGA3D_DXT5; 368bf215546Sopenharmony_ci 369bf215546Sopenharmony_ci /* Float formats (only 1, 2 and 4-component formats supported) */ 370bf215546Sopenharmony_ci case PIPE_FORMAT_R32_FLOAT: 371bf215546Sopenharmony_ci return SVGA3D_R_S23E8; 372bf215546Sopenharmony_ci case PIPE_FORMAT_R32G32_FLOAT: 373bf215546Sopenharmony_ci return SVGA3D_RG_S23E8; 374bf215546Sopenharmony_ci case PIPE_FORMAT_R32G32B32A32_FLOAT: 375bf215546Sopenharmony_ci return SVGA3D_ARGB_S23E8; 376bf215546Sopenharmony_ci case PIPE_FORMAT_R16_FLOAT: 377bf215546Sopenharmony_ci return SVGA3D_R_S10E5; 378bf215546Sopenharmony_ci case PIPE_FORMAT_R16G16_FLOAT: 379bf215546Sopenharmony_ci return SVGA3D_RG_S10E5; 380bf215546Sopenharmony_ci case PIPE_FORMAT_R16G16B16A16_FLOAT: 381bf215546Sopenharmony_ci return SVGA3D_ARGB_S10E5; 382bf215546Sopenharmony_ci 383bf215546Sopenharmony_ci case PIPE_FORMAT_Z32_UNORM: 384bf215546Sopenharmony_ci /* SVGA3D_Z_D32 is not yet unsupported */ 385bf215546Sopenharmony_ci FALLTHROUGH; 386bf215546Sopenharmony_ci default: 387bf215546Sopenharmony_ci return SVGA3D_FORMAT_INVALID; 388bf215546Sopenharmony_ci } 389bf215546Sopenharmony_ci} 390bf215546Sopenharmony_ci 391bf215546Sopenharmony_ci 392bf215546Sopenharmony_ci/* 393bf215546Sopenharmony_ci * Format capability description entry. 394bf215546Sopenharmony_ci */ 395bf215546Sopenharmony_cistruct format_cap { 396bf215546Sopenharmony_ci const char *name; 397bf215546Sopenharmony_ci 398bf215546Sopenharmony_ci SVGA3dSurfaceFormat format; 399bf215546Sopenharmony_ci 400bf215546Sopenharmony_ci /* 401bf215546Sopenharmony_ci * Capability index corresponding to the format. 402bf215546Sopenharmony_ci */ 403bf215546Sopenharmony_ci SVGA3dDevCapIndex devcap; 404bf215546Sopenharmony_ci 405bf215546Sopenharmony_ci /* size of each pixel/block */ 406bf215546Sopenharmony_ci unsigned block_width, block_height, block_bytes; 407bf215546Sopenharmony_ci 408bf215546Sopenharmony_ci /* 409bf215546Sopenharmony_ci * Mask of supported SVGA3dFormatOp operations, to be inferred when the 410bf215546Sopenharmony_ci * capability is not explicitly present. 411bf215546Sopenharmony_ci */ 412bf215546Sopenharmony_ci uint32 defaultOperations; 413bf215546Sopenharmony_ci}; 414bf215546Sopenharmony_ci 415bf215546Sopenharmony_ci 416bf215546Sopenharmony_ci/* 417bf215546Sopenharmony_ci * Format capability description table. 418bf215546Sopenharmony_ci * 419bf215546Sopenharmony_ci * Ordered by increasing SVGA3dSurfaceFormat value, but with gaps. 420bf215546Sopenharmony_ci */ 421bf215546Sopenharmony_cistatic const struct format_cap format_cap_table[] = { 422bf215546Sopenharmony_ci { 423bf215546Sopenharmony_ci "SVGA3D_FORMAT_INVALID", 424bf215546Sopenharmony_ci SVGA3D_FORMAT_INVALID, 0, 0, 0, 0, 0 425bf215546Sopenharmony_ci }, 426bf215546Sopenharmony_ci { 427bf215546Sopenharmony_ci "SVGA3D_X8R8G8B8", 428bf215546Sopenharmony_ci SVGA3D_X8R8G8B8, 429bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8, 430bf215546Sopenharmony_ci 1, 1, 4, 431bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 432bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 433bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 434bf215546Sopenharmony_ci SVGA3DFORMAT_OP_DISPLAYMODE | 435bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 436bf215546Sopenharmony_ci }, 437bf215546Sopenharmony_ci { 438bf215546Sopenharmony_ci "SVGA3D_A8R8G8B8", 439bf215546Sopenharmony_ci SVGA3D_A8R8G8B8, 440bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8, 441bf215546Sopenharmony_ci 1, 1, 4, 442bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 443bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 444bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 445bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 446bf215546Sopenharmony_ci }, 447bf215546Sopenharmony_ci { 448bf215546Sopenharmony_ci "SVGA3D_R5G6B5", 449bf215546Sopenharmony_ci SVGA3D_R5G6B5, 450bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_R5G6B5, 451bf215546Sopenharmony_ci 1, 1, 2, 452bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 453bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 454bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 455bf215546Sopenharmony_ci SVGA3DFORMAT_OP_DISPLAYMODE | 456bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 457bf215546Sopenharmony_ci }, 458bf215546Sopenharmony_ci { 459bf215546Sopenharmony_ci "SVGA3D_X1R5G5B5", 460bf215546Sopenharmony_ci SVGA3D_X1R5G5B5, 461bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5, 462bf215546Sopenharmony_ci 1, 1, 2, 463bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 464bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 465bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 466bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 467bf215546Sopenharmony_ci }, 468bf215546Sopenharmony_ci { 469bf215546Sopenharmony_ci "SVGA3D_A1R5G5B5", 470bf215546Sopenharmony_ci SVGA3D_A1R5G5B5, 471bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5, 472bf215546Sopenharmony_ci 1, 1, 2, 473bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 474bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 475bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 476bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 477bf215546Sopenharmony_ci }, 478bf215546Sopenharmony_ci { 479bf215546Sopenharmony_ci "SVGA3D_A4R4G4B4", 480bf215546Sopenharmony_ci SVGA3D_A4R4G4B4, 481bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4, 482bf215546Sopenharmony_ci 1, 1, 2, 483bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 484bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 485bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 486bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 487bf215546Sopenharmony_ci }, 488bf215546Sopenharmony_ci { 489bf215546Sopenharmony_ci /* 490bf215546Sopenharmony_ci * SVGA3D_Z_D32 is not yet supported, and has no corresponding 491bf215546Sopenharmony_ci * SVGA3D_DEVCAP_xxx. 492bf215546Sopenharmony_ci */ 493bf215546Sopenharmony_ci "SVGA3D_Z_D32", 494bf215546Sopenharmony_ci SVGA3D_Z_D32, 0, 0, 0, 0, 0 495bf215546Sopenharmony_ci }, 496bf215546Sopenharmony_ci { 497bf215546Sopenharmony_ci "SVGA3D_Z_D16", 498bf215546Sopenharmony_ci SVGA3D_Z_D16, 499bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_Z_D16, 500bf215546Sopenharmony_ci 1, 1, 2, 501bf215546Sopenharmony_ci SVGA3DFORMAT_OP_ZSTENCIL 502bf215546Sopenharmony_ci }, 503bf215546Sopenharmony_ci { 504bf215546Sopenharmony_ci "SVGA3D_Z_D24S8", 505bf215546Sopenharmony_ci SVGA3D_Z_D24S8, 506bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8, 507bf215546Sopenharmony_ci 1, 1, 4, 508bf215546Sopenharmony_ci SVGA3DFORMAT_OP_ZSTENCIL 509bf215546Sopenharmony_ci }, 510bf215546Sopenharmony_ci { 511bf215546Sopenharmony_ci "SVGA3D_Z_D15S1", 512bf215546Sopenharmony_ci SVGA3D_Z_D15S1, 513bf215546Sopenharmony_ci SVGA3D_DEVCAP_MAX, 514bf215546Sopenharmony_ci 1, 1, 2, 515bf215546Sopenharmony_ci SVGA3DFORMAT_OP_ZSTENCIL 516bf215546Sopenharmony_ci }, 517bf215546Sopenharmony_ci { 518bf215546Sopenharmony_ci "SVGA3D_LUMINANCE8", 519bf215546Sopenharmony_ci SVGA3D_LUMINANCE8, 520bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8, 521bf215546Sopenharmony_ci 1, 1, 1, 522bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 523bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 524bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE 525bf215546Sopenharmony_ci }, 526bf215546Sopenharmony_ci { 527bf215546Sopenharmony_ci /* 528bf215546Sopenharmony_ci * SVGA3D_LUMINANCE4_ALPHA4 is not supported, and has no corresponding 529bf215546Sopenharmony_ci * SVGA3D_DEVCAP_xxx. 530bf215546Sopenharmony_ci */ 531bf215546Sopenharmony_ci "SVGA3D_LUMINANCE4_ALPHA4", 532bf215546Sopenharmony_ci SVGA3D_LUMINANCE4_ALPHA4, 0, 0, 0, 0, 0 533bf215546Sopenharmony_ci }, 534bf215546Sopenharmony_ci { 535bf215546Sopenharmony_ci "SVGA3D_LUMINANCE16", 536bf215546Sopenharmony_ci SVGA3D_LUMINANCE16, 537bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16, 538bf215546Sopenharmony_ci 1, 1, 2, 539bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 540bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 541bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE 542bf215546Sopenharmony_ci }, 543bf215546Sopenharmony_ci { 544bf215546Sopenharmony_ci "SVGA3D_LUMINANCE8_ALPHA8", 545bf215546Sopenharmony_ci SVGA3D_LUMINANCE8_ALPHA8, 546bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8, 547bf215546Sopenharmony_ci 1, 1, 2, 548bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 549bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 550bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE 551bf215546Sopenharmony_ci }, 552bf215546Sopenharmony_ci { 553bf215546Sopenharmony_ci "SVGA3D_DXT1", 554bf215546Sopenharmony_ci SVGA3D_DXT1, 555bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_DXT1, 556bf215546Sopenharmony_ci 4, 4, 8, 557bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 558bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE 559bf215546Sopenharmony_ci }, 560bf215546Sopenharmony_ci { 561bf215546Sopenharmony_ci "SVGA3D_DXT2", 562bf215546Sopenharmony_ci SVGA3D_DXT2, 563bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_DXT2, 564bf215546Sopenharmony_ci 4, 4, 8, 565bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 566bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE 567bf215546Sopenharmony_ci }, 568bf215546Sopenharmony_ci { 569bf215546Sopenharmony_ci "SVGA3D_DXT3", 570bf215546Sopenharmony_ci SVGA3D_DXT3, 571bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_DXT3, 572bf215546Sopenharmony_ci 4, 4, 16, 573bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 574bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE 575bf215546Sopenharmony_ci }, 576bf215546Sopenharmony_ci { 577bf215546Sopenharmony_ci "SVGA3D_DXT4", 578bf215546Sopenharmony_ci SVGA3D_DXT4, 579bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_DXT4, 580bf215546Sopenharmony_ci 4, 4, 16, 581bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 582bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE 583bf215546Sopenharmony_ci }, 584bf215546Sopenharmony_ci { 585bf215546Sopenharmony_ci "SVGA3D_DXT5", 586bf215546Sopenharmony_ci SVGA3D_DXT5, 587bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_DXT5, 588bf215546Sopenharmony_ci 4, 4, 8, 589bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 590bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE 591bf215546Sopenharmony_ci }, 592bf215546Sopenharmony_ci { 593bf215546Sopenharmony_ci "SVGA3D_BUMPU8V8", 594bf215546Sopenharmony_ci SVGA3D_BUMPU8V8, 595bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8, 596bf215546Sopenharmony_ci 1, 1, 2, 597bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 598bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 599bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE 600bf215546Sopenharmony_ci }, 601bf215546Sopenharmony_ci { 602bf215546Sopenharmony_ci /* 603bf215546Sopenharmony_ci * SVGA3D_BUMPL6V5U5 is unsupported; it has no corresponding 604bf215546Sopenharmony_ci * SVGA3D_DEVCAP_xxx. 605bf215546Sopenharmony_ci */ 606bf215546Sopenharmony_ci "SVGA3D_BUMPL6V5U5", 607bf215546Sopenharmony_ci SVGA3D_BUMPL6V5U5, 0, 0, 0, 0, 0 608bf215546Sopenharmony_ci }, 609bf215546Sopenharmony_ci { 610bf215546Sopenharmony_ci "SVGA3D_BUMPX8L8V8U8", 611bf215546Sopenharmony_ci SVGA3D_BUMPX8L8V8U8, 612bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8, 613bf215546Sopenharmony_ci 1, 1, 4, 614bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 615bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE 616bf215546Sopenharmony_ci }, 617bf215546Sopenharmony_ci { 618bf215546Sopenharmony_ci "SVGA3D_FORMAT_DEAD1", 619bf215546Sopenharmony_ci SVGA3D_FORMAT_DEAD1, 0, 0, 0, 0, 0 620bf215546Sopenharmony_ci }, 621bf215546Sopenharmony_ci { 622bf215546Sopenharmony_ci "SVGA3D_ARGB_S10E5", 623bf215546Sopenharmony_ci SVGA3D_ARGB_S10E5, 624bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5, 625bf215546Sopenharmony_ci 1, 1, 2, 626bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 627bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 628bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 629bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 630bf215546Sopenharmony_ci }, 631bf215546Sopenharmony_ci { 632bf215546Sopenharmony_ci "SVGA3D_ARGB_S23E8", 633bf215546Sopenharmony_ci SVGA3D_ARGB_S23E8, 634bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8, 635bf215546Sopenharmony_ci 1, 1, 4, 636bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 637bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 638bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 639bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 640bf215546Sopenharmony_ci }, 641bf215546Sopenharmony_ci { 642bf215546Sopenharmony_ci "SVGA3D_A2R10G10B10", 643bf215546Sopenharmony_ci SVGA3D_A2R10G10B10, 644bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10, 645bf215546Sopenharmony_ci 1, 1, 4, 646bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 647bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 648bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 649bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 650bf215546Sopenharmony_ci }, 651bf215546Sopenharmony_ci { 652bf215546Sopenharmony_ci /* 653bf215546Sopenharmony_ci * SVGA3D_V8U8 is unsupported; it has no corresponding 654bf215546Sopenharmony_ci * SVGA3D_DEVCAP_xxx. SVGA3D_BUMPU8V8 should be used instead. 655bf215546Sopenharmony_ci */ 656bf215546Sopenharmony_ci "SVGA3D_V8U8", 657bf215546Sopenharmony_ci SVGA3D_V8U8, 0, 0, 0, 0, 0 658bf215546Sopenharmony_ci }, 659bf215546Sopenharmony_ci { 660bf215546Sopenharmony_ci "SVGA3D_Q8W8V8U8", 661bf215546Sopenharmony_ci SVGA3D_Q8W8V8U8, 662bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8, 663bf215546Sopenharmony_ci 1, 1, 4, 664bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 665bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE 666bf215546Sopenharmony_ci }, 667bf215546Sopenharmony_ci { 668bf215546Sopenharmony_ci "SVGA3D_CxV8U8", 669bf215546Sopenharmony_ci SVGA3D_CxV8U8, 670bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_CxV8U8, 671bf215546Sopenharmony_ci 1, 1, 2, 672bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE 673bf215546Sopenharmony_ci }, 674bf215546Sopenharmony_ci { 675bf215546Sopenharmony_ci /* 676bf215546Sopenharmony_ci * SVGA3D_X8L8V8U8 is unsupported; it has no corresponding 677bf215546Sopenharmony_ci * SVGA3D_DEVCAP_xxx. SVGA3D_BUMPX8L8V8U8 should be used instead. 678bf215546Sopenharmony_ci */ 679bf215546Sopenharmony_ci "SVGA3D_X8L8V8U8", 680bf215546Sopenharmony_ci SVGA3D_X8L8V8U8, 0, 0, 0, 0, 0 681bf215546Sopenharmony_ci }, 682bf215546Sopenharmony_ci { 683bf215546Sopenharmony_ci "SVGA3D_A2W10V10U10", 684bf215546Sopenharmony_ci SVGA3D_A2W10V10U10, 685bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10, 686bf215546Sopenharmony_ci 1, 1, 4, 687bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE 688bf215546Sopenharmony_ci }, 689bf215546Sopenharmony_ci { 690bf215546Sopenharmony_ci "SVGA3D_ALPHA8", 691bf215546Sopenharmony_ci SVGA3D_ALPHA8, 692bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_ALPHA8, 693bf215546Sopenharmony_ci 1, 1, 1, 694bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 695bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 696bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE 697bf215546Sopenharmony_ci }, 698bf215546Sopenharmony_ci { 699bf215546Sopenharmony_ci "SVGA3D_R_S10E5", 700bf215546Sopenharmony_ci SVGA3D_R_S10E5, 701bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_R_S10E5, 702bf215546Sopenharmony_ci 1, 1, 2, 703bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 704bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 705bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 706bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 707bf215546Sopenharmony_ci }, 708bf215546Sopenharmony_ci { 709bf215546Sopenharmony_ci "SVGA3D_R_S23E8", 710bf215546Sopenharmony_ci SVGA3D_R_S23E8, 711bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_R_S23E8, 712bf215546Sopenharmony_ci 1, 1, 4, 713bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 714bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 715bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 716bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 717bf215546Sopenharmony_ci }, 718bf215546Sopenharmony_ci { 719bf215546Sopenharmony_ci "SVGA3D_RG_S10E5", 720bf215546Sopenharmony_ci SVGA3D_RG_S10E5, 721bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5, 722bf215546Sopenharmony_ci 1, 1, 2, 723bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 724bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 725bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 726bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 727bf215546Sopenharmony_ci }, 728bf215546Sopenharmony_ci { 729bf215546Sopenharmony_ci "SVGA3D_RG_S23E8", 730bf215546Sopenharmony_ci SVGA3D_RG_S23E8, 731bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8, 732bf215546Sopenharmony_ci 1, 1, 4, 733bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 734bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 735bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 736bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 737bf215546Sopenharmony_ci }, 738bf215546Sopenharmony_ci { 739bf215546Sopenharmony_ci /* 740bf215546Sopenharmony_ci * SVGA3D_BUFFER is a placeholder format for index/vertex buffers. 741bf215546Sopenharmony_ci */ 742bf215546Sopenharmony_ci "SVGA3D_BUFFER", 743bf215546Sopenharmony_ci SVGA3D_BUFFER, 0, 1, 1, 1, 0 744bf215546Sopenharmony_ci }, 745bf215546Sopenharmony_ci { 746bf215546Sopenharmony_ci "SVGA3D_Z_D24X8", 747bf215546Sopenharmony_ci SVGA3D_Z_D24X8, 748bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8, 749bf215546Sopenharmony_ci 1, 1, 4, 750bf215546Sopenharmony_ci SVGA3DFORMAT_OP_ZSTENCIL 751bf215546Sopenharmony_ci }, 752bf215546Sopenharmony_ci { 753bf215546Sopenharmony_ci "SVGA3D_V16U16", 754bf215546Sopenharmony_ci SVGA3D_V16U16, 755bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_V16U16, 756bf215546Sopenharmony_ci 1, 1, 4, 757bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 758bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 759bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE 760bf215546Sopenharmony_ci }, 761bf215546Sopenharmony_ci { 762bf215546Sopenharmony_ci "SVGA3D_G16R16", 763bf215546Sopenharmony_ci SVGA3D_G16R16, 764bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_G16R16, 765bf215546Sopenharmony_ci 1, 1, 4, 766bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 767bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 768bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 769bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 770bf215546Sopenharmony_ci }, 771bf215546Sopenharmony_ci { 772bf215546Sopenharmony_ci "SVGA3D_A16B16G16R16", 773bf215546Sopenharmony_ci SVGA3D_A16B16G16R16, 774bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16, 775bf215546Sopenharmony_ci 1, 1, 8, 776bf215546Sopenharmony_ci SVGA3DFORMAT_OP_TEXTURE | 777bf215546Sopenharmony_ci SVGA3DFORMAT_OP_CUBETEXTURE | 778bf215546Sopenharmony_ci SVGA3DFORMAT_OP_VOLUMETEXTURE | 779bf215546Sopenharmony_ci SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET 780bf215546Sopenharmony_ci }, 781bf215546Sopenharmony_ci { 782bf215546Sopenharmony_ci "SVGA3D_UYVY", 783bf215546Sopenharmony_ci SVGA3D_UYVY, 784bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_UYVY, 785bf215546Sopenharmony_ci 0, 0, 0, 0 786bf215546Sopenharmony_ci }, 787bf215546Sopenharmony_ci { 788bf215546Sopenharmony_ci "SVGA3D_YUY2", 789bf215546Sopenharmony_ci SVGA3D_YUY2, 790bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_YUY2, 791bf215546Sopenharmony_ci 0, 0, 0, 0 792bf215546Sopenharmony_ci }, 793bf215546Sopenharmony_ci { 794bf215546Sopenharmony_ci "SVGA3D_NV12", 795bf215546Sopenharmony_ci SVGA3D_NV12, 796bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_NV12, 797bf215546Sopenharmony_ci 0, 0, 0, 0 798bf215546Sopenharmony_ci }, 799bf215546Sopenharmony_ci { 800bf215546Sopenharmony_ci "SVGA3D_FORMAT_DEAD2", 801bf215546Sopenharmony_ci SVGA3D_FORMAT_DEAD2, 0, 0, 0, 0, 0 802bf215546Sopenharmony_ci }, 803bf215546Sopenharmony_ci { 804bf215546Sopenharmony_ci "SVGA3D_R32G32B32A32_TYPELESS", 805bf215546Sopenharmony_ci SVGA3D_R32G32B32A32_TYPELESS, 806bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32A32_TYPELESS, 807bf215546Sopenharmony_ci 1, 1, 16, 0 808bf215546Sopenharmony_ci }, 809bf215546Sopenharmony_ci { 810bf215546Sopenharmony_ci "SVGA3D_R32G32B32A32_UINT", 811bf215546Sopenharmony_ci SVGA3D_R32G32B32A32_UINT, 812bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32A32_UINT, 813bf215546Sopenharmony_ci 1, 1, 16, 0 814bf215546Sopenharmony_ci }, 815bf215546Sopenharmony_ci { 816bf215546Sopenharmony_ci "SVGA3D_R32G32B32A32_SINT", 817bf215546Sopenharmony_ci SVGA3D_R32G32B32A32_SINT, 818bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32A32_SINT, 819bf215546Sopenharmony_ci 1, 1, 16, 0 820bf215546Sopenharmony_ci }, 821bf215546Sopenharmony_ci { 822bf215546Sopenharmony_ci "SVGA3D_R32G32B32_TYPELESS", 823bf215546Sopenharmony_ci SVGA3D_R32G32B32_TYPELESS, 824bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32_TYPELESS, 825bf215546Sopenharmony_ci 1, 1, 12, 0 826bf215546Sopenharmony_ci }, 827bf215546Sopenharmony_ci { 828bf215546Sopenharmony_ci "SVGA3D_R32G32B32_FLOAT", 829bf215546Sopenharmony_ci SVGA3D_R32G32B32_FLOAT, 830bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32_FLOAT, 831bf215546Sopenharmony_ci 1, 1, 12, 0 832bf215546Sopenharmony_ci }, 833bf215546Sopenharmony_ci { 834bf215546Sopenharmony_ci "SVGA3D_R32G32B32_UINT", 835bf215546Sopenharmony_ci SVGA3D_R32G32B32_UINT, 836bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32_UINT, 837bf215546Sopenharmony_ci 1, 1, 12, 0 838bf215546Sopenharmony_ci }, 839bf215546Sopenharmony_ci { 840bf215546Sopenharmony_ci "SVGA3D_R32G32B32_SINT", 841bf215546Sopenharmony_ci SVGA3D_R32G32B32_SINT, 842bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32_SINT, 843bf215546Sopenharmony_ci 1, 1, 12, 0 844bf215546Sopenharmony_ci }, 845bf215546Sopenharmony_ci { 846bf215546Sopenharmony_ci "SVGA3D_R16G16B16A16_TYPELESS", 847bf215546Sopenharmony_ci SVGA3D_R16G16B16A16_TYPELESS, 848bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16B16A16_TYPELESS, 849bf215546Sopenharmony_ci 1, 1, 8, 0 850bf215546Sopenharmony_ci }, 851bf215546Sopenharmony_ci { 852bf215546Sopenharmony_ci "SVGA3D_R16G16B16A16_UINT", 853bf215546Sopenharmony_ci SVGA3D_R16G16B16A16_UINT, 854bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16B16A16_UINT, 855bf215546Sopenharmony_ci 1, 1, 8, 0 856bf215546Sopenharmony_ci }, 857bf215546Sopenharmony_ci { 858bf215546Sopenharmony_ci "SVGA3D_R16G16B16A16_SNORM", 859bf215546Sopenharmony_ci SVGA3D_R16G16B16A16_SNORM, 860bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16B16A16_SNORM, 861bf215546Sopenharmony_ci 1, 1, 8, 0 862bf215546Sopenharmony_ci }, 863bf215546Sopenharmony_ci { 864bf215546Sopenharmony_ci "SVGA3D_R16G16B16A16_SINT", 865bf215546Sopenharmony_ci SVGA3D_R16G16B16A16_SINT, 866bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16B16A16_SINT, 867bf215546Sopenharmony_ci 1, 1, 8, 0 868bf215546Sopenharmony_ci }, 869bf215546Sopenharmony_ci { 870bf215546Sopenharmony_ci "SVGA3D_R32G32_TYPELESS", 871bf215546Sopenharmony_ci SVGA3D_R32G32_TYPELESS, 872bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32_TYPELESS, 873bf215546Sopenharmony_ci 1, 1, 8, 0 874bf215546Sopenharmony_ci }, 875bf215546Sopenharmony_ci { 876bf215546Sopenharmony_ci "SVGA3D_R32G32_UINT", 877bf215546Sopenharmony_ci SVGA3D_R32G32_UINT, 878bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32_UINT, 879bf215546Sopenharmony_ci 1, 1, 8, 0 880bf215546Sopenharmony_ci }, 881bf215546Sopenharmony_ci { 882bf215546Sopenharmony_ci "SVGA3D_R32G32_SINT", 883bf215546Sopenharmony_ci SVGA3D_R32G32_SINT, 884bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32_SINT, 885bf215546Sopenharmony_ci 1, 1, 8, 886bf215546Sopenharmony_ci 0 887bf215546Sopenharmony_ci }, 888bf215546Sopenharmony_ci { 889bf215546Sopenharmony_ci "SVGA3D_R32G8X24_TYPELESS", 890bf215546Sopenharmony_ci SVGA3D_R32G8X24_TYPELESS, 891bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G8X24_TYPELESS, 892bf215546Sopenharmony_ci 1, 1, 8, 0 893bf215546Sopenharmony_ci }, 894bf215546Sopenharmony_ci { 895bf215546Sopenharmony_ci "SVGA3D_D32_FLOAT_S8X24_UINT", 896bf215546Sopenharmony_ci SVGA3D_D32_FLOAT_S8X24_UINT, 897bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_D32_FLOAT_S8X24_UINT, 898bf215546Sopenharmony_ci 1, 1, 8, 0 899bf215546Sopenharmony_ci }, 900bf215546Sopenharmony_ci { 901bf215546Sopenharmony_ci "SVGA3D_R32_FLOAT_X8X24", 902bf215546Sopenharmony_ci SVGA3D_R32_FLOAT_X8X24, 903bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32_FLOAT_X8X24, 904bf215546Sopenharmony_ci 1, 1, 8, 0 905bf215546Sopenharmony_ci }, 906bf215546Sopenharmony_ci { 907bf215546Sopenharmony_ci "SVGA3D_X32_G8X24_UINT", 908bf215546Sopenharmony_ci SVGA3D_X32_G8X24_UINT, 909bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_X32_G8X24_UINT, 910bf215546Sopenharmony_ci 1, 1, 4, 0 911bf215546Sopenharmony_ci }, 912bf215546Sopenharmony_ci { 913bf215546Sopenharmony_ci "SVGA3D_R10G10B10A2_TYPELESS", 914bf215546Sopenharmony_ci SVGA3D_R10G10B10A2_TYPELESS, 915bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R10G10B10A2_TYPELESS, 916bf215546Sopenharmony_ci 1, 1, 4, 0 917bf215546Sopenharmony_ci }, 918bf215546Sopenharmony_ci { 919bf215546Sopenharmony_ci "SVGA3D_R10G10B10A2_UINT", 920bf215546Sopenharmony_ci SVGA3D_R10G10B10A2_UINT, 921bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R10G10B10A2_UINT, 922bf215546Sopenharmony_ci 1, 1, 4, 0 923bf215546Sopenharmony_ci }, 924bf215546Sopenharmony_ci { 925bf215546Sopenharmony_ci "SVGA3D_R11G11B10_FLOAT", 926bf215546Sopenharmony_ci SVGA3D_R11G11B10_FLOAT, 927bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R11G11B10_FLOAT, 928bf215546Sopenharmony_ci 1, 1, 4, 0 929bf215546Sopenharmony_ci }, 930bf215546Sopenharmony_ci { 931bf215546Sopenharmony_ci "SVGA3D_R8G8B8A8_TYPELESS", 932bf215546Sopenharmony_ci SVGA3D_R8G8B8A8_TYPELESS, 933bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8B8A8_TYPELESS, 934bf215546Sopenharmony_ci 1, 1, 4, 0 935bf215546Sopenharmony_ci }, 936bf215546Sopenharmony_ci { 937bf215546Sopenharmony_ci "SVGA3D_R8G8B8A8_UNORM", 938bf215546Sopenharmony_ci SVGA3D_R8G8B8A8_UNORM, 939bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UNORM, 940bf215546Sopenharmony_ci 1, 1, 4, 0 941bf215546Sopenharmony_ci }, 942bf215546Sopenharmony_ci { 943bf215546Sopenharmony_ci "SVGA3D_R8G8B8A8_UNORM_SRGB", 944bf215546Sopenharmony_ci SVGA3D_R8G8B8A8_UNORM_SRGB, 945bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UNORM_SRGB, 946bf215546Sopenharmony_ci 1, 1, 4, 0 947bf215546Sopenharmony_ci }, 948bf215546Sopenharmony_ci { 949bf215546Sopenharmony_ci "SVGA3D_R8G8B8A8_UINT", 950bf215546Sopenharmony_ci SVGA3D_R8G8B8A8_UINT, 951bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UINT, 952bf215546Sopenharmony_ci 1, 1, 4, 0 953bf215546Sopenharmony_ci }, 954bf215546Sopenharmony_ci { 955bf215546Sopenharmony_ci "SVGA3D_R8G8B8A8_SINT", 956bf215546Sopenharmony_ci SVGA3D_R8G8B8A8_SINT, 957bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8B8A8_SINT, 958bf215546Sopenharmony_ci 1, 1, 4, 0 959bf215546Sopenharmony_ci }, 960bf215546Sopenharmony_ci { 961bf215546Sopenharmony_ci "SVGA3D_R16G16_TYPELESS", 962bf215546Sopenharmony_ci SVGA3D_R16G16_TYPELESS, 963bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16_TYPELESS, 964bf215546Sopenharmony_ci 1, 1, 4, 0 965bf215546Sopenharmony_ci }, 966bf215546Sopenharmony_ci { 967bf215546Sopenharmony_ci "SVGA3D_R16G16_UINT", 968bf215546Sopenharmony_ci SVGA3D_R16G16_UINT, 969bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16_UINT, 970bf215546Sopenharmony_ci 1, 1, 4, 0 971bf215546Sopenharmony_ci }, 972bf215546Sopenharmony_ci { 973bf215546Sopenharmony_ci "SVGA3D_R16G16_SINT", 974bf215546Sopenharmony_ci SVGA3D_R16G16_SINT, 975bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16_SINT, 976bf215546Sopenharmony_ci 1, 1, 4, 0 977bf215546Sopenharmony_ci }, 978bf215546Sopenharmony_ci { 979bf215546Sopenharmony_ci "SVGA3D_R32_TYPELESS", 980bf215546Sopenharmony_ci SVGA3D_R32_TYPELESS, 981bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32_TYPELESS, 982bf215546Sopenharmony_ci 1, 1, 4, 0 983bf215546Sopenharmony_ci }, 984bf215546Sopenharmony_ci { 985bf215546Sopenharmony_ci "SVGA3D_D32_FLOAT", 986bf215546Sopenharmony_ci SVGA3D_D32_FLOAT, 987bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_D32_FLOAT, 988bf215546Sopenharmony_ci 1, 1, 4, 0 989bf215546Sopenharmony_ci }, 990bf215546Sopenharmony_ci { 991bf215546Sopenharmony_ci "SVGA3D_R32_UINT", 992bf215546Sopenharmony_ci SVGA3D_R32_UINT, 993bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32_UINT, 994bf215546Sopenharmony_ci 1, 1, 4, 0 995bf215546Sopenharmony_ci }, 996bf215546Sopenharmony_ci { 997bf215546Sopenharmony_ci "SVGA3D_R32_SINT", 998bf215546Sopenharmony_ci SVGA3D_R32_SINT, 999bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32_SINT, 1000bf215546Sopenharmony_ci 1, 1, 4, 0 1001bf215546Sopenharmony_ci }, 1002bf215546Sopenharmony_ci { 1003bf215546Sopenharmony_ci "SVGA3D_R24G8_TYPELESS", 1004bf215546Sopenharmony_ci SVGA3D_R24G8_TYPELESS, 1005bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R24G8_TYPELESS, 1006bf215546Sopenharmony_ci 1, 1, 4, 0 1007bf215546Sopenharmony_ci }, 1008bf215546Sopenharmony_ci { 1009bf215546Sopenharmony_ci "SVGA3D_D24_UNORM_S8_UINT", 1010bf215546Sopenharmony_ci SVGA3D_D24_UNORM_S8_UINT, 1011bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_D24_UNORM_S8_UINT, 1012bf215546Sopenharmony_ci 1, 1, 4, 0 1013bf215546Sopenharmony_ci }, 1014bf215546Sopenharmony_ci { 1015bf215546Sopenharmony_ci "SVGA3D_R24_UNORM_X8", 1016bf215546Sopenharmony_ci SVGA3D_R24_UNORM_X8, 1017bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R24_UNORM_X8, 1018bf215546Sopenharmony_ci 1, 1, 4, 0 1019bf215546Sopenharmony_ci }, 1020bf215546Sopenharmony_ci { 1021bf215546Sopenharmony_ci "SVGA3D_X24_G8_UINT", 1022bf215546Sopenharmony_ci SVGA3D_X24_G8_UINT, 1023bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_X24_G8_UINT, 1024bf215546Sopenharmony_ci 1, 1, 4, 0 1025bf215546Sopenharmony_ci }, 1026bf215546Sopenharmony_ci { 1027bf215546Sopenharmony_ci "SVGA3D_R8G8_TYPELESS", 1028bf215546Sopenharmony_ci SVGA3D_R8G8_TYPELESS, 1029bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8_TYPELESS, 1030bf215546Sopenharmony_ci 1, 1, 2, 0 1031bf215546Sopenharmony_ci }, 1032bf215546Sopenharmony_ci { 1033bf215546Sopenharmony_ci "SVGA3D_R8G8_UNORM", 1034bf215546Sopenharmony_ci SVGA3D_R8G8_UNORM, 1035bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8_UNORM, 1036bf215546Sopenharmony_ci 1, 1, 2, 0 1037bf215546Sopenharmony_ci }, 1038bf215546Sopenharmony_ci { 1039bf215546Sopenharmony_ci "SVGA3D_R8G8_UINT", 1040bf215546Sopenharmony_ci SVGA3D_R8G8_UINT, 1041bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8_UINT, 1042bf215546Sopenharmony_ci 1, 1, 2, 0 1043bf215546Sopenharmony_ci }, 1044bf215546Sopenharmony_ci { 1045bf215546Sopenharmony_ci "SVGA3D_R8G8_SINT", 1046bf215546Sopenharmony_ci SVGA3D_R8G8_SINT, 1047bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8_SINT, 1048bf215546Sopenharmony_ci 1, 1, 2, 0 1049bf215546Sopenharmony_ci }, 1050bf215546Sopenharmony_ci { 1051bf215546Sopenharmony_ci "SVGA3D_R16_TYPELESS", 1052bf215546Sopenharmony_ci SVGA3D_R16_TYPELESS, 1053bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16_TYPELESS, 1054bf215546Sopenharmony_ci 1, 1, 2, 0 1055bf215546Sopenharmony_ci }, 1056bf215546Sopenharmony_ci { 1057bf215546Sopenharmony_ci "SVGA3D_R16_UNORM", 1058bf215546Sopenharmony_ci SVGA3D_R16_UNORM, 1059bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16_UNORM, 1060bf215546Sopenharmony_ci 1, 1, 2, 0 1061bf215546Sopenharmony_ci }, 1062bf215546Sopenharmony_ci { 1063bf215546Sopenharmony_ci "SVGA3D_R16_UINT", 1064bf215546Sopenharmony_ci SVGA3D_R16_UINT, 1065bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16_UINT, 1066bf215546Sopenharmony_ci 1, 1, 2, 0 1067bf215546Sopenharmony_ci }, 1068bf215546Sopenharmony_ci { 1069bf215546Sopenharmony_ci "SVGA3D_R16_SNORM", 1070bf215546Sopenharmony_ci SVGA3D_R16_SNORM, 1071bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16_SNORM, 1072bf215546Sopenharmony_ci 1, 1, 2, 0 1073bf215546Sopenharmony_ci }, 1074bf215546Sopenharmony_ci { 1075bf215546Sopenharmony_ci "SVGA3D_R16_SINT", 1076bf215546Sopenharmony_ci SVGA3D_R16_SINT, 1077bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16_SINT, 1078bf215546Sopenharmony_ci 1, 1, 2, 0 1079bf215546Sopenharmony_ci }, 1080bf215546Sopenharmony_ci { 1081bf215546Sopenharmony_ci "SVGA3D_R8_TYPELESS", 1082bf215546Sopenharmony_ci SVGA3D_R8_TYPELESS, 1083bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8_TYPELESS, 1084bf215546Sopenharmony_ci 1, 1, 1, 0 1085bf215546Sopenharmony_ci }, 1086bf215546Sopenharmony_ci { 1087bf215546Sopenharmony_ci "SVGA3D_R8_UNORM", 1088bf215546Sopenharmony_ci SVGA3D_R8_UNORM, 1089bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8_UNORM, 1090bf215546Sopenharmony_ci 1, 1, 1, 0 1091bf215546Sopenharmony_ci }, 1092bf215546Sopenharmony_ci { 1093bf215546Sopenharmony_ci "SVGA3D_R8_UINT", 1094bf215546Sopenharmony_ci SVGA3D_R8_UINT, 1095bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8_UINT, 1096bf215546Sopenharmony_ci 1, 1, 1, 0 1097bf215546Sopenharmony_ci }, 1098bf215546Sopenharmony_ci { 1099bf215546Sopenharmony_ci "SVGA3D_R8_SNORM", 1100bf215546Sopenharmony_ci SVGA3D_R8_SNORM, 1101bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8_SNORM, 1102bf215546Sopenharmony_ci 1, 1, 1, 0 1103bf215546Sopenharmony_ci }, 1104bf215546Sopenharmony_ci { 1105bf215546Sopenharmony_ci "SVGA3D_R8_SINT", 1106bf215546Sopenharmony_ci SVGA3D_R8_SINT, 1107bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8_SINT, 1108bf215546Sopenharmony_ci 1, 1, 1, 0 1109bf215546Sopenharmony_ci }, 1110bf215546Sopenharmony_ci { 1111bf215546Sopenharmony_ci "SVGA3D_P8", 1112bf215546Sopenharmony_ci SVGA3D_P8, 0, 0, 0, 0, 0 1113bf215546Sopenharmony_ci }, 1114bf215546Sopenharmony_ci { 1115bf215546Sopenharmony_ci "SVGA3D_R9G9B9E5_SHAREDEXP", 1116bf215546Sopenharmony_ci SVGA3D_R9G9B9E5_SHAREDEXP, 1117bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R9G9B9E5_SHAREDEXP, 1118bf215546Sopenharmony_ci 1, 1, 4, 0 1119bf215546Sopenharmony_ci }, 1120bf215546Sopenharmony_ci { 1121bf215546Sopenharmony_ci "SVGA3D_R8G8_B8G8_UNORM", 1122bf215546Sopenharmony_ci SVGA3D_R8G8_B8G8_UNORM, 0, 0, 0, 0, 0 1123bf215546Sopenharmony_ci }, 1124bf215546Sopenharmony_ci { 1125bf215546Sopenharmony_ci "SVGA3D_G8R8_G8B8_UNORM", 1126bf215546Sopenharmony_ci SVGA3D_G8R8_G8B8_UNORM, 0, 0, 0, 0, 0 1127bf215546Sopenharmony_ci }, 1128bf215546Sopenharmony_ci { 1129bf215546Sopenharmony_ci "SVGA3D_BC1_TYPELESS", 1130bf215546Sopenharmony_ci SVGA3D_BC1_TYPELESS, 1131bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC1_TYPELESS, 1132bf215546Sopenharmony_ci 4, 4, 8, 0 1133bf215546Sopenharmony_ci }, 1134bf215546Sopenharmony_ci { 1135bf215546Sopenharmony_ci "SVGA3D_BC1_UNORM_SRGB", 1136bf215546Sopenharmony_ci SVGA3D_BC1_UNORM_SRGB, 1137bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC1_UNORM_SRGB, 1138bf215546Sopenharmony_ci 4, 4, 8, 0 1139bf215546Sopenharmony_ci }, 1140bf215546Sopenharmony_ci { 1141bf215546Sopenharmony_ci "SVGA3D_BC2_TYPELESS", 1142bf215546Sopenharmony_ci SVGA3D_BC2_TYPELESS, 1143bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC2_TYPELESS, 1144bf215546Sopenharmony_ci 4, 4, 16, 0 1145bf215546Sopenharmony_ci }, 1146bf215546Sopenharmony_ci { 1147bf215546Sopenharmony_ci "SVGA3D_BC2_UNORM_SRGB", 1148bf215546Sopenharmony_ci SVGA3D_BC2_UNORM_SRGB, 1149bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC2_UNORM_SRGB, 1150bf215546Sopenharmony_ci 4, 4, 16, 0 1151bf215546Sopenharmony_ci }, 1152bf215546Sopenharmony_ci { 1153bf215546Sopenharmony_ci "SVGA3D_BC3_TYPELESS", 1154bf215546Sopenharmony_ci SVGA3D_BC3_TYPELESS, 1155bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC3_TYPELESS, 1156bf215546Sopenharmony_ci 4, 4, 16, 0 1157bf215546Sopenharmony_ci }, 1158bf215546Sopenharmony_ci { 1159bf215546Sopenharmony_ci "SVGA3D_BC3_UNORM_SRGB", 1160bf215546Sopenharmony_ci SVGA3D_BC3_UNORM_SRGB, 1161bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC3_UNORM_SRGB, 1162bf215546Sopenharmony_ci 4, 4, 16, 0 1163bf215546Sopenharmony_ci }, 1164bf215546Sopenharmony_ci { 1165bf215546Sopenharmony_ci "SVGA3D_BC4_TYPELESS", 1166bf215546Sopenharmony_ci SVGA3D_BC4_TYPELESS, 1167bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC4_TYPELESS, 1168bf215546Sopenharmony_ci 4, 4, 8, 0 1169bf215546Sopenharmony_ci }, 1170bf215546Sopenharmony_ci { 1171bf215546Sopenharmony_ci "SVGA3D_ATI1", 1172bf215546Sopenharmony_ci SVGA3D_ATI1, 0, 0, 0, 0, 0 1173bf215546Sopenharmony_ci }, 1174bf215546Sopenharmony_ci { 1175bf215546Sopenharmony_ci "SVGA3D_BC4_SNORM", 1176bf215546Sopenharmony_ci SVGA3D_BC4_SNORM, 1177bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC4_SNORM, 1178bf215546Sopenharmony_ci 4, 4, 8, 0 1179bf215546Sopenharmony_ci }, 1180bf215546Sopenharmony_ci { 1181bf215546Sopenharmony_ci "SVGA3D_BC5_TYPELESS", 1182bf215546Sopenharmony_ci SVGA3D_BC5_TYPELESS, 1183bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC5_TYPELESS, 1184bf215546Sopenharmony_ci 4, 4, 16, 0 1185bf215546Sopenharmony_ci }, 1186bf215546Sopenharmony_ci { 1187bf215546Sopenharmony_ci "SVGA3D_ATI2", 1188bf215546Sopenharmony_ci SVGA3D_ATI2, 0, 0, 0, 0, 0 1189bf215546Sopenharmony_ci }, 1190bf215546Sopenharmony_ci { 1191bf215546Sopenharmony_ci "SVGA3D_BC5_SNORM", 1192bf215546Sopenharmony_ci SVGA3D_BC5_SNORM, 1193bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC5_SNORM, 1194bf215546Sopenharmony_ci 4, 4, 16, 0 1195bf215546Sopenharmony_ci }, 1196bf215546Sopenharmony_ci { 1197bf215546Sopenharmony_ci "SVGA3D_R10G10B10_XR_BIAS_A2_UNORM", 1198bf215546Sopenharmony_ci SVGA3D_R10G10B10_XR_BIAS_A2_UNORM, 0, 0, 0, 0, 0 1199bf215546Sopenharmony_ci }, 1200bf215546Sopenharmony_ci { 1201bf215546Sopenharmony_ci "SVGA3D_B8G8R8A8_TYPELESS", 1202bf215546Sopenharmony_ci SVGA3D_B8G8R8A8_TYPELESS, 1203bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B8G8R8A8_TYPELESS, 1204bf215546Sopenharmony_ci 1, 1, 4, 0 1205bf215546Sopenharmony_ci }, 1206bf215546Sopenharmony_ci { 1207bf215546Sopenharmony_ci "SVGA3D_B8G8R8A8_UNORM_SRGB", 1208bf215546Sopenharmony_ci SVGA3D_B8G8R8A8_UNORM_SRGB, 1209bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B8G8R8A8_UNORM_SRGB, 1210bf215546Sopenharmony_ci 1, 1, 4, 0 1211bf215546Sopenharmony_ci }, 1212bf215546Sopenharmony_ci { 1213bf215546Sopenharmony_ci "SVGA3D_B8G8R8X8_TYPELESS", 1214bf215546Sopenharmony_ci SVGA3D_B8G8R8X8_TYPELESS, 1215bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B8G8R8X8_TYPELESS, 1216bf215546Sopenharmony_ci 1, 1, 4, 0 1217bf215546Sopenharmony_ci }, 1218bf215546Sopenharmony_ci { 1219bf215546Sopenharmony_ci "SVGA3D_B8G8R8X8_UNORM_SRGB", 1220bf215546Sopenharmony_ci SVGA3D_B8G8R8X8_UNORM_SRGB, 1221bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B8G8R8X8_UNORM_SRGB, 1222bf215546Sopenharmony_ci 1, 1, 4, 0 1223bf215546Sopenharmony_ci }, 1224bf215546Sopenharmony_ci { 1225bf215546Sopenharmony_ci "SVGA3D_Z_DF16", 1226bf215546Sopenharmony_ci SVGA3D_Z_DF16, 1227bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_Z_DF16, 1228bf215546Sopenharmony_ci 1, 1, 2, 0 1229bf215546Sopenharmony_ci }, 1230bf215546Sopenharmony_ci { 1231bf215546Sopenharmony_ci "SVGA3D_Z_DF24", 1232bf215546Sopenharmony_ci SVGA3D_Z_DF24, 1233bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_Z_DF24, 1234bf215546Sopenharmony_ci 1, 1, 4, 0 1235bf215546Sopenharmony_ci }, 1236bf215546Sopenharmony_ci { 1237bf215546Sopenharmony_ci "SVGA3D_Z_D24S8_INT", 1238bf215546Sopenharmony_ci SVGA3D_Z_D24S8_INT, 1239bf215546Sopenharmony_ci SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT, 1240bf215546Sopenharmony_ci 1, 1, 4, 0 1241bf215546Sopenharmony_ci }, 1242bf215546Sopenharmony_ci { 1243bf215546Sopenharmony_ci "SVGA3D_YV12", 1244bf215546Sopenharmony_ci SVGA3D_YV12, 0, 0, 0, 0, 0 1245bf215546Sopenharmony_ci }, 1246bf215546Sopenharmony_ci { 1247bf215546Sopenharmony_ci "SVGA3D_R32G32B32A32_FLOAT", 1248bf215546Sopenharmony_ci SVGA3D_R32G32B32A32_FLOAT, 1249bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32B32A32_FLOAT, 1250bf215546Sopenharmony_ci 1, 1, 16, 0 1251bf215546Sopenharmony_ci }, 1252bf215546Sopenharmony_ci { 1253bf215546Sopenharmony_ci "SVGA3D_R16G16B16A16_FLOAT", 1254bf215546Sopenharmony_ci SVGA3D_R16G16B16A16_FLOAT, 1255bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16B16A16_FLOAT, 1256bf215546Sopenharmony_ci 1, 1, 8, 0 1257bf215546Sopenharmony_ci }, 1258bf215546Sopenharmony_ci { 1259bf215546Sopenharmony_ci "SVGA3D_R16G16B16A16_UNORM", 1260bf215546Sopenharmony_ci SVGA3D_R16G16B16A16_UNORM, 1261bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16B16A16_UNORM, 1262bf215546Sopenharmony_ci 1, 1, 8, 0 1263bf215546Sopenharmony_ci }, 1264bf215546Sopenharmony_ci { 1265bf215546Sopenharmony_ci "SVGA3D_R32G32_FLOAT", 1266bf215546Sopenharmony_ci SVGA3D_R32G32_FLOAT, 1267bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32G32_FLOAT, 1268bf215546Sopenharmony_ci 1, 1, 8, 0 1269bf215546Sopenharmony_ci }, 1270bf215546Sopenharmony_ci { 1271bf215546Sopenharmony_ci "SVGA3D_R10G10B10A2_UNORM", 1272bf215546Sopenharmony_ci SVGA3D_R10G10B10A2_UNORM, 1273bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R10G10B10A2_UNORM, 1274bf215546Sopenharmony_ci 1, 1, 4, 0 1275bf215546Sopenharmony_ci }, 1276bf215546Sopenharmony_ci { 1277bf215546Sopenharmony_ci "SVGA3D_R8G8B8A8_SNORM", 1278bf215546Sopenharmony_ci SVGA3D_R8G8B8A8_SNORM, 1279bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8B8A8_SNORM, 1280bf215546Sopenharmony_ci 1, 1, 4, 0 1281bf215546Sopenharmony_ci }, 1282bf215546Sopenharmony_ci { 1283bf215546Sopenharmony_ci "SVGA3D_R16G16_FLOAT", 1284bf215546Sopenharmony_ci SVGA3D_R16G16_FLOAT, 1285bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16_FLOAT, 1286bf215546Sopenharmony_ci 1, 1, 4, 0 1287bf215546Sopenharmony_ci }, 1288bf215546Sopenharmony_ci { 1289bf215546Sopenharmony_ci "SVGA3D_R16G16_UNORM", 1290bf215546Sopenharmony_ci SVGA3D_R16G16_UNORM, 1291bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16_UNORM, 1292bf215546Sopenharmony_ci 1, 1, 4, 0 1293bf215546Sopenharmony_ci }, 1294bf215546Sopenharmony_ci { 1295bf215546Sopenharmony_ci "SVGA3D_R16G16_SNORM", 1296bf215546Sopenharmony_ci SVGA3D_R16G16_SNORM, 1297bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16G16_SNORM, 1298bf215546Sopenharmony_ci 1, 1, 4, 0 1299bf215546Sopenharmony_ci }, 1300bf215546Sopenharmony_ci { 1301bf215546Sopenharmony_ci "SVGA3D_R32_FLOAT", 1302bf215546Sopenharmony_ci SVGA3D_R32_FLOAT, 1303bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R32_FLOAT, 1304bf215546Sopenharmony_ci 1, 1, 4, 0 1305bf215546Sopenharmony_ci }, 1306bf215546Sopenharmony_ci { 1307bf215546Sopenharmony_ci "SVGA3D_R8G8_SNORM", 1308bf215546Sopenharmony_ci SVGA3D_R8G8_SNORM, 1309bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R8G8_SNORM, 1310bf215546Sopenharmony_ci 1, 1, 2, 0 1311bf215546Sopenharmony_ci }, 1312bf215546Sopenharmony_ci { 1313bf215546Sopenharmony_ci "SVGA3D_R16_FLOAT", 1314bf215546Sopenharmony_ci SVGA3D_R16_FLOAT, 1315bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R16_FLOAT, 1316bf215546Sopenharmony_ci 1, 1, 2, 0 1317bf215546Sopenharmony_ci }, 1318bf215546Sopenharmony_ci { 1319bf215546Sopenharmony_ci "SVGA3D_D16_UNORM", 1320bf215546Sopenharmony_ci SVGA3D_D16_UNORM, 1321bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_D16_UNORM, 1322bf215546Sopenharmony_ci 1, 1, 2, 0 1323bf215546Sopenharmony_ci }, 1324bf215546Sopenharmony_ci { 1325bf215546Sopenharmony_ci "SVGA3D_A8_UNORM", 1326bf215546Sopenharmony_ci SVGA3D_A8_UNORM, 1327bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_A8_UNORM, 1328bf215546Sopenharmony_ci 1, 1, 1, 0 1329bf215546Sopenharmony_ci }, 1330bf215546Sopenharmony_ci { 1331bf215546Sopenharmony_ci "SVGA3D_BC1_UNORM", 1332bf215546Sopenharmony_ci SVGA3D_BC1_UNORM, 1333bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC1_UNORM, 1334bf215546Sopenharmony_ci 4, 4, 8, 0 1335bf215546Sopenharmony_ci }, 1336bf215546Sopenharmony_ci { 1337bf215546Sopenharmony_ci "SVGA3D_BC2_UNORM", 1338bf215546Sopenharmony_ci SVGA3D_BC2_UNORM, 1339bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC2_UNORM, 1340bf215546Sopenharmony_ci 4, 4, 16, 0 1341bf215546Sopenharmony_ci }, 1342bf215546Sopenharmony_ci { 1343bf215546Sopenharmony_ci "SVGA3D_BC3_UNORM", 1344bf215546Sopenharmony_ci SVGA3D_BC3_UNORM, 1345bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC3_UNORM, 1346bf215546Sopenharmony_ci 4, 4, 16, 0 1347bf215546Sopenharmony_ci }, 1348bf215546Sopenharmony_ci { 1349bf215546Sopenharmony_ci "SVGA3D_B5G6R5_UNORM", 1350bf215546Sopenharmony_ci SVGA3D_B5G6R5_UNORM, 1351bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B5G6R5_UNORM, 1352bf215546Sopenharmony_ci 1, 1, 2, 0 1353bf215546Sopenharmony_ci }, 1354bf215546Sopenharmony_ci { 1355bf215546Sopenharmony_ci "SVGA3D_B5G5R5A1_UNORM", 1356bf215546Sopenharmony_ci SVGA3D_B5G5R5A1_UNORM, 1357bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B5G5R5A1_UNORM, 1358bf215546Sopenharmony_ci 1, 1, 2, 0 1359bf215546Sopenharmony_ci }, 1360bf215546Sopenharmony_ci { 1361bf215546Sopenharmony_ci "SVGA3D_B8G8R8A8_UNORM", 1362bf215546Sopenharmony_ci SVGA3D_B8G8R8A8_UNORM, 1363bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B8G8R8A8_UNORM, 1364bf215546Sopenharmony_ci 1, 1, 4, 0 1365bf215546Sopenharmony_ci }, 1366bf215546Sopenharmony_ci { 1367bf215546Sopenharmony_ci "SVGA3D_B8G8R8X8_UNORM", 1368bf215546Sopenharmony_ci SVGA3D_B8G8R8X8_UNORM, 1369bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_B8G8R8X8_UNORM, 1370bf215546Sopenharmony_ci 1, 1, 4, 0 1371bf215546Sopenharmony_ci }, 1372bf215546Sopenharmony_ci { 1373bf215546Sopenharmony_ci "SVGA3D_BC4_UNORM", 1374bf215546Sopenharmony_ci SVGA3D_BC4_UNORM, 1375bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC4_UNORM, 1376bf215546Sopenharmony_ci 4, 4, 8, 0 1377bf215546Sopenharmony_ci }, 1378bf215546Sopenharmony_ci { 1379bf215546Sopenharmony_ci "SVGA3D_BC5_UNORM", 1380bf215546Sopenharmony_ci SVGA3D_BC5_UNORM, 1381bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC5_UNORM, 1382bf215546Sopenharmony_ci 4, 4, 16, 0 1383bf215546Sopenharmony_ci }, 1384bf215546Sopenharmony_ci { 1385bf215546Sopenharmony_ci "SVGA3D_B4G4R4A4_UNORM", 1386bf215546Sopenharmony_ci SVGA3D_B4G4R4A4_UNORM, 1387bf215546Sopenharmony_ci 0, 0, 0, 0 1388bf215546Sopenharmony_ci }, 1389bf215546Sopenharmony_ci { 1390bf215546Sopenharmony_ci "SVGA3D_BC6H_TYPELESS", 1391bf215546Sopenharmony_ci SVGA3D_BC6H_TYPELESS, 1392bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC6H_TYPELESS, 1393bf215546Sopenharmony_ci 4, 4, 16, 0 1394bf215546Sopenharmony_ci }, 1395bf215546Sopenharmony_ci { 1396bf215546Sopenharmony_ci "SVGA3D_BC6H_UF16", 1397bf215546Sopenharmony_ci SVGA3D_BC6H_UF16, 1398bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC6H_UF16, 1399bf215546Sopenharmony_ci 4, 4, 16, 0 1400bf215546Sopenharmony_ci }, 1401bf215546Sopenharmony_ci { 1402bf215546Sopenharmony_ci "SVGA3D_BC6H_SF16", 1403bf215546Sopenharmony_ci SVGA3D_BC6H_SF16, 1404bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC6H_SF16, 1405bf215546Sopenharmony_ci 4, 4, 16, 0 1406bf215546Sopenharmony_ci }, 1407bf215546Sopenharmony_ci { 1408bf215546Sopenharmony_ci "SVGA3D_BC7_TYPELESS", 1409bf215546Sopenharmony_ci SVGA3D_BC7_TYPELESS, 1410bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC7_TYPELESS, 1411bf215546Sopenharmony_ci 4, 4, 16, 0 1412bf215546Sopenharmony_ci }, 1413bf215546Sopenharmony_ci { 1414bf215546Sopenharmony_ci "SVGA3D_BC7_UNORM", 1415bf215546Sopenharmony_ci SVGA3D_BC7_UNORM, 1416bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC6H_TYPELESS, 1417bf215546Sopenharmony_ci 4, 4, 16, 0 1418bf215546Sopenharmony_ci }, 1419bf215546Sopenharmony_ci { 1420bf215546Sopenharmony_ci "SVGA3D_BC7_UNORM_SRGB", 1421bf215546Sopenharmony_ci SVGA3D_BC7_UNORM_SRGB, 1422bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_BC6H_TYPELESS, 1423bf215546Sopenharmony_ci 4, 4, 16, 0 1424bf215546Sopenharmony_ci }, 1425bf215546Sopenharmony_ci { 1426bf215546Sopenharmony_ci "SVGA3D_AYUV", 1427bf215546Sopenharmony_ci SVGA3D_AYUV, 1428bf215546Sopenharmony_ci 0, 1429bf215546Sopenharmony_ci 1, 1, 4, 0 1430bf215546Sopenharmony_ci }, 1431bf215546Sopenharmony_ci { 1432bf215546Sopenharmony_ci "SVGA3D_R11G11B10_TYPELESS", 1433bf215546Sopenharmony_ci SVGA3D_R11G11B10_TYPELESS, 1434bf215546Sopenharmony_ci SVGA3D_DEVCAP_DXFMT_R11G11B10_FLOAT, 1435bf215546Sopenharmony_ci 1, 1, 4, 0 1436bf215546Sopenharmony_ci } 1437bf215546Sopenharmony_ci}; 1438bf215546Sopenharmony_ci 1439bf215546Sopenharmony_cistatic const SVGA3dSurfaceFormat compat_x8r8g8b8[] = { 1440bf215546Sopenharmony_ci SVGA3D_X8R8G8B8, SVGA3D_A8R8G8B8, SVGA3D_B8G8R8X8_UNORM, 1441bf215546Sopenharmony_ci SVGA3D_B8G8R8A8_UNORM, 0 1442bf215546Sopenharmony_ci}; 1443bf215546Sopenharmony_cistatic const SVGA3dSurfaceFormat compat_r8[] = { 1444bf215546Sopenharmony_ci SVGA3D_R8_UNORM, SVGA3D_NV12, SVGA3D_YV12, 0 1445bf215546Sopenharmony_ci}; 1446bf215546Sopenharmony_cistatic const SVGA3dSurfaceFormat compat_g8r8[] = { 1447bf215546Sopenharmony_ci SVGA3D_R8G8_UNORM, SVGA3D_NV12, 0 1448bf215546Sopenharmony_ci}; 1449bf215546Sopenharmony_cistatic const SVGA3dSurfaceFormat compat_r5g6b5[] = { 1450bf215546Sopenharmony_ci SVGA3D_R5G6B5, SVGA3D_B5G6R5_UNORM, 0 1451bf215546Sopenharmony_ci}; 1452bf215546Sopenharmony_ci 1453bf215546Sopenharmony_cistatic const struct format_compat_entry format_compats[] = { 1454bf215546Sopenharmony_ci {PIPE_FORMAT_B8G8R8X8_UNORM, compat_x8r8g8b8}, 1455bf215546Sopenharmony_ci {PIPE_FORMAT_B8G8R8A8_UNORM, compat_x8r8g8b8}, 1456bf215546Sopenharmony_ci {PIPE_FORMAT_R8_UNORM, compat_r8}, 1457bf215546Sopenharmony_ci {PIPE_FORMAT_R8G8_UNORM, compat_g8r8}, 1458bf215546Sopenharmony_ci {PIPE_FORMAT_B5G6R5_UNORM, compat_r5g6b5} 1459bf215546Sopenharmony_ci}; 1460bf215546Sopenharmony_ci 1461bf215546Sopenharmony_ci/** 1462bf215546Sopenharmony_ci * Debug only: 1463bf215546Sopenharmony_ci * 1. check that format_cap_table[i] matches the i-th SVGA3D format. 1464bf215546Sopenharmony_ci * 2. check that format_conversion_table[i].pformat == i. 1465bf215546Sopenharmony_ci */ 1466bf215546Sopenharmony_cistatic void 1467bf215546Sopenharmony_cicheck_format_tables(void) 1468bf215546Sopenharmony_ci{ 1469bf215546Sopenharmony_ci static boolean first_call = TRUE; 1470bf215546Sopenharmony_ci 1471bf215546Sopenharmony_ci if (first_call) { 1472bf215546Sopenharmony_ci unsigned i; 1473bf215546Sopenharmony_ci 1474bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(format_cap_table) == SVGA3D_FORMAT_MAX); 1475bf215546Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(format_cap_table); i++) { 1476bf215546Sopenharmony_ci assert(format_cap_table[i].format == i); 1477bf215546Sopenharmony_ci } 1478bf215546Sopenharmony_ci 1479bf215546Sopenharmony_ci first_call = FALSE; 1480bf215546Sopenharmony_ci } 1481bf215546Sopenharmony_ci} 1482bf215546Sopenharmony_ci 1483bf215546Sopenharmony_ci 1484bf215546Sopenharmony_ci/** 1485bf215546Sopenharmony_ci * Return string name of an SVGA3dDevCapIndex value. 1486bf215546Sopenharmony_ci * For debugging. 1487bf215546Sopenharmony_ci */ 1488bf215546Sopenharmony_cistatic const char * 1489bf215546Sopenharmony_cisvga_devcap_name(SVGA3dDevCapIndex cap) 1490bf215546Sopenharmony_ci{ 1491bf215546Sopenharmony_ci static const struct debug_named_value devcap_names[] = { 1492bf215546Sopenharmony_ci /* Note, we only list the DXFMT devcaps so far */ 1493bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_X8R8G8B8), 1494bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_A8R8G8B8), 1495bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R5G6B5), 1496bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_X1R5G5B5), 1497bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_A1R5G5B5), 1498bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_A4R4G4B4), 1499bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_D32), 1500bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_D16), 1501bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_D24S8), 1502bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_D15S1), 1503bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_LUMINANCE8), 1504bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_LUMINANCE4_ALPHA4), 1505bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_LUMINANCE16), 1506bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_LUMINANCE8_ALPHA8), 1507bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_DXT1), 1508bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_DXT2), 1509bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_DXT3), 1510bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_DXT4), 1511bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_DXT5), 1512bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BUMPU8V8), 1513bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BUMPL6V5U5), 1514bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BUMPX8L8V8U8), 1515bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_FORMAT_DEAD1), 1516bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_ARGB_S10E5), 1517bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_ARGB_S23E8), 1518bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_A2R10G10B10), 1519bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_V8U8), 1520bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Q8W8V8U8), 1521bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_CxV8U8), 1522bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_X8L8V8U8), 1523bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_A2W10V10U10), 1524bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_ALPHA8), 1525bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R_S10E5), 1526bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R_S23E8), 1527bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_RG_S10E5), 1528bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_RG_S23E8), 1529bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BUFFER), 1530bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_D24X8), 1531bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_V16U16), 1532bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_G16R16), 1533bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_A16B16G16R16), 1534bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_UYVY), 1535bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_YUY2), 1536bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_NV12), 1537bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32A32_TYPELESS), 1538bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32A32_UINT), 1539bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32A32_SINT), 1540bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32_TYPELESS), 1541bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32_FLOAT), 1542bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32_UINT), 1543bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32_SINT), 1544bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16B16A16_TYPELESS), 1545bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16B16A16_UINT), 1546bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16B16A16_SNORM), 1547bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16B16A16_SINT), 1548bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32_TYPELESS), 1549bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32_UINT), 1550bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32_SINT), 1551bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G8X24_TYPELESS), 1552bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_D32_FLOAT_S8X24_UINT), 1553bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32_FLOAT_X8X24), 1554bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_X32_G8X24_UINT), 1555bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R10G10B10A2_TYPELESS), 1556bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R10G10B10A2_UINT), 1557bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R11G11B10_FLOAT), 1558bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8B8A8_TYPELESS), 1559bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UNORM), 1560bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UNORM_SRGB), 1561bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UINT), 1562bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8B8A8_SINT), 1563bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16_TYPELESS), 1564bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16_UINT), 1565bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16_SINT), 1566bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32_TYPELESS), 1567bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_D32_FLOAT), 1568bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32_UINT), 1569bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32_SINT), 1570bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R24G8_TYPELESS), 1571bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_D24_UNORM_S8_UINT), 1572bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R24_UNORM_X8), 1573bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_X24_G8_UINT), 1574bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8_TYPELESS), 1575bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8_UNORM), 1576bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8_UINT), 1577bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8_SINT), 1578bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16_TYPELESS), 1579bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16_UNORM), 1580bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16_UINT), 1581bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16_SNORM), 1582bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16_SINT), 1583bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8_TYPELESS), 1584bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8_UNORM), 1585bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8_UINT), 1586bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8_SNORM), 1587bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8_SINT), 1588bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_P8), 1589bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R9G9B9E5_SHAREDEXP), 1590bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8_B8G8_UNORM), 1591bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_G8R8_G8B8_UNORM), 1592bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC1_TYPELESS), 1593bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC1_UNORM_SRGB), 1594bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC2_TYPELESS), 1595bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC2_UNORM_SRGB), 1596bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC3_TYPELESS), 1597bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC3_UNORM_SRGB), 1598bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC4_TYPELESS), 1599bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_ATI1), 1600bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC4_SNORM), 1601bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC5_TYPELESS), 1602bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_ATI2), 1603bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC5_SNORM), 1604bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R10G10B10_XR_BIAS_A2_UNORM), 1605bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B8G8R8A8_TYPELESS), 1606bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B8G8R8A8_UNORM_SRGB), 1607bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B8G8R8X8_TYPELESS), 1608bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B8G8R8X8_UNORM_SRGB), 1609bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_DF16), 1610bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_DF24), 1611bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_Z_D24S8_INT), 1612bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_YV12), 1613bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32B32A32_FLOAT), 1614bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16B16A16_FLOAT), 1615bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16B16A16_UNORM), 1616bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32G32_FLOAT), 1617bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R10G10B10A2_UNORM), 1618bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8B8A8_SNORM), 1619bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16_FLOAT), 1620bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16_UNORM), 1621bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16G16_SNORM), 1622bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R32_FLOAT), 1623bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R8G8_SNORM), 1624bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_R16_FLOAT), 1625bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_D16_UNORM), 1626bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_A8_UNORM), 1627bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC1_UNORM), 1628bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC2_UNORM), 1629bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC3_UNORM), 1630bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B5G6R5_UNORM), 1631bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B5G5R5A1_UNORM), 1632bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B8G8R8A8_UNORM), 1633bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_B8G8R8X8_UNORM), 1634bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC4_UNORM), 1635bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DEVCAP_DXFMT_BC5_UNORM), 1636bf215546Sopenharmony_ci DEBUG_NAMED_VALUE_END, 1637bf215546Sopenharmony_ci }; 1638bf215546Sopenharmony_ci return debug_dump_enum(devcap_names, cap); 1639bf215546Sopenharmony_ci} 1640bf215546Sopenharmony_ci 1641bf215546Sopenharmony_ci 1642bf215546Sopenharmony_ci/** 1643bf215546Sopenharmony_ci * Return string for a bitmask of name of SVGA3D_DXFMT_x flags. 1644bf215546Sopenharmony_ci * For debugging. 1645bf215546Sopenharmony_ci */ 1646bf215546Sopenharmony_cistatic const char * 1647bf215546Sopenharmony_cisvga_devcap_format_flags(unsigned flags) 1648bf215546Sopenharmony_ci{ 1649bf215546Sopenharmony_ci static const struct debug_named_value devcap_flags[] = { 1650bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_SUPPORTED), 1651bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_SHADER_SAMPLE), 1652bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_COLOR_RENDERTARGET), 1653bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_DEPTH_RENDERTARGET), 1654bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_BLENDABLE), 1655bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_MIPS), 1656bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_ARRAY), 1657bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_VOLUME), 1658bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_DX_VERTEX_BUFFER), 1659bf215546Sopenharmony_ci DEBUG_NAMED_VALUE(SVGA3D_DXFMT_MULTISAMPLE), 1660bf215546Sopenharmony_ci DEBUG_NAMED_VALUE_END 1661bf215546Sopenharmony_ci }; 1662bf215546Sopenharmony_ci 1663bf215546Sopenharmony_ci return debug_dump_flags(devcap_flags, flags); 1664bf215546Sopenharmony_ci} 1665bf215546Sopenharmony_ci 1666bf215546Sopenharmony_ci 1667bf215546Sopenharmony_ci/* 1668bf215546Sopenharmony_ci * Get format capabilities from the host. It takes in consideration 1669bf215546Sopenharmony_ci * deprecated/unsupported formats, and formats which are implicitely assumed to 1670bf215546Sopenharmony_ci * be supported when the host does not provide an explicit capability entry. 1671bf215546Sopenharmony_ci */ 1672bf215546Sopenharmony_civoid 1673bf215546Sopenharmony_cisvga_get_format_cap(struct svga_screen *ss, 1674bf215546Sopenharmony_ci SVGA3dSurfaceFormat format, 1675bf215546Sopenharmony_ci SVGA3dSurfaceFormatCaps *caps) 1676bf215546Sopenharmony_ci{ 1677bf215546Sopenharmony_ci struct svga_winsys_screen *sws = ss->sws; 1678bf215546Sopenharmony_ci SVGA3dDevCapResult result; 1679bf215546Sopenharmony_ci const struct format_cap *entry; 1680bf215546Sopenharmony_ci 1681bf215546Sopenharmony_ci#ifdef DEBUG 1682bf215546Sopenharmony_ci check_format_tables(); 1683bf215546Sopenharmony_ci#else 1684bf215546Sopenharmony_ci (void) check_format_tables; 1685bf215546Sopenharmony_ci#endif 1686bf215546Sopenharmony_ci 1687bf215546Sopenharmony_ci assert(format < ARRAY_SIZE(format_cap_table)); 1688bf215546Sopenharmony_ci entry = &format_cap_table[format]; 1689bf215546Sopenharmony_ci assert(entry->format == format); 1690bf215546Sopenharmony_ci 1691bf215546Sopenharmony_ci if (entry->devcap && sws->get_cap(sws, entry->devcap, &result)) { 1692bf215546Sopenharmony_ci assert(format < SVGA3D_UYVY || entry->defaultOperations == 0); 1693bf215546Sopenharmony_ci caps->value = result.u; 1694bf215546Sopenharmony_ci } else { 1695bf215546Sopenharmony_ci /* Implicitly advertised format -- use default caps */ 1696bf215546Sopenharmony_ci caps->value = entry->defaultOperations; 1697bf215546Sopenharmony_ci } 1698bf215546Sopenharmony_ci} 1699bf215546Sopenharmony_ci 1700bf215546Sopenharmony_ci 1701bf215546Sopenharmony_ci/* 1702bf215546Sopenharmony_ci * Get DX format capabilities from VGPU10 device. 1703bf215546Sopenharmony_ci */ 1704bf215546Sopenharmony_cistatic void 1705bf215546Sopenharmony_cisvga_get_dx_format_cap(struct svga_screen *ss, 1706bf215546Sopenharmony_ci SVGA3dSurfaceFormat format, 1707bf215546Sopenharmony_ci SVGA3dDevCapResult *caps) 1708bf215546Sopenharmony_ci{ 1709bf215546Sopenharmony_ci struct svga_winsys_screen *sws = ss->sws; 1710bf215546Sopenharmony_ci const struct format_cap *entry; 1711bf215546Sopenharmony_ci 1712bf215546Sopenharmony_ci#ifdef DEBUG 1713bf215546Sopenharmony_ci check_format_tables(); 1714bf215546Sopenharmony_ci#else 1715bf215546Sopenharmony_ci (void) check_format_tables; 1716bf215546Sopenharmony_ci#endif 1717bf215546Sopenharmony_ci 1718bf215546Sopenharmony_ci assert(sws->have_vgpu10); 1719bf215546Sopenharmony_ci assert(format < ARRAY_SIZE(format_cap_table)); 1720bf215546Sopenharmony_ci entry = &format_cap_table[format]; 1721bf215546Sopenharmony_ci assert(entry->format == format); 1722bf215546Sopenharmony_ci assert(entry->devcap > SVGA3D_DEVCAP_DXCONTEXT); 1723bf215546Sopenharmony_ci 1724bf215546Sopenharmony_ci caps->u = 0; 1725bf215546Sopenharmony_ci if (entry->devcap) { 1726bf215546Sopenharmony_ci sws->get_cap(sws, entry->devcap, caps); 1727bf215546Sopenharmony_ci 1728bf215546Sopenharmony_ci /* pre-SM41 capable svga device supports SHADER_SAMPLE capability for 1729bf215546Sopenharmony_ci * these formats but does not advertise the devcap. 1730bf215546Sopenharmony_ci * So enable this bit here. 1731bf215546Sopenharmony_ci */ 1732bf215546Sopenharmony_ci if (!sws->have_sm4_1 && 1733bf215546Sopenharmony_ci (format == SVGA3D_R32_FLOAT_X8X24 || 1734bf215546Sopenharmony_ci format == SVGA3D_R24_UNORM_X8)) { 1735bf215546Sopenharmony_ci caps->u |= SVGA3D_DXFMT_SHADER_SAMPLE; 1736bf215546Sopenharmony_ci } 1737bf215546Sopenharmony_ci } 1738bf215546Sopenharmony_ci else { 1739bf215546Sopenharmony_ci caps->u = entry->defaultOperations; 1740bf215546Sopenharmony_ci } 1741bf215546Sopenharmony_ci 1742bf215546Sopenharmony_ci if (0) { 1743bf215546Sopenharmony_ci debug_printf("Format %s, devcap %s = 0x%x (%s)\n", 1744bf215546Sopenharmony_ci svga_format_name(format), 1745bf215546Sopenharmony_ci svga_devcap_name(entry->devcap), 1746bf215546Sopenharmony_ci caps->u, 1747bf215546Sopenharmony_ci svga_devcap_format_flags(caps->u)); 1748bf215546Sopenharmony_ci } 1749bf215546Sopenharmony_ci} 1750bf215546Sopenharmony_ci 1751bf215546Sopenharmony_ci 1752bf215546Sopenharmony_civoid 1753bf215546Sopenharmony_cisvga_format_size(SVGA3dSurfaceFormat format, 1754bf215546Sopenharmony_ci unsigned *block_width, 1755bf215546Sopenharmony_ci unsigned *block_height, 1756bf215546Sopenharmony_ci unsigned *bytes_per_block) 1757bf215546Sopenharmony_ci{ 1758bf215546Sopenharmony_ci assert(format < ARRAY_SIZE(format_cap_table)); 1759bf215546Sopenharmony_ci *block_width = format_cap_table[format].block_width; 1760bf215546Sopenharmony_ci *block_height = format_cap_table[format].block_height; 1761bf215546Sopenharmony_ci *bytes_per_block = format_cap_table[format].block_bytes; 1762bf215546Sopenharmony_ci /* Make sure the table entry was valid */ 1763bf215546Sopenharmony_ci if (*block_width == 0) 1764bf215546Sopenharmony_ci debug_printf("Bad table entry for %s\n", svga_format_name(format)); 1765bf215546Sopenharmony_ci assert(*block_width); 1766bf215546Sopenharmony_ci assert(*block_height); 1767bf215546Sopenharmony_ci assert(*bytes_per_block); 1768bf215546Sopenharmony_ci} 1769bf215546Sopenharmony_ci 1770bf215546Sopenharmony_ci 1771bf215546Sopenharmony_ciconst char * 1772bf215546Sopenharmony_cisvga_format_name(SVGA3dSurfaceFormat format) 1773bf215546Sopenharmony_ci{ 1774bf215546Sopenharmony_ci assert(format < ARRAY_SIZE(format_cap_table)); 1775bf215546Sopenharmony_ci return format_cap_table[format].name; 1776bf215546Sopenharmony_ci} 1777bf215546Sopenharmony_ci 1778bf215546Sopenharmony_ci 1779bf215546Sopenharmony_ci/** 1780bf215546Sopenharmony_ci * Is the given SVGA3dSurfaceFormat a signed or unsigned integer color format? 1781bf215546Sopenharmony_ci */ 1782bf215546Sopenharmony_ciboolean 1783bf215546Sopenharmony_cisvga_format_is_integer(SVGA3dSurfaceFormat format) 1784bf215546Sopenharmony_ci{ 1785bf215546Sopenharmony_ci switch (format) { 1786bf215546Sopenharmony_ci case SVGA3D_R32G32B32A32_SINT: 1787bf215546Sopenharmony_ci case SVGA3D_R32G32B32_SINT: 1788bf215546Sopenharmony_ci case SVGA3D_R32G32_SINT: 1789bf215546Sopenharmony_ci case SVGA3D_R32_SINT: 1790bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_SINT: 1791bf215546Sopenharmony_ci case SVGA3D_R16G16_SINT: 1792bf215546Sopenharmony_ci case SVGA3D_R16_SINT: 1793bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_SINT: 1794bf215546Sopenharmony_ci case SVGA3D_R8G8_SINT: 1795bf215546Sopenharmony_ci case SVGA3D_R8_SINT: 1796bf215546Sopenharmony_ci case SVGA3D_R32G32B32A32_UINT: 1797bf215546Sopenharmony_ci case SVGA3D_R32G32B32_UINT: 1798bf215546Sopenharmony_ci case SVGA3D_R32G32_UINT: 1799bf215546Sopenharmony_ci case SVGA3D_R32_UINT: 1800bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_UINT: 1801bf215546Sopenharmony_ci case SVGA3D_R16G16_UINT: 1802bf215546Sopenharmony_ci case SVGA3D_R16_UINT: 1803bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_UINT: 1804bf215546Sopenharmony_ci case SVGA3D_R8G8_UINT: 1805bf215546Sopenharmony_ci case SVGA3D_R8_UINT: 1806bf215546Sopenharmony_ci case SVGA3D_R10G10B10A2_UINT: 1807bf215546Sopenharmony_ci return TRUE; 1808bf215546Sopenharmony_ci default: 1809bf215546Sopenharmony_ci return FALSE; 1810bf215546Sopenharmony_ci } 1811bf215546Sopenharmony_ci} 1812bf215546Sopenharmony_ci 1813bf215546Sopenharmony_ciboolean 1814bf215546Sopenharmony_cisvga_format_support_gen_mips(enum pipe_format format) 1815bf215546Sopenharmony_ci{ 1816bf215546Sopenharmony_ci const struct vgpu10_format_entry *entry = svga_format_entry(format); 1817bf215546Sopenharmony_ci 1818bf215546Sopenharmony_ci return (entry->flags & TF_GEN_MIPS) > 0; 1819bf215546Sopenharmony_ci} 1820bf215546Sopenharmony_ci 1821bf215546Sopenharmony_ci 1822bf215546Sopenharmony_ci/** 1823bf215546Sopenharmony_ci * Given a texture format, return the expected data type returned from 1824bf215546Sopenharmony_ci * the texture sampler. For example, UNORM8 formats return floating point 1825bf215546Sopenharmony_ci * values while SINT formats returned signed integer values. 1826bf215546Sopenharmony_ci * Note: this function could be moved into the gallum u_format.[ch] code 1827bf215546Sopenharmony_ci * if it's useful to anyone else. 1828bf215546Sopenharmony_ci */ 1829bf215546Sopenharmony_cienum tgsi_return_type 1830bf215546Sopenharmony_cisvga_get_texture_datatype(enum pipe_format format) 1831bf215546Sopenharmony_ci{ 1832bf215546Sopenharmony_ci const struct util_format_description *desc = util_format_description(format); 1833bf215546Sopenharmony_ci enum tgsi_return_type t; 1834bf215546Sopenharmony_ci 1835bf215546Sopenharmony_ci if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ) { 1836bf215546Sopenharmony_ci if (util_format_is_depth_or_stencil(format)) { 1837bf215546Sopenharmony_ci t = TGSI_RETURN_TYPE_FLOAT; /* XXX revisit this */ 1838bf215546Sopenharmony_ci } 1839bf215546Sopenharmony_ci else if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) { 1840bf215546Sopenharmony_ci t = TGSI_RETURN_TYPE_FLOAT; 1841bf215546Sopenharmony_ci } 1842bf215546Sopenharmony_ci else if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) { 1843bf215546Sopenharmony_ci t = desc->channel[0].normalized ? TGSI_RETURN_TYPE_UNORM : TGSI_RETURN_TYPE_UINT; 1844bf215546Sopenharmony_ci } 1845bf215546Sopenharmony_ci else if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) { 1846bf215546Sopenharmony_ci t = desc->channel[0].normalized ? TGSI_RETURN_TYPE_SNORM : TGSI_RETURN_TYPE_SINT; 1847bf215546Sopenharmony_ci } 1848bf215546Sopenharmony_ci else { 1849bf215546Sopenharmony_ci assert(!"Unexpected channel type in svga_get_texture_datatype()"); 1850bf215546Sopenharmony_ci t = TGSI_RETURN_TYPE_FLOAT; 1851bf215546Sopenharmony_ci } 1852bf215546Sopenharmony_ci } 1853bf215546Sopenharmony_ci else { 1854bf215546Sopenharmony_ci /* compressed format, shared exponent format, etc. */ 1855bf215546Sopenharmony_ci switch (format) { 1856bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_RGB: 1857bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_RGBA: 1858bf215546Sopenharmony_ci case PIPE_FORMAT_DXT3_RGBA: 1859bf215546Sopenharmony_ci case PIPE_FORMAT_DXT5_RGBA: 1860bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_SRGB: 1861bf215546Sopenharmony_ci case PIPE_FORMAT_DXT1_SRGBA: 1862bf215546Sopenharmony_ci case PIPE_FORMAT_DXT3_SRGBA: 1863bf215546Sopenharmony_ci case PIPE_FORMAT_DXT5_SRGBA: 1864bf215546Sopenharmony_ci case PIPE_FORMAT_RGTC1_UNORM: 1865bf215546Sopenharmony_ci case PIPE_FORMAT_RGTC2_UNORM: 1866bf215546Sopenharmony_ci case PIPE_FORMAT_LATC1_UNORM: 1867bf215546Sopenharmony_ci case PIPE_FORMAT_LATC2_UNORM: 1868bf215546Sopenharmony_ci case PIPE_FORMAT_ETC1_RGB8: 1869bf215546Sopenharmony_ci t = TGSI_RETURN_TYPE_UNORM; 1870bf215546Sopenharmony_ci break; 1871bf215546Sopenharmony_ci case PIPE_FORMAT_RGTC1_SNORM: 1872bf215546Sopenharmony_ci case PIPE_FORMAT_RGTC2_SNORM: 1873bf215546Sopenharmony_ci case PIPE_FORMAT_LATC1_SNORM: 1874bf215546Sopenharmony_ci case PIPE_FORMAT_LATC2_SNORM: 1875bf215546Sopenharmony_ci case PIPE_FORMAT_R10G10B10X2_SNORM: 1876bf215546Sopenharmony_ci t = TGSI_RETURN_TYPE_SNORM; 1877bf215546Sopenharmony_ci break; 1878bf215546Sopenharmony_ci case PIPE_FORMAT_R11G11B10_FLOAT: 1879bf215546Sopenharmony_ci case PIPE_FORMAT_R9G9B9E5_FLOAT: 1880bf215546Sopenharmony_ci t = TGSI_RETURN_TYPE_FLOAT; 1881bf215546Sopenharmony_ci break; 1882bf215546Sopenharmony_ci default: 1883bf215546Sopenharmony_ci assert(!"Unexpected channel type in svga_get_texture_datatype()"); 1884bf215546Sopenharmony_ci t = TGSI_RETURN_TYPE_FLOAT; 1885bf215546Sopenharmony_ci } 1886bf215546Sopenharmony_ci } 1887bf215546Sopenharmony_ci 1888bf215546Sopenharmony_ci return t; 1889bf215546Sopenharmony_ci} 1890bf215546Sopenharmony_ci 1891bf215546Sopenharmony_ci 1892bf215546Sopenharmony_ci/** 1893bf215546Sopenharmony_ci * Given an svga context, return true iff there are currently any integer color 1894bf215546Sopenharmony_ci * buffers attached to the framebuffer. 1895bf215546Sopenharmony_ci */ 1896bf215546Sopenharmony_ciboolean 1897bf215546Sopenharmony_cisvga_has_any_integer_cbufs(const struct svga_context *svga) 1898bf215546Sopenharmony_ci{ 1899bf215546Sopenharmony_ci unsigned i; 1900bf215546Sopenharmony_ci for (i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) { 1901bf215546Sopenharmony_ci struct pipe_surface *cbuf = svga->curr.framebuffer.cbufs[i]; 1902bf215546Sopenharmony_ci 1903bf215546Sopenharmony_ci if (cbuf && util_format_is_pure_integer(cbuf->format)) { 1904bf215546Sopenharmony_ci return TRUE; 1905bf215546Sopenharmony_ci } 1906bf215546Sopenharmony_ci } 1907bf215546Sopenharmony_ci return FALSE; 1908bf215546Sopenharmony_ci} 1909bf215546Sopenharmony_ci 1910bf215546Sopenharmony_ci 1911bf215546Sopenharmony_ci/** 1912bf215546Sopenharmony_ci * Given an SVGA format, return the corresponding typeless format. 1913bf215546Sopenharmony_ci * If there is no typeless format, return the format unchanged. 1914bf215546Sopenharmony_ci */ 1915bf215546Sopenharmony_ciSVGA3dSurfaceFormat 1916bf215546Sopenharmony_cisvga_typeless_format(SVGA3dSurfaceFormat format) 1917bf215546Sopenharmony_ci{ 1918bf215546Sopenharmony_ci switch (format) { 1919bf215546Sopenharmony_ci case SVGA3D_R32G32B32A32_UINT: 1920bf215546Sopenharmony_ci case SVGA3D_R32G32B32A32_SINT: 1921bf215546Sopenharmony_ci case SVGA3D_R32G32B32A32_FLOAT: 1922bf215546Sopenharmony_ci case SVGA3D_R32G32B32A32_TYPELESS: 1923bf215546Sopenharmony_ci return SVGA3D_R32G32B32A32_TYPELESS; 1924bf215546Sopenharmony_ci case SVGA3D_R32G32B32_FLOAT: 1925bf215546Sopenharmony_ci case SVGA3D_R32G32B32_UINT: 1926bf215546Sopenharmony_ci case SVGA3D_R32G32B32_SINT: 1927bf215546Sopenharmony_ci case SVGA3D_R32G32B32_TYPELESS: 1928bf215546Sopenharmony_ci return SVGA3D_R32G32B32_TYPELESS; 1929bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_UINT: 1930bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_UNORM: 1931bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_SNORM: 1932bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_SINT: 1933bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_FLOAT: 1934bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_TYPELESS: 1935bf215546Sopenharmony_ci return SVGA3D_R16G16B16A16_TYPELESS; 1936bf215546Sopenharmony_ci case SVGA3D_R32G32_UINT: 1937bf215546Sopenharmony_ci case SVGA3D_R32G32_SINT: 1938bf215546Sopenharmony_ci case SVGA3D_R32G32_FLOAT: 1939bf215546Sopenharmony_ci case SVGA3D_R32G32_TYPELESS: 1940bf215546Sopenharmony_ci return SVGA3D_R32G32_TYPELESS; 1941bf215546Sopenharmony_ci case SVGA3D_D32_FLOAT_S8X24_UINT: 1942bf215546Sopenharmony_ci case SVGA3D_X32_G8X24_UINT: 1943bf215546Sopenharmony_ci case SVGA3D_R32G8X24_TYPELESS: 1944bf215546Sopenharmony_ci return SVGA3D_R32G8X24_TYPELESS; 1945bf215546Sopenharmony_ci case SVGA3D_R10G10B10A2_UINT: 1946bf215546Sopenharmony_ci case SVGA3D_R10G10B10A2_UNORM: 1947bf215546Sopenharmony_ci case SVGA3D_R10G10B10A2_TYPELESS: 1948bf215546Sopenharmony_ci return SVGA3D_R10G10B10A2_TYPELESS; 1949bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_UNORM: 1950bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_SNORM: 1951bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_UNORM_SRGB: 1952bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_UINT: 1953bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_SINT: 1954bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_TYPELESS: 1955bf215546Sopenharmony_ci return SVGA3D_R8G8B8A8_TYPELESS; 1956bf215546Sopenharmony_ci case SVGA3D_R16G16_UINT: 1957bf215546Sopenharmony_ci case SVGA3D_R16G16_SINT: 1958bf215546Sopenharmony_ci case SVGA3D_R16G16_UNORM: 1959bf215546Sopenharmony_ci case SVGA3D_R16G16_SNORM: 1960bf215546Sopenharmony_ci case SVGA3D_R16G16_FLOAT: 1961bf215546Sopenharmony_ci case SVGA3D_R16G16_TYPELESS: 1962bf215546Sopenharmony_ci return SVGA3D_R16G16_TYPELESS; 1963bf215546Sopenharmony_ci case SVGA3D_D32_FLOAT: 1964bf215546Sopenharmony_ci case SVGA3D_R32_FLOAT: 1965bf215546Sopenharmony_ci case SVGA3D_R32_UINT: 1966bf215546Sopenharmony_ci case SVGA3D_R32_SINT: 1967bf215546Sopenharmony_ci case SVGA3D_R32_TYPELESS: 1968bf215546Sopenharmony_ci return SVGA3D_R32_TYPELESS; 1969bf215546Sopenharmony_ci case SVGA3D_D24_UNORM_S8_UINT: 1970bf215546Sopenharmony_ci case SVGA3D_R24G8_TYPELESS: 1971bf215546Sopenharmony_ci return SVGA3D_R24G8_TYPELESS; 1972bf215546Sopenharmony_ci case SVGA3D_X24_G8_UINT: 1973bf215546Sopenharmony_ci return SVGA3D_R24_UNORM_X8; 1974bf215546Sopenharmony_ci case SVGA3D_R8G8_UNORM: 1975bf215546Sopenharmony_ci case SVGA3D_R8G8_SNORM: 1976bf215546Sopenharmony_ci case SVGA3D_R8G8_UINT: 1977bf215546Sopenharmony_ci case SVGA3D_R8G8_SINT: 1978bf215546Sopenharmony_ci case SVGA3D_R8G8_TYPELESS: 1979bf215546Sopenharmony_ci return SVGA3D_R8G8_TYPELESS; 1980bf215546Sopenharmony_ci case SVGA3D_D16_UNORM: 1981bf215546Sopenharmony_ci case SVGA3D_R16_UNORM: 1982bf215546Sopenharmony_ci case SVGA3D_R16_UINT: 1983bf215546Sopenharmony_ci case SVGA3D_R16_SNORM: 1984bf215546Sopenharmony_ci case SVGA3D_R16_SINT: 1985bf215546Sopenharmony_ci case SVGA3D_R16_FLOAT: 1986bf215546Sopenharmony_ci case SVGA3D_R16_TYPELESS: 1987bf215546Sopenharmony_ci return SVGA3D_R16_TYPELESS; 1988bf215546Sopenharmony_ci case SVGA3D_R8_UNORM: 1989bf215546Sopenharmony_ci case SVGA3D_R8_UINT: 1990bf215546Sopenharmony_ci case SVGA3D_R8_SNORM: 1991bf215546Sopenharmony_ci case SVGA3D_R8_SINT: 1992bf215546Sopenharmony_ci case SVGA3D_R8_TYPELESS: 1993bf215546Sopenharmony_ci return SVGA3D_R8_TYPELESS; 1994bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_UNORM_SRGB: 1995bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_UNORM: 1996bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_TYPELESS: 1997bf215546Sopenharmony_ci return SVGA3D_B8G8R8A8_TYPELESS; 1998bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_UNORM_SRGB: 1999bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_UNORM: 2000bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_TYPELESS: 2001bf215546Sopenharmony_ci return SVGA3D_B8G8R8X8_TYPELESS; 2002bf215546Sopenharmony_ci case SVGA3D_BC1_UNORM: 2003bf215546Sopenharmony_ci case SVGA3D_BC1_UNORM_SRGB: 2004bf215546Sopenharmony_ci case SVGA3D_BC1_TYPELESS: 2005bf215546Sopenharmony_ci return SVGA3D_BC1_TYPELESS; 2006bf215546Sopenharmony_ci case SVGA3D_BC2_UNORM: 2007bf215546Sopenharmony_ci case SVGA3D_BC2_UNORM_SRGB: 2008bf215546Sopenharmony_ci case SVGA3D_BC2_TYPELESS: 2009bf215546Sopenharmony_ci return SVGA3D_BC2_TYPELESS; 2010bf215546Sopenharmony_ci case SVGA3D_BC3_UNORM: 2011bf215546Sopenharmony_ci case SVGA3D_BC3_UNORM_SRGB: 2012bf215546Sopenharmony_ci case SVGA3D_BC3_TYPELESS: 2013bf215546Sopenharmony_ci return SVGA3D_BC3_TYPELESS; 2014bf215546Sopenharmony_ci case SVGA3D_BC4_UNORM: 2015bf215546Sopenharmony_ci case SVGA3D_BC4_SNORM: 2016bf215546Sopenharmony_ci case SVGA3D_BC4_TYPELESS: 2017bf215546Sopenharmony_ci return SVGA3D_BC4_TYPELESS; 2018bf215546Sopenharmony_ci case SVGA3D_BC5_UNORM: 2019bf215546Sopenharmony_ci case SVGA3D_BC5_SNORM: 2020bf215546Sopenharmony_ci case SVGA3D_BC5_TYPELESS: 2021bf215546Sopenharmony_ci return SVGA3D_BC5_TYPELESS; 2022bf215546Sopenharmony_ci case SVGA3D_BC6H_UF16: 2023bf215546Sopenharmony_ci case SVGA3D_BC6H_SF16: 2024bf215546Sopenharmony_ci case SVGA3D_BC6H_TYPELESS: 2025bf215546Sopenharmony_ci return SVGA3D_BC6H_TYPELESS; 2026bf215546Sopenharmony_ci case SVGA3D_BC7_UNORM: 2027bf215546Sopenharmony_ci case SVGA3D_BC7_UNORM_SRGB: 2028bf215546Sopenharmony_ci case SVGA3D_BC7_TYPELESS: 2029bf215546Sopenharmony_ci return SVGA3D_BC7_TYPELESS; 2030bf215546Sopenharmony_ci case SVGA3D_R11G11B10_FLOAT: 2031bf215546Sopenharmony_ci case SVGA3D_R11G11B10_TYPELESS: 2032bf215546Sopenharmony_ci return SVGA3D_R11G11B10_TYPELESS; 2033bf215546Sopenharmony_ci 2034bf215546Sopenharmony_ci /* Special cases (no corresponding _TYPELESS formats) */ 2035bf215546Sopenharmony_ci case SVGA3D_A8_UNORM: 2036bf215546Sopenharmony_ci case SVGA3D_B5G5R5A1_UNORM: 2037bf215546Sopenharmony_ci case SVGA3D_B5G6R5_UNORM: 2038bf215546Sopenharmony_ci case SVGA3D_R9G9B9E5_SHAREDEXP: 2039bf215546Sopenharmony_ci return format; 2040bf215546Sopenharmony_ci default: 2041bf215546Sopenharmony_ci debug_printf("Unexpected format %s in %s\n", 2042bf215546Sopenharmony_ci svga_format_name(format), __FUNCTION__); 2043bf215546Sopenharmony_ci return format; 2044bf215546Sopenharmony_ci } 2045bf215546Sopenharmony_ci} 2046bf215546Sopenharmony_ci 2047bf215546Sopenharmony_ci 2048bf215546Sopenharmony_ci/** 2049bf215546Sopenharmony_ci * Given a surface format, return the corresponding format to use for 2050bf215546Sopenharmony_ci * a texture sampler. In most cases, it's the format unchanged, but there 2051bf215546Sopenharmony_ci * are some special cases. 2052bf215546Sopenharmony_ci */ 2053bf215546Sopenharmony_ciSVGA3dSurfaceFormat 2054bf215546Sopenharmony_cisvga_sampler_format(SVGA3dSurfaceFormat format) 2055bf215546Sopenharmony_ci{ 2056bf215546Sopenharmony_ci switch (format) { 2057bf215546Sopenharmony_ci case SVGA3D_D16_UNORM: 2058bf215546Sopenharmony_ci return SVGA3D_R16_UNORM; 2059bf215546Sopenharmony_ci case SVGA3D_D24_UNORM_S8_UINT: 2060bf215546Sopenharmony_ci return SVGA3D_R24_UNORM_X8; 2061bf215546Sopenharmony_ci case SVGA3D_D32_FLOAT: 2062bf215546Sopenharmony_ci return SVGA3D_R32_FLOAT; 2063bf215546Sopenharmony_ci case SVGA3D_D32_FLOAT_S8X24_UINT: 2064bf215546Sopenharmony_ci return SVGA3D_R32_FLOAT_X8X24; 2065bf215546Sopenharmony_ci default: 2066bf215546Sopenharmony_ci return format; 2067bf215546Sopenharmony_ci } 2068bf215546Sopenharmony_ci} 2069bf215546Sopenharmony_ci 2070bf215546Sopenharmony_ci 2071bf215546Sopenharmony_ci/** 2072bf215546Sopenharmony_ci * Is the given format an uncompressed snorm format? 2073bf215546Sopenharmony_ci */ 2074bf215546Sopenharmony_cibool 2075bf215546Sopenharmony_cisvga_format_is_uncompressed_snorm(SVGA3dSurfaceFormat format) 2076bf215546Sopenharmony_ci{ 2077bf215546Sopenharmony_ci switch (format) { 2078bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_SNORM: 2079bf215546Sopenharmony_ci case SVGA3D_R8G8_SNORM: 2080bf215546Sopenharmony_ci case SVGA3D_R8_SNORM: 2081bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_SNORM: 2082bf215546Sopenharmony_ci case SVGA3D_R16G16_SNORM: 2083bf215546Sopenharmony_ci case SVGA3D_R16_SNORM: 2084bf215546Sopenharmony_ci return true; 2085bf215546Sopenharmony_ci default: 2086bf215546Sopenharmony_ci return false; 2087bf215546Sopenharmony_ci } 2088bf215546Sopenharmony_ci} 2089bf215546Sopenharmony_ci 2090bf215546Sopenharmony_ci 2091bf215546Sopenharmony_cibool 2092bf215546Sopenharmony_cisvga_format_is_typeless(SVGA3dSurfaceFormat format) 2093bf215546Sopenharmony_ci{ 2094bf215546Sopenharmony_ci switch (format) { 2095bf215546Sopenharmony_ci case SVGA3D_R32G32B32A32_TYPELESS: 2096bf215546Sopenharmony_ci case SVGA3D_R32G32B32_TYPELESS: 2097bf215546Sopenharmony_ci case SVGA3D_R16G16B16A16_TYPELESS: 2098bf215546Sopenharmony_ci case SVGA3D_R32G32_TYPELESS: 2099bf215546Sopenharmony_ci case SVGA3D_R32G8X24_TYPELESS: 2100bf215546Sopenharmony_ci case SVGA3D_R10G10B10A2_TYPELESS: 2101bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_TYPELESS: 2102bf215546Sopenharmony_ci case SVGA3D_R16G16_TYPELESS: 2103bf215546Sopenharmony_ci case SVGA3D_R32_TYPELESS: 2104bf215546Sopenharmony_ci case SVGA3D_R24G8_TYPELESS: 2105bf215546Sopenharmony_ci case SVGA3D_R8G8_TYPELESS: 2106bf215546Sopenharmony_ci case SVGA3D_R16_TYPELESS: 2107bf215546Sopenharmony_ci case SVGA3D_R8_TYPELESS: 2108bf215546Sopenharmony_ci case SVGA3D_BC1_TYPELESS: 2109bf215546Sopenharmony_ci case SVGA3D_BC2_TYPELESS: 2110bf215546Sopenharmony_ci case SVGA3D_BC3_TYPELESS: 2111bf215546Sopenharmony_ci case SVGA3D_BC4_TYPELESS: 2112bf215546Sopenharmony_ci case SVGA3D_BC5_TYPELESS: 2113bf215546Sopenharmony_ci case SVGA3D_BC6H_TYPELESS: 2114bf215546Sopenharmony_ci case SVGA3D_BC7_TYPELESS: 2115bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_TYPELESS: 2116bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_TYPELESS: 2117bf215546Sopenharmony_ci return true; 2118bf215546Sopenharmony_ci default: 2119bf215546Sopenharmony_ci return false; 2120bf215546Sopenharmony_ci } 2121bf215546Sopenharmony_ci} 2122bf215546Sopenharmony_ci 2123bf215546Sopenharmony_ci 2124bf215546Sopenharmony_ci/** 2125bf215546Sopenharmony_ci * \brief Can we import a surface with a given SVGA3D format as a texture? 2126bf215546Sopenharmony_ci * 2127bf215546Sopenharmony_ci * \param ss[in] pointer to the svga screen. 2128bf215546Sopenharmony_ci * \param pformat[in] pipe format of the local texture. 2129bf215546Sopenharmony_ci * \param sformat[in] svga3d format of the imported surface. 2130bf215546Sopenharmony_ci * \param bind[in] bind flags of the imported texture. 2131bf215546Sopenharmony_ci * \param verbose[in] Print out incompatibilities in debug mode. 2132bf215546Sopenharmony_ci */ 2133bf215546Sopenharmony_cibool 2134bf215546Sopenharmony_cisvga_format_is_shareable(const struct svga_screen *ss, 2135bf215546Sopenharmony_ci enum pipe_format pformat, 2136bf215546Sopenharmony_ci SVGA3dSurfaceFormat sformat, 2137bf215546Sopenharmony_ci unsigned bind, 2138bf215546Sopenharmony_ci bool verbose) 2139bf215546Sopenharmony_ci{ 2140bf215546Sopenharmony_ci SVGA3dSurfaceFormat default_format = 2141bf215546Sopenharmony_ci svga_translate_format(ss, pformat, bind); 2142bf215546Sopenharmony_ci int i; 2143bf215546Sopenharmony_ci 2144bf215546Sopenharmony_ci if (default_format == SVGA3D_FORMAT_INVALID) 2145bf215546Sopenharmony_ci return false; 2146bf215546Sopenharmony_ci if (default_format == sformat) 2147bf215546Sopenharmony_ci return true; 2148bf215546Sopenharmony_ci 2149bf215546Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(format_compats); ++i) { 2150bf215546Sopenharmony_ci if (format_compats[i].pformat == pformat) { 2151bf215546Sopenharmony_ci const SVGA3dSurfaceFormat *compat_format = 2152bf215546Sopenharmony_ci format_compats[i].compat_format; 2153bf215546Sopenharmony_ci while (*compat_format != 0) { 2154bf215546Sopenharmony_ci if (*compat_format == sformat) 2155bf215546Sopenharmony_ci return true; 2156bf215546Sopenharmony_ci compat_format++; 2157bf215546Sopenharmony_ci } 2158bf215546Sopenharmony_ci } 2159bf215546Sopenharmony_ci } 2160bf215546Sopenharmony_ci 2161bf215546Sopenharmony_ci if (verbose) { 2162bf215546Sopenharmony_ci debug_printf("Incompatible imported surface format.\n"); 2163bf215546Sopenharmony_ci debug_printf("Texture format: \"%s\". Imported format: \"%s\".\n", 2164bf215546Sopenharmony_ci svga_format_name(default_format), 2165bf215546Sopenharmony_ci svga_format_name(sformat)); 2166bf215546Sopenharmony_ci } 2167bf215546Sopenharmony_ci 2168bf215546Sopenharmony_ci return false; 2169bf215546Sopenharmony_ci} 2170bf215546Sopenharmony_ci 2171bf215546Sopenharmony_ci 2172bf215546Sopenharmony_ci/** 2173bf215546Sopenharmony_ci * Return the sRGB format which corresponds to the given (linear) format. 2174bf215546Sopenharmony_ci * If there's no such sRGB format, return the format as-is. 2175bf215546Sopenharmony_ci */ 2176bf215546Sopenharmony_ciSVGA3dSurfaceFormat 2177bf215546Sopenharmony_cisvga_linear_to_srgb(SVGA3dSurfaceFormat format) 2178bf215546Sopenharmony_ci{ 2179bf215546Sopenharmony_ci switch (format) { 2180bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_UNORM: 2181bf215546Sopenharmony_ci return SVGA3D_R8G8B8A8_UNORM_SRGB; 2182bf215546Sopenharmony_ci case SVGA3D_BC1_UNORM: 2183bf215546Sopenharmony_ci return SVGA3D_BC1_UNORM_SRGB; 2184bf215546Sopenharmony_ci case SVGA3D_BC2_UNORM: 2185bf215546Sopenharmony_ci return SVGA3D_BC2_UNORM_SRGB; 2186bf215546Sopenharmony_ci case SVGA3D_BC3_UNORM: 2187bf215546Sopenharmony_ci return SVGA3D_BC3_UNORM_SRGB; 2188bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_UNORM: 2189bf215546Sopenharmony_ci return SVGA3D_B8G8R8A8_UNORM_SRGB; 2190bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_UNORM: 2191bf215546Sopenharmony_ci return SVGA3D_B8G8R8X8_UNORM_SRGB; 2192bf215546Sopenharmony_ci default: 2193bf215546Sopenharmony_ci return format; 2194bf215546Sopenharmony_ci } 2195bf215546Sopenharmony_ci} 2196bf215546Sopenharmony_ci 2197bf215546Sopenharmony_ci 2198bf215546Sopenharmony_ci/** 2199bf215546Sopenharmony_ci * Implement pipe_screen::is_format_supported(). 2200bf215546Sopenharmony_ci * \param bindings bitmask of PIPE_BIND_x flags 2201bf215546Sopenharmony_ci */ 2202bf215546Sopenharmony_cibool 2203bf215546Sopenharmony_cisvga_is_format_supported(struct pipe_screen *screen, 2204bf215546Sopenharmony_ci enum pipe_format format, 2205bf215546Sopenharmony_ci enum pipe_texture_target target, 2206bf215546Sopenharmony_ci unsigned sample_count, 2207bf215546Sopenharmony_ci unsigned storage_sample_count, 2208bf215546Sopenharmony_ci unsigned bindings) 2209bf215546Sopenharmony_ci{ 2210bf215546Sopenharmony_ci struct svga_screen *ss = svga_screen(screen); 2211bf215546Sopenharmony_ci SVGA3dSurfaceFormat svga_format; 2212bf215546Sopenharmony_ci SVGA3dSurfaceFormatCaps caps; 2213bf215546Sopenharmony_ci SVGA3dSurfaceFormatCaps mask; 2214bf215546Sopenharmony_ci 2215bf215546Sopenharmony_ci assert(bindings); 2216bf215546Sopenharmony_ci assert(!ss->sws->have_vgpu10); 2217bf215546Sopenharmony_ci 2218bf215546Sopenharmony_ci /* Multisamples is not supported in VGPU9 device */ 2219bf215546Sopenharmony_ci if (sample_count > 1) 2220bf215546Sopenharmony_ci return false; 2221bf215546Sopenharmony_ci 2222bf215546Sopenharmony_ci svga_format = svga_translate_format(ss, format, bindings); 2223bf215546Sopenharmony_ci if (svga_format == SVGA3D_FORMAT_INVALID) { 2224bf215546Sopenharmony_ci return false; 2225bf215546Sopenharmony_ci } 2226bf215546Sopenharmony_ci 2227bf215546Sopenharmony_ci if (util_format_is_srgb(format) && 2228bf215546Sopenharmony_ci (bindings & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_RENDER_TARGET))) { 2229bf215546Sopenharmony_ci /* We only support sRGB rendering with vgpu10 */ 2230bf215546Sopenharmony_ci return false; 2231bf215546Sopenharmony_ci } 2232bf215546Sopenharmony_ci 2233bf215546Sopenharmony_ci /* 2234bf215546Sopenharmony_ci * Override host capabilities, so that we end up with the same 2235bf215546Sopenharmony_ci * visuals for all virtual hardware implementations. 2236bf215546Sopenharmony_ci */ 2237bf215546Sopenharmony_ci if (bindings & PIPE_BIND_DISPLAY_TARGET) { 2238bf215546Sopenharmony_ci switch (svga_format) { 2239bf215546Sopenharmony_ci case SVGA3D_A8R8G8B8: 2240bf215546Sopenharmony_ci case SVGA3D_X8R8G8B8: 2241bf215546Sopenharmony_ci case SVGA3D_R5G6B5: 2242bf215546Sopenharmony_ci break; 2243bf215546Sopenharmony_ci 2244bf215546Sopenharmony_ci /* VGPU10 formats */ 2245bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_UNORM: 2246bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_UNORM: 2247bf215546Sopenharmony_ci case SVGA3D_B5G6R5_UNORM: 2248bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_UNORM_SRGB: 2249bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_UNORM_SRGB: 2250bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_UNORM_SRGB: 2251bf215546Sopenharmony_ci break; 2252bf215546Sopenharmony_ci 2253bf215546Sopenharmony_ci /* Often unsupported/problematic. This means we end up with the same 2254bf215546Sopenharmony_ci * visuals for all virtual hardware implementations. 2255bf215546Sopenharmony_ci */ 2256bf215546Sopenharmony_ci case SVGA3D_A4R4G4B4: 2257bf215546Sopenharmony_ci case SVGA3D_A1R5G5B5: 2258bf215546Sopenharmony_ci return false; 2259bf215546Sopenharmony_ci 2260bf215546Sopenharmony_ci default: 2261bf215546Sopenharmony_ci return false; 2262bf215546Sopenharmony_ci } 2263bf215546Sopenharmony_ci } 2264bf215546Sopenharmony_ci 2265bf215546Sopenharmony_ci /* 2266bf215546Sopenharmony_ci * Query the host capabilities. 2267bf215546Sopenharmony_ci */ 2268bf215546Sopenharmony_ci svga_get_format_cap(ss, svga_format, &caps); 2269bf215546Sopenharmony_ci 2270bf215546Sopenharmony_ci if (bindings & PIPE_BIND_RENDER_TARGET) { 2271bf215546Sopenharmony_ci /* Check that the color surface is blendable, unless it's an 2272bf215546Sopenharmony_ci * integer format. 2273bf215546Sopenharmony_ci */ 2274bf215546Sopenharmony_ci if (!svga_format_is_integer(svga_format) && 2275bf215546Sopenharmony_ci (caps.value & SVGA3DFORMAT_OP_NOALPHABLEND)) { 2276bf215546Sopenharmony_ci return false; 2277bf215546Sopenharmony_ci } 2278bf215546Sopenharmony_ci } 2279bf215546Sopenharmony_ci 2280bf215546Sopenharmony_ci mask.value = 0; 2281bf215546Sopenharmony_ci if (bindings & PIPE_BIND_RENDER_TARGET) 2282bf215546Sopenharmony_ci mask.value |= SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET; 2283bf215546Sopenharmony_ci 2284bf215546Sopenharmony_ci if (bindings & PIPE_BIND_DEPTH_STENCIL) 2285bf215546Sopenharmony_ci mask.value |= SVGA3DFORMAT_OP_ZSTENCIL; 2286bf215546Sopenharmony_ci 2287bf215546Sopenharmony_ci if (bindings & PIPE_BIND_SAMPLER_VIEW) 2288bf215546Sopenharmony_ci mask.value |= SVGA3DFORMAT_OP_TEXTURE; 2289bf215546Sopenharmony_ci 2290bf215546Sopenharmony_ci if (target == PIPE_TEXTURE_CUBE) 2291bf215546Sopenharmony_ci mask.value |= SVGA3DFORMAT_OP_CUBETEXTURE; 2292bf215546Sopenharmony_ci else if (target == PIPE_TEXTURE_3D) 2293bf215546Sopenharmony_ci mask.value |= SVGA3DFORMAT_OP_VOLUMETEXTURE; 2294bf215546Sopenharmony_ci 2295bf215546Sopenharmony_ci return (caps.value & mask.value) == mask.value; 2296bf215546Sopenharmony_ci} 2297bf215546Sopenharmony_ci 2298bf215546Sopenharmony_ci 2299bf215546Sopenharmony_ci/** 2300bf215546Sopenharmony_ci * Implement pipe_screen::is_format_supported() for VGPU10 device. 2301bf215546Sopenharmony_ci * \param bindings bitmask of PIPE_BIND_x flags 2302bf215546Sopenharmony_ci */ 2303bf215546Sopenharmony_cibool 2304bf215546Sopenharmony_cisvga_is_dx_format_supported(struct pipe_screen *screen, 2305bf215546Sopenharmony_ci enum pipe_format format, 2306bf215546Sopenharmony_ci enum pipe_texture_target target, 2307bf215546Sopenharmony_ci unsigned sample_count, 2308bf215546Sopenharmony_ci unsigned storage_sample_count, 2309bf215546Sopenharmony_ci unsigned bindings) 2310bf215546Sopenharmony_ci{ 2311bf215546Sopenharmony_ci struct svga_screen *ss = svga_screen(screen); 2312bf215546Sopenharmony_ci SVGA3dSurfaceFormat svga_format; 2313bf215546Sopenharmony_ci SVGA3dDevCapResult caps; 2314bf215546Sopenharmony_ci unsigned int mask = 0; 2315bf215546Sopenharmony_ci 2316bf215546Sopenharmony_ci assert(bindings); 2317bf215546Sopenharmony_ci assert(ss->sws->have_vgpu10); 2318bf215546Sopenharmony_ci 2319bf215546Sopenharmony_ci /* To support framebuffer without attachments */ 2320bf215546Sopenharmony_ci if ((format == PIPE_FORMAT_NONE) && (bindings == PIPE_BIND_RENDER_TARGET)) 2321bf215546Sopenharmony_ci return (ss->sws->have_gl43 && (sample_count <= ss->forcedSampleCount)); 2322bf215546Sopenharmony_ci 2323bf215546Sopenharmony_ci if (sample_count > 1) { 2324bf215546Sopenharmony_ci 2325bf215546Sopenharmony_ci /* No MSAA support for shader image */ 2326bf215546Sopenharmony_ci if (bindings & PIPE_BIND_SHADER_IMAGE) 2327bf215546Sopenharmony_ci return false; 2328bf215546Sopenharmony_ci 2329bf215546Sopenharmony_ci /* In ms_samples, if bit N is set it means that we support 2330bf215546Sopenharmony_ci * multisample with N+1 samples per pixel. 2331bf215546Sopenharmony_ci */ 2332bf215546Sopenharmony_ci if ((ss->ms_samples & (1 << (sample_count - 1))) == 0) { 2333bf215546Sopenharmony_ci return false; 2334bf215546Sopenharmony_ci } 2335bf215546Sopenharmony_ci mask |= SVGA3D_DXFMT_MULTISAMPLE; 2336bf215546Sopenharmony_ci } 2337bf215546Sopenharmony_ci 2338bf215546Sopenharmony_ci /* 2339bf215546Sopenharmony_ci * For VGPU10 vertex formats, skip querying host capabilities 2340bf215546Sopenharmony_ci */ 2341bf215546Sopenharmony_ci 2342bf215546Sopenharmony_ci if (bindings & PIPE_BIND_VERTEX_BUFFER) { 2343bf215546Sopenharmony_ci unsigned flags; 2344bf215546Sopenharmony_ci svga_translate_vertex_format_vgpu10(format, &svga_format, &flags); 2345bf215546Sopenharmony_ci return svga_format != SVGA3D_FORMAT_INVALID; 2346bf215546Sopenharmony_ci } 2347bf215546Sopenharmony_ci 2348bf215546Sopenharmony_ci if (bindings & PIPE_BIND_SAMPLER_VIEW && target == PIPE_BUFFER) { 2349bf215546Sopenharmony_ci unsigned flags; 2350bf215546Sopenharmony_ci svga_translate_texture_buffer_view_format(format, &svga_format, &flags); 2351bf215546Sopenharmony_ci return svga_format != SVGA3D_FORMAT_INVALID; 2352bf215546Sopenharmony_ci } 2353bf215546Sopenharmony_ci 2354bf215546Sopenharmony_ci svga_format = svga_translate_format(ss, format, bindings); 2355bf215546Sopenharmony_ci if (svga_format == SVGA3D_FORMAT_INVALID) { 2356bf215546Sopenharmony_ci return false; 2357bf215546Sopenharmony_ci } 2358bf215546Sopenharmony_ci 2359bf215546Sopenharmony_ci /* 2360bf215546Sopenharmony_ci * Override host capabilities, so that we end up with the same 2361bf215546Sopenharmony_ci * visuals for all virtual hardware implementations. 2362bf215546Sopenharmony_ci */ 2363bf215546Sopenharmony_ci if (bindings & PIPE_BIND_DISPLAY_TARGET) { 2364bf215546Sopenharmony_ci switch (svga_format) { 2365bf215546Sopenharmony_ci case SVGA3D_A8R8G8B8: 2366bf215546Sopenharmony_ci case SVGA3D_X8R8G8B8: 2367bf215546Sopenharmony_ci case SVGA3D_R5G6B5: 2368bf215546Sopenharmony_ci break; 2369bf215546Sopenharmony_ci 2370bf215546Sopenharmony_ci /* VGPU10 formats */ 2371bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_UNORM: 2372bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_UNORM: 2373bf215546Sopenharmony_ci case SVGA3D_B5G6R5_UNORM: 2374bf215546Sopenharmony_ci case SVGA3D_B8G8R8X8_UNORM_SRGB: 2375bf215546Sopenharmony_ci case SVGA3D_B8G8R8A8_UNORM_SRGB: 2376bf215546Sopenharmony_ci case SVGA3D_R8G8B8A8_UNORM_SRGB: 2377bf215546Sopenharmony_ci break; 2378bf215546Sopenharmony_ci 2379bf215546Sopenharmony_ci /* Often unsupported/problematic. This means we end up with the same 2380bf215546Sopenharmony_ci * visuals for all virtual hardware implementations. 2381bf215546Sopenharmony_ci */ 2382bf215546Sopenharmony_ci case SVGA3D_A4R4G4B4: 2383bf215546Sopenharmony_ci case SVGA3D_A1R5G5B5: 2384bf215546Sopenharmony_ci return false; 2385bf215546Sopenharmony_ci 2386bf215546Sopenharmony_ci default: 2387bf215546Sopenharmony_ci return false; 2388bf215546Sopenharmony_ci } 2389bf215546Sopenharmony_ci } 2390bf215546Sopenharmony_ci 2391bf215546Sopenharmony_ci /* 2392bf215546Sopenharmony_ci * Query the host capabilities. 2393bf215546Sopenharmony_ci */ 2394bf215546Sopenharmony_ci svga_get_dx_format_cap(ss, svga_format, &caps); 2395bf215546Sopenharmony_ci 2396bf215546Sopenharmony_ci if (bindings & PIPE_BIND_RENDER_TARGET) { 2397bf215546Sopenharmony_ci /* Check that the color surface is blendable, unless it's an 2398bf215546Sopenharmony_ci * integer format. 2399bf215546Sopenharmony_ci */ 2400bf215546Sopenharmony_ci if (!(svga_format_is_integer(svga_format) || 2401bf215546Sopenharmony_ci (caps.u & SVGA3D_DXFMT_BLENDABLE))) { 2402bf215546Sopenharmony_ci return false; 2403bf215546Sopenharmony_ci } 2404bf215546Sopenharmony_ci mask |= SVGA3D_DXFMT_COLOR_RENDERTARGET; 2405bf215546Sopenharmony_ci } 2406bf215546Sopenharmony_ci 2407bf215546Sopenharmony_ci if (bindings & PIPE_BIND_DEPTH_STENCIL) 2408bf215546Sopenharmony_ci mask |= SVGA3D_DXFMT_DEPTH_RENDERTARGET; 2409bf215546Sopenharmony_ci 2410bf215546Sopenharmony_ci switch (target) { 2411bf215546Sopenharmony_ci case PIPE_TEXTURE_3D: 2412bf215546Sopenharmony_ci mask |= SVGA3D_DXFMT_VOLUME; 2413bf215546Sopenharmony_ci break; 2414bf215546Sopenharmony_ci case PIPE_TEXTURE_1D_ARRAY: 2415bf215546Sopenharmony_ci case PIPE_TEXTURE_2D_ARRAY: 2416bf215546Sopenharmony_ci case PIPE_TEXTURE_CUBE_ARRAY: 2417bf215546Sopenharmony_ci mask |= SVGA3D_DXFMT_ARRAY; 2418bf215546Sopenharmony_ci break; 2419bf215546Sopenharmony_ci default: 2420bf215546Sopenharmony_ci break; 2421bf215546Sopenharmony_ci } 2422bf215546Sopenharmony_ci 2423bf215546Sopenharmony_ci /* Is the format supported for rendering */ 2424bf215546Sopenharmony_ci if ((caps.u & mask) != mask) 2425bf215546Sopenharmony_ci return false; 2426bf215546Sopenharmony_ci 2427bf215546Sopenharmony_ci if (bindings & PIPE_BIND_SAMPLER_VIEW) { 2428bf215546Sopenharmony_ci SVGA3dSurfaceFormat sampler_format; 2429bf215546Sopenharmony_ci 2430bf215546Sopenharmony_ci /* Get the sampler view format */ 2431bf215546Sopenharmony_ci sampler_format = svga_sampler_format(svga_format); 2432bf215546Sopenharmony_ci if (sampler_format != svga_format) { 2433bf215546Sopenharmony_ci caps.u = 0; 2434bf215546Sopenharmony_ci svga_get_dx_format_cap(ss, sampler_format, &caps); 2435bf215546Sopenharmony_ci mask &= SVGA3D_DXFMT_VOLUME; 2436bf215546Sopenharmony_ci mask |= SVGA3D_DXFMT_SHADER_SAMPLE; 2437bf215546Sopenharmony_ci if ((caps.u & mask) != mask) 2438bf215546Sopenharmony_ci return false; 2439bf215546Sopenharmony_ci } 2440bf215546Sopenharmony_ci } 2441bf215546Sopenharmony_ci 2442bf215546Sopenharmony_ci return true; 2443bf215546Sopenharmony_ci} 2444