2012-04-21 21:13:50 +00:00
|
|
|
|
/* RetroArch - A frontend for libretro.
|
2013-01-01 00:37:37 +00:00
|
|
|
|
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
|
|
|
|
* Copyright (C) 2011-2013 - Daniel De Matteis
|
2012-01-05 11:37:27 +00:00
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2012-01-05 11:37:27 +00:00
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2012-01-05 11:37:27 +00:00
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2012-01-05 11:37:27 +00:00
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-05-28 00:29:51 +00:00
|
|
|
|
#ifdef _XBOX
|
2012-01-05 11:37:27 +00:00
|
|
|
|
#include <xtl.h>
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#include <xgraphics.h>
|
2012-05-28 00:29:51 +00:00
|
|
|
|
#endif
|
2012-04-17 03:23:54 +00:00
|
|
|
|
|
2012-01-05 12:30:13 +00:00
|
|
|
|
#include "../driver.h"
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#include "xdk_d3d.h"
|
2012-05-28 00:29:51 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_HLSL
|
2012-04-14 19:45:43 +00:00
|
|
|
|
#include "../gfx/shader_hlsl.h"
|
2012-05-28 00:29:51 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "./../gfx/gfx_context.h"
|
2012-01-05 12:30:13 +00:00
|
|
|
|
#include "../general.h"
|
2012-02-16 15:14:31 +00:00
|
|
|
|
#include "../message.h"
|
2012-01-05 11:37:27 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-13 12:46:50 +00:00
|
|
|
|
#ifdef _XBOX1
|
|
|
|
|
#define HAVE_MENU_PANEL
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-07-16 00:15:47 +00:00
|
|
|
|
#include "../xdk/xdk_resources.h"
|
2012-03-17 23:23:11 +00:00
|
|
|
|
|
2013-03-10 22:24:28 +00:00
|
|
|
|
#ifdef HAVE_RGUI
|
|
|
|
|
#include "../frontend/menu/rgui.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#if defined(_XBOX1)
|
|
|
|
|
unsigned font_x, font_y;
|
|
|
|
|
#elif defined(_XBOX360)
|
2013-01-09 16:59:23 +00:00
|
|
|
|
#include "../frontend/menu/rmenu_xui.h"
|
2012-07-15 05:25:42 +00:00
|
|
|
|
const DWORD g_MapLinearToSrgbGpuFormat[] =
|
|
|
|
|
{
|
|
|
|
|
GPUTEXTUREFORMAT_1_REVERSE,
|
|
|
|
|
GPUTEXTUREFORMAT_1,
|
|
|
|
|
GPUTEXTUREFORMAT_8,
|
|
|
|
|
GPUTEXTUREFORMAT_1_5_5_5,
|
|
|
|
|
GPUTEXTUREFORMAT_5_6_5,
|
|
|
|
|
GPUTEXTUREFORMAT_6_5_5,
|
|
|
|
|
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_8_A,
|
|
|
|
|
GPUTEXTUREFORMAT_8_B,
|
|
|
|
|
GPUTEXTUREFORMAT_8_8,
|
|
|
|
|
GPUTEXTUREFORMAT_Cr_Y1_Cb_Y0_REP,
|
|
|
|
|
GPUTEXTUREFORMAT_Y1_Cr_Y0_Cb_REP,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_EDRAM,
|
|
|
|
|
GPUTEXTUREFORMAT_8_8_8_8_A,
|
|
|
|
|
GPUTEXTUREFORMAT_4_4_4_4,
|
|
|
|
|
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_16_16_EDRAM,
|
|
|
|
|
GPUTEXTUREFORMAT_24_8,
|
|
|
|
|
GPUTEXTUREFORMAT_24_8_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_16,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_16_EXPAND,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_EXPAND,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_16_16_EXPAND,
|
|
|
|
|
GPUTEXTUREFORMAT_16_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_16_16_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_32,
|
|
|
|
|
GPUTEXTUREFORMAT_32_32,
|
|
|
|
|
GPUTEXTUREFORMAT_32_32_32_32,
|
|
|
|
|
GPUTEXTUREFORMAT_32_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_32_32_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_32_32_32_32_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_32_AS_8,
|
|
|
|
|
GPUTEXTUREFORMAT_32_AS_8_8,
|
|
|
|
|
GPUTEXTUREFORMAT_16_MPEG,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_MPEG,
|
|
|
|
|
GPUTEXTUREFORMAT_8_INTERLACED,
|
|
|
|
|
GPUTEXTUREFORMAT_32_AS_8_INTERLACED,
|
|
|
|
|
GPUTEXTUREFORMAT_32_AS_8_8_INTERLACED,
|
|
|
|
|
GPUTEXTUREFORMAT_16_INTERLACED,
|
|
|
|
|
GPUTEXTUREFORMAT_16_MPEG_INTERLACED,
|
|
|
|
|
GPUTEXTUREFORMAT_16_16_MPEG_INTERLACED,
|
|
|
|
|
GPUTEXTUREFORMAT_DXN,
|
|
|
|
|
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
|
|
|
|
|
GPUTEXTUREFORMAT_32_32_32_FLOAT,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT3A,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT5A,
|
|
|
|
|
GPUTEXTUREFORMAT_CTX1,
|
|
|
|
|
GPUTEXTUREFORMAT_DXT3A_AS_1_1_1_1,
|
|
|
|
|
GPUTEXTUREFORMAT_8_8_8_8_GAMMA_EDRAM,
|
|
|
|
|
GPUTEXTUREFORMAT_2_10_10_10_FLOAT_EDRAM,
|
|
|
|
|
};
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#endif
|
2012-07-15 05:25:42 +00:00
|
|
|
|
|
2013-01-03 02:02:52 +00:00
|
|
|
|
static void check_window(void *data)
|
2012-05-28 00:29:51 +00:00
|
|
|
|
{
|
2013-01-03 02:02:52 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
|
2012-05-28 00:29:51 +00:00
|
|
|
|
bool quit, resize;
|
|
|
|
|
|
2012-11-19 03:09:16 +00:00
|
|
|
|
d3d->ctx_driver->check_window(&quit,
|
2012-12-14 19:33:07 +00:00
|
|
|
|
&resize, NULL, NULL, g_extern.frame_count);
|
2012-05-28 00:29:51 +00:00
|
|
|
|
|
|
|
|
|
if (quit)
|
2012-07-07 12:41:58 +00:00
|
|
|
|
d3d->quitting = true;
|
2012-05-28 00:29:51 +00:00
|
|
|
|
else if (resize)
|
2012-07-07 12:41:58 +00:00
|
|
|
|
d3d->should_resize = true;
|
2012-05-28 00:29:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-01 00:45:29 +00:00
|
|
|
|
#ifdef HAVE_HLSL
|
|
|
|
|
static bool hlsl_shader_init(void)
|
|
|
|
|
{
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
2013-04-12 19:25:16 +00:00
|
|
|
|
const gl_shader_backend_t *backend = NULL;
|
|
|
|
|
|
2013-04-07 01:00:08 +00:00
|
|
|
|
const char *shader_path = g_settings.video.shader_path;
|
2013-04-12 19:25:16 +00:00
|
|
|
|
enum rarch_shader_type type = gfx_shader_parse_type(shader_path, DEFAULT_SHADER_TYPE);
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_HLSL
|
|
|
|
|
case RARCH_SHADER_HLSL:
|
|
|
|
|
RARCH_LOG("[D3D]: Using HLSL shader backend.\n");
|
|
|
|
|
backend = &hlsl_backend;
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2012-10-01 00:45:29 +00:00
|
|
|
|
|
2013-04-12 19:25:16 +00:00
|
|
|
|
if (!backend)
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("[GL]: Didn't find valid shader backend. Continuing without shaders.\n");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d3d->shader = backend;
|
|
|
|
|
return d3d->shader->init(shader_path);
|
2012-10-01 00:45:29 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-01-03 02:02:52 +00:00
|
|
|
|
static void xdk_d3d_free(void *data)
|
2012-01-05 11:37:27 +00:00
|
|
|
|
{
|
2013-01-19 11:45:35 +00:00
|
|
|
|
#ifdef RARCH_CONSOLE
|
|
|
|
|
if (driver.video_data)
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
2012-02-02 18:01:52 +00:00
|
|
|
|
|
2012-07-07 12:41:58 +00:00
|
|
|
|
if (!d3d)
|
2012-01-05 11:37:27 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2012-12-15 03:36:19 +00:00
|
|
|
|
d3d->font_ctx->deinit(d3d);
|
2012-09-30 22:09:04 +00:00
|
|
|
|
|
2013-04-12 20:17:06 +00:00
|
|
|
|
#ifdef HAVE_HLSL
|
2013-04-12 19:56:43 +00:00
|
|
|
|
if (d3d->shader)
|
|
|
|
|
d3d->shader->deinit();
|
|
|
|
|
d3d->shader = NULL;
|
2013-04-12 20:17:06 +00:00
|
|
|
|
#endif
|
2013-04-12 19:56:43 +00:00
|
|
|
|
|
2012-11-19 03:09:16 +00:00
|
|
|
|
d3d->ctx_driver->destroy();
|
2012-04-15 16:13:24 +00:00
|
|
|
|
|
2012-07-07 12:41:58 +00:00
|
|
|
|
free(d3d);
|
2012-01-05 11:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#ifdef _XBOX360
|
2012-07-15 05:25:42 +00:00
|
|
|
|
|
|
|
|
|
static void xdk_convert_texture_to_as16_srgb( D3DTexture *pTexture )
|
|
|
|
|
{
|
|
|
|
|
pTexture->Format.SignX = GPUSIGN_GAMMA;
|
|
|
|
|
pTexture->Format.SignY = GPUSIGN_GAMMA;
|
|
|
|
|
pTexture->Format.SignZ = GPUSIGN_GAMMA;
|
|
|
|
|
|
|
|
|
|
XGTEXTURE_DESC desc;
|
|
|
|
|
XGGetTextureDesc( pTexture, 0, &desc );
|
|
|
|
|
|
|
|
|
|
//convert to AS_16_16_16_16 format
|
|
|
|
|
pTexture->Format.DataFormat = g_MapLinearToSrgbGpuFormat[ (desc.Format & D3DFORMAT_TEXTUREFORMAT_MASK) >> D3DFORMAT_TEXTUREFORMAT_SHIFT ];
|
|
|
|
|
}
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#endif
|
2012-07-15 05:25:42 +00:00
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
static void xdk_d3d_set_viewport(bool force_full)
|
2012-03-08 23:09:39 +00:00
|
|
|
|
{
|
2013-04-19 21:08:31 +00:00
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
2013-01-10 23:58:08 +00:00
|
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->d3d_render_device;
|
2013-04-19 21:08:31 +00:00
|
|
|
|
|
|
|
|
|
RD3DDevice_Clear(d3dr, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
|
|
|
|
|
|
2012-11-20 05:08:58 +00:00
|
|
|
|
unsigned width, height; // Set the viewport based on the current resolution
|
2012-04-10 19:23:42 +00:00
|
|
|
|
int m_viewport_x_temp, m_viewport_y_temp, m_viewport_width_temp, m_viewport_height_temp;
|
|
|
|
|
float m_zNear, m_zFar;
|
|
|
|
|
|
2012-11-20 05:08:58 +00:00
|
|
|
|
d3d->ctx_driver->get_video_size(&width, &height);
|
2012-04-10 19:23:42 +00:00
|
|
|
|
m_viewport_x_temp = 0;
|
|
|
|
|
m_viewport_y_temp = 0;
|
|
|
|
|
m_viewport_width_temp = width;
|
|
|
|
|
m_viewport_height_temp = height;
|
|
|
|
|
m_zNear = 0.0f;
|
|
|
|
|
m_zFar = 1.0f;
|
|
|
|
|
|
|
|
|
|
if (!force_full)
|
|
|
|
|
{
|
|
|
|
|
float desired_aspect = g_settings.video.aspect_ratio;
|
|
|
|
|
float device_aspect = (float)width / height;
|
|
|
|
|
float delta;
|
|
|
|
|
|
|
|
|
|
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
2012-05-22 00:19:40 +00:00
|
|
|
|
{
|
2012-05-29 13:25:39 +00:00
|
|
|
|
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
2012-11-20 14:44:44 +00:00
|
|
|
|
m_viewport_x_temp = g_extern.console.screen.viewports.custom_vp.x;
|
|
|
|
|
m_viewport_y_temp = g_extern.console.screen.viewports.custom_vp.y;
|
|
|
|
|
m_viewport_width_temp = g_extern.console.screen.viewports.custom_vp.width;
|
|
|
|
|
m_viewport_height_temp = g_extern.console.screen.viewports.custom_vp.height;
|
2012-05-22 00:19:40 +00:00
|
|
|
|
}
|
|
|
|
|
else if (device_aspect > desired_aspect)
|
2012-04-10 19:23:42 +00:00
|
|
|
|
{
|
|
|
|
|
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
2012-04-14 19:45:43 +00:00
|
|
|
|
m_viewport_x_temp = (int)(width * (0.5 - delta));
|
|
|
|
|
m_viewport_width_temp = (int)(2.0 * width * delta);
|
|
|
|
|
width = (unsigned)(2.0 * width * delta);
|
2012-04-10 19:23:42 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
delta = (device_aspect / desired_aspect - 1.0) / 2.0 + 0.5;
|
2012-04-14 19:45:43 +00:00
|
|
|
|
m_viewport_y_temp = (int)(height * (0.5 - delta));
|
|
|
|
|
m_viewport_height_temp = (int)(2.0 * height * delta);
|
|
|
|
|
height = (unsigned)(2.0 * height * delta);
|
2012-04-10 19:23:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 13:40:14 +00:00
|
|
|
|
D3DVIEWPORT vp = {0};
|
2012-04-10 19:23:42 +00:00
|
|
|
|
vp.Width = m_viewport_width_temp;
|
|
|
|
|
vp.Height = m_viewport_height_temp;
|
|
|
|
|
vp.X = m_viewport_x_temp;
|
|
|
|
|
vp.Y = m_viewport_y_temp;
|
|
|
|
|
vp.MinZ = m_zNear;
|
|
|
|
|
vp.MaxZ = m_zFar;
|
2013-04-16 14:47:20 +00:00
|
|
|
|
RD3DDevice_SetViewport(d3d->d3d_render_device, &vp);
|
2012-03-08 23:09:39 +00:00
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#ifdef _XBOX1
|
|
|
|
|
font_x = vp.X;
|
|
|
|
|
font_y = vp.Y;
|
|
|
|
|
#endif
|
2012-03-08 23:09:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-03 02:02:52 +00:00
|
|
|
|
static void xdk_d3d_set_rotation(void *data, unsigned orientation)
|
2012-03-10 15:41:10 +00:00
|
|
|
|
{
|
2012-04-10 19:23:42 +00:00
|
|
|
|
(void)data;
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
2012-11-20 14:03:20 +00:00
|
|
|
|
FLOAT angle = 0;
|
2012-04-10 19:23:42 +00:00
|
|
|
|
|
|
|
|
|
switch(orientation)
|
|
|
|
|
{
|
|
|
|
|
case ORIENTATION_NORMAL:
|
|
|
|
|
angle = M_PI * 0 / 180;
|
2012-11-20 14:44:44 +00:00
|
|
|
|
break;
|
2012-11-20 14:03:20 +00:00
|
|
|
|
case ORIENTATION_FLIPPED_ROTATED:
|
|
|
|
|
angle = M_PI * 90 / 180;
|
2012-04-14 19:45:43 +00:00
|
|
|
|
break;
|
2012-04-10 19:23:42 +00:00
|
|
|
|
case ORIENTATION_FLIPPED:
|
2012-04-14 19:45:43 +00:00
|
|
|
|
angle = M_PI * 180 / 180;
|
|
|
|
|
break;
|
2012-11-20 14:03:20 +00:00
|
|
|
|
case ORIENTATION_VERTICAL:
|
|
|
|
|
angle = M_PI * 270 / 180;
|
2012-04-14 19:45:43 +00:00
|
|
|
|
break;
|
2012-04-10 19:23:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-20 14:03:20 +00:00
|
|
|
|
#if defined(HAVE_HLSL)
|
2012-04-17 03:23:54 +00:00
|
|
|
|
/* TODO: Move to D3DXMATRIX here */
|
2012-11-20 14:16:54 +00:00
|
|
|
|
hlsl_set_proj_matrix(XMMatrixRotationZ(angle));
|
2012-11-20 14:03:20 +00:00
|
|
|
|
#elif defined(_XBOX1)
|
|
|
|
|
D3DXMATRIX p_out, p_rotate;
|
|
|
|
|
D3DXMatrixIdentity(&p_out);
|
|
|
|
|
D3DXMatrixRotationZ(&p_rotate, angle);
|
|
|
|
|
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_SetTransform(d3d->d3d_render_device, D3DTS_WORLD, &p_rotate);
|
|
|
|
|
RD3DDevice_SetTransform(d3d->d3d_render_device, D3DTS_VIEW, &p_out);
|
|
|
|
|
RD3DDevice_SetTransform(d3d->d3d_render_device, D3DTS_PROJECTION, &p_out);
|
2012-11-20 14:03:20 +00:00
|
|
|
|
#endif
|
2012-03-08 23:09:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 17:31:04 +00:00
|
|
|
|
#ifdef HAVE_FBO
|
2013-01-03 02:02:52 +00:00
|
|
|
|
void xdk_d3d_deinit_fbo(void *data)
|
2012-11-20 14:44:44 +00:00
|
|
|
|
{
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0
|
2013-01-03 02:02:52 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
|
2012-11-20 14:44:44 +00:00
|
|
|
|
if (d3d->fbo_inited)
|
|
|
|
|
{
|
2013-01-08 17:24:31 +00:00
|
|
|
|
RARCH_LOG("[xdk_d3d_deinit_fbo::] Deiniting FBO.\n");
|
2012-11-20 14:44:44 +00:00
|
|
|
|
if (d3d->lpTexture_ot)
|
|
|
|
|
{
|
|
|
|
|
d3d->lpTexture_ot->Release();
|
|
|
|
|
d3d->lpTexture_ot = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (d3d->lpSurface)
|
|
|
|
|
{
|
|
|
|
|
d3d->lpSurface->Release();
|
|
|
|
|
d3d->lpSurface = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
d3d->fbo_inited = false;
|
|
|
|
|
}
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#endif
|
2012-11-20 14:44:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-03 02:02:52 +00:00
|
|
|
|
void xdk_d3d_init_fbo(void *data)
|
2012-05-07 03:34:41 +00:00
|
|
|
|
{
|
2013-01-08 16:48:55 +00:00
|
|
|
|
HRESULT ret;
|
2013-01-03 02:02:52 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0
|
2012-11-20 14:44:44 +00:00
|
|
|
|
xdk_d3d_deinit_fbo(d3d);
|
2012-05-23 21:46:45 +00:00
|
|
|
|
|
2013-01-08 17:24:31 +00:00
|
|
|
|
ret = d3d->d3d_render_device->CreateTexture(d3d->tex_w * g_settings.video.fbo.scale_x, d3d->tex_h * g_settings.video.fbo.scale_y,
|
2012-11-21 17:52:37 +00:00
|
|
|
|
1, 0, g_extern.console.screen.gamma_correction ? ( D3DFORMAT )MAKESRGBFMT( D3DFMT_X8R8G8B8 ) : D3DFMT_X8R8G8B8,
|
2012-11-20 01:51:00 +00:00
|
|
|
|
0, &d3d->lpTexture_ot, NULL);
|
2012-05-23 21:46:45 +00:00
|
|
|
|
|
2013-01-08 17:24:31 +00:00
|
|
|
|
if (ret != S_OK)
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("[xdk_d3d_init_fbo::] Failed at CreateTexture.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-08 16:48:55 +00:00
|
|
|
|
ret = d3d->d3d_render_device->CreateRenderTarget(d3d->tex_w * g_settings.video.fbo.scale_x, d3d->tex_h * g_settings.video.fbo.scale_y,
|
2012-11-21 17:52:37 +00:00
|
|
|
|
g_extern.console.screen.gamma_correction ? ( D3DFORMAT )MAKESRGBFMT( D3DFMT_X8R8G8B8 ) : D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE,
|
2012-11-20 14:44:44 +00:00
|
|
|
|
0, 0, &d3d->lpSurface, NULL);
|
2012-05-23 21:46:45 +00:00
|
|
|
|
|
2013-01-08 16:48:55 +00:00
|
|
|
|
if (ret != S_OK)
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("[xdk_d3d_init_fbo::] Failed at CreateRenderTarget.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 12:41:58 +00:00
|
|
|
|
d3d->lpTexture_ot_as16srgb = *d3d->lpTexture_ot;
|
2012-07-15 05:25:42 +00:00
|
|
|
|
xdk_convert_texture_to_as16_srgb(d3d->lpTexture);
|
|
|
|
|
xdk_convert_texture_to_as16_srgb(&d3d->lpTexture_ot_as16srgb);
|
2012-11-20 14:44:44 +00:00
|
|
|
|
|
|
|
|
|
d3d->fbo_inited = true;
|
2012-07-07 17:31:04 +00:00
|
|
|
|
#endif
|
2013-04-06 04:21:11 +00:00
|
|
|
|
}
|
2013-04-06 21:10:15 +00:00
|
|
|
|
#endif
|
2012-05-23 21:46:45 +00:00
|
|
|
|
|
2013-04-07 17:43:54 +00:00
|
|
|
|
static bool xdk_d3d_set_shader(void *data, enum rarch_shader_type type, const char *path)
|
2013-01-02 16:23:31 +00:00
|
|
|
|
{
|
2013-04-07 17:43:54 +00:00
|
|
|
|
/* TODO - stub */
|
2013-01-07 15:46:26 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
return true;
|
2013-01-02 16:23:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-20 01:51:00 +00:00
|
|
|
|
void xdk_d3d_generate_pp(D3DPRESENT_PARAMETERS *d3dpp, const video_info_t *video)
|
2012-11-19 22:29:57 +00:00
|
|
|
|
{
|
2012-11-20 14:44:44 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
2013-01-12 02:13:03 +00:00
|
|
|
|
uint64_t lifecycle_mode_state = g_extern.lifecycle_mode_state;
|
2012-11-19 22:29:57 +00:00
|
|
|
|
|
2012-11-20 14:44:44 +00:00
|
|
|
|
memset(d3dpp, 0, sizeof(*d3dpp));
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
2012-11-21 17:52:37 +00:00
|
|
|
|
d3d->texture_fmt = video->rgb32 ? D3DFMT_X8R8G8B8 : D3DFMT_LIN_R5G6B5;
|
2012-11-20 14:44:44 +00:00
|
|
|
|
d3d->base_size = video->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
|
|
|
|
|
|
|
|
|
|
unsigned width, height;
|
|
|
|
|
d3d->ctx_driver->get_video_size(&width, &height);
|
2012-11-20 05:08:58 +00:00
|
|
|
|
|
2012-11-20 05:39:35 +00:00
|
|
|
|
d3dpp->BackBufferWidth = d3d->win_width = width;
|
|
|
|
|
d3dpp->BackBufferHeight = d3d->win_height = height;
|
2012-11-20 05:08:58 +00:00
|
|
|
|
|
2012-11-19 22:29:57 +00:00
|
|
|
|
#if defined(_XBOX1)
|
2012-11-20 14:44:44 +00:00
|
|
|
|
// Get the "video mode"
|
2012-11-20 05:39:35 +00:00
|
|
|
|
DWORD video_mode = XGetVideoFlags();
|
2012-11-19 22:29:57 +00:00
|
|
|
|
|
|
|
|
|
// Check if we are able to use progressive mode
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (video_mode & XC_VIDEO_FLAGS_HDTV_480p)
|
2012-11-20 01:03:26 +00:00
|
|
|
|
d3dpp->Flags = D3DPRESENTFLAG_PROGRESSIVE;
|
2012-11-19 22:29:57 +00:00
|
|
|
|
else
|
2012-11-20 01:03:26 +00:00
|
|
|
|
d3dpp->Flags = D3DPRESENTFLAG_INTERLACED;
|
2012-11-19 22:29:57 +00:00
|
|
|
|
|
|
|
|
|
// Only valid in PAL mode, not valid for HDTV modes!
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I)
|
2012-11-19 22:29:57 +00:00
|
|
|
|
{
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (video_mode & XC_VIDEO_FLAGS_PAL_60Hz)
|
2012-11-20 01:03:26 +00:00
|
|
|
|
d3dpp->FullScreen_RefreshRateInHz = 60;
|
2012-11-19 22:29:57 +00:00
|
|
|
|
else
|
2012-11-20 01:03:26 +00:00
|
|
|
|
d3dpp->FullScreen_RefreshRateInHz = 50;
|
2012-11-19 22:29:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (XGetAVPack() == XC_AV_PACK_HDTV)
|
2012-11-19 22:29:57 +00:00
|
|
|
|
{
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (video_mode & XC_VIDEO_FLAGS_HDTV_480p)
|
2012-11-20 01:03:26 +00:00
|
|
|
|
d3dpp->Flags = D3DPRESENTFLAG_PROGRESSIVE;
|
2013-01-11 17:14:16 +00:00
|
|
|
|
else if (video_mode & XC_VIDEO_FLAGS_HDTV_720p)
|
2012-11-20 14:44:44 +00:00
|
|
|
|
d3dpp->Flags = D3DPRESENTFLAG_PROGRESSIVE;
|
2013-01-11 17:14:16 +00:00
|
|
|
|
else if (video_mode & XC_VIDEO_FLAGS_HDTV_1080i)
|
2012-11-20 14:44:44 +00:00
|
|
|
|
d3dpp->Flags = D3DPRESENTFLAG_INTERLACED;
|
2012-11-19 22:29:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-12 02:13:03 +00:00
|
|
|
|
if (lifecycle_mode_state & MODE_MENU_WIDESCREEN)
|
2012-11-20 14:44:44 +00:00
|
|
|
|
d3dpp->Flags |= D3DPRESENTFLAG_WIDESCREEN;
|
2012-11-20 01:03:26 +00:00
|
|
|
|
|
2012-11-21 17:52:37 +00:00
|
|
|
|
d3dpp->BackBufferFormat = D3DFMT_X8R8G8B8;
|
2012-11-20 01:03:26 +00:00
|
|
|
|
d3dpp->FullScreen_PresentationInterval = d3d->vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
2013-04-19 20:55:40 +00:00
|
|
|
|
d3dpp->SwapEffect = D3DSWAPEFFECT_COPY;
|
2012-11-20 00:40:52 +00:00
|
|
|
|
#elif defined(_XBOX360)
|
2013-01-12 02:13:03 +00:00
|
|
|
|
if (!(lifecycle_mode_state & (1ULL << MODE_MENU_WIDESCREEN)))
|
2012-11-20 00:40:52 +00:00
|
|
|
|
d3dpp->Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
|
|
|
|
|
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (g_extern.console.screen.gamma_correction)
|
2012-11-20 00:40:52 +00:00
|
|
|
|
{
|
2012-11-20 01:51:00 +00:00
|
|
|
|
d3dpp->BackBufferFormat = (D3DFORMAT)MAKESRGBFMT(d3d->texture_fmt);
|
2012-11-20 00:40:52 +00:00
|
|
|
|
d3dpp->FrontBufferFormat = (D3DFORMAT)MAKESRGBFMT(D3DFMT_LE_X8R8G8B8);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-11-20 01:51:00 +00:00
|
|
|
|
d3dpp->BackBufferFormat = d3d->texture_fmt;
|
2012-11-20 00:40:52 +00:00
|
|
|
|
d3dpp->FrontBufferFormat = D3DFMT_LE_X8R8G8B8;
|
|
|
|
|
}
|
|
|
|
|
d3dpp->MultiSampleQuality = 0;
|
|
|
|
|
d3dpp->PresentationInterval = d3d->vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
|
|
|
|
d3dpp->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
|
|
|
|
#endif
|
2012-11-20 01:03:26 +00:00
|
|
|
|
d3dpp->BackBufferCount = 2;
|
|
|
|
|
d3dpp->MultiSampleType = D3DMULTISAMPLE_NONE;
|
|
|
|
|
d3dpp->EnableAutoDepthStencil = FALSE;
|
2012-11-20 00:40:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-03 02:02:52 +00:00
|
|
|
|
static void xdk_d3d_init_textures(void *data, const video_info_t *video)
|
2012-11-20 00:40:52 +00:00
|
|
|
|
{
|
2013-01-08 16:48:55 +00:00
|
|
|
|
HRESULT ret;
|
2013-01-03 02:02:52 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
|
2012-11-20 14:44:44 +00:00
|
|
|
|
D3DPRESENT_PARAMETERS d3dpp;
|
|
|
|
|
D3DVIEWPORT vp = {0};
|
|
|
|
|
xdk_d3d_generate_pp(&d3dpp, video);
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
2012-11-21 17:52:37 +00:00
|
|
|
|
d3d->texture_fmt = video->rgb32 ? D3DFMT_LIN_X8R8G8B8 : D3DFMT_LIN_R5G6B5;
|
2012-11-20 14:44:44 +00:00
|
|
|
|
d3d->base_size = video->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
|
|
|
|
if (d3d->lpTexture)
|
|
|
|
|
{
|
|
|
|
|
d3d->lpTexture->Release();
|
|
|
|
|
d3d->lpTexture = NULL;
|
|
|
|
|
}
|
2012-11-20 14:44:44 +00:00
|
|
|
|
|
2013-01-08 16:48:55 +00:00
|
|
|
|
ret = d3d->d3d_render_device->CreateTexture(d3d->tex_w, d3d->tex_h, 1, 0, d3d->texture_fmt,
|
2012-11-20 14:44:44 +00:00
|
|
|
|
0, &d3d->lpTexture
|
2012-11-20 00:55:16 +00:00
|
|
|
|
#ifdef _XBOX360
|
2012-11-20 14:44:44 +00:00
|
|
|
|
, NULL
|
|
|
|
|
#endif
|
|
|
|
|
);
|
|
|
|
|
|
2013-01-08 16:48:55 +00:00
|
|
|
|
if (ret != S_OK)
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("[xdk_d3d_init_textures::] failed at CreateTexture.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-20 14:44:44 +00:00
|
|
|
|
D3DLOCKED_RECT d3dlr;
|
2013-04-16 16:49:09 +00:00
|
|
|
|
D3DTexture_LockRect(d3d->lpTexture, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
2012-11-20 14:44:44 +00:00
|
|
|
|
memset(d3dlr.pBits, 0, d3d->tex_w * d3dlr.Pitch);
|
|
|
|
|
|
|
|
|
|
d3d->last_width = d3d->tex_w;
|
|
|
|
|
d3d->last_height = d3d->tex_h;
|
2012-11-19 22:29:57 +00:00
|
|
|
|
|
2012-11-20 00:55:16 +00:00
|
|
|
|
#if defined(_XBOX1)
|
2012-11-19 22:29:57 +00:00
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_LIGHTING, FALSE);
|
|
|
|
|
#elif defined(_XBOX360)
|
2013-04-16 14:47:20 +00:00
|
|
|
|
RD3DDevice_Clear(d3d->d3d_render_device, 0, NULL, D3DCLEAR_TARGET,
|
2012-11-20 14:44:44 +00:00
|
|
|
|
0xff000000, 1.0f, 0);
|
2012-11-19 22:29:57 +00:00
|
|
|
|
#endif
|
2012-11-20 05:39:35 +00:00
|
|
|
|
vp.Width = d3d->win_width;
|
|
|
|
|
vp.Height = d3d->win_height;
|
2012-11-20 00:55:16 +00:00
|
|
|
|
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_ZENABLE, FALSE);
|
|
|
|
|
|
2012-11-19 22:29:57 +00:00
|
|
|
|
vp.MinZ = 0.0f;
|
|
|
|
|
vp.MaxZ = 1.0f;
|
2013-04-16 14:47:20 +00:00
|
|
|
|
RD3DDevice_SetViewport(d3d->d3d_render_device, &vp);
|
2012-11-19 22:29:57 +00:00
|
|
|
|
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (g_extern.console.screen.viewports.custom_vp.width == 0)
|
2012-11-19 22:29:57 +00:00
|
|
|
|
g_extern.console.screen.viewports.custom_vp.width = vp.Width;
|
|
|
|
|
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (g_extern.console.screen.viewports.custom_vp.height == 0)
|
2012-11-19 22:29:57 +00:00
|
|
|
|
g_extern.console.screen.viewports.custom_vp.height = vp.Height;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-03 02:02:52 +00:00
|
|
|
|
static void xdk_d3d_reinit_textures(void *data, const video_info_t *video)
|
2012-11-20 01:51:00 +00:00
|
|
|
|
{
|
2013-01-03 02:02:52 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
|
2012-11-20 14:44:44 +00:00
|
|
|
|
unsigned old_base_size = d3d->base_size;
|
|
|
|
|
unsigned old_width = d3d->tex_w;
|
|
|
|
|
unsigned old_height = d3d->tex_h;
|
2012-11-21 17:52:37 +00:00
|
|
|
|
d3d->texture_fmt = video->rgb32 ? D3DFMT_LIN_X8R8G8B8 : D3DFMT_LIN_R5G6B5;
|
2012-11-20 14:44:44 +00:00
|
|
|
|
d3d->base_size = video->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
2013-04-13 10:08:52 +00:00
|
|
|
|
d3d->tex_w = d3d->tex_h = RARCH_SCALE_BASE * video->input_scale;
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
2012-11-20 14:44:44 +00:00
|
|
|
|
if (old_base_size != d3d->base_size || old_width != d3d->tex_w || old_height != d3d->tex_h)
|
|
|
|
|
{
|
|
|
|
|
RARCH_LOG("Reinitializing textures (%u x %u @ %u bpp)\n", d3d->tex_w,
|
|
|
|
|
d3d->tex_h, d3d->base_size * CHAR_BIT);
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
2012-11-20 14:44:44 +00:00
|
|
|
|
xdk_d3d_init_textures(d3d, video);
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0 /* ifdef HAVE_FBO */
|
2012-11-20 14:44:44 +00:00
|
|
|
|
if (d3d->tex_w > old_width || d3d->tex_h > old_height)
|
|
|
|
|
{
|
|
|
|
|
RARCH_LOG("Reiniting FBO.\n");
|
|
|
|
|
xdk_d3d_init_fbo(d3d);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
RARCH_LOG("Reinitializing textures skipped.\n");
|
2012-11-20 01:51:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
2012-01-05 11:37:27 +00:00
|
|
|
|
{
|
2013-01-08 16:48:55 +00:00
|
|
|
|
HRESULT ret;
|
|
|
|
|
|
2012-05-27 22:56:58 +00:00
|
|
|
|
if (driver.video_data)
|
2012-11-20 01:51:00 +00:00
|
|
|
|
{
|
2012-11-20 14:44:44 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
|
|
|
|
// Reinitialize textures as we might have changed pixel formats.
|
|
|
|
|
xdk_d3d_reinit_textures(d3d, video);
|
|
|
|
|
return driver.video_data;
|
2012-11-20 01:51:00 +00:00
|
|
|
|
}
|
2012-01-21 22:59:27 +00:00
|
|
|
|
|
2012-09-30 22:09:04 +00:00
|
|
|
|
//we'll just use driver.video_data throughout here because it needs to
|
|
|
|
|
//exist when we delegate initing to the context file
|
|
|
|
|
driver.video_data = (xdk_d3d_video_t*)calloc(1, sizeof(xdk_d3d_video_t));
|
|
|
|
|
if (!driver.video_data)
|
2012-01-07 13:54:55 +00:00
|
|
|
|
return NULL;
|
2012-02-13 14:16:01 +00:00
|
|
|
|
|
2012-09-30 22:09:04 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
2012-05-28 21:19:40 +00:00
|
|
|
|
|
2012-09-30 22:09:04 +00:00
|
|
|
|
d3d->vsync = video->vsync;
|
2013-04-13 10:08:52 +00:00
|
|
|
|
d3d->tex_w = RARCH_SCALE_BASE * video->input_scale;
|
|
|
|
|
d3d->tex_h = RARCH_SCALE_BASE * video->input_scale;
|
2012-05-29 13:25:39 +00:00
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#if defined(_XBOX1)
|
2012-11-19 04:00:38 +00:00
|
|
|
|
d3d->ctx_driver = gfx_ctx_init_first(GFX_CTX_DIRECT3D8_API);
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#elif defined(_XBOX360)
|
2012-11-19 03:46:48 +00:00
|
|
|
|
d3d->ctx_driver = gfx_ctx_init_first(GFX_CTX_DIRECT3D9_API);
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#endif
|
2012-11-20 01:51:00 +00:00
|
|
|
|
if (d3d->ctx_driver)
|
|
|
|
|
{
|
2012-11-20 14:44:44 +00:00
|
|
|
|
D3DPRESENT_PARAMETERS d3dpp;
|
|
|
|
|
xdk_d3d_generate_pp(&d3dpp, video);
|
|
|
|
|
|
2013-01-08 16:48:55 +00:00
|
|
|
|
ret = d3d->d3d_device->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
2012-11-20 14:44:44 +00:00
|
|
|
|
&d3dpp, &d3d->d3d_render_device);
|
2013-01-08 16:48:55 +00:00
|
|
|
|
|
|
|
|
|
if (ret != S_OK)
|
|
|
|
|
RARCH_ERR("Failed at CreateDevice.\n");
|
2013-04-16 14:47:20 +00:00
|
|
|
|
RD3DDevice_Clear(d3d->d3d_render_device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
|
2012-11-20 01:51:00 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2012-05-22 14:04:39 +00:00
|
|
|
|
{
|
2012-09-30 22:09:04 +00:00
|
|
|
|
free(d3d);
|
|
|
|
|
return NULL;
|
2012-05-22 14:04:39 +00:00
|
|
|
|
}
|
2012-01-22 00:43:54 +00:00
|
|
|
|
|
2012-11-19 03:09:16 +00:00
|
|
|
|
RARCH_LOG("Found D3D context: %s\n", d3d->ctx_driver->ident);
|
2012-01-05 11:37:27 +00:00
|
|
|
|
|
2012-11-19 22:29:57 +00:00
|
|
|
|
xdk_d3d_init_textures(d3d, video);
|
|
|
|
|
|
2012-11-19 23:33:57 +00:00
|
|
|
|
#if defined(_XBOX1)
|
|
|
|
|
// use an orthogonal matrix for the projection matrix
|
|
|
|
|
D3DXMATRIX mat;
|
2012-11-20 01:51:00 +00:00
|
|
|
|
D3DXMatrixOrthoOffCenterLH(&mat, 0, d3d->win_width , d3d->win_height , 0, 0.0f, 1.0f);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
|
|
|
|
|
d3d->d3d_render_device->SetTransform(D3DTS_PROJECTION, &mat);
|
|
|
|
|
|
|
|
|
|
// use an identity matrix for the world and view matrices
|
|
|
|
|
D3DXMatrixIdentity(&mat);
|
|
|
|
|
d3d->d3d_render_device->SetTransform(D3DTS_WORLD, &mat);
|
|
|
|
|
d3d->d3d_render_device->SetTransform(D3DTS_VIEW, &mat);
|
|
|
|
|
|
2013-01-08 17:24:31 +00:00
|
|
|
|
ret = d3d->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
2012-11-20 14:44:44 +00:00
|
|
|
|
D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &d3d->vertex_buf);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
|
2013-01-08 17:24:31 +00:00
|
|
|
|
if (ret != S_OK)
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("[xdk_d3d_init::] Failed at CreateVertexBuffer.\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-19 23:33:57 +00:00
|
|
|
|
const DrawVerticeFormats init_verts[] = {
|
|
|
|
|
{ -1.0f, -1.0f, 1.0f, 0.0f, 1.0f },
|
|
|
|
|
{ 1.0f, -1.0f, 1.0f, 1.0f, 1.0f },
|
|
|
|
|
{ -1.0f, 1.0f, 1.0f, 0.0f, 0.0f },
|
|
|
|
|
{ 1.0f, 1.0f, 1.0f, 1.0f, 0.0f },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BYTE *verts_ptr;
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DVertexBuffer_Lock(d3d->vertex_buf, 0, 0, &verts_ptr, 0);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
memcpy(verts_ptr, init_verts, sizeof(init_verts));
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DVertexBuffer_Unlock(d3d->vertex_buf);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_SetVertexShader(d3d->d3d_render_device, D3DFVF_XYZ | D3DFVF_TEX1);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
#elif defined(_XBOX360)
|
2013-01-08 17:24:31 +00:00
|
|
|
|
ret = d3d->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
2012-11-20 14:44:44 +00:00
|
|
|
|
0, 0, 0, &d3d->vertex_buf, NULL);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
|
2013-01-08 17:24:31 +00:00
|
|
|
|
if (ret != S_OK)
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("[xdk_d3d_init::] Failed at CreateVertexBuffer.\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-19 23:33:57 +00:00
|
|
|
|
static const DrawVerticeFormats init_verts[] = {
|
|
|
|
|
{ -1.0f, -1.0f, 0.0f, 1.0f },
|
|
|
|
|
{ 1.0f, -1.0f, 1.0f, 1.0f },
|
|
|
|
|
{ -1.0f, 1.0f, 0.0f, 0.0f },
|
|
|
|
|
{ 1.0f, 1.0f, 1.0f, 0.0f },
|
|
|
|
|
};
|
2012-11-20 14:44:44 +00:00
|
|
|
|
|
2012-11-19 23:33:57 +00:00
|
|
|
|
void *verts_ptr;
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DVertexBuffer_Lock(d3d->vertex_buf, 0, 0, &verts_ptr, 0);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
memcpy(verts_ptr, init_verts, sizeof(init_verts));
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DVertexBuffer_Unlock(d3d->vertex_buf);
|
2012-11-19 23:33:57 +00:00
|
|
|
|
|
|
|
|
|
static const D3DVERTEXELEMENT VertexElements[] =
|
|
|
|
|
{
|
|
|
|
|
{ 0, 0 * sizeof(float), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
|
|
|
|
|
{ 0, 2 * sizeof(float), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
|
|
|
|
|
D3DDECL_END()
|
|
|
|
|
};
|
|
|
|
|
|
2013-01-08 17:24:31 +00:00
|
|
|
|
ret = d3d->d3d_render_device->CreateVertexDeclaration(VertexElements, &d3d->v_decl);
|
|
|
|
|
|
|
|
|
|
if (ret != S_OK)
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("[xdk_d3d_init::] Failed at CreateVertexDeclaration.\n");
|
|
|
|
|
}
|
2012-11-19 23:33:57 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2012-11-20 05:39:35 +00:00
|
|
|
|
d3d->ctx_driver->get_video_size(&d3d->win_width, &d3d->win_height);
|
|
|
|
|
RARCH_LOG("Detecting screen resolution: %ux%u.\n", d3d->win_width, d3d->win_height);
|
2012-09-30 23:17:30 +00:00
|
|
|
|
|
2012-11-19 23:33:57 +00:00
|
|
|
|
d3d->ctx_driver->swap_interval(d3d->vsync ? 1 : 0);
|
2012-09-30 23:17:30 +00:00
|
|
|
|
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#ifdef HAVE_HLSL
|
2012-10-01 00:45:29 +00:00
|
|
|
|
if (!hlsl_shader_init())
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("Shader init failed.\n");
|
2012-11-20 14:44:44 +00:00
|
|
|
|
d3d->ctx_driver->destroy();
|
|
|
|
|
free(d3d);
|
|
|
|
|
return NULL;
|
2012-10-01 00:45:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-12 19:56:43 +00:00
|
|
|
|
RARCH_LOG("D3D: Loaded %u program(s).\n", d3d->shader->num_shaders());
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#endif
|
2012-01-05 11:37:27 +00:00
|
|
|
|
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0 /* ifdef HAVE_FBO */
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_init_fbo(d3d);
|
2012-07-07 17:31:04 +00:00
|
|
|
|
#endif
|
2012-04-18 03:01:17 +00:00
|
|
|
|
|
2012-10-15 04:24:39 +00:00
|
|
|
|
xdk_d3d_set_rotation(d3d, g_extern.console.screen.orientation);
|
2012-05-22 00:19:40 +00:00
|
|
|
|
|
2012-09-30 22:09:04 +00:00
|
|
|
|
//really returns driver.video_data to driver.video_data - see comment above
|
2012-07-07 12:41:58 +00:00
|
|
|
|
return d3d;
|
2012-01-05 11:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 04:54:16 +00:00
|
|
|
|
#ifdef HAVE_RMENU
|
2013-04-10 07:34:46 +00:00
|
|
|
|
extern struct texture_image *menu_texture;
|
2013-04-10 04:54:16 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-10 08:06:15 +00:00
|
|
|
|
#ifdef _XBOX1
|
2013-04-19 20:55:40 +00:00
|
|
|
|
static bool texture_image_render(struct texture_image *out_img,
|
|
|
|
|
int x, int y, int w, int h, bool force_fullscreen)
|
2013-04-10 08:06:15 +00:00
|
|
|
|
{
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
|
|
|
|
|
|
|
|
|
if (out_img->pixels == NULL || out_img->vertex_buf == NULL)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
float fX = static_cast<float>(x);
|
|
|
|
|
float fY = static_cast<float>(y);
|
|
|
|
|
|
|
|
|
|
// create the new vertices
|
|
|
|
|
DrawVerticeFormats newVerts[] =
|
|
|
|
|
{
|
|
|
|
|
// x, y, z, color, u ,v
|
|
|
|
|
{fX, fY, 0.0f, 0, 0, 0},
|
|
|
|
|
{fX + w, fY, 0.0f, 0, 1, 0},
|
|
|
|
|
{fX + w, fY + h, 0.0f, 0, 1, 1},
|
|
|
|
|
{fX, fY + h, 0.0f, 0, 0, 1}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// load the existing vertices
|
|
|
|
|
DrawVerticeFormats *pCurVerts;
|
|
|
|
|
|
|
|
|
|
HRESULT ret = out_img->vertex_buf->Lock(0, 0, (unsigned char**)&pCurVerts, 0);
|
|
|
|
|
|
|
|
|
|
if (FAILED(ret))
|
|
|
|
|
{
|
|
|
|
|
RARCH_ERR("Error occurred during m_pVertexBuffer->Lock().\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// copy the new verts over the old verts
|
|
|
|
|
memcpy(pCurVerts, newVerts, 4 * sizeof(DrawVerticeFormats));
|
|
|
|
|
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DVertexBuffer_Unlock(out_img->vertex_buf);
|
2013-04-10 08:06:15 +00:00
|
|
|
|
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
|
|
|
|
|
|
// also blend the texture with the set alpha value
|
|
|
|
|
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
|
|
|
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
|
|
|
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
|
|
|
|
|
|
|
|
// draw the quad
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_SetTexture(d3d->d3d_render_device, 0, out_img->pixels);
|
|
|
|
|
IDirect3DDevice8_SetStreamSource(d3d->d3d_render_device, 0, out_img->vertex_buf, sizeof(DrawVerticeFormats));
|
|
|
|
|
RD3DDevice_SetVertexShader(d3d->d3d_render_device, D3DFVF_CUSTOMVERTEX);
|
2013-04-19 20:55:40 +00:00
|
|
|
|
|
|
|
|
|
if (force_fullscreen)
|
|
|
|
|
{
|
|
|
|
|
D3DVIEWPORT vp = {0};
|
|
|
|
|
vp.Width = w;
|
|
|
|
|
vp.Height = h;
|
|
|
|
|
vp.X = 0;
|
|
|
|
|
vp.Y = 0;
|
|
|
|
|
vp.MinZ = 0.0f;
|
|
|
|
|
vp.MaxZ = 1.0f;
|
|
|
|
|
RD3DDevice_SetViewport(d3dr, &vp);
|
|
|
|
|
}
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_DrawPrimitive(d3d->d3d_render_device, D3DPT_QUADLIST, 0, 1);
|
2013-04-10 08:06:15 +00:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-10 04:54:16 +00:00
|
|
|
|
#if defined(HAVE_RGUI) || defined(HAVE_RMENU)
|
|
|
|
|
|
2013-04-11 13:05:42 +00:00
|
|
|
|
#ifdef HAVE_MENU_PANEL
|
|
|
|
|
extern struct texture_image *menu_panel;
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-10 04:54:16 +00:00
|
|
|
|
static inline void xdk_d3d_draw_texture(void *data)
|
|
|
|
|
{
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
|
2013-04-10 05:47:11 +00:00
|
|
|
|
#if defined(HAVE_RMENU_XUI)
|
|
|
|
|
menu_iterate_xui();
|
|
|
|
|
#elif defined(HAVE_RMENU)
|
2013-04-10 07:34:46 +00:00
|
|
|
|
menu_texture->x = 0;
|
|
|
|
|
menu_texture->y = 0;
|
2013-04-10 04:54:16 +00:00
|
|
|
|
|
2013-04-11 13:05:42 +00:00
|
|
|
|
if (d3d->rgui_texture_enable)
|
|
|
|
|
{
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
|
2013-04-13 13:19:57 +00:00
|
|
|
|
texture_image_render(menu_texture, menu_texture->x, menu_texture->y,
|
2013-04-19 20:55:40 +00:00
|
|
|
|
640, 480, true);
|
2013-04-11 13:05:42 +00:00
|
|
|
|
d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_MENU_PANEL
|
|
|
|
|
if ((menu_panel->x != 0) || (menu_panel->y != 0))
|
|
|
|
|
{
|
2013-04-13 13:19:57 +00:00
|
|
|
|
texture_image_render(menu_panel, menu_panel->x, menu_panel->y,
|
2013-04-19 20:55:40 +00:00
|
|
|
|
610, 20, false);
|
2013-04-11 13:05:42 +00:00
|
|
|
|
menu_panel->x = 0;
|
|
|
|
|
menu_panel->y = 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2013-04-10 04:54:16 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
static bool xdk_d3d_frame(void *data, const void *frame,
|
2012-01-07 13:54:55 +00:00
|
|
|
|
unsigned width, unsigned height, unsigned pitch, const char *msg)
|
2012-01-05 11:37:27 +00:00
|
|
|
|
{
|
2013-04-16 16:49:09 +00:00
|
|
|
|
#ifndef _XBOX1
|
|
|
|
|
DWORD fetchConstant;
|
|
|
|
|
UINT64 pendingMask3;
|
|
|
|
|
#endif
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
2013-01-10 23:58:08 +00:00
|
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->d3d_render_device;
|
2013-01-12 02:13:03 +00:00
|
|
|
|
uint64_t lifecycle_mode_state = g_extern.lifecycle_mode_state;
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0 /* ifdef HAVE_FBO */
|
2012-05-06 16:53:43 +00:00
|
|
|
|
D3DSurface* pRenderTarget0;
|
2012-07-07 19:47:23 +00:00
|
|
|
|
#endif
|
2012-01-05 11:37:27 +00:00
|
|
|
|
|
2012-07-07 12:41:58 +00:00
|
|
|
|
if (d3d->last_width != width || d3d->last_height != height)
|
2012-01-07 14:21:23 +00:00
|
|
|
|
{
|
|
|
|
|
D3DLOCKED_RECT d3dlr;
|
2012-03-08 15:14:09 +00:00
|
|
|
|
|
2013-04-16 16:49:09 +00:00
|
|
|
|
D3DTexture_LockRect(d3d->lpTexture, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
2012-11-19 18:56:53 +00:00
|
|
|
|
memset(d3dlr.pBits, 0, d3d->tex_w * d3dlr.Pitch);
|
2012-01-07 14:21:23 +00:00
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#if defined(_XBOX1)
|
2013-04-13 10:08:52 +00:00
|
|
|
|
float tex_w = width;
|
|
|
|
|
float tex_h = height;
|
2012-10-01 01:35:38 +00:00
|
|
|
|
|
|
|
|
|
DrawVerticeFormats verts[] = {
|
|
|
|
|
{ -1.0f, -1.0f, 1.0f, 0.0f, tex_h },
|
|
|
|
|
{ 1.0f, -1.0f, 1.0f, tex_w, tex_h },
|
|
|
|
|
{ -1.0f, 1.0f, 1.0f, 0.0f, 0.0f },
|
|
|
|
|
{ 1.0f, 1.0f, 1.0f, tex_w, 0.0f },
|
|
|
|
|
};
|
|
|
|
|
#elif defined(_XBOX360)
|
2012-11-20 05:08:58 +00:00
|
|
|
|
float tex_w = width / ((float)d3d->tex_w);
|
|
|
|
|
float tex_h = height / ((float)d3d->tex_h);
|
2012-05-06 20:02:54 +00:00
|
|
|
|
|
2012-05-06 20:11:06 +00:00
|
|
|
|
DrawVerticeFormats verts[] = {
|
2012-04-14 02:38:40 +00:00
|
|
|
|
{ -1.0f, -1.0f, 0.0f, tex_h },
|
2012-05-06 20:02:54 +00:00
|
|
|
|
{ 1.0f, -1.0f, tex_w, tex_h },
|
|
|
|
|
{ -1.0f, 1.0f, 0.0f, 0.0f },
|
|
|
|
|
{ 1.0f, 1.0f, tex_w, 0.0f },
|
2012-04-10 19:23:42 +00:00
|
|
|
|
};
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#endif
|
2012-04-10 19:23:42 +00:00
|
|
|
|
|
2012-05-06 20:02:54 +00:00
|
|
|
|
// Align texels and vertices (D3D9 quirk).
|
|
|
|
|
for (unsigned i = 0; i < 4; i++)
|
|
|
|
|
{
|
2012-11-20 05:08:58 +00:00
|
|
|
|
verts[i].x -= 0.5f / ((float)d3d->tex_w);
|
|
|
|
|
verts[i].y += 0.5f / ((float)d3d->tex_h);
|
2012-05-06 20:02:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#if defined(_XBOX1)
|
|
|
|
|
BYTE *verts_ptr;
|
|
|
|
|
#elif defined(_XBOX360)
|
2012-04-17 03:12:03 +00:00
|
|
|
|
void *verts_ptr;
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#endif
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DVertexBuffer_Lock(d3d->vertex_buf, 0, 0, &verts_ptr, 0);
|
2012-04-10 19:23:42 +00:00
|
|
|
|
memcpy(verts_ptr, verts, sizeof(verts));
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DVertexBuffer_Unlock(d3d->vertex_buf);
|
2012-03-08 12:44:20 +00:00
|
|
|
|
|
2012-07-07 12:41:58 +00:00
|
|
|
|
d3d->last_width = width;
|
|
|
|
|
d3d->last_height = height;
|
2012-01-07 14:21:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0 /* ifdef HAVE_FBO */
|
2012-11-19 03:46:48 +00:00
|
|
|
|
if (d3d->fbo_inited)
|
2012-05-06 16:53:43 +00:00
|
|
|
|
{
|
2013-01-10 23:58:08 +00:00
|
|
|
|
d3dr->GetRenderTarget(0, &pRenderTarget0);
|
|
|
|
|
d3dr->SetRenderTarget(0, d3d->lpSurface);
|
2012-05-06 16:53:43 +00:00
|
|
|
|
}
|
2012-07-07 19:47:23 +00:00
|
|
|
|
#endif
|
2012-05-06 16:53:43 +00:00
|
|
|
|
|
2012-07-07 12:41:58 +00:00
|
|
|
|
if (d3d->should_resize)
|
2013-04-19 00:18:15 +00:00
|
|
|
|
{
|
|
|
|
|
#ifdef _XBOX1
|
2013-06-02 22:43:17 +00:00
|
|
|
|
d3dr->SetFlickerFilter(g_extern.console.screen.flicker_filter_index);
|
|
|
|
|
d3dr->SetSoftDisplayFilter(g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE));
|
2013-04-19 00:18:15 +00:00
|
|
|
|
#endif
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_set_viewport(false);
|
2013-04-19 00:18:15 +00:00
|
|
|
|
d3d->should_resize = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_HLSL
|
|
|
|
|
if (d3d->shader)
|
|
|
|
|
d3d->shader->set_mvp(NULL);
|
|
|
|
|
#endif
|
2012-05-28 00:29:51 +00:00
|
|
|
|
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_SetTexture(d3dr, 0, d3d->lpTexture);
|
2012-05-06 16:53:43 +00:00
|
|
|
|
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#ifdef HAVE_HLSL
|
2013-04-12 19:25:16 +00:00
|
|
|
|
if (d3d->shader)
|
|
|
|
|
d3d->shader->use(1);
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0 /* ifdef HAVE_FBO */
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (d3d->fbo_inited)
|
2012-05-06 16:53:43 +00:00
|
|
|
|
{
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#ifdef HAVE_HLSL
|
2013-04-12 19:25:16 +00:00
|
|
|
|
if (d3d->shader)
|
|
|
|
|
d3d->shader->set_params(width, height, d3d->tex_w, d3d->tex_h, g_settings.video.fbo.scale_x * width,
|
|
|
|
|
g_settings.video.fbo.scale_y * height, g_extern.frame_count);
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#endif
|
|
|
|
|
D3DVIEWPORT vp = {0};
|
2012-10-15 05:22:20 +00:00
|
|
|
|
vp.Width = g_settings.video.fbo.scale_x * width;
|
|
|
|
|
vp.Height = g_settings.video.fbo.scale_y * height;
|
2012-05-06 16:53:43 +00:00
|
|
|
|
vp.X = 0;
|
|
|
|
|
vp.Y = 0;
|
|
|
|
|
vp.MinZ = 0.0f;
|
|
|
|
|
vp.MaxZ = 1.0f;
|
2013-04-16 14:47:20 +00:00
|
|
|
|
RD3DDevice_SetViewport(d3dr, &vp);
|
2012-05-06 16:53:43 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2012-07-07 17:31:04 +00:00
|
|
|
|
#endif
|
2012-05-06 16:53:43 +00:00
|
|
|
|
{
|
2012-07-07 17:31:04 +00:00
|
|
|
|
#ifdef HAVE_HLSL
|
2013-04-12 19:56:43 +00:00
|
|
|
|
|
2013-04-12 19:25:16 +00:00
|
|
|
|
if (d3d->shader)
|
|
|
|
|
d3d->shader->set_params(width, height, d3d->tex_w, d3d->tex_h, d3d->win_width,
|
2013-04-12 19:56:43 +00:00
|
|
|
|
d3d->win_height, g_extern.frame_count,
|
|
|
|
|
/* TODO - missing a bunch of params at the end */
|
|
|
|
|
NULL, NULL, NULL, 0);
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#endif
|
2012-07-07 17:31:04 +00:00
|
|
|
|
}
|
2012-04-19 13:59:07 +00:00
|
|
|
|
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (frame)
|
2012-12-15 06:19:59 +00:00
|
|
|
|
{
|
2013-01-10 23:58:08 +00:00
|
|
|
|
unsigned base_size = d3d->base_size;
|
2013-01-09 06:27:05 +00:00
|
|
|
|
D3DLOCKED_RECT d3dlr;
|
2013-04-16 16:49:09 +00:00
|
|
|
|
D3DTexture_LockRect(d3d->lpTexture, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
2012-11-20 01:51:00 +00:00
|
|
|
|
|
2013-01-09 06:27:05 +00:00
|
|
|
|
for (unsigned y = 0; y < height; y++)
|
|
|
|
|
{
|
|
|
|
|
const uint8_t *in = (const uint8_t*)frame + y * pitch;
|
|
|
|
|
uint8_t *out = (uint8_t*)d3dlr.pBits + y * d3dlr.Pitch;
|
2013-01-10 23:58:08 +00:00
|
|
|
|
memcpy(out, in, width * base_size);
|
2013-01-09 06:27:05 +00:00
|
|
|
|
}
|
2012-12-15 06:19:59 +00:00
|
|
|
|
}
|
2012-04-19 13:59:07 +00:00
|
|
|
|
|
2013-04-16 20:44:49 +00:00
|
|
|
|
unsigned filter = g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
|
|
|
|
|
|
|
|
|
RD3DDevice_SetSamplerState_MinFilter(d3dr, 0, filter);
|
|
|
|
|
RD3DDevice_SetSamplerState_MagFilter(d3dr, 0, filter);
|
2013-04-16 14:10:45 +00:00
|
|
|
|
RD3DDevice_SetSamplerState_AddressU(d3dr, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
|
|
|
|
RD3DDevice_SetSamplerState_AddressV(d3dr, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
2012-04-17 03:23:54 +00:00
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#if defined(_XBOX1)
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_SetVertexShader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1);
|
|
|
|
|
IDirect3DDevice8_SetStreamSource(d3dr, 0, d3d->vertex_buf, sizeof(DrawVerticeFormats));
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#elif defined(_XBOX360)
|
2013-04-16 16:49:09 +00:00
|
|
|
|
D3DDevice_SetVertexDeclaration(d3dr, d3d->v_decl);
|
|
|
|
|
D3DDevice_SetStreamSource_Inline(d3dr, 0, d3d->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#endif
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
|
2012-01-05 11:37:27 +00:00
|
|
|
|
|
2013-04-06 04:21:11 +00:00
|
|
|
|
#if 0 /* ifdef HAVE_FBO */
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (d3d->fbo_inited)
|
2012-05-06 16:53:43 +00:00
|
|
|
|
{
|
2013-01-10 23:58:08 +00:00
|
|
|
|
d3dr->Resolve(D3DRESOLVE_RENDERTARGET0, NULL, d3d->lpTexture_ot,
|
2012-11-20 14:44:44 +00:00
|
|
|
|
NULL, 0, 0, NULL, 0, 0, NULL);
|
2012-05-06 16:53:43 +00:00
|
|
|
|
|
2013-01-10 23:58:08 +00:00
|
|
|
|
d3dr->SetRenderTarget(0, pRenderTarget0);
|
2012-05-06 16:53:43 +00:00
|
|
|
|
pRenderTarget0->Release();
|
2013-04-16 16:49:09 +00:00
|
|
|
|
RD3DDevice_SetTexture(d3dr, 0, &d3d->lpTexture_ot_as16srgb);
|
2012-05-06 16:53:43 +00:00
|
|
|
|
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#ifdef HAVE_HLSL
|
2012-05-06 19:57:01 +00:00
|
|
|
|
hlsl_use(2);
|
2013-04-12 19:25:16 +00:00
|
|
|
|
|
|
|
|
|
if (d3d->shader)
|
|
|
|
|
d3d->shader->set_params(g_settings.video.fbo.scale_x * width, g_settings.video.fbo.scale_y * height, g_settings.video.fbo.scale_x * d3d->tex_w, g_settings.video.fbo.scale_y * d3d->tex_h, d3d->win_width,
|
|
|
|
|
d3d->win_height, g_extern.frame_count);
|
2012-07-07 13:40:14 +00:00
|
|
|
|
#endif
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_set_viewport(false);
|
2012-05-28 00:29:51 +00:00
|
|
|
|
|
2013-04-16 14:10:45 +00:00
|
|
|
|
RD3DDevice_SetSamplerState_MinFilter(d3dr, D3DSAMP_MINFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
|
|
|
|
RD3DDevice_SetSamplerState_MagFilter(d3dr, D3DSAMP_MAGFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
|
|
|
|
RD3DDevice_SetSamplerState_AddressU(d3dr, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
|
|
|
|
RD3DDevice_SetSamplerState_AddressV(d3dr, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
2013-04-16 16:49:09 +00:00
|
|
|
|
D3DDevice_SetVertexDeclaration(d3dr, d3d->v_decl);
|
|
|
|
|
Direct3DDevice_SetStreamSource_Inline(d3dr, 0, d3d->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
|
|
|
|
RD3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
|
2012-05-06 16:53:43 +00:00
|
|
|
|
}
|
2012-07-07 17:31:04 +00:00
|
|
|
|
#endif
|
2012-05-06 16:53:43 +00:00
|
|
|
|
|
2013-04-10 04:54:16 +00:00
|
|
|
|
#if defined(HAVE_RGUI) || defined(HAVE_RMENU)
|
2013-04-11 14:38:12 +00:00
|
|
|
|
|
|
|
|
|
#if defined(HAVE_RMENU_XUI) || defined(HAVE_RGUI)
|
|
|
|
|
if (d3d->rgui_texture_enable)
|
2013-04-10 05:47:11 +00:00
|
|
|
|
#endif
|
2013-04-10 04:54:16 +00:00
|
|
|
|
xdk_d3d_draw_texture(d3d);
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-10-01 01:35:38 +00:00
|
|
|
|
#if defined(_XBOX1)
|
2012-11-22 04:52:24 +00:00
|
|
|
|
float msg_width = 60;
|
|
|
|
|
float msg_height = 365;
|
2012-11-22 04:32:58 +00:00
|
|
|
|
#elif defined(_XBOX360)
|
2013-06-14 15:31:17 +00:00
|
|
|
|
float msg_width = (lifecycle_mode_state & (1ULL << MODE_MENU_HD)) ? 160 : 100;
|
|
|
|
|
float msg_height = 120;
|
2012-11-22 04:32:58 +00:00
|
|
|
|
#endif
|
2013-03-12 01:42:33 +00:00
|
|
|
|
|
2013-07-15 22:47:09 +00:00
|
|
|
|
#if 0
|
2012-12-15 16:46:57 +00:00
|
|
|
|
if (msg)
|
2013-03-11 19:05:05 +00:00
|
|
|
|
{
|
|
|
|
|
font_parms.x = msg_width;
|
|
|
|
|
font_parms.y = msg_height;
|
|
|
|
|
d3d->font_ctx->render_msg(d3d, msg, &font_parms);
|
|
|
|
|
}
|
2013-07-15 22:47:09 +00:00
|
|
|
|
#endif
|
2012-02-12 14:23:35 +00:00
|
|
|
|
|
2013-07-15 22:47:09 +00:00
|
|
|
|
d3d->ctx_driver->update_window_title();
|
2013-06-07 23:45:04 +00:00
|
|
|
|
|
2013-04-11 13:05:42 +00:00
|
|
|
|
gfx_ctx_xdk_swap_buffers();
|
2012-12-15 16:46:57 +00:00
|
|
|
|
|
2013-04-13 12:28:12 +00:00
|
|
|
|
g_extern.frame_count++;
|
|
|
|
|
|
2012-01-05 11:37:27 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
static void xdk_d3d_set_nonblock_state(void *data, bool state)
|
2012-01-05 11:37:27 +00:00
|
|
|
|
{
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
2012-01-05 11:37:27 +00:00
|
|
|
|
|
2013-01-11 17:14:16 +00:00
|
|
|
|
if (d3d->vsync)
|
2012-05-28 13:47:27 +00:00
|
|
|
|
{
|
|
|
|
|
RARCH_LOG("D3D Vsync => %s\n", state ? "off" : "on");
|
2012-09-30 16:29:32 +00:00
|
|
|
|
gfx_ctx_xdk_set_swap_interval(state ? 0 : 1);
|
2012-05-28 13:47:27 +00:00
|
|
|
|
}
|
2012-01-05 11:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
static bool xdk_d3d_alive(void *data)
|
2012-01-05 11:37:27 +00:00
|
|
|
|
{
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
2012-07-07 12:41:58 +00:00
|
|
|
|
check_window(d3d);
|
|
|
|
|
return !d3d->quitting;
|
2012-01-05 11:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
static bool xdk_d3d_focus(void *data)
|
2012-02-12 17:42:51 +00:00
|
|
|
|
{
|
2012-05-28 00:29:51 +00:00
|
|
|
|
(void)data;
|
|
|
|
|
return gfx_ctx_window_has_focus();
|
2012-02-12 17:42:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
|
static void xdk_d3d_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
|
2013-03-10 02:34:37 +00:00
|
|
|
|
{
|
|
|
|
|
(void)data;
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
|
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
|
if (aspect_ratio_idx == ASPECT_RATIO_SQUARE)
|
|
|
|
|
gfx_set_square_pixel_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
|
|
|
|
|
else if (aspect_ratio_idx == ASPECT_RATIO_CORE)
|
2013-03-10 02:34:37 +00:00
|
|
|
|
gfx_set_core_viewport();
|
2013-04-20 08:56:04 +00:00
|
|
|
|
else if (aspect_ratio_idx == ASPECT_RATIO_CONFIG)
|
|
|
|
|
gfx_set_config_viewport();
|
2013-03-10 02:34:37 +00:00
|
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
|
g_settings.video.aspect_ratio = aspectratio_lut[aspect_ratio_idx].value;
|
2013-03-10 02:34:37 +00:00
|
|
|
|
d3d->should_resize = true;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-10 02:39:05 +00:00
|
|
|
|
static void xdk_d3d_set_filtering(void *data, unsigned index, bool set_smooth) { }
|
2013-03-10 02:34:37 +00:00
|
|
|
|
|
2013-03-10 19:00:58 +00:00
|
|
|
|
static void xdk_d3d_apply_state_changes(void *data)
|
|
|
|
|
{
|
2013-03-10 19:24:19 +00:00
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
|
|
|
|
d3d->should_resize = true;
|
2013-03-10 19:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-07 17:43:54 +00:00
|
|
|
|
#if defined(HAVE_RGUI) || defined(HAVE_RMENU)
|
|
|
|
|
static void xdk_d3d_set_texture_frame(void *data,
|
|
|
|
|
const void *frame, bool rgb32, unsigned width, unsigned height,
|
|
|
|
|
float alpha)
|
|
|
|
|
{
|
|
|
|
|
(void)frame;
|
|
|
|
|
(void)rgb32;
|
|
|
|
|
(void)width;
|
|
|
|
|
(void)height;
|
|
|
|
|
(void)alpha;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-13 15:00:46 +00:00
|
|
|
|
static void xdk_d3d_set_texture_enable(void *data, bool state, bool full_screen)
|
2013-03-10 22:24:28 +00:00
|
|
|
|
{
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
2013-04-07 17:43:54 +00:00
|
|
|
|
d3d->rgui_texture_enable = state;
|
2013-04-13 15:00:46 +00:00
|
|
|
|
d3d->rgui_texture_full_screen = full_screen;
|
2013-03-10 22:24:28 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-03-11 20:42:02 +00:00
|
|
|
|
static void xdk_d3d_set_osd_msg(void *data, const char *msg, void *userdata)
|
|
|
|
|
{
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
|
|
|
|
font_params_t *params = (font_params_t*)userdata;
|
|
|
|
|
|
|
|
|
|
if (d3d->font_ctx)
|
2013-03-11 21:04:56 +00:00
|
|
|
|
d3d->font_ctx->render_msg(d3d, msg, params);
|
2013-03-11 20:42:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-10 02:34:37 +00:00
|
|
|
|
static const video_poke_interface_t d3d_poke_interface = {
|
|
|
|
|
xdk_d3d_set_filtering,
|
2013-04-07 01:00:08 +00:00
|
|
|
|
#ifdef HAVE_FBO
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
#endif
|
2013-03-10 02:34:37 +00:00
|
|
|
|
xdk_d3d_set_aspect_ratio,
|
2013-03-10 19:00:58 +00:00
|
|
|
|
xdk_d3d_apply_state_changes,
|
2013-04-07 17:43:54 +00:00
|
|
|
|
#if defined(HAVE_RGUI) || defined(HAVE_RMENU)
|
|
|
|
|
xdk_d3d_set_texture_frame,
|
|
|
|
|
xdk_d3d_set_texture_enable,
|
2013-03-10 22:24:28 +00:00
|
|
|
|
#endif
|
2013-03-11 20:42:02 +00:00
|
|
|
|
xdk_d3d_set_osd_msg,
|
2013-03-10 02:34:37 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void d3d_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
|
|
|
|
{
|
|
|
|
|
(void)data;
|
|
|
|
|
*iface = &d3d_poke_interface;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
static void xdk_d3d_start(void)
|
2012-01-21 22:59:27 +00:00
|
|
|
|
{
|
2012-04-10 19:23:42 +00:00
|
|
|
|
video_info_t video_info = {0};
|
|
|
|
|
|
|
|
|
|
video_info.vsync = g_settings.video.vsync;
|
|
|
|
|
video_info.force_aspect = false;
|
|
|
|
|
video_info.smooth = g_settings.video.smooth;
|
|
|
|
|
video_info.input_scale = 2;
|
2012-11-19 20:34:34 +00:00
|
|
|
|
video_info.fullscreen = true;
|
2012-11-20 22:54:35 +00:00
|
|
|
|
video_info.rgb32 = false;
|
2012-04-10 19:23:42 +00:00
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
driver.video_data = xdk_d3d_init(&video_info, NULL, NULL);
|
2012-11-19 20:34:34 +00:00
|
|
|
|
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
2013-03-10 02:34:37 +00:00
|
|
|
|
d3d_get_poke_interface(d3d, &driver.video_poke);
|
2012-11-19 20:34:34 +00:00
|
|
|
|
|
|
|
|
|
#if defined(_XBOX1)
|
|
|
|
|
font_x = 0;
|
|
|
|
|
font_y = 0;
|
|
|
|
|
#elif defined(_XBOX360)
|
2012-12-15 02:59:31 +00:00
|
|
|
|
snprintf(g_settings.video.font_path, sizeof(g_settings.video.font_path), "game:\\media\\Arial_12.xpr");
|
2012-11-19 20:34:34 +00:00
|
|
|
|
#endif
|
2013-01-11 20:04:51 +00:00
|
|
|
|
d3d->font_ctx = d3d_font_init_first(d3d, g_settings.video.font_path, 0 /* font size - fixed/unused */);
|
2012-01-21 22:59:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-19 09:59:52 +00:00
|
|
|
|
static void xdk_d3d_restart(void)
|
|
|
|
|
{
|
|
|
|
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
2013-01-19 11:19:54 +00:00
|
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->d3d_render_device;
|
2013-01-19 09:59:52 +00:00
|
|
|
|
|
|
|
|
|
if (!d3d)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-01-19 11:19:54 +00:00
|
|
|
|
D3DPRESENT_PARAMETERS d3dpp;
|
|
|
|
|
video_info_t video_info = {0};
|
|
|
|
|
|
|
|
|
|
video_info.vsync = g_settings.video.vsync;
|
|
|
|
|
video_info.force_aspect = false;
|
|
|
|
|
video_info.smooth = g_settings.video.smooth;
|
|
|
|
|
video_info.input_scale = 2;
|
|
|
|
|
video_info.fullscreen = true;
|
2013-01-19 11:35:16 +00:00
|
|
|
|
video_info.rgb32 = (d3d->base_size == sizeof(uint32_t)) ? true : false;
|
2013-01-19 11:19:54 +00:00
|
|
|
|
xdk_d3d_generate_pp(&d3dpp, &video_info);
|
|
|
|
|
|
|
|
|
|
d3dr->Reset(&d3dpp);
|
2013-01-19 09:59:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 17:15:06 +00:00
|
|
|
|
const video_driver_t video_xdk_d3d = {
|
|
|
|
|
xdk_d3d_init,
|
|
|
|
|
xdk_d3d_frame,
|
|
|
|
|
xdk_d3d_set_nonblock_state,
|
|
|
|
|
xdk_d3d_alive,
|
|
|
|
|
xdk_d3d_focus,
|
2013-04-07 17:43:54 +00:00
|
|
|
|
#if defined(HAVE_HLSL)
|
2013-01-08 18:07:06 +00:00
|
|
|
|
xdk_d3d_set_shader,
|
2013-04-07 17:43:54 +00:00
|
|
|
|
#else
|
|
|
|
|
NULL,
|
|
|
|
|
#endif
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_free,
|
2012-07-07 14:53:33 +00:00
|
|
|
|
"xdk_d3d",
|
2012-07-07 17:15:06 +00:00
|
|
|
|
xdk_d3d_start,
|
|
|
|
|
xdk_d3d_restart,
|
|
|
|
|
xdk_d3d_set_rotation,
|
2013-03-10 02:34:37 +00:00
|
|
|
|
NULL, /* viewport_info */
|
|
|
|
|
NULL, /* read_viewport */
|
|
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
|
NULL, /* overlay_interface */
|
|
|
|
|
#endif
|
|
|
|
|
d3d_get_poke_interface,
|
2012-04-09 14:04:24 +00:00
|
|
|
|
};
|