1.1 --- a/src/display.h Sat Jan 27 12:03:53 2007 +0000
1.2 +++ b/src/display.h Tue Sep 04 08:40:23 2007 +0000
1.5 - * $Id: display.h,v 1.4 2007-01-27 12:03:53 nkeynes Exp $
1.6 + * $Id: display.h,v 1.5 2007-02-11 10:09:32 nkeynes Exp $
1.8 * The PC side of the video support (responsible for actually displaying /
1.11 #ifndef dream_video_H
1.12 #define dream_video_H
1.20 extern int colour_format_bytes[];
1.22 -typedef struct video_buffer {
1.26 + * Structure to hold pixel data held in GL buffers.
1.28 +typedef struct render_buffer {
1.33 - gboolean line_double;
1.36 + sh4addr_t address; /* Address buffer was rendered to, or -1 for unrendered */
1.37 + uint32_t size; /* Size of buffer in bytes, must be width*height*bpp */
1.39 + int buf_id; /* driver-specific buffer id, if applicable */
1.40 + gboolean flushed; /* True if the buffer has been flushed to vram */
1.41 +} *render_buffer_t;
1.44 - * Core video driver - expected to directly support an OpenGL context
1.45 + * Structure to hold pixel data stored in pvr2 vram, as opposed to data in
1.48 +typedef struct frame_buffer {
1.51 + uint32_t rowstride;
1.52 + int colour_format;
1.53 + sh4addr_t address;
1.54 + uint32_t size; /* Size of buffer in bytes, must be width*height*bpp */
1.56 +} * frame_buffer_t;
1.59 + * Core video driver - exports function to setup a GL context, as well as handle
1.60 + * keyboard input and display resultant output.
1.62 typedef struct display_driver {
1.64 @@ -87,47 +109,44 @@
1.65 uint16_t (*resolve_keysym)( const gchar *keysym );
1.68 - * Set the current display format to the specified values. This is
1.69 - * called immediately prior to any display frame call where the
1.70 - * parameters have changed from the previous frame
1.71 + * Create a render target with the given width and height.
1.73 - gboolean (*set_display_format)( uint32_t hres, uint32_t vres,
1.75 + render_buffer_t (*create_render_buffer)( uint32_t width, uint32_t height );
1.78 - * Set the current rendering format to the specified values. This is
1.79 - * called immediately prior to starting rendering of a frame where the
1.80 - * parameters have changed from the previous frame. Note that the driver
1.81 - * is not required to precisely support the requested colour format.
1.83 - * This method is also responsible for setting up an appropriate GL
1.84 - * context for the main engine to render into.
1.86 - * @param hres The horizontal resolution (ie 640)
1.87 - * @param vres The vertical resolution (ie 480)
1.88 - * @param colour_fmt The colour format of the buffer (ie COLFMT_ARGB4444)
1.89 - * @param texture Flag indicating that the frame being rendered is a
1.90 - * texture, rather than a display frame.
1.91 + * Destroy the specified render buffer and release any associated
1.94 - gboolean (*set_render_format)( uint32_t hres, uint32_t vres,
1.95 - int colour_fmt, gboolean texture );
1.96 + void (*destroy_render_buffer)( render_buffer_t buffer );
1.99 - * Display a single frame using the supplied pixmap data. Is assumed to
1.100 - * invalidate the current GL front buffer (but not the back buffer).
1.101 + * Set the current rendering target to the specified buffer.
1.103 - gboolean (*display_frame)( video_buffer_t buffer );
1.104 + gboolean (*set_render_target)( render_buffer_t buffer );
1.107 + * Display a single frame using the supplied pixmap data.
1.109 + gboolean (*display_frame_buffer)( frame_buffer_t buffer );
1.112 + * Display a single frame using a previously rendered GL buffer.
1.114 + gboolean (*display_render_buffer)( render_buffer_t buffer );
1.117 * Display a single blanked frame using a fixed colour for the
1.118 - * entire frame (specified in RGB888 format). Is assumed to invalidate
1.119 - * the current GL front buffer (but not the back buffer).
1.120 + * entire frame (specified in RGB888 format).
1.122 - gboolean (*display_blank_frame)( uint32_t rgb );
1.123 + gboolean (*display_blank)( uint32_t rgb );
1.126 - * Promote the current render back buffer to the front buffer
1.127 + * Copy the image data from the GL buffer to the target memory buffer,
1.128 + * using the format etc from the buffer. This may force a glFinish()
1.129 + * but does not invalidate the buffer.
1.131 - void (*display_back_buffer)( void );
1.132 + gboolean (*read_render_buffer)( render_buffer_t buffer, char *target );
1.134 } *display_driver_t;
1.136 void video_open( void );