Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 63e90c6f974301ed6e037d93940ef271 > files > 135

gens-gs-2.16.7-4.mga5.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>MDP - mdp_render.h: Renderers</title>
	<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
	<link rel='stylesheet' href='mdp.css' type='text/css'>
</head>

<body>

<h1 class='doc_title'>MDP - mdp_render.h: Renderers</h1>
<h4 class='doc_set'>Mega Drive Plugins v1.0.0<br>Revision 0</h4>

<div class='navbar'>
	<span class='navitem'><a href="index.html">Index</a></span>
	<span class='navarrow'>→</span>
	<span class='navitem'><a href="mdp_render_h.html">mdp_render.h</a></span>
</div>

<p>
The primary motivation for creating MDP was to allow renderers to be loaded
from outside of the main emulator. <span class='filename'>mdp_render.h</span>
provides the structs and constants needed to create a renderer using MDP.
</p>

<p>
The <span class='struct'>mdp_render_t</span> struct defines the basic renderer
information structure that is used to register a given rendering plugin with
the emulator via <span class='struct'>mdp_host_t</span>-><span class='function'>renderer_register()</span>.
</p>

<p>Format of the <span class='struct'>mdp_render_t</span> struct:</p>

<pre class='code'>
#include &quot;mdp/mdp_render.h&quot;

typedef struct PACKED _mdp_render_t
{
	/*! BEGIN: MDP v1.0 render plugin definition struct. !*/
	
	mdp_render_fn blit;	/* Blit function. */
	const char* tag;	/* Render tag. */
	
	int scale;		/* Scaling ratio. (1 == 320x240; 2 = 640x480; etc) */
	uint32_t flags;		/* Render flags. */
	
	void *data;		/* Extra data. */
	
	/*! END: MDP v1.0 render plugin definition struct. !*/
} mdp_render_t;
</pre>

<p>Fields:</p>

<table class='mdp_render_t'>
	<tr>
		<th>Field</th>
		<th>Type</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>blit</td>
		<td class='type'>mdp_render_fn</td>
		<td>
			Pointer to the main rendering function. The function prototype
			for <span class='type'>mdp_render_fn</span> is defined as:<br>
			typedef int (MDP_FNCALL *mdp_render_fn)(const mdp_render_info_t *renderInfo);
		</td>
	</tr>
	<tr>
		<td>tag</td>
		<td class='type'>const char*</td>
		<td>
			A short tag describing the renderer, e.g. &quot;2xSaI&quot;.
		</td>
	</tr>
	<tr>
		<td>scale</td>
		<td class='type'>int</td>
		<td>
			Scaling ratio. This indicates the integer zoom that the renderer
			performs on the source image. It must be greater than zero.
		</td>
	</tr>
	<tr>
		<td>flags</td>
		<td class='type'>uint32_t</td>
		<td>
			Render flags. See <a href="#render_flags">Render Flags</a> for
			more information.
		</td>
	</tr>
	<tr>
		<td>data</td>
		<td class='type'>void*</td>
		<td>
			User-defined data passed to the rendering function,
			<span class='function'>blit()</span>, when rendering an image.
		</td>
	</tr>
</table>

<hr>

<a name="render_flags">
<h2>Render Flags</h2>
</a>

<p>
The <span class='struct'>mdp_render_t</span> struct has a field
<span class='variable'>flags</span>, which indicates various features
that the renderer supports. This is a bitfield, so individual features
can be OR'd together to indicate that the renderer supports multiple
features.
</p>

<p>
Note: Color modes indicated are RGB555 (15-bit), RGB565 (16-bit),
and RGB888 (32-bit). 24-bit color is not supported by MDP.
</p>

<p>Render Flag bits:</p>

<table class='render_flags'>
	<tr>
		<th>Flag</th>
		<th>Value</th>
		<th>Description</th>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_555to555</td>
		<td class='value'>(1 << 0)</td>
		<td>
			Renderer suppots blitting an RGB555 source to an RGB555 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_555to565</td>
		<td class='value'>(1 << 1)</td>
		<td>
			Renderer suppots blitting an RGB555 source to an RGB565 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_555to888</td>
		<td class='value'>(1 << 2)</td>
		<td>
			Renderer suppots blitting an RGB555 source to an RGB888 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_565to555</td>
		<td class='value'>(1 << 3)</td>
		<td>
			Renderer suppots blitting an RGB565 source to an RGB555 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_565to565</td>
		<td class='value'>(1 << 4)</td>
		<td>
			Renderer suppots blitting an RGB565 source to an RGB565 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_565to888</td>
		<td class='value'>(1 << 5)</td>
		<td>
			Renderer suppots blitting an RGB565 source to an RGB888 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_888to555</td>
		<td class='value'>(1 << 6)</td>
		<td>
			Renderer suppots blitting an RGB888 source to an RGB555 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_888to565</td>
		<td class='value'>(1 << 7)</td>
		<td>
			Renderer suppots blitting an RGB888 source to an RGB565 destination.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_FLAG_RGB_888to888</td>
		<td class='value'>(1 << 8)</td>
		<td>
			Renderer suppots blitting an RGB888 source to an RGB888 destination.
		</td>
	</tr>
