RetroArch
Classes | Macros | Typedefs | Functions | Variables
vita2d.c File Reference
#include <psp2/display.h>
#include <psp2/gxm.h>
#include <psp2/types.h>
#include <psp2/kernel/sysmem.h>
#include <psp2/message_dialog.h>
#include <psp2/sysmodule.h>
#include <string.h>
#include <stdlib.h>
#include "vita2d.h"
#include "utils.h"
Include dependency graph for vita2d.c:

Classes

struct  vita2d_display_data
 

Macros

#define VITA2D_DEBUG(...)
 
#define DISPLAY_WIDTH   960
 
#define DISPLAY_HEIGHT   544
 
#define DISPLAY_STRIDE_IN_PIXELS   1024
 
#define DISPLAY_COLOR_FORMAT   SCE_GXM_COLOR_FORMAT_A8B8G8R8
 
#define DISPLAY_PIXEL_FORMAT   SCE_DISPLAY_PIXELFORMAT_A8B8G8R8
 
#define DISPLAY_BUFFER_COUNT   3
 
#define DISPLAY_MAX_PENDING_SWAPS   2
 
#define MSAA_MODE   SCE_GXM_MULTISAMPLE_NONE
 
#define DEFAULT_TEMP_POOL_SIZE   (1 * 1024 * 1024)
 

Typedefs

typedef struct vita2d_display_data vita2d_display_data
 

Functions

static voidpatcher_host_alloc (void *user_data, unsigned int size)
 
static void patcher_host_free (void *user_data, void *mem)
 
static void display_callback (const void *callback_data)
 
int vita2d_init ()
 
int vita2d_init_advanced (unsigned int temp_pool_size)
 
void vita2d_wait_rendering_done ()
 
int vita2d_fini ()
 
void vita2d_clear_screen ()
 
void vita2d_swap_buffers ()
 
void vita2d_start_drawing ()
 
void vita2d_end_drawing ()
 
int vita2d_common_dialog_update ()
 
void vita2d_set_clear_color (unsigned int color)
 
unsigned int vita2d_get_clear_color ()
 
void vita2d_set_vblank_wait (int enable)
 
voidvita2d_get_current_fb ()
 
void vita2d_set_region_clip (SceGxmRegionClipMode mode, unsigned int x_min, unsigned int y_min, unsigned int x_max, unsigned int y_max)
 
voidvita2d_pool_malloc (unsigned int size)
 
voidvita2d_pool_memalign (unsigned int size, unsigned int alignment)
 
unsigned int vita2d_pool_free_space ()
 
void vita2d_pool_reset ()
 

Variables

const SceGxmProgram clear_v_gxp
 
const SceGxmProgram clear_f_gxp
 
const SceGxmProgram color_v_gxp
 
const SceGxmProgram color_f_gxp
 
const SceGxmProgram texture_v_gxp
 
const SceGxmProgram texture_f_gxp
 
const SceGxmProgram texture_tint_f_gxp
 
static int pgf_module_was_loaded = 0
 
static const SceGxmProgram *const clearVertexProgramGxp = &clear_v_gxp
 
static const SceGxmProgram *const clearFragmentProgramGxp = &clear_f_gxp
 
static const SceGxmProgram *const colorVertexProgramGxp = &color_v_gxp
 
static const SceGxmProgram *const colorFragmentProgramGxp = &color_f_gxp
 
static const SceGxmProgram *const textureVertexProgramGxp = &texture_v_gxp
 
static const SceGxmProgram *const textureFragmentProgramGxp = &texture_f_gxp
 
static const SceGxmProgram *const textureTintFragmentProgramGxp = &texture_tint_f_gxp
 
static int vita2d_initialized = 0
 
static float clear_color [4] = {0.0f, 0.0f, 0.0f, 1.0f}
 
static unsigned int clear_color_u = 0xff000000
 
static int vblank_wait = 1
 
static SceUID vdmRingBufferUid
 
static SceUID vertexRingBufferUid
 
static SceUID fragmentRingBufferUid
 
static SceUID fragmentUsseRingBufferUid
 
static SceGxmContextParams contextParams
 
static SceGxmRenderTarget * renderTarget = NULL
 
static SceUID displayBufferUid [DISPLAY_BUFFER_COUNT]
 
static voiddisplayBufferData [DISPLAY_BUFFER_COUNT]
 
static SceGxmColorSurface displaySurface [DISPLAY_BUFFER_COUNT]
 
static SceGxmSyncObject * displayBufferSync [DISPLAY_BUFFER_COUNT]
 
static SceUID depthBufferUid
 
static SceGxmDepthStencilSurface depthSurface
 
static voiddepthBufferData = NULL
 
static unsigned int backBufferIndex = 0
 
static unsigned int frontBufferIndex = 0
 
static SceGxmShaderPatcher * shaderPatcher = NULL
 
static SceGxmVertexProgram * clearVertexProgram = NULL
 
static SceGxmFragmentProgram * clearFragmentProgram = NULL
 
static SceGxmShaderPatcherId clearVertexProgramId
 
static SceGxmShaderPatcherId clearFragmentProgramId
 
static SceGxmShaderPatcherId colorVertexProgramId
 
static SceGxmShaderPatcherId colorFragmentProgramId
 
static SceGxmShaderPatcherId textureVertexProgramId
 
static SceGxmShaderPatcherId textureFragmentProgramId
 
static SceGxmShaderPatcherId textureTintFragmentProgramId
 
static SceUID patcherBufferUid
 
static SceUID patcherVertexUsseUid
 
static SceUID patcherFragmentUsseUid
 
static SceUID clearVerticesUid
 
static SceUID clearIndicesUid
 
static vita2d_clear_vertexclearVertices = NULL
 
static uint16_tclearIndices = NULL
 
float _vita2d_ortho_matrix [4 *4]
 
SceGxmContext * _vita2d_context = NULL
 
SceGxmVertexProgram * _vita2d_colorVertexProgram = NULL
 
SceGxmFragmentProgram * _vita2d_colorFragmentProgram = NULL
 
SceGxmVertexProgram * _vita2d_textureVertexProgram = NULL
 
SceGxmFragmentProgram * _vita2d_textureFragmentProgram = NULL
 
SceGxmFragmentProgram * _vita2d_textureTintFragmentProgram = NULL
 
const SceGxmProgramParameter * _vita2d_clearClearColorParam = NULL
 
const SceGxmProgramParameter * _vita2d_colorWvpParam = NULL
 
const SceGxmProgramParameter * _vita2d_textureWvpParam = NULL
 
const SceGxmProgramParameter * _vita2d_textureTintColorParam = NULL
 
static voidpool_addr = NULL
 
static SceUID poolUid
 
static unsigned int pool_index = 0
 
static unsigned int pool_size = 0
 

Macro Definition Documentation

◆ DEFAULT_TEMP_POOL_SIZE

#define DEFAULT_TEMP_POOL_SIZE   (1 * 1024 * 1024)

◆ DISPLAY_BUFFER_COUNT

#define DISPLAY_BUFFER_COUNT   3

◆ DISPLAY_COLOR_FORMAT

#define DISPLAY_COLOR_FORMAT   SCE_GXM_COLOR_FORMAT_A8B8G8R8

◆ DISPLAY_HEIGHT

#define DISPLAY_HEIGHT   544

◆ DISPLAY_MAX_PENDING_SWAPS

#define DISPLAY_MAX_PENDING_SWAPS   2

◆ DISPLAY_PIXEL_FORMAT

#define DISPLAY_PIXEL_FORMAT   SCE_DISPLAY_PIXELFORMAT_A8B8G8R8

◆ DISPLAY_STRIDE_IN_PIXELS

#define DISPLAY_STRIDE_IN_PIXELS   1024

◆ DISPLAY_WIDTH

#define DISPLAY_WIDTH   960

◆ MSAA_MODE

#define MSAA_MODE   SCE_GXM_MULTISAMPLE_NONE

◆ VITA2D_DEBUG

#define VITA2D_DEBUG (   ...)

Typedef Documentation

◆ vita2d_display_data

Function Documentation

◆ display_callback()

static void display_callback ( const void callback_data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ patcher_host_alloc()

static void* patcher_host_alloc ( void user_data,
unsigned int  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ patcher_host_free()

static void patcher_host_free ( void user_data,
void mem 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vita2d_clear_screen()

void vita2d_clear_screen ( )

◆ vita2d_common_dialog_update()

int vita2d_common_dialog_update ( )
Here is the call graph for this function:

◆ vita2d_end_drawing()

void vita2d_end_drawing ( )
Here is the caller graph for this function:

◆ vita2d_fini()

int vita2d_fini ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vita2d_get_clear_color()

unsigned int vita2d_get_clear_color ( )
Here is the caller graph for this function:

◆ vita2d_get_current_fb()

void* vita2d_get_current_fb ( )

◆ vita2d_init()

int vita2d_init ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vita2d_init_advanced()

int vita2d_init_advanced ( unsigned int  temp_pool_size)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vita2d_pool_free_space()

unsigned int vita2d_pool_free_space ( )

◆ vita2d_pool_malloc()

void* vita2d_pool_malloc ( unsigned int  size)

◆ vita2d_pool_memalign()

void* vita2d_pool_memalign ( unsigned int  size,
unsigned int  alignment 
)
Here is the caller graph for this function:

◆ vita2d_pool_reset()

void vita2d_pool_reset ( )
Here is the caller graph for this function:

◆ vita2d_set_clear_color()

void vita2d_set_clear_color ( unsigned int  color)
Here is the caller graph for this function:

◆ vita2d_set_region_clip()

void vita2d_set_region_clip ( SceGxmRegionClipMode  mode,
unsigned int  x_min,
unsigned int  y_min,
unsigned int  x_max,
unsigned int  y_max 
)

◆ vita2d_set_vblank_wait()

void vita2d_set_vblank_wait ( int  enable)
Here is the caller graph for this function:

◆ vita2d_start_drawing()

void vita2d_start_drawing ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vita2d_swap_buffers()

void vita2d_swap_buffers ( )
Here is the caller graph for this function:

◆ vita2d_wait_rendering_done()

void vita2d_wait_rendering_done ( )
Here is the caller graph for this function:

Variable Documentation

◆ _vita2d_clearClearColorParam

const SceGxmProgramParameter* _vita2d_clearClearColorParam = NULL

◆ _vita2d_colorFragmentProgram

SceGxmFragmentProgram* _vita2d_colorFragmentProgram = NULL

◆ _vita2d_colorVertexProgram

SceGxmVertexProgram* _vita2d_colorVertexProgram = NULL

◆ _vita2d_colorWvpParam

const SceGxmProgramParameter* _vita2d_colorWvpParam = NULL

◆ _vita2d_context

SceGxmContext* _vita2d_context = NULL

◆ _vita2d_ortho_matrix

float _vita2d_ortho_matrix[4 *4]

◆ _vita2d_textureFragmentProgram

SceGxmFragmentProgram* _vita2d_textureFragmentProgram = NULL

◆ _vita2d_textureTintColorParam

const SceGxmProgramParameter* _vita2d_textureTintColorParam = NULL

◆ _vita2d_textureTintFragmentProgram

SceGxmFragmentProgram* _vita2d_textureTintFragmentProgram = NULL

◆ _vita2d_textureVertexProgram

SceGxmVertexProgram* _vita2d_textureVertexProgram = NULL

◆ _vita2d_textureWvpParam

const SceGxmProgramParameter* _vita2d_textureWvpParam = NULL

◆ backBufferIndex

unsigned int backBufferIndex = 0
static

◆ clear_color

float clear_color[4] = {0.0f, 0.0f, 0.0f, 1.0f}
static

◆ clear_color_u

unsigned int clear_color_u = 0xff000000
static

◆ clear_f_gxp

const SceGxmProgram clear_f_gxp

◆ clear_v_gxp

const SceGxmProgram clear_v_gxp

◆ clearFragmentProgram

SceGxmFragmentProgram* clearFragmentProgram = NULL
static

◆ clearFragmentProgramGxp

const SceGxmProgram* const clearFragmentProgramGxp = &clear_f_gxp
static

◆ clearFragmentProgramId

SceGxmShaderPatcherId clearFragmentProgramId
static

◆ clearIndices

uint16_t* clearIndices = NULL
static

◆ clearIndicesUid

SceUID clearIndicesUid
static

◆ clearVertexProgram

SceGxmVertexProgram* clearVertexProgram = NULL
static

◆ clearVertexProgramGxp

const SceGxmProgram* const clearVertexProgramGxp = &clear_v_gxp
static

◆ clearVertexProgramId

SceGxmShaderPatcherId clearVertexProgramId
static

◆ clearVertices

vita2d_clear_vertex* clearVertices = NULL
static

◆ clearVerticesUid

SceUID clearVerticesUid
static

◆ color_f_gxp

const SceGxmProgram color_f_gxp

◆ color_v_gxp

const SceGxmProgram color_v_gxp

◆ colorFragmentProgramGxp

const SceGxmProgram* const colorFragmentProgramGxp = &color_f_gxp
static

◆ colorFragmentProgramId

SceGxmShaderPatcherId colorFragmentProgramId
static

◆ colorVertexProgramGxp

const SceGxmProgram* const colorVertexProgramGxp = &color_v_gxp
static

◆ colorVertexProgramId

SceGxmShaderPatcherId colorVertexProgramId
static

◆ contextParams

SceGxmContextParams contextParams
static

◆ depthBufferData

void* depthBufferData = NULL
static

◆ depthBufferUid

SceUID depthBufferUid
static

◆ depthSurface

SceGxmDepthStencilSurface depthSurface
static

◆ displayBufferData

void* displayBufferData[DISPLAY_BUFFER_COUNT]
static

◆ displayBufferSync

SceGxmSyncObject* displayBufferSync[DISPLAY_BUFFER_COUNT]
static

◆ displayBufferUid

static SceUID displayBufferUid
static

◆ displaySurface

SceGxmColorSurface displaySurface[DISPLAY_BUFFER_COUNT]
static

◆ fragmentRingBufferUid

SceUID fragmentRingBufferUid
static

◆ fragmentUsseRingBufferUid

SceUID fragmentUsseRingBufferUid
static

◆ frontBufferIndex

unsigned int frontBufferIndex = 0
static

◆ patcherBufferUid

SceUID patcherBufferUid
static

◆ patcherFragmentUsseUid

SceUID patcherFragmentUsseUid
static

◆ patcherVertexUsseUid

SceUID patcherVertexUsseUid
static

◆ pgf_module_was_loaded

int pgf_module_was_loaded = 0
static

◆ pool_addr

void* pool_addr = NULL
static

◆ pool_index

unsigned int pool_index = 0
static

◆ pool_size

unsigned int pool_size = 0
static

◆ poolUid

SceUID poolUid
static

◆ renderTarget

SceGxmRenderTarget* renderTarget = NULL
static

◆ shaderPatcher

SceGxmShaderPatcher* shaderPatcher = NULL
static

◆ texture_f_gxp

const SceGxmProgram texture_f_gxp

◆ texture_tint_f_gxp

const SceGxmProgram texture_tint_f_gxp

◆ texture_v_gxp

const SceGxmProgram texture_v_gxp

◆ textureFragmentProgramGxp

const SceGxmProgram* const textureFragmentProgramGxp = &texture_f_gxp
static

◆ textureFragmentProgramId

SceGxmShaderPatcherId textureFragmentProgramId
static

◆ textureTintFragmentProgramGxp

const SceGxmProgram* const textureTintFragmentProgramGxp = &texture_tint_f_gxp
static

◆ textureTintFragmentProgramId

SceGxmShaderPatcherId textureTintFragmentProgramId
static

◆ textureVertexProgramGxp

const SceGxmProgram* const textureVertexProgramGxp = &texture_v_gxp
static

◆ textureVertexProgramId

SceGxmShaderPatcherId textureVertexProgramId
static

◆ vblank_wait

int vblank_wait = 1
static

◆ vdmRingBufferUid

SceUID vdmRingBufferUid
static

◆ vertexRingBufferUid

SceUID vertexRingBufferUid
static

◆ vita2d_initialized

int vita2d_initialized = 0
static