Search
lxdream.org :: lxdream/src/display.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/display.h
changeset 477:9a373f2ff009
prev451:50622730f226
next502:c4ecae2b1b5e
author nkeynes
date Tue Nov 06 08:35:16 2007 +0000 (16 years ago)
permissions -rw-r--r--
last change Issue #37: Add nulldc GDI format
file annotate diff log raw
1.1 --- a/src/display.h Sun Oct 21 05:15:56 2007 +0000
1.2 +++ b/src/display.h Tue Nov 06 08:35:16 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
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.7 *
1.8 * The PC side of the video support (responsible for actually displaying /
1.9 * rendering frames)
1.10 @@ -23,25 +23,26 @@
1.11 #include <stdint.h>
1.12 #include <glib.h>
1.13 #include <GL/gl.h>
1.14 -#include "dream.h"
1.15 +#include "lxdream.h"
1.16
1.17 #ifdef __cplusplus
1.18 extern "C" {
1.19 #endif
1.20
1.21 /**
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.25 */
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.41
1.42 struct colour_format {
1.43 GLint type, format, int_format;
1.44 @@ -54,31 +55,33 @@
1.45 /**
1.46 * Structure to hold pixel data held in GL buffers.
1.47 */
1.48 -typedef struct render_buffer {
1.49 +struct render_buffer {
1.50 uint32_t width;
1.51 uint32_t height;
1.52 uint32_t rowstride;
1.53 int colour_format;
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.57 int scale;
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.61 +};
1.62
1.63 /**
1.64 * Structure to hold pixel data stored in pvr2 vram, as opposed to data in
1.65 * GL buffers.
1.66 */
1.67 -typedef struct frame_buffer {
1.68 +struct frame_buffer {
1.69 uint32_t width;
1.70 uint32_t height;
1.71 uint32_t rowstride;
1.72 int colour_format;
1.73 sh4addr_t address;
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.76 char *data;
1.77 -} * frame_buffer_t;
1.78 +};
1.79
1.80 /**
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.84
1.85 /**
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.89 */
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.92
1.93 /**
1.94 * Display a single frame using a previously rendered GL buffer.
1.95 @@ -136,7 +140,7 @@
1.96
1.97 /**
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.101 */
1.102 gboolean (*display_blank)( uint32_t rgb );
1.103
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.113 */
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.117
1.118 } *display_driver_t;
1.119
.