From c34900b360681c2f9702b2ecb5c2b65829a8da30 Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Sat, 5 Jan 2013 17:55:42 +0000 Subject: - d3dhlsl.c: Clamp hlsl_prescale_x/y to a minimum of 1. Fixes crashes when using -nomaximize switch. [MooglyGuy] --- src/osd/windows/d3dhlsl.c | 7 +++++-- src/osd/windows/drawd3d.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/osd') diff --git a/src/osd/windows/d3dhlsl.c b/src/osd/windows/d3dhlsl.c index 2ed0787bfda..d6a182caf99 100644 --- a/src/osd/windows/d3dhlsl.c +++ b/src/osd/windows/d3dhlsl.c @@ -2023,7 +2023,7 @@ bool hlsl_info::register_texture(d3d_texture_info *texture, int width, int heigh if (hlsl_prescale_x == 0) { hlsl_prescale_x = 1; - while (width * xscale * hlsl_prescale_x < d3d->width) + while (width * xscale * hlsl_prescale_x <= d3d->width) { hlsl_prescale_x++; } @@ -2033,13 +2033,16 @@ bool hlsl_info::register_texture(d3d_texture_info *texture, int width, int heigh if (hlsl_prescale_y == 0) { hlsl_prescale_y = 1; - while (height * yscale * hlsl_prescale_y < d3d->height) + while (height * yscale * hlsl_prescale_y <= d3d->height) { hlsl_prescale_y++; } hlsl_prescale_y--; } + hlsl_prescale_x = ((hlsl_prescale_x == 0) ? 1 : hlsl_prescale_x); + hlsl_prescale_y = ((hlsl_prescale_y == 0) ? 1 : hlsl_prescale_y); + if (!add_render_target(d3d, texture, width, height, xscale * hlsl_prescale_x, yscale * hlsl_prescale_y)) return false; diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 024f437a3ad..f519d6008ea 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -1880,7 +1880,7 @@ d3d_texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsource, error: d3dintf->post_fx_available = false; - mame_printf_verbose("Direct3D: Critical warning: A texture failed to allocate. Expect things to get bad quickly.\n"); + printf("Direct3D: Critical warning: A texture failed to allocate. Expect things to get bad quickly.\n"); if (texture->d3dsurface != NULL) (*d3dintf->surface.release)(texture->d3dsurface); if (texture->d3dtex != NULL) -- cgit v1.2.3