| 1 | /* |
| 2 | * (C) GraÅžvydas "notaz" Ignotas, 2011 |
| 3 | * |
| 4 | * This work is licensed under the terms of any of these licenses |
| 5 | * (at your option): |
| 6 | * - GNU GPL, version 2 or later. |
| 7 | * - GNU LGPL, version 2.1 or later. |
| 8 | * See the COPYING file in the top-level directory. |
| 9 | */ |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | |
| 13 | extern const unsigned char cmd_lengths[256]; |
| 14 | #define command_lengths cmd_lengths |
| 15 | |
| 16 | #include "psx_gpu/psx_gpu.c" |
| 17 | #include "psx_gpu/psx_gpu_parse.c" |
| 18 | #include "gpu.h" |
| 19 | |
| 20 | static psx_gpu_struct egpu __attribute__((aligned(256))); |
| 21 | |
| 22 | void do_cmd_list(uint32_t *list, int count) |
| 23 | { |
| 24 | gpu_parse(&egpu, list, count * 4); |
| 25 | } |
| 26 | |
| 27 | int renderer_init(void) |
| 28 | { |
| 29 | initialize_psx_gpu(&egpu, gpu.vram); |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | void renderer_sync_ecmds(uint32_t *ecmds) |
| 34 | { |
| 35 | gpu_parse(&egpu, ecmds + 1, 6 * 4); |
| 36 | } |
| 37 | |
| 38 | void renderer_update_caches(int x, int y, int w, int h) |
| 39 | { |
| 40 | update_texture_cache_region(&egpu, x, y, x + w - 1, y + h - 1); |
| 41 | } |
| 42 | |
| 43 | void renderer_flush_queues(void) |
| 44 | { |
| 45 | flush_render_block_buffer(&egpu); |
| 46 | } |
| 47 | |
| 48 | void renderer_set_interlace(int enable, int is_odd) |
| 49 | { |
| 50 | egpu.interlace_mode &= ~(RENDER_INTERLACE_ENABLED|RENDER_INTERLACE_ODD); |
| 51 | if (enable) |
| 52 | egpu.interlace_mode |= RENDER_INTERLACE_ENABLED; |
| 53 | if (is_odd) |
| 54 | egpu.interlace_mode |= RENDER_INTERLACE_ODD; |
| 55 | } |
| 56 | |
| 57 | void renderer_set_config(const struct rearmed_cbs *cbs) |
| 58 | { |
| 59 | } |