From b41802d6ce8657ac1033dbbecac9e98a701791ae Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Sun, 6 Jan 2013 00:28:22 +0000 Subject: 01234567890123456789012345678901234567890123456789012345678901234567890123456789 - drawd3d.c: Move default_texture creation into device_create_resources. Should fix intermittent crashes when alt-tabbing back to a full-screen instance of MAME. [MooglyGuy] --- src/osd/windows/drawd3d.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/osd') diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index ac9efa6a2aa..1b3a28c6238 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -787,22 +787,6 @@ try_again: } } - if (d3d->default_bitmap.valid()) - { - render_texinfo texture; - - // fake in the basic data so it looks like it came from render.c - texture.base = d3d->default_bitmap.raw_pixptr(0); - texture.rowpixels = d3d->default_bitmap.rowpixels(); - texture.width = d3d->default_bitmap.width(); - texture.height = d3d->default_bitmap.height(); - texture.palette = NULL; - texture.seqid = 0; - - // now create it - d3d->default_texture = texture_create(d3d, &texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32)); - } - int ret = d3d->hlsl->create_resources(false); if (ret != 0) return ret; @@ -871,6 +855,22 @@ static int device_create_resources(d3d_info *d3d) result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); result = (*d3dintf->device.present)(d3d->device, NULL, NULL, NULL, NULL, 0); + if (d3d->default_bitmap.valid()) + { + render_texinfo texture; + + // fake in the basic data so it looks like it came from render.c + texture.base = d3d->default_bitmap.raw_pixptr(0); + texture.rowpixels = d3d->default_bitmap.rowpixels(); + texture.width = d3d->default_bitmap.width(); + texture.height = d3d->default_bitmap.height(); + texture.palette = NULL; + texture.seqid = 0; + + // now create it + d3d->default_texture = texture_create(d3d, &texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32)); + } + // experimental: if we have a vector bitmap, create a texture for it if (d3d->vector_bitmap.valid()) { @@ -952,6 +952,7 @@ static void device_delete_resources(d3d_info *d3d) d3d->vertexbuf = NULL; global_free(d3d->default_texture); + d3d->default_texture = NULL; } -- cgit v1.2.3