forked from Ports/goldeneye-pc-port
GE's texLoadFromGdl picks a handler per G_NOOP texture reference from w0 & 7. TEXTURETYPE_LOD/MIPMAP (texHandleType0/Type2) issue ONE load block at TMEM 0, so tiles 0..n are LOD levels of that one image. TEXTURETYPE_DETAIL (texHandleType1, src/game/tex.c) issues TWO: the detail texture at TMEM 0 and the real base image at TMEM texGetSizeInBytes(detail,0) on tiles 1+. gfx_lod_tile_offset folded every G_TL_LOD draw to tile 0 (D107 -- correct for the first two, wrong for DETAIL), so the port drew the detail texture and never imported the base image at all. All four Surface 1 treeline cards (tex1198-tex1201, RGBA5551 64x17 cut-outs) are DETAIL bindings sharing one detail texture, tex2465: an opaque 32x32 IA8 noise tile. That is the same texture D267/D276 measured at 1023/1024 texels opaque and called the mystery "noise painter" -- hence 20+ passes chasing decode, alpha, mip and geometry theories for what was a binding bug. Fix (port layer only): under G_TL_LOD, if tile fi+1 differs from tile fi in BOTH TMEM address and fmt/siz, sample tile 1. Asymmetric on purpose -- LOD levels of one image always share a format, so a mip chain can never trip it, and a detail pair that happened to share a format just keeps the old behaviour. Config Video.DetailBaseTile, default on. Verified: Surface 1 idle spawn goes from an opaque tiled noise wall to discrete snow-covered pines with ground/snow unchanged; Surface 2 shows a discrete night treeline; Depot renders clean; bunker1 golden framediff is bit-identical with the fix on and off. Offline scan of every level's bg: DETAIL bindings exist only in sevx (84), depo (39), sevb (4), sev (4), so every other level is provably untouched. User play-test confirmed. Also refuted and removed pass 25's fix direction: cut-out mip suppression changed nothing, and its alpha census showed the wall is painted by a fully opaque texture -- retiring the mip / 1-bit-alpha / XLU-smear branch. The GE_D236P25 probe is gone with it. tools_pc/gen_env_probes.py: stop counting a "GE_FOO[" log-line TAG in the doc as a documented env var. GE_TEXDUMP_ADDR prints "GE_TEXA[...]", which is not the name of any getenv(), so the check reported a permanent phantom GONE. Generalised as docs/porting-notes.md D12; full trail in findings.md D236 pass 26. Carries the pending D75/M-197 sidecar-converter fix and the env-gated D236/D75 probes, which the doc gates require to land alongside their rows.
70 lines
2.8 KiB
C
70 lines
2.8 KiB
C
#ifndef GFX_API_H
|
|
#define GFX_API_H
|
|
|
|
#ifndef __cplusplus
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#endif
|
|
|
|
#include "gfx_rendering_api.h"
|
|
#include "gfx_window_manager_api.h"
|
|
|
|
struct XYWidthHeight {
|
|
int16_t x, y;
|
|
uint32_t width, height;
|
|
};
|
|
|
|
struct GfxDimensions {
|
|
float internal_mul;
|
|
uint32_t width, height;
|
|
float aspect_ratio;
|
|
};
|
|
|
|
struct GfxInitSettings {
|
|
struct GfxWindowManagerAPI *wapi;
|
|
struct GfxRenderingAPI *rapi;
|
|
struct GfxWindowInitSettings window_settings;
|
|
};
|
|
|
|
extern struct GfxDimensions gfx_current_window_dimensions; // The dimensions of the window
|
|
extern struct GfxDimensions
|
|
gfx_current_dimensions; // The dimensions of the draw area the game draws to, before scaling (if applicable)
|
|
extern struct XYWidthHeight
|
|
gfx_current_game_window_viewport; // The area of the window the game is drawn to, (0, 0) is top-left corner
|
|
extern uint32_t gfx_msaa_level;
|
|
extern struct XYWidthHeight gfx_current_native_viewport; // The internal/native video mode of the game
|
|
extern float gfx_current_native_aspect; // The aspect ratio of the above mode
|
|
extern bool gfx_framebuffers_enabled;
|
|
extern bool gfx_detail_textures_enabled;
|
|
|
|
void gfx_init(const struct GfxInitSettings *settings);
|
|
void gfx_destroy(void);
|
|
struct GfxRenderingAPI* gfx_get_current_rendering_api(void);
|
|
void gfx_start_frame(void);
|
|
void gfx_run(Gfx* commands);
|
|
void gfx_end_frame(void);
|
|
void gfx_set_target_fps(int);
|
|
void gfx_set_texture_filter(enum FilteringMode mode);
|
|
void gfx_set_mipmap_filter(enum MipmapFilteringMode mode);
|
|
void gfx_set_fix_mip_textures(int on);
|
|
void gfx_set_detail_base_tile(int on); /* D236: sample the base image of a DETAIL binding */
|
|
void gfx_set_wrap_fix(int on);
|
|
void gfx_set_anisotropy_level(int level); /* 1 = off; clamped to GL max */
|
|
void gfx_set_safe_area_crop(int on); /* crop the N64 TV-overscan safe-area margin instead of showing it as black bars */
|
|
/* On-window pixel rect (top-left origin) the full VI logical canvas (0,0)-
|
|
* (SCREEN_WIDTH, SCREEN_HEIGHT) currently maps to, honoring the safe-area
|
|
* crop above -- for inverting a window mouse click into logical 2D UI space
|
|
* (see port/src/optionsoverlay.c, D316). */
|
|
void gfx_get_ui_screen_rect(int32_t *outX, int32_t *outY, int32_t *outW, int32_t *outH);
|
|
void gfx_texture_cache_clear(void);
|
|
int gfx_texture_cache_count(void); /* D235 */
|
|
void gfx_texture_cache_delete(const uint8_t *orig_addr);
|
|
void gfx_texture_cache_delete_range(const uint8_t *start, const uint8_t *end);
|
|
int gfx_create_framebuffer(uint32_t width, uint32_t height, int upscale, int autoresize);
|
|
void gfx_resize_framebuffer(int fb, uint32_t width, uint32_t height, int upscale, int autoresize);
|
|
void gfx_set_framebuffer(int fb, float noise_scale) ;
|
|
void gfx_reset_framebuffer(void);
|
|
void gfx_copy_framebuffer(int fb_dst, int fb_src, int left, int top, int use_back);
|
|
|
|
#endif
|