1.1 --- a/src/display.h Sun Oct 21 05:15:56 2007 +0000
1.2 +++ b/src/display.h Wed Oct 31 11:53:35 2007 +0000
1.5 - * $Id: display.h,v 1.10 2007-10-21 05:15:56 nkeynes Exp $
1.6 + * $Id: display.h,v 1.11 2007-10-31 09:10:23 nkeynes Exp $
1.8 * The PC side of the video support (responsible for actually displaying /
1.15 +#include "lxdream.h"
1.22 - * Supported colour formats. Note that ARGB4444 is only ever used for texture
1.23 + * Supported colour formats. Note that BGRA4444 is only ever used for texture
1.24 * rendering (it's not valid for display purposes).
1.26 -#define COLFMT_ARGB1555 0
1.27 +#define COLFMT_BGRA1555 0
1.28 #define COLFMT_RGB565 1
1.29 -#define COLFMT_ARGB4444 2
1.30 +#define COLFMT_BGRA4444 2
1.31 #define COLFMT_YUV422 3 /* 8-bit YUV (texture source only) */
1.32 -#define COLFMT_RGB888 4 /* 24-bit RGB */
1.33 -#define COLFMT_ARGB8888 5
1.34 +#define COLFMT_BGR888 4 /* 24-bit BGR */
1.35 +#define COLFMT_BGRA8888 5
1.36 #define COLFMT_INDEX4 6 /* 4 bit indexed colour (texture source only) */
1.37 #define COLFMT_INDEX8 7 /* 8-bit indexed colour (texture source only) */
1.38 -#define COLFMT_RGB0888 8 /* 32-bit RGB */
1.39 +#define COLFMT_BGR0888 8 /* 32-bit BGR */
1.40 +#define COLFMT_RGB888 9 /* 24-bit RGB (ie GL native) */
1.42 struct colour_format {
1.43 GLint type, format, int_format;
1.46 * Structure to hold pixel data held in GL buffers.
1.48 -typedef struct render_buffer {
1.49 +struct render_buffer {
1.54 sh4addr_t address; /* Address buffer was rendered to, or -1 for unrendered */
1.55 uint32_t size; /* Size of buffer in bytes, must be width*height*bpp */
1.56 + gboolean inverted;/* True if the buffer is upside down */
1.58 unsigned int buf_id; /* driver-specific buffer id, if applicable */
1.59 gboolean flushed; /* True if the buffer has been flushed to vram */
1.60 -} *render_buffer_t;
1.64 * Structure to hold pixel data stored in pvr2 vram, as opposed to data in
1.67 -typedef struct frame_buffer {
1.68 +struct frame_buffer {
1.74 uint32_t size; /* Size of buffer in bytes, must be width*height*bpp */
1.75 + gboolean inverted;/* True if the buffer is upside down */
1.77 -} * frame_buffer_t;
1.81 * Core video driver - exports function to setup a GL context, as well as handle
1.82 @@ -125,9 +128,10 @@
1.83 gboolean (*set_render_target)( render_buffer_t buffer );
1.86 - * Display a single frame using the supplied pixmap data.
1.87 + * Load the supplied frame buffer into the given render buffer.
1.88 + * Included here to allow driver-specific optimizations.
1.90 - gboolean (*display_frame_buffer)( frame_buffer_t buffer );
1.91 + void (*load_frame_buffer)( frame_buffer_t frame, render_buffer_t render );
1.94 * Display a single frame using a previously rendered GL buffer.
1.98 * Display a single blanked frame using a fixed colour for the
1.99 - * entire frame (specified in RGB888 format).
1.100 + * entire frame (specified in BGR888 format).
1.102 gboolean (*display_blank)( uint32_t rgb );
1.104 @@ -144,8 +148,14 @@
1.105 * Copy the image data from the GL buffer to the target memory buffer,
1.106 * using the format etc from the buffer. This may force a glFinish()
1.107 * but does not invalidate the buffer.
1.108 + * @param target buffer to fill with image data, which must be large enough
1.109 + * to accomodate the image.
1.110 + * @param buffer Render buffer to read from.
1.111 + * @param rowstride rowstride of the target data
1.112 + * @param format colour format to output the data in.
1.114 - gboolean (*read_render_buffer)( render_buffer_t buffer, unsigned char *target );
1.115 + gboolean (*read_render_buffer)( unsigned char *target, render_buffer_t buffer,
1.116 + int rowstride, int format );
1.118 } *display_driver_t;