</table>

<hr>

<a name="mdp_render_info_t">
<h2>mdp_render_info_t</h2>
</a>

<p>
The <span class='struct'>mdp_render_info_t</span> struct is passed to
<span class='function'>mdp_render_fn</span> functions when the emulator
wants to render an image.
</p>

<p>Format of the <span class='struct'>mdp_render_t</span> struct:</p>

<pre class='code'>
#include &quot;mdp/mdp_render.h&quot;

typedef struct PACKED _mdp_render_info_t
{
	/*! BEGIN: MDP v1.0 render information struct. !*/
	
	void *destScreen;	/* Destination screen buffer. */
	void *mdScreen;		/* Source screen buffer. */
	
	int destPitch;		/* Destination screen buffer pitch. */
	int srcPitch;		/* Source screen buffer pitch. */
	
	int width;		/* Image width. */
	int height;		/* Image height. */
	
	uint32_t cpuFlags;	/* CPU flags. */
	uint32_t vmodeFlags;	/* Video mode flags. */
	
	void *data;		/* Extra data set by the plugin. */
	
	/*! END: MDP v1.0 render information struct. !*/
} mdp_render_info_t;
</pre>

<p>Fields:</p>

<table class='mdp_render_info_t'>
	<tr>
		<th>Field</th>
		<th>Type</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>destScreen</td>
		<td class='type'>void*</td>
		<td>
			Pointer to the destination screen buffer.
		</td>
	</tr>
	<tr>
		<td>mdScreen</td>
		<td class='type'>void*</td>
		<td>
			Pointer to the source screen buffer.
		</td>
	</tr>
	<tr>
		<td>destPitch</td>
		<td class='type'>int</td>
		<td>
			Pitch of the destination screen buffer, in bytes.
		</td>
	</tr>
	<tr>
		<td>srcPitch</td>
		<td class='type'>int</td>
		<td>
			Pitch of the source screen buffer, in bytes.
		</td>
	</tr>
	<tr>
		<td>width</td>
		<td class='type'>int</td>
		<td>
			Width of the image to blit, in pixels.
		</td>
	</tr>
	<tr>
		<td>height</td>
		<td class='type'>int</td>
		<td>
			Height of the image to blit, in pixels.
		</td>
	</tr>
	<tr>
		<td>cpuFlags</td>
		<td class='type'>uint32_t</td>
		<td>
			System CPU flags. See <a href="mdp_cpuflags_h.html"><span class='filename'>mdp_cpuflags.h</span></a>
			for a description of the CPU flags field.
		</td>
	</tr>
	<tr>
		<td>vmodeFlags</td>
		<td class='type'>uint32_t</td>
		<td>
			Video mode flags. See <a href="#vmode_flags">Video Mode Flags</a>
			for more information.
		</td>
	</tr>
	<tr>
		<td>data</td>
		<td class='type'>void*</td>
		<td>
			User-defined data specified in the
			<span class='struct'>mdp_render_t</span> struct.
		</td>
	</tr>
</table>

<a name="vmode_flags">
<h2>Video Mode Flags</h2>
</a>

<p>
The Video Mode Flags are specified in the <span class='struct'>mdp_render_info_t</span>
struct in order to tell the rendering plugin what the current video
mode is. In MDP v1.0, there are currently four bits indicatin what the source and
destination video modes are. Two bits are used for each one.
</p>

<p>Video Modes:</p>

<table class='vmodeFlags'>
	<tr>
		<th>Flag</th>
		<th>Value</th>
		<th>Description</th>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_VMODE_RGB_555</td>
		<td class='value'>0x00</td>
		<td>
			RGB555 (15-bit).
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_VMODE_RGB_565</td>
		<td class='value'>0x01</td>
		<td>
			RGB565 (16-bit).
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_VMODE_RGB_888</td>
		<td class='value'>0x02</td>
		<td>
			RGB888 (32-bit).
		</td>
	</tr>
</table>

<p>
Two convenience macros are provided for retrieving the video mode
flags from the <span class='variable'>vmodeFlags</span> field:
</p>

<table class='vmodeFlags'>
	<tr>
		<th>Macro</th>
		<th>Description</th>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_VMODE_GET_SRC(x)</td>
		<td>
			Get the source video mode.
		</td>
	</tr>
	<tr>
		<td class='macro'>MDP_RENDER_VMODE_GET_DST(x)</td>
		<td>
			Get the destination video mode.
		</td>
	</tr>
</table>

<p>
The plugin should check both the source and destination video modes
and act appropriately. If the plugin doesn't support a specific combination,
it should return the error code -<span class='value'>-MDP_ERR_RENDER_UNSUPPORTED_VMODE</span>.
</p>

</body>
</html>