(SW Renderer) Properly get and set internal/dither mask resolutions.

Should fix issue #211
This commit is contained in:
r5 2017-07-30 18:27:25 +01:00
parent f9ab0a1ed3
commit ae09b521b1
3 changed files with 30 additions and 15 deletions

View File

@ -2269,8 +2269,8 @@ static void alloc_surface(void)
uint32_t width = MEDNAFEN_CORE_GEOMETRY_MAX_W;
uint32_t height = is_pal ? MEDNAFEN_CORE_GEOMETRY_MAX_H : 480;
width <<= GPU_get_dither_upscale_shift();
height <<= GPU_get_dither_upscale_shift();
width <<= GPU_get_upscale_shift();
height <<= GPU_get_upscale_shift();
if (surf != NULL)
delete surf;
@ -3596,7 +3596,7 @@ void retro_run(void)
retro_get_system_av_info(&new_av_info);
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &new_av_info);
if (GPU_get_dither_upscale_shift() != psx_gpu_upscale_shift)
if (GPU_get_upscale_shift() != psx_gpu_upscale_shift)
{
struct retro_system_av_info new_av_info;
retro_get_system_av_info(&new_av_info);
@ -3610,17 +3610,17 @@ void retro_run(void)
else
{
// Failed, we have to postpone the upscaling change
psx_gpu_upscale_shift = GPU_get_dither_upscale_shift();
psx_gpu_upscale_shift = GPU_get_upscale_shift();
}
}
switch (psx_gpu_dither_mode)
{
case DITHER_NATIVE:
GPU_set_dither_upscale_shift(psx_gpu_upscale_shift);
GPU_set_dither_upscale_shift(0);
break;
case DITHER_UPSCALED:
GPU_set_dither_upscale_shift(0);
GPU_set_dither_upscale_shift(psx_gpu_upscale_shift);
break;
case DITHER_OFF:
break;
@ -3766,7 +3766,7 @@ void retro_run(void)
const void *fb = NULL;
unsigned width = rects[0];
unsigned height = spec.DisplayRect.h;
uint8_t upscale_shift = GPU_get_dither_upscale_shift();
uint8_t upscale_shift = GPU_get_upscale_shift();
if (rsx_intf_is_type() == RSX_SOFTWARE)
{

View File

@ -1978,13 +1978,6 @@ int GPU_StateAction(StateMem *sm, int load, int data_only)
return(ret);
}
void GPU_set_dither_upscale_shift(uint8 upscale_shift)
{
PS_GPU *gpu = (PS_GPU*)GPU;
gpu->dither_upscale_shift = upscale_shift;
}
void GPU_set_display_change_count(unsigned a)
{
PS_GPU *gpu = (PS_GPU*)GPU;
@ -1997,12 +1990,30 @@ unsigned GPU_get_display_change_count(void)
return gpu->display_change_count;
}
void GPU_set_dither_upscale_shift(uint8 factor)
{
PS_GPU *gpu = (PS_GPU*)GPU;
gpu->dither_upscale_shift = factor;
}
uint8 GPU_get_dither_upscale_shift(void)
{
PS_GPU *gpu = (PS_GPU*)GPU;
return gpu->dither_upscale_shift;
}
void GPU_set_upscale_shift(uint8 factor)
{
PS_GPU *gpu = (PS_GPU*)GPU;
gpu->upscale_shift = factor;
}
uint8 GPU_get_upscale_shift(void)
{
PS_GPU *gpu = (PS_GPU*)GPU;
return gpu->upscale_shift;
}
bool GPU_DMACanWrite(void)
{
return CalcFIFOReadyBit();

View File

@ -236,7 +236,11 @@ bool GPU_DMACanWrite(void);
uint8 GPU_get_dither_upscale_shift(void);
void GPU_set_dither_upscale_shift(uint8 upscale_shift);
void GPU_set_dither_upscale_shift(uint8 factor);
uint8 GPU_get_upscale_shift(void);
void GPU_set_upscale_shift(uint8 factor);
void GPU_set_display_change_count(unsigned a);