Path: blob/master/libsnes/bsnes/snes/alt/ppu-compatibility/render/render.hpp
2 views
//render.cpp1inline void render_line_mode0();2inline void render_line_mode1();3inline void render_line_mode2();4inline void render_line_mode3();5inline void render_line_mode4();6inline void render_line_mode5();7inline void render_line_mode6();8inline void render_line_mode7();910//cache.cpp11enum { COLORDEPTH_4 = 0, COLORDEPTH_16 = 1, COLORDEPTH_256 = 2 };12enum { TILE_2BIT = 0, TILE_4BIT = 1, TILE_8BIT = 2 };1314struct pixel_t {15//bgr555 color data for main/subscreen pixels: 0x0000 = transparent / use palette color # 016//needs to be bgr555 instead of palette index for direct color mode ($2130 bit 0) to work17uint16 src_main, src_sub;18//indicates source of palette # for main/subscreen (BG1-4, OAM, or back)19uint8 bg_main, bg_sub;20//color_exemption -- true when bg == OAM && palette index >= 192, disables color add/sub effects21uint8 ce_main, ce_sub;22//priority level of src_n. to set src_n,23//the priority of the pixel must be >pri_n24uint8 pri_main, pri_sub;25} pixel_cache[256];2627uint8 *bg_tiledata[3];28uint8 *bg_tiledata_state[3]; //0 = valid, 1 = dirty2930template<unsigned color_depth> void render_bg_tile(uint16 tile_num);31inline void flush_pixel_cache();32void alloc_tiledata_cache();33void flush_tiledata_cache();34void free_tiledata_cache();3536//windows.cpp37struct window_t {38uint8 main[256], sub[256];39} window[6];4041void build_window_table(uint8 bg, bool mainscreen);42void build_window_tables(uint8 bg);4344//bg.cpp45struct {46uint16 tw, th; //tile width, height47uint16 mx, my; //screen mask x, y48uint16 scx, scy; //sc index offsets49} bg_info[4];50void update_bg_info();5152template<unsigned bg> uint16 bg_get_tile(uint16 x, uint16 y);53template<unsigned mode, unsigned bg, unsigned color_depth> void render_line_bg(uint8 pri0_pos, uint8 pri1_pos);5455//oam.cpp56struct sprite_item {57uint8 width, height;58uint16 x, y;59uint8 character;60bool use_nameselect;61bool vflip, hflip;62uint8 palette;63uint8 priority;64bool size;65} sprite_list[128];66bool sprite_list_valid;67unsigned active_sprite;6869uint8 oam_itemlist[32];70struct oam_tileitem {71uint16 x, y, pri, pal, tile;72bool hflip;73} oam_tilelist[34];7475enum { OAM_PRI_NONE = 4 };76uint8 oam_line_pal[256], oam_line_pri[256];7778void update_sprite_list(unsigned addr, uint8 data);79void build_sprite_list();80bool is_sprite_on_scanline();81void load_oam_tiles();82void render_oam_tile(int tile_num);83void render_line_oam_rto();84void render_line_oam(uint8 pri0_pos, uint8 pri1_pos, uint8 pri2_pos, uint8 pri3_pos);8586//mode7.cpp87template<unsigned bg> void render_line_mode7(uint8 pri0_pos, uint8 pri1_pos);8889//addsub.cpp90inline uint16 addsub(uint32 x, uint32 y, bool halve);9192//line.cpp93inline uint16 get_palette(uint8 index);94inline uint16 get_direct_color(uint8 p, uint8 t);95inline uint16 get_pixel_normal(uint32 x);96inline uint16 get_pixel_swap(uint32 x);97void render_line_output();98void render_line_clear();99100101