mirror of
https://github.com/jkdansereau/goldeneye-pc-port.git
synced 2026-10-23 15:52:42 +02:00
- Replace setjmp/longjmp green threads with real pthreads (8MB stacks); PortQueue side table (mutex+condvar) for OSMesgQueue; dedicated tick thread posts VI retrace + services timers (D24). - Dual-mapped N64 DRAM: one 8MB store at V1 0x70000000 (s32-safe, all game RAM symbols) and V2 0x80000000 (KSEG0 mirror for offset|0x80000000 rebuilds). Windows: CreateFileMappingW + MapViewOfFileEx; POSIX: memfd + MAP_FIXED. dram_syms.s pins cfb_16/_bssSegmentEnd/tlb block (D25). - Address-width shims: PHYS_TO_K0 identity, OS_K0_TO_PHYSICAL = offset from V1 base, OS_PHYSICAL_TO_K0 identity; fast3d seg_addr() remaps small offsets into V2 (D26). - ASLR off (-Wl,--disable-dynamicbase): absolute symbols referenced through pointer-typed externs (.refptr + BASE reloc) must not rebase; startup sanity check on image base 0x140000000 (D27). - osPiStartDma posts its completion message on every path (fixes romReceiveMesg deadlock) (D29). - SEH-free crash handler: raw fault log first, validated manual EBP-chain walk second (-fno-omit-frame-pointer), TerminateProcess; crashDumpThreads via Toolhelp32 for heartbeat hang dumps (D30). - PD fast3d integrated (port/fast3d/), replaces gfxstub.c; real src/sched.c compiled; mainproc runs as a real pthread, host thread pumps SDL events. - Docs: findings D24-D31 + Phase 2 status (section F/G). Current state: boots through bossInitMainthreadData to langInit(), then SIGSEGVs on the first file load — stack frame clobbered by a table of truncated s32 pointers (D31, open). Next: attribute the write with 'set scheduler-locking on' + hardware watchpoint.
62 lines
2.8 KiB
C
62 lines
2.8 KiB
C
#ifndef GFX_RENDERING_API_H
|
|
#define GFX_RENDERING_API_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
struct ShaderProgram;
|
|
|
|
struct GfxClipParameters {
|
|
bool z_is_from_0_to_1;
|
|
bool invert_y;
|
|
};
|
|
|
|
enum FilteringMode { FILTER_NONE, FILTER_LINEAR, FILTER_THREE_POINT };
|
|
enum MipmapFilteringMode { MIPMAP_DISABLED, MIPMAP_NEAREST, MIPMAP_LINEAR };
|
|
|
|
struct GfxRenderingAPI {
|
|
const char* (*get_name)(void);
|
|
int (*get_max_texture_size)(void);
|
|
struct GfxClipParameters (*get_clip_parameters)(void);
|
|
void (*unload_shader)(struct ShaderProgram* old_prg);
|
|
void (*load_shader)(struct ShaderProgram* new_prg);
|
|
struct ShaderProgram* (*create_and_load_new_shader)(uint64_t shader_id0, uint32_t shader_id1);
|
|
struct ShaderProgram* (*lookup_shader)(uint64_t shader_id0, uint32_t shader_id1);
|
|
void (*shader_get_info)(struct ShaderProgram* prg, uint8_t* num_inputs, bool used_textures[2]);
|
|
void (*clear_shaders)(void);
|
|
uint32_t (*new_texture)(void);
|
|
void (*select_texture)(int tile, uint32_t texture_id, bool linear_filter);
|
|
void (*upload_texture)(const uint8_t* rgba32_buf, uint32_t width, uint32_t height, bool gen_mipmaps);
|
|
void (*set_sampler_parameters)(int sampler, bool linear_filter, uint32_t cms, uint32_t cmt, bool mipmaps);
|
|
void (*set_depth_mode)(bool depth_test, bool depth_update, bool depth_compare, bool depth_source_prim, uint16_t zmode);
|
|
void (*set_depth_range)(float znear, float zfar);
|
|
void (*set_viewport)(int x, int y, int width, int height);
|
|
void (*set_scissor)(int x, int y, int width, int height);
|
|
void (*set_use_alpha)(bool use_alpha, bool modulate);
|
|
void (*draw_triangles)(float buf_vbo[], size_t buf_vbo_len, size_t buf_vbo_num_tris);
|
|
void (*init)(void);
|
|
void (*on_resize)(void);
|
|
void (*start_frame)(void);
|
|
void (*end_frame)(void);
|
|
void (*finish_render)(void);
|
|
int (*create_framebuffer)();
|
|
void (*update_framebuffer_parameters)(int fb_id, uint32_t width, uint32_t height, uint32_t msaa_level,
|
|
bool opengl_invert_y, bool render_target, bool has_depth_buffer,
|
|
bool can_extract_depth);
|
|
bool (*start_draw_to_framebuffer)(int fb_id, float noise_scale);
|
|
void (*copy_framebuffer)(int fb_dst, int fb_src, int left, int top, bool flip_y, bool use_back);
|
|
void (*clear_framebuffer)(bool clear_color, bool clear_depth);
|
|
void (*resolve_msaa_color_buffer)(int fb_id_target, int fb_id_source);
|
|
void* (*get_framebuffer_texture_id)(int fb_id);
|
|
void (*select_texture_fb)(int fb_id);
|
|
void (*delete_texture)(uint32_t texID);
|
|
void (*set_texture_filter)(enum FilteringMode mode);
|
|
enum FilteringMode (*get_texture_filter)(void);
|
|
void (*set_mipmap_filter)(enum MipmapFilteringMode mode);
|
|
void (*set_anisotropy_level)(int);
|
|
int (*get_max_anisotropy_level)(void);
|
|
};
|
|
|
|
#endif
|