X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fgpu_neon%2Fpsx_gpu_if.c;h=3f3805a9d0bd2679e26c2707df0eeaea2aacba95;hb=1fce6ce87dcd15107e3aa26b767395dbb6eafe6c;hp=62c4f9e51d73a314954156ff6ed80391a4103ccb;hpb=7956599fa5f666016f71870d9889748c97839041;p=pcsx_rearmed.git diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c index 62c4f9e5..3f3805a9 100644 --- a/plugins/gpu_neon/psx_gpu_if.c +++ b/plugins/gpu_neon/psx_gpu_if.c @@ -9,7 +9,12 @@ */ #include + +#ifdef _WIN32 +#include +#else #include +#endif extern const unsigned char cmd_lengths[256]; #define command_lengths cmd_lengths @@ -43,17 +48,33 @@ int do_cmd_list(uint32_t *list, int count, int *last_cmd) #define ENHANCEMENT_BUF_SIZE (1024 * 1024 * 2 * 4 + 4096 * 2) +static uint16_t *get_enhancement_bufer(int *x, int *y, int *w, int *h, + int *vram_h) +{ + uint16_t *ret = select_enhancement_buf_ptr(&egpu, *x); + + *x *= 2; + *y *= 2; + *w = *w * 2; + *h = *h * 2; + *vram_h = 1024; + return ret; +} + static void map_enhancement_buffer(void) { // currently we use 4x 1024*1024 buffers instead of single 2048*1024 // to be able to reuse 1024-width code better (triangle setup, // dithering phase, lines). - gpu.enhancement_bufer = gpu.mmap(ENHANCEMENT_BUF_SIZE); - if (gpu.enhancement_bufer == NULL) + egpu.enhancement_buf_ptr = gpu.mmap(ENHANCEMENT_BUF_SIZE); + if (egpu.enhancement_buf_ptr == NULL) { fprintf(stderr, "failed to map enhancement buffer\n"); - else - gpu.enhancement_bufer += 4096 / 2; - egpu.enhancement_buf_ptr = gpu.enhancement_bufer; + gpu.get_enhancement_bufer = NULL; + } + else { + egpu.enhancement_buf_ptr += 4096 / 2; + gpu.get_enhancement_bufer = get_enhancement_bufer; + } } int renderer_init(void) @@ -63,7 +84,7 @@ int renderer_init(void) initialized = 1; } - if (gpu.mmap != NULL && gpu.enhancement_bufer == NULL) + if (gpu.mmap != NULL && egpu.enhancement_buf_ptr == NULL) map_enhancement_buffer(); ex_regs = gpu.ex_regs; @@ -72,11 +93,10 @@ int renderer_init(void) void renderer_finish(void) { - if (gpu.enhancement_bufer != NULL) { - gpu.enhancement_bufer -= 4096 / 2; - gpu.munmap(gpu.enhancement_bufer, ENHANCEMENT_BUF_SIZE); + if (egpu.enhancement_buf_ptr != NULL) { + egpu.enhancement_buf_ptr -= 4096 / 2; + gpu.munmap(egpu.enhancement_buf_ptr, ENHANCEMENT_BUF_SIZE); } - gpu.enhancement_bufer = NULL; egpu.enhancement_buf_ptr = NULL; egpu.enhancement_current_buf_ptr = NULL; initialized = 0; @@ -142,7 +162,7 @@ void renderer_notify_res_change(void) if (egpu.enhancement_x_threshold != gpu.screen.hres) { egpu.enhancement_x_threshold = gpu.screen.hres; - update_enhancement_buf_table(&egpu); + update_enhancement_buf_table_from_hres(&egpu); } } @@ -165,6 +185,22 @@ void renderer_set_config(const struct rearmed_cbs *cbs) initialized = 1; } - if (gpu.enhancement_bufer == NULL) + if (gpu.mmap != NULL && egpu.enhancement_buf_ptr == NULL) map_enhancement_buffer(); + if (cbs->pl_set_gpu_caps) + cbs->pl_set_gpu_caps(GPU_CAP_SUPPORTS_2X); + + egpu.use_dithering = cbs->gpu_neon.allow_dithering; + if(!egpu.use_dithering) { + egpu.dither_table[0] = dither_table_row(0, 0, 0, 0); + egpu.dither_table[1] = dither_table_row(0, 0, 0, 0); + egpu.dither_table[2] = dither_table_row(0, 0, 0, 0); + egpu.dither_table[3] = dither_table_row(0, 0, 0, 0); + } else { + egpu.dither_table[0] = dither_table_row(-4, 0, -3, 1); + egpu.dither_table[1] = dither_table_row(2, -2, 3, -1); + egpu.dither_table[2] = dither_table_row(-3, 1, -4, 0); + egpu.dither_table[3] = dither_table_row(3, -1, 2, -2); + } + }