(D3D) Cleanups

This commit is contained in:
twinaphex 2015-04-05 16:34:31 +02:00
parent 3f118245a6
commit 162ffd9586
1 changed files with 165 additions and 166 deletions

View File

@ -710,11 +710,12 @@ static const gfx_ctx_driver_t *d3d_get_context(void *data)
/* Default to Direct3D9 for now.
TODO: GL core contexts through ANGLE? */
enum gfx_ctx_api api = GFX_CTX_DIRECT3D9_API;
unsigned major = 9, minor = 0;
unsigned major = 9;
unsigned minor = 0;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
#if defined(_XBOX1)
#if defined(HAVE_D3D8)
api = GFX_CTX_DIRECT3D8_API;
major = 8;
#endif
@ -1081,11 +1082,8 @@ static void d3d_reinit_renderchain(void *data,
if (!d3d)
return;
d3d->pixel_size = video->rgb32 ?
sizeof(uint32_t) : sizeof(uint16_t);
d3d->tex_w = d3d->tex_h =
RARCH_SCALE_BASE * video->input_scale;
d3d->pixel_size = video->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
d3d->tex_w = d3d->tex_h = RARCH_SCALE_BASE * video->input_scale;
RARCH_LOG(
"Reinitializing renderchain - and textures (%u x %u @ %u bpp)\n",
d3d->tex_w, d3d->tex_h, d3d->pixel_size * CHAR_BIT);
@ -1105,19 +1103,17 @@ static bool texture_image_render(d3d_video_t *d3d,
struct texture_image *out_img,
int x, int y, int w, int h, bool force_fullscreen)
{
float fX, fY;
void *verts = NULL;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
float fX = (float)(x);
float fY = (float)(y);
if (!d3d)
return false;
if (!out_img->pixels || !out_img->vertex_buf)
return false;
fX = (float)(x);
fY = (float)(y);
// create the new vertices
/* Create the new vertices. */
Vertex newVerts[] =
{
// x, y, z, color, u ,v
@ -1228,9 +1224,9 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
if (d3d->shader.pass[i].fbo.valid)
continue;
d3d->shader.pass[i].fbo.scale_x =
d3d->shader.pass[i].fbo.scale_y = 1.0f;
d3d->shader.pass[i].fbo.type_x =
d3d->shader.pass[i].fbo.scale_x = 1.0f;
d3d->shader.pass[i].fbo.type_x = RARCH_SCALE_INPUT;
d3d->shader.pass[i].fbo.type_y = RARCH_SCALE_INPUT;
}
@ -1305,11 +1301,14 @@ static bool d3d_init_singlepass(d3d_video_t *d3d)
memset(&d3d->shader, 0, sizeof(d3d->shader));
d3d->shader.passes = 1;
pass = (video_shader_pass*)&d3d->shader.pass[0];
pass->fbo.valid = true;
pass->fbo.scale_x = pass->fbo.scale_y = 1.0;
pass->fbo.type_x = pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
pass->fbo.scale_y = 1.0;
pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
pass->fbo.scale_x = pass->fbo.scale_y;
pass->fbo.type_x = pass->fbo.type_y;
strlcpy(pass->source.path, d3d->cg_shader.c_str(),
sizeof(pass->source.path));
#endif