# graphics.h

`#include "dxlibp.h"`
`#include <pspgu.h>`
`#include <valloc.h>`
graphics.hのインクルード依存関係図

ソースコードを見る。

## データ構造
struct | DXP_FVF_2D
struct | DXP_FVF_2DTEX
struct | DXP_FVF_2DTEX_F
struct | DXPTEXTURE3
struct | DXPGRAPHICSHANDLE
struct | DXPMATERIAL
struct | DXPMESH
struct | DXPMODEL
struct | DXPGRAPHICSDATA
## マクロ定義
#define | VRAM_BASE (0x44000000)
#define | VRAM_OFFSET2ADDRESS(OFFSET) (VRAM_BASE | OFFSET)
#define | GULIST_LEN 262144
#define | GULIST_LIM 200000
#define | DXP_DRAWSTATE_EITHER 0xffffffff
#define | DXP_DRAWSTATE_NONTEX2D 0
#define | DXP_DRAWSTATE_TEX2D 1
#define | DXP_DRAWSTATE_NONTEX3D 2
#define | DXP_DRAWSTATE_TEX3D 3
#define | DXP_DRAWSTATE_INTRAFONT 4
#define | GUENABLE(STATUS) {if(!sceGuGetStatus(STATUS))sceGuEnable(STATUS);}
#define | GUDISABLE(STATUS) {if(sceGuGetStatus(STATUS))sceGuDisable(STATUS);}
#define | GUINITCHECK {if(!dxpGraphicsData.init)return -1;}
#define | GUSTART {if(!dxpGraphicsData.gustarted){sceGuStart(GU_DIRECT,dxpGuList);dxpGraphicsData.gustarted = 1;}}
#define | GUFINISH {if(dxpGraphicsData.gustarted){sceGuFinish();dxpGraphicsData.gustarted = 0;}}
#define | GUSYNC {GUFINISH;sceGuSync(0,0);}
#define | MIN(a, b) (a < b ? a : b)
#define | GHANDLE2GPTR(PTR, HANDLE) {if(HANDLE < 0 || HANDLE >= DXP_BUILDOPTION_GHANDLE_MAXNUM)return -1;PTR = dxpGraphicsData.grapharray[HANDLE];if(!PTR)return -1;if(!PTR->tex)return -1;}
#define | DXP_VTYPE_2D (GU_VERTEX_16BIT)
#define | DXP_VTYPE_2DTEX (GU_VERTEX_16BIT | GU_TEXTURE_16BIT)
#define | DXP_VTYPE_2DTEX_F (GU_VERTEX_32BITF | GU_TEXTURE_16BIT)
#define | PSM2BYTEX2(PSM) (PSM == GU_PSM_5650 || PSM == GU_PSM_5551 || PSM == GU_PSM_4444 ? 4 : (PSM == GU_PSM_8888 ? 8 : (PSM == GU_PSM_T8 ? 2 : 1)))
## 関数
static int | dxpN_2 (int num)
static u32 | dxpGraphics4444_8888 (u32 src)
static u32 | dxpGraphics5551_8888 (u32 src)
static u32 | dxpGraphics5650_8888 (u32 src)
static u32 | dxpGraphics8888_4444 (u32 src)
static u32 | dxpGraphics8888_5551 (u32 src)
static u32 | dxpGraphics8888_5650 (u32 src)
int | dxpGraphicsInit ()
int | dxpGraphicsEnd ()
int | dxpGraphicsCalcTexSize (int width, int height, int psm)
DXPTEXTURE3 * | dxpGraphicsCreateTexture ()
int | dxpGraphicsReleseTexture (DXPTEXTURE3 *texptr)
DXPGRAPHICSHANDLE * | dxpGraphicsCreateGraphicHandle ()
int | dxpGraphicsReleseGraphicHandle (DXPGRAPHICSHANDLE *gptr)
int | dxpGraphicsSetup2DTex (DXPTEXTURE3 *texptr, int flag)
int | dxpGraphicsSetup2D (u32 color)
void | dxpGraphicsWaitVSync ()
static DXPTEXTURE3 * | dxpGraphHandle2TexPtr (int gh)
static void * | dxpGuGetMemory (u32 size)
## 変数
DXPGRAPHICSDATA | dxpGraphicsData
u32 | dxpGuList [GULIST_LEN]
u8 | dxpPsm2SliceSize [11][2]

## マクロ定義

#define DXP_DRAWSTATE_EITHER 0xffffffff

#define DXP_DRAWSTATE_INTRAFONT 4

#define DXP_DRAWSTATE_NONTEX2D 0

#define DXP_DRAWSTATE_NONTEX3D 2

#define DXP_DRAWSTATE_TEX2D 1

#define DXP_DRAWSTATE_TEX3D 3

#define DXP_VTYPE_2D (GU_VERTEX_16BIT)

#define DXP_VTYPE_2DTEX (GU_VERTEX_16BIT | GU_TEXTURE_16BIT)

#define DXP_VTYPE_2DTEX_F (GU_VERTEX_32BITF | GU_TEXTURE_16BIT)

#define GHANDLE2GPTR | ( | PTR,
|  | HANDLE |  | ) | {if(HANDLE < 0 || HANDLE >= DXP_BUILDOPTION_GHANDLE_MAXNUM)return -1;PTR = dxpGraphicsData.grapharray[HANDLE];if(!PTR)return -1;if(!PTR->tex)return -1;}

#define GUDISABLE | ( | STATUS |  | ) | {if(sceGuGetStatus(STATUS))sceGuDisable(STATUS);}

#define GUENABLE | ( | STATUS |  | ) | {if(!sceGuGetStatus(STATUS))sceGuEnable(STATUS);}

#define GUFINISH {if(dxpGraphicsData.gustarted){sceGuFinish();dxpGraphicsData.gustarted = 0;}}

#define GUINITCHECK {if(!dxpGraphicsData.init)return -1;}

#define GULIST_LEN 262144

#define GULIST_LIM 200000

#define GUSTART {if(!dxpGraphicsData.gustarted){sceGuStart(GU_DIRECT,dxpGuList);dxpGraphicsData.gustarted = 1;}}

#define GUSYNC {GUFINISH;sceGuSync(0,0);}

#define MIN | ( | a,
|  | b |  | ) | (a < b ? a : b)

#define PSM2BYTEX2 | ( | PSM |  | ) | (PSM == GU_PSM_5650 || PSM == GU_PSM_5551 || PSM == GU_PSM_4444 ? 4 : (PSM == GU_PSM_8888 ? 8 : (PSM == GU_PSM_T8 ? 2 : 1)))

#define VRAM_BASE (0x44000000)

#define VRAM_OFFSET2ADDRESS | ( | OFFSET |  | ) | (VRAM_BASE | OFFSET)

## 関数

static DXPTEXTURE3* dxpGraphHandle2TexPtr | ( | int | gh | ) | `[inline, static]`

static u32 dxpGraphics4444_8888 | ( | u32 | src | ) | `[inline, static]`

static u32 dxpGraphics5551_8888 | ( | u32 | src | ) | `[inline, static]`

static u32 dxpGraphics5650_8888 | ( | u32 | src | ) | `[inline, static]`

static u32 dxpGraphics8888_4444 | ( | u32 | src | ) | `[inline, static]`

static u32 dxpGraphics8888_5551 | ( | u32 | src | ) | `[inline, static]`

static u32 dxpGraphics8888_5650 | ( | u32 | src | ) | `[inline, static]`

int dxpGraphicsCalcTexSize | ( | int | width,
|  | int | height,
|  | int | psm |
| ) |  |  |

DXPGRAPHICSHANDLE* dxpGraphicsCreateGraphicHandle | ( |  | ) |

DXPTEXTURE3* dxpGraphicsCreateTexture | ( |  | ) |

int dxpGraphicsEnd | ( |  | ) |

int dxpGraphicsInit | ( |  | ) |

int dxpGraphicsReleseGraphicHandle | ( | DXPGRAPHICSHANDLE * | gptr | ) |

int dxpGraphicsReleseTexture | ( | DXPTEXTURE3 * | texptr | ) |

int dxpGraphicsSetup2D | ( | u32 | color | ) |

int dxpGraphicsSetup2DTex | ( | DXPTEXTURE3 * | texptr,
|  | int | flag |
| ) |  |  |

void dxpGraphicsWaitVSync | ( |  | ) |

static void* dxpGuGetMemory | ( | u32 | size | ) | `[inline, static]`

static int dxpN_2 | ( | int | num | ) | `[inline, static]`

## 変数

DXPGRAPHICSDATA dxpGraphicsData

u32 dxpGuList[GULIST_LEN]

u8 dxpPsm2SliceSize[11][2]