90ca4913 |
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 | |
652c6b8b |
13 | extern const unsigned char cmd_lengths[256]; |
14 | #define command_lengths cmd_lengths |
15 | |
b243416b |
16 | static unsigned int *ex_regs; |
17 | |
18 | #define PCSX |
19 | #define SET_Ex(r, v) \ |
20 | ex_regs[r] = v |
21 | |
90ca4913 |
22 | #include "psx_gpu/psx_gpu.c" |
90ca4913 |
23 | #include "psx_gpu/psx_gpu_parse.c" |
62d7fa95 |
24 | #include "../gpulib/gpu.h" |
90ca4913 |
25 | |
26 | static psx_gpu_struct egpu __attribute__((aligned(256))); |
27 | |
b243416b |
28 | int do_cmd_list(uint32_t *list, int count, int *last_cmd) |
90ca4913 |
29 | { |
b243416b |
30 | int ret = gpu_parse(&egpu, list, count * 4, (u32 *)last_cmd); |
31 | |
32 | ex_regs[1] &= ~0x1ff; |
33 | ex_regs[1] |= egpu.texture_settings & 0x1ff; |
34 | return ret; |
90ca4913 |
35 | } |
36 | |
37 | int renderer_init(void) |
38 | { |
39 | initialize_psx_gpu(&egpu, gpu.vram); |
b243416b |
40 | ex_regs = gpu.ex_regs; |
90ca4913 |
41 | return 0; |
42 | } |
43 | |
44 | void renderer_sync_ecmds(uint32_t *ecmds) |
45 | { |
b243416b |
46 | gpu_parse(&egpu, ecmds + 1, 6 * 4, NULL); |
90ca4913 |
47 | } |
48 | |
05740673 |
49 | void renderer_update_caches(int x, int y, int w, int h) |
90ca4913 |
50 | { |
05740673 |
51 | update_texture_cache_region(&egpu, x, y, x + w - 1, y + h - 1); |
90ca4913 |
52 | } |
53 | |
54 | void renderer_flush_queues(void) |
55 | { |
56 | flush_render_block_buffer(&egpu); |
57 | } |
58 | |
5440b88e |
59 | void renderer_set_interlace(int enable, int is_odd) |
60 | { |
61 | egpu.interlace_mode &= ~(RENDER_INTERLACE_ENABLED|RENDER_INTERLACE_ODD); |
62 | if (enable) |
63 | egpu.interlace_mode |= RENDER_INTERLACE_ENABLED; |
64 | if (is_odd) |
65 | egpu.interlace_mode |= RENDER_INTERLACE_ODD; |
66 | } |
67 | |
90ca4913 |
68 | void renderer_set_config(const struct rearmed_cbs *cbs) |
69 | { |
70 | } |