third_party/virtualbox/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
/**
 * Convert SVGA format value to its D3D equivalent
 */
Convert SVGA format value to its D3D equivalent
Convert SVGA format value to its D3D equivalent
D3DFORMAT vmsvga3dSurfaceFormat2D3D(SVGA3dSurfaceFormat format)
{
    switch (format)
    {
    case SVGA3D_X8R8G8B8:
        return D3DFMT_X8R8G8B8;
    case SVGA3D_A8R8G8B8:
        return D3DFMT_A8R8G8B8;
    case SVGA3D_R5G6B5:
        return D3DFMT_R5G6B5;
    case SVGA3D_X1R5G5B5:
        return D3DFMT_X1R5G5B5;
    case SVGA3D_A1R5G5B5:
        return D3DFMT_A1R5G5B5;
    case SVGA3D_A4R4G4B4:
        return D3DFMT_A4R4G4B4;
    case SVGA3D_R8G8B8A8_UNORM:
        return D3DFMT_A8B8G8R8;
    case SVGA3D_Z_D32:
        return D3DFMT_D32;
    case SVGA3D_Z_D16:
        return D3DFMT_D16;
    case SVGA3D_Z_D24S8_INT:    
    case SVGA3D_Z_D24S8:
        return D3DFMT_D24S8;
    case SVGA3D_Z_D15S1:
        return D3DFMT_D15S1;
    case SVGA3D_Z_D24X8:
        return D3DFMT_D24X8;
    case SVGA3D_Z_DF16:
        AssertFailedReturn(D3DFMT_UNKNOWN);
    case SVGA3D_Z_DF24:
        return D3DFMT_D24FS8;
    case SVGA3D_LUMINANCE8:
        return D3DFMT_L8;
    case SVGA3D_LUMINANCE4_ALPHA4:
        return D3DFMT_A4L4;
    case SVGA3D_LUMINANCE16:
        return D3DFMT_L16;
    case SVGA3D_LUMINANCE8_ALPHA8:
        return D3DFMT_A8L8;
    case SVGA3D_DXT1:
        return D3DFMT_DXT1;
    case SVGA3D_DXT2:
        return D3DFMT_DXT2;
    case SVGA3D_DXT3:
        return D3DFMT_DXT3;
    case SVGA3D_DXT4:
        return D3DFMT_DXT4;
    case SVGA3D_DXT5:
        return D3DFMT_DXT5;
    case SVGA3D_BUMPU8V8:
        return D3DFMT_V8U8;
    case SVGA3D_BUMPL6V5U5:
        return D3DFMT_L6V5U5;
    case SVGA3D_BUMPX8L8V8U8:
        return D3DFMT_X8L8V8U8;
    case SVGA3D_BUMPL8V8U8:
        AssertFailedReturn(D3DFMT_UNKNOWN);
    case SVGA3D_V8U8:
        return D3DFMT_V8U8;
    case SVGA3D_Q8W8V8U8:
        return D3DFMT_Q8W8V8U8;
    case SVGA3D_CxV8U8:
        return D3DFMT_CxV8U8;
    case SVGA3D_X8L8V8U8:
        return D3DFMT_X8L8V8U8;
    case SVGA3D_A2W10V10U10:
        return D3DFMT_A2W10V10U10;
    case SVGA3D_ARGB_S10E5:   
        return D3DFMT_A16B16G16R16F;
    case SVGA3D_ARGB_S23E8:   
        return D3DFMT_A32B32G32R32F;
    case SVGA3D_A2R10G10B10:
        return D3DFMT_A2R10G10B10;
    case SVGA3D_ALPHA8:
        return D3DFMT_A8;
    case SVGA3D_R_S10E5:
        return D3DFMT_R16F;
    case SVGA3D_R_S23E8:
        return D3DFMT_R32F;
    case SVGA3D_RG_S10E5:
        return D3DFMT_G16R16F;
    case SVGA3D_RG_S23E8:
        return D3DFMT_G32R32F;
    case SVGA3D_BUFFER:
        return D3DFMT_UNKNOWN;
    case SVGA3D_V16U16:
        return D3DFMT_V16U16;
    case SVGA3D_G16R16:
        return D3DFMT_G16R16;
    case SVGA3D_A16B16G16R16:
        return D3DFMT_A16B16G16R16;
    case SVGA3D_UYVY:
        return D3DFMT_UYVY;
    case SVGA3D_YUY2:
        return D3DFMT_YUY2;
    case SVGA3D_NV12:
        return (D3DFORMAT)MAKEFOURCC('N', 'V', '1', '2');
    case SVGA3D_AYUV:
        return (D3DFORMAT)MAKEFOURCC('A', 'Y', 'U', 'V');
    case SVGA3D_R8G8B8A8_SNORM:
        return D3DFMT_Q8W8V8U8;
    case SVGA3D_R16G16_UNORM:
        return D3DFMT_G16R16;
    case SVGA3D_BC4_UNORM:
    case SVGA3D_BC5_UNORM:
        break;
    case SVGA3D_FORMAT_MAX:     
    case SVGA3D_FORMAT_INVALID:
        break;
    }
    AssertFailedReturn(D3DFMT_UNKNOWN);
}
D3DFORMAT vmsvga3dSurfaceFormat2D3D ( SVGA3dSurfaceFormat format ) { switch ( format ) { case SVGA3D_X8R8G8B8 : return D3DFMT_X8R8G8B8 ; case SVGA3D_A8R8G8B8 : return D3DFMT_A8R8G8B8 ; case SVGA3D_R5G6B5 : return D3DFMT_R5G6B5 ; case SVGA3D_X1R5G5B5 : return D3DFMT_X1R5G5B5 ; case SVGA3D_A1R5G5B5 : return D3DFMT_A1R5G5B5 ; case SVGA3D_A4R4G4B4 : return D3DFMT_A4R4G4B4 ; case SVGA3D_R8G8B8A8_UNORM : return D3DFMT_A8B8G8R8 ; case SVGA3D_Z_D32 : return D3DFMT_D32 ; case SVGA3D_Z_D16 : return D3DFMT_D16 ; case SVGA3D_Z_D24S8_INT : case SVGA3D_Z_D24S8 : return D3DFMT_D24S8 ; case SVGA3D_Z_D15S1 : return D3DFMT_D15S1 ; case SVGA3D_Z_D24X8 : return D3DFMT_D24X8 ; case SVGA3D_Z_DF16 : AssertFailedReturn ( D3DFMT_UNKNOWN ) ; case SVGA3D_Z_DF24 : return D3DFMT_D24FS8 ; case SVGA3D_LUMINANCE8 : return D3DFMT_L8 ; case SVGA3D_LUMINANCE4_ALPHA4 : return D3DFMT_A4L4 ; case SVGA3D_LUMINANCE16 : return D3DFMT_L16 ; case SVGA3D_LUMINANCE8_ALPHA8 : return D3DFMT_A8L8 ; case SVGA3D_DXT1 : return D3DFMT_DXT1 ; case SVGA3D_DXT2 : return D3DFMT_DXT2 ; case SVGA3D_DXT3 : return D3DFMT_DXT3 ; case SVGA3D_DXT4 : return D3DFMT_DXT4 ; case SVGA3D_DXT5 : return D3DFMT_DXT5 ; case SVGA3D_BUMPU8V8 : return D3DFMT_V8U8 ; case SVGA3D_BUMPL6V5U5 : return D3DFMT_L6V5U5 ; case SVGA3D_BUMPX8L8V8U8 : return D3DFMT_X8L8V8U8 ; case SVGA3D_BUMPL8V8U8 : AssertFailedReturn ( D3DFMT_UNKNOWN ) ; case SVGA3D_V8U8 : return D3DFMT_V8U8 ; case SVGA3D_Q8W8V8U8 : return D3DFMT_Q8W8V8U8 ; case SVGA3D_CxV8U8 : return D3DFMT_CxV8U8 ; case SVGA3D_X8L8V8U8 : return D3DFMT_X8L8V8U8 ; case SVGA3D_A2W10V10U10 : return D3DFMT_A2W10V10U10 ; case SVGA3D_ARGB_S10E5 : return D3DFMT_A16B16G16R16F ; case SVGA3D_ARGB_S23E8 : return D3DFMT_A32B32G32R32F ; case SVGA3D_A2R10G10B10 : return D3DFMT_A2R10G10B10 ; case SVGA3D_ALPHA8 : return D3DFMT_A8 ; case SVGA3D_R_S10E5 : return D3DFMT_R16F ; case SVGA3D_R_S23E8 : return D3DFMT_R32F ; case SVGA3D_RG_S10E5 : return D3DFMT_G16R16F ; case SVGA3D_RG_S23E8 : return D3DFMT_G32R32F ; case SVGA3D_BUFFER : return D3DFMT_UNKNOWN ; case SVGA3D_V16U16 : return D3DFMT_V16U16 ; case SVGA3D_G16R16 : return D3DFMT_G16R16 ; case SVGA3D_A16B16G16R16 : return D3DFMT_A16B16G16R16 ; case SVGA3D_UYVY : return D3DFMT_UYVY ; case SVGA3D_YUY2 : return D3DFMT_YUY2 ; case SVGA3D_NV12 : return ( D3DFORMAT ) MAKEFOURCC ( ' ' , ' ' , ' ' , ' ' ) ; case SVGA3D_AYUV : return ( D3DFORMAT ) MAKEFOURCC ( ' ' , ' ' , ' ' , ' ' ) ; case SVGA3D_R8G8B8A8_SNORM : return D3DFMT_Q8W8V8U8 ; case SVGA3D_R16G16_UNORM : return D3DFMT_G16R16 ; case SVGA3D_BC4_UNORM : case SVGA3D_BC5_UNORM : break ; case SVGA3D_FORMAT_MAX : case SVGA3D_FORMAT_INVALID : break ; } AssertFailedReturn ( D3DFMT_UNKNOWN ) ; }
Convert SVGA format value to its D3D equivalent
Convert SVGA format value to its D3D equivalent
/** @todo not correct */ /* Advanced D3D9 depth formats. */ /** @todo supposed to be floating-point, but unable to find a match for D3D9... */ /* Bump-map formats */ /* No corresponding D3D9 equivalent. */ /* signed bump-map formats */ /* mixed bump-map formats */ /* 16-bit floating-point ARGB */ /* 32-bit floating-point ARGB */ /* Single- and dual-component floating point formats */ /*
     * Any surface can be used as a buffer object, but SVGA3D_BUFFER is
     * the most efficient format to use when creating new surfaces
     * expressly for index or vertex data.
     */ /* Packed Video formats */ /* Planar video formats */ /* Video format with alpha */ /* Unknown; only in DX10 & 11 */ /* shut up MSC */