- d3dhlsl.c: Clamp hlsl_prescale_x/y to a minimum of 1. Fixes crashes when using

-nomaximize switch. [MooglyGuy]
This commit is contained in:
Ryan Holtz 2013-01-05 17:55:42 +00:00
parent f728c29698
commit c34900b360
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -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)