aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpulib
diff options
context:
space:
mode:
authorJustin Weiss2020-08-02 22:04:52 -0700
committerJustin Weiss2020-08-13 08:56:50 -0700
commit43047988e507799d7d5bbcd926c5d0b5b94fcdc1 (patch)
tree40cdd3800bfb51ca35efc795417e9daa8d33296f /plugins/gpulib
parentab323c13064ac483e66682556ae3bf387df0f29d (diff)
downloadpcsx_rearmed-43047988e507799d7d5bbcd926c5d0b5b94fcdc1.tar.gz
pcsx_rearmed-43047988e507799d7d5bbcd926c5d0b5b94fcdc1.tar.bz2
pcsx_rearmed-43047988e507799d7d5bbcd926c5d0b5b94fcdc1.zip
Add an option to downscale hi-res views
Some older devices that use gpu_unai don't have a high enough resolution to display all of the pixels in high-res mode. There's a setting in unai to skip rendering of these pixels, but it's not connected to the libretro frontend, and does not appear to be used in the gpulib implementation at all. This commit adds a gpu_unai setting, Enable Hi-Res Downscaling, that will enable pixel skipping and blit only the pixels actually rendered into a buffer no larger than 384x240. This buffer is then treated as the actual framebuffer by gpulib and the libretro frontend.
Diffstat (limited to 'plugins/gpulib')
-rw-r--r--plugins/gpulib/gpu.h4
-rw-r--r--plugins/gpulib/vout_pl.c12
2 files changed, 16 insertions, 0 deletions
diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h
index 7e1d18b..009297d 100644
--- a/plugins/gpulib/gpu.h
+++ b/plugins/gpulib/gpu.h
@@ -68,6 +68,8 @@ struct psx_gpu {
uint32_t blanked:1;
uint32_t enhancement_enable:1;
uint32_t enhancement_active:1;
+ uint32_t downscale_enable:1;
+ uint32_t downscale_active:1;
uint32_t *frame_count;
uint32_t *hcnt; /* hsync count */
struct {
@@ -91,6 +93,8 @@ struct psx_gpu {
int useDithering:1; /* 0 - off , 1 - on */
uint16_t *(*get_enhancement_bufer)
(int *x, int *y, int *w, int *h, int *vram_h);
+ uint16_t *(*get_downscale_buffer)
+ (int *x, int *y, int *w, int *h, int *vram_h);
void *(*mmap)(unsigned int size);
void (*munmap)(void *ptr, unsigned int size);
};
diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c
index a9437cb..075e3c3 100644
--- a/plugins/gpulib/vout_pl.c
+++ b/plugins/gpulib/vout_pl.c
@@ -43,6 +43,15 @@ static void check_mode_change(int force)
h_out *= 2;
}
+ gpu.state.downscale_active =
+ gpu.get_downscale_buffer != NULL && gpu.state.downscale_enable
+ && (w >= 512 || h >= 256);
+
+ if (gpu.state.downscale_active) {
+ w_out = w < 512 ? w : 320;
+ h_out = h < 256 ? h : h / 2;
+ }
+
// width|rgb24 change?
if (force || (gpu.status.reg ^ old_status) & ((7<<16)|(1<<21)) || h != old_h)
{
@@ -69,6 +78,9 @@ void vout_update(void)
if (gpu.state.enhancement_active)
vram = gpu.get_enhancement_bufer(&x, &y, &w, &h, &vram_h);
+ if (gpu.state.downscale_active)
+ vram = gpu.get_downscale_buffer(&x, &y, &w, &h, &vram_h);
+
if (y + h > vram_h) {
if (y + h - vram_h > h / 2) {
// wrap