Surface Descriptor

Surface Descriptor

The surface descriptor structure has the following members:

typedef struct tagKMSURFACEDESC
{
  KMDWORD SurfaceType;
  KMDWORD BitDepth;
  KMDWORD PixelFormat;
  union{
    KMDWORD USize;
    KMDWORD Width;
  } u0;
  union{
    KMDWORD VSize;
    KMDWORD Height;
  } u1;
  union {
    KMDWORD dwTextureSize;
    KMDWORD dwFrameBufferSize;
  } uSize;
  KMDWORD fSurfaceFlags;
  PKMDWORD pSurface;
  PKMDWORD pVirtual;
  PKMDWORD pPhysical;
} KMSURFACEDESC, *PKMSURFACEDESC, **PPKMSURFACEDESC;

Each member is explained in details as follows:

typedef struct tagKMSURFACEDESC
{

KMDWORD SurfaceType;
  Indicates the type of surface. One of the following is stored.

  SurfaceType | Description
  --- | ---
  KM_SURFACETYPE_FRAMEBUFFER | Frame buffer
  KM_SURFACETYPE_TEXTURE | Texture
  KM_SURFACETYPE_SMALLVQ_TEXTURE | Small VQ texture

  Note: The higher 16 bits of this member are reserved for Ninja.

KMDWORD BitDepth;
  Indicates number of bits per pixel. One of the following is stored.

  BitDepth | Description
  --- | ---
  KM_BITDEPTH_16 | 1pixel = 16bit
  KM_BITDEPTH_24 | 1pixel = 24bit
  KM_BITDEPTH_32 | 1pixel = 32bit

KMDWORD PixelFormat;
  Indicates the pixel format. One of the following is stored.
  For frame buffer:

  PixelFormat | Description
  --- | ---
  KM_DSPBPP_RGB565 | RGB-565 format
  KM_DSPBPP_RGB555 | RGB-555 format
  KM_DSPBPP_ARGB1555 | ARGB-1555 format
  KM_DSPBPP_RGB888 | RGB-888 format
  KM_DSPBPP_ARGB8888 | ARGB-8888 format

  For texture:

  PixelFormat | Description
  --- | ---
  KM_PIXELFORMAT_ARGB1555 | ARGB-1555 format
  KM_PIXELFORMAT_RGB565 | RGB-565 format
  KM_PIXELFORMAT_ARGB4444 | ARGB-4444 format
  KM_PIXELFORMAT_YUV422 | YUV-422 format
  KM_PIXELFORMAT_BUMP | Bump map
  KM_PIXELFORMAT_PALETTIZED_4BPP | 4 bpp palette format
  KM_PIXELFORMAT_PALETTIZED_8BPP | 8 bpp palette format

union{
  KMDWORD USize;
    For Texture, Horizontal Size. One of the following is stored.

    USize | Description
    --- | ---
    KM_MAPSIZE_8 | Horizontal size, 8 pixels
    KM_MAPSIZE_16 | Horizontal size, 16 pixels
    KM_MAPSIZE_32 | Horizontal size, 32 pixels
    KM_MAPSIZE_64 | Horizontal size, 64 pixels
    KM_MAPSIZE_128 | Horizontal size, 128 pixels
    KM_MAPSIZE_256 | Horizontal size, 256 pixels
    KM_MAPSIZE_512 | Horizontal size, 512 pixels
    KM_MAPSIZE_1024 | Horizontal size, 1024 pixels

  KMDWORD Width;
    For Frame Buffer, Horizontal Size.

} u0;
union{
  KMDWORD VSize;
    For Texture, Vertical Size. One of the following is stored.

    VSize | Description
    --- | ---
    KM_MAPSIZE_8 | Vertical size, 8 pixels
    KM_MAPSIZE_16 | Vertical size, 16 pixels
    KM_MAPSIZE_32 | Vertical size, 32 pixels
    KM_MAPSIZE_64 | Vertical size, 64 pixels
    KM_MAPSIZE_128 | Vertical size, 128 pixels
    KM_MAPSIZE_256 | Vertical size, 256 pixels
    KM_MAPSIZE_512 | Vertical size, 512 pixels
    KM_MAPSIZE_1024 | Vertical size, 1024 pixels

  KMDWORD Height;
    For Frame Buffer, Vertical Size.

} u1;
union {
  KMDWORD dwTextureSize;
    Texture Size (byte)
  KMDWORD dwFrameBufferSize;
    FrameBuffer Size (byte)

} uSize;

KMDWORD fSurfaceFlags;
  This is a flag to indicate the attribute of the surface. The following values are available.
  For Frame Buffer:

  bit 0 | 0...full screen buffer 1... use StripBuffer used

  For Texture:

  bit 31 | 0=Non MipMap 1=MipMapped
  bit 30 | 0=Non VQ 1=VQed Texture
  bit 26 | 0=Twiddled 1=Scan-order
  bit 25 | 0=Non Stride 1=Stride Select
  bit 15 | 0=Non Palettized 1=Palettized
  bit 5-3 | U-Size 0=8 1=16 2=32 3=64 4=128 5=256 6=512 7=1024
  bit 2-0 | V-Size 0=8 1=16 2=32 3=64 4=128 5=256 6=512 7=1024

  For texture, the logical sum of the following flags is set.

  fSurfaceFlags | Description
  --- | ---
  KM_SURFACEFLAGS_MIPMAPED | Indicates use of mipmap.
  KM_SURFACEFLAGS_VQ | Indicates the VQ/SmallVQ compression format.
  KM_SURFACEFLAGS_NOTWIDDLED | Indicates Non-TWIDDLED format(= Scan-order format).
  KM_SURFACEFLAGS_STRIDE | Indicates use of stride.
  KM_SURFACEFLAGS_PALETTIZED | Indicates palettized texture.
  KM_SURFACEFLAGS_USIZE8 | Size (width) is 8 texel
  KM_SURFACEFLAGS_USIZE16 | Size (width) is 16 texel
  KM_SURFACEFLAGS_USIZE32 | Size (width) is 32 texel
  KM_SURFACEFLAGS_USIZE64 | Size (width) is 64 texel
  KM_SURFACEFLAGS_USIZE128 | Size (width) is 128 texel
  KM_SURFACEFLAGS_USIZE256 | Size (width) is 256 texel
  KM_SURFACEFLAGS_USIZE512 | Size (width) is 512 texel
  KM_SURFACEFLAGS_USIZE1024 | Size (width) is 1024 texel
  KM_SURFACEFLAGS_VSIZE8 | Size (height) is 8 texel
  KM_SURFACEFLAGS_VSIZE16 | Size (height) is 16 texel
  KM_SURFACEFLAGS_VSIZE32 | Size (height) is 32 texel
  KM_SURFACEFLAGS_VSIZE64 | Size (height) is 64 texel
  KM_SURFACEFLAGS_VSIZE128 | Size (height) is 128 texel
  KM_SURFACEFLAGS_VSIZE256 | Size (height) is 256 texel
  KM_SURFACEFLAGS_VSIZE512 | Size (height) is 512 texel
  KM_SURFACEFLAGS_VSIZE1024 | Size (height) is 1024 texel

PKMDWORD pSurface;
  Pointer to surface instance.
PKMDWORD pVirtual;
  Texture instance ( Virtual address on SH4 )
PKMDWORD pPhysical;
  Texture instance ( physical address on SH4 )

} KMSURFACEDESC, *PKMSURFACEDESC, **PPKMSURFACEDESC;

Surface Descriptor