aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpulib
diff options
context:
space:
mode:
authorhizzlekizzle2020-08-13 18:06:23 -0500
committerGitHub2020-08-13 18:06:23 -0500
commitd56340b165b4a7ef25bc3c7509d4f2315843bc31 (patch)
treec2adb49f15dd24282077446f93548b4731f7d1ee /plugins/gpulib
parentddd39f209f4ce6f03ed3198d7d58c2e36565baa9 (diff)
parent43047988e507799d7d5bbcd926c5d0b5b94fcdc1 (diff)
downloadpcsx_rearmed-d56340b165b4a7ef25bc3c7509d4f2315843bc31.tar.gz
pcsx_rearmed-d56340b165b4a7ef25bc3c7509d4f2315843bc31.tar.bz2
pcsx_rearmed-d56340b165b4a7ef25bc3c7509d4f2315843bc31.zip
Merge pull request #444 from justinweiss/hires-downscale
Add an option to downscale hi-res views
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 36de7ee..d0f3bf8 100644
--- a/plugins/gpulib/gpu.h
+++ b/plugins/gpulib/gpu.h
@@ -71,6 +71,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 {
@@ -94,6 +96,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