1 // license:BSD-3-Clause 2 // copyright-holders:Olivier Galibert 3 #ifndef MAME_VIDEO_POWERVR2_H 4 #define MAME_VIDEO_POWERVR2_H 5 6 #pragma once 7 8 class powervr2_device : public device_t, 9 public device_video_interface 10 { 11 public: 12 enum { NUM_BUFFERS = 4 }; 13 enum { 14 EOXFER_YUV_IRQ, 15 EOXFER_OPLST_IRQ, 16 EOXFER_OPMV_IRQ, 17 EOXFER_TRLST_IRQ, 18 EOXFER_TRMV_IRQ, 19 EOXFER_PTLST_IRQ, 20 VBL_IN_IRQ, 21 VBL_OUT_IRQ, 22 HBL_IN_IRQ, 23 EOR_VIDEO_IRQ, 24 EOR_TSP_IRQ, 25 EOR_ISP_IRQ, 26 DMA_PVR_IRQ, 27 ERR_ISP_LIMIT_IRQ, 28 ERR_PVRIF_ILL_ADDR_IRQ 29 }; 30 31 void ta_map(address_map &map); 32 void pd_dma_map(address_map &map); 33 34 struct { 35 uint32_t pvr_addr; 36 uint32_t sys_addr; 37 uint32_t size; 38 uint8_t sel; 39 uint8_t dir; 40 uint8_t flag; 41 uint8_t start; 42 } m_pvr_dma; 43 44 static const int pvr_parconfseq[]; 45 static const int pvr_wordsvertex[24]; 46 static const int pvr_wordspolygon[24]; 47 int pvr_parameterconfig[128]; 48 uint32_t dilated0[15][1024]; 49 uint32_t dilated1[15][1024]; 50 int dilatechose[64]; 51 float wbuffer[480][640]; 52 53 54 // the real accumulation buffer is a 32x32x8bpp buffer into which tiles get rendered before they get copied to the framebuffer 55 // our implementation is not currently tile based, and thus the accumulation buffer is screen sized 56 std::unique_ptr<bitmap_rgb32> fake_accumulationbuffer_bitmap; 57 58 /* 59 * Per-polygon base and offset colors. These are scaled by per-vertex 60 * weights. 61 * 62 * These are only used if the colortype in the polygon header is 2 63 * or 3. If it is 0 or 1, then each vertex's base and offset colors are 64 * specified completely independently of one another in the per-vertex 65 * parameters. 66 * 67 * The base color is combined with the texture sample (if any) according 68 * to one of four fixed functions. The offset color is then added to 69 * the combined texture sample and base color with the exception of 70 * alpha. 71 * 72 * poly_offs_color is not always used. Not specifying a poly_offs_color 73 * is equivalent to using a poly_offs_color of 0. 74 * 75 * poly_last_mode_2_base_color is used to hold the last base color 76 * specified using color type 2. Color type 3 will always use the last 77 * base color specified using color type 2. 78 */ 79 float poly_base_color[4], poly_offs_color[4], 80 poly_last_mode_2_base_color[4]; 81 82 struct texinfo 83 { 84 uint32_t address = 0, vqbase = 0; 85 86 uint32_t tsinstruction = 0; 87 88 int textured = 0, sizex = 0, sizey = 0, stride = 0, sizes = 0, pf = 0, palette = 0, mode = 0, mipmapped = 0, blend_mode = 0, filter_mode = 0; 89 int coltype = 0; 90 91 uint32_t (powervr2_device::*r)(texinfo *t, float x, float y) = nullptr; 92 uint32_t (*blend)(uint32_t s, uint32_t d) = nullptr; 93 int (*u_func)(float uv, int size) = nullptr; 94 int (*v_func)(float uv, int size) = nullptr; 95 int palbase = 0, cd = 0; 96 }; 97 98 struct vert 99 { 100 float x = 0, y = 0, w = 0, u = 0, v = 0; 101 102 // base and offset colors 103 float b[4] = { 0, 0, 0, 0 }, o[4] = { 0, 0, 0, 0 }; 104 }; 105 106 struct strip 107 { 108 int svert = 0, evert = 0; 109 texinfo ti; 110 }; 111 112 static const unsigned MAX_VERTS = 65536; 113 static const unsigned MAX_STRIPS = 65536; 114 115 /* 116 * There are five polygon lists: 117 * 118 * Opaque 119 * Punch-through polygon 120 * Opaque/punch-through modifier volume 121 * Translucent 122 * Translucent modifier volume 123 * 124 * They are rendered in that order. List indices are are three bits, so 125 * technically there are 8 polygon lists, but only the first 5 are valid. 126 */ 127 enum { 128 DISPLAY_LIST_OPAQUE, 129 DISPLAY_LIST_OPAQUE_MOD, 130 DISPLAY_LIST_TRANS, 131 DISPLAY_LIST_TRANS_MOD, 132 DISPLAY_LIST_PUNCH_THROUGH, 133 DISPLAY_LIST_LAST, 134 135 DISPLAY_LIST_COUNT, 136 137 DISPLAY_LIST_NONE = -1 138 }; 139 140 struct poly_group { 141 strip strips[MAX_STRIPS]; 142 int strips_size = 0; 143 }; 144 145 struct receiveddata { 146 vert verts[MAX_VERTS]; 147 struct poly_group groups[DISPLAY_LIST_COUNT]; 148 uint32_t ispbase = 0; 149 uint32_t fbwsof1 = 0; 150 uint32_t fbwsof2 = 0; 151 int busy = 0; 152 int valid = 0; 153 int verts_size = 0; 154 }; 155 156 enum { 157 TEX_FILTER_NEAREST = 0, 158 TEX_FILTER_BILINEAR, 159 TEX_FILTER_TRILINEAR_A, 160 TEX_FILTER_TRILINEAR_B 161 }; 162 163 int tafifo_pos, tafifo_mask, tafifo_vertexwords, tafifo_listtype; 164 int start_render_received; 165 int renderselect; 166 int listtype_used; 167 int alloc_ctrl_OPB_Mode, alloc_ctrl_PT_OPB, alloc_ctrl_TM_OPB, alloc_ctrl_T_OPB, alloc_ctrl_OM_OPB, alloc_ctrl_O_OPB; 168 std::unique_ptr<receiveddata[]> grab; 169 int grabsel; 170 int grabsellast; 171 uint32_t paracontrol,paratype,endofstrip,listtype,global_paratype,parameterconfig; 172 uint32_t groupcontrol,groupen,striplen,userclip; 173 uint32_t objcontrol,shadow,volume,coltype,texture,offset_color_enable,gouraud,uv16bit; 174 uint32_t texturesizes,textureaddress,scanorder,pixelformat; 175 uint32_t blend_mode, srcselect,dstselect,fogcontrol,colorclamp, use_alpha; 176 uint32_t ignoretexalpha,flipuv,clampuv,filtermode,sstexture,mmdadjust,tsinstruction; 177 uint32_t depthcomparemode,cullingmode,zwritedisable,cachebypass,dcalcctrl,volumeinstruction,mipmapped,vqcompressed,strideselect,paletteselector; 178 179 uint64_t *dc_texture_ram; 180 uint64_t *dc_framebuffer_ram; 181 182 uint64_t *pvr2_texture_ram; 183 uint64_t *pvr2_framebuffer_ram; 184 uint64_t *elan_ram; 185 186 uint32_t debug_dip_status; 187 emu_timer *vbout_timer; 188 emu_timer *vbin_timer; 189 emu_timer *hbin_timer; 190 emu_timer *endofrender_timer_isp; 191 emu_timer *endofrender_timer_tsp; 192 emu_timer *endofrender_timer_video; 193 emu_timer *yuv_timer_end; 194 uint32_t tafifo_buff[32]; 195 int scanline; 196 int next_y; 197 198 powervr2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); irq_callback()199 auto irq_callback() { return irq_cb.bind(); } 200 201 uint32_t id_r(); 202 uint32_t revision_r(); 203 uint32_t softreset_r(); 204 void softreset_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 205 void startrender_w(address_space &space, uint32_t data); 206 uint32_t param_base_r(); 207 void param_base_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 208 uint32_t region_base_r(); 209 void region_base_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 210 uint32_t vo_border_col_r(); 211 void vo_border_col_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 212 uint32_t fb_r_ctrl_r(); 213 void fb_r_ctrl_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 214 uint32_t fb_w_ctrl_r(); 215 void fb_w_ctrl_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 216 uint32_t fb_w_linestride_r(); 217 void fb_w_linestride_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 218 uint32_t fb_r_sof1_r(); 219 void fb_r_sof1_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 220 uint32_t fb_r_sof2_r(); 221 void fb_r_sof2_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 222 uint32_t fb_r_size_r(); 223 void fb_r_size_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 224 uint32_t fb_w_sof1_r(); 225 void fb_w_sof1_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 226 uint32_t fb_w_sof2_r(); 227 void fb_w_sof2_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 228 uint32_t fb_x_clip_r(); 229 void fb_x_clip_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 230 uint32_t fb_y_clip_r(); 231 void fb_y_clip_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 232 uint32_t fpu_param_cfg_r(); 233 void fpu_param_cfg_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 234 uint32_t isp_backgnd_t_r(); 235 void isp_backgnd_t_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 236 uint32_t spg_hblank_int_r(); 237 void spg_hblank_int_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 238 uint32_t spg_vblank_int_r(); 239 void spg_vblank_int_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 240 uint32_t spg_control_r(); 241 void spg_control_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 242 uint32_t spg_hblank_r(); 243 void spg_hblank_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 244 uint32_t spg_load_r(); 245 void spg_load_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 246 uint32_t spg_vblank_r(); 247 void spg_vblank_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 248 uint32_t spg_width_r(); 249 void spg_width_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 250 uint32_t text_control_r(); 251 void text_control_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 252 uint32_t vo_control_r(); 253 void vo_control_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 254 uint32_t vo_startx_r(); 255 void vo_startx_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 256 uint32_t vo_starty_r(); 257 void vo_starty_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 258 uint32_t pal_ram_ctrl_r(); 259 void pal_ram_ctrl_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 260 uint32_t spg_status_r(); 261 262 uint32_t ta_ol_base_r(); 263 void ta_ol_base_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 264 uint32_t ta_isp_base_r(); 265 void ta_isp_base_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 266 uint32_t ta_ol_limit_r(); 267 void ta_ol_limit_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 268 uint32_t ta_isp_limit_r(); 269 void ta_isp_limit_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 270 uint32_t ta_next_opb_r(); 271 uint32_t ta_itp_current_r(); 272 uint32_t ta_alloc_ctrl_r(); 273 void ta_alloc_ctrl_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 274 uint32_t ta_list_init_r(); 275 void ta_list_init_w(uint32_t data); 276 uint32_t ta_yuv_tex_base_r(); 277 void ta_yuv_tex_base_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 278 uint32_t ta_yuv_tex_ctrl_r(); 279 void ta_yuv_tex_ctrl_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 280 uint32_t ta_yuv_tex_cnt_r(); 281 void ta_yuv_tex_cnt_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 282 void ta_list_cont_w(uint32_t data); 283 uint32_t ta_next_opb_init_r(); 284 void ta_next_opb_init_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 285 286 287 uint32_t fog_table_r(offs_t offset); 288 void fog_table_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 289 uint32_t palette_r(offs_t offset); 290 void palette_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 291 292 uint32_t sb_pdstap_r(); 293 void sb_pdstap_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 294 uint32_t sb_pdstar_r(); 295 void sb_pdstar_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 296 uint32_t sb_pdlen_r(); 297 void sb_pdlen_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 298 uint32_t sb_pddir_r(); 299 void sb_pddir_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 300 uint32_t sb_pdtsel_r(); 301 void sb_pdtsel_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 302 uint32_t sb_pden_r(); 303 void sb_pden_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 304 uint32_t sb_pdst_r(); 305 void sb_pdst_w(address_space &space, offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 306 uint32_t sb_pdapro_r(); 307 void sb_pdapro_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 308 309 uint32_t pvr2_ta_r(offs_t offset); 310 void pvr2_ta_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 311 void pvrs_ta_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 312 uint32_t elan_regs_r(offs_t offset); 313 void elan_regs_w(offs_t offset, uint32_t data); 314 void ta_fifo_poly_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0); 315 void ta_fifo_yuv_w(uint8_t data); 316 void ta_texture_directpath0_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0); 317 void ta_texture_directpath1_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0); 318 319 TIMER_CALLBACK_MEMBER(vbin); 320 TIMER_CALLBACK_MEMBER(vbout); 321 TIMER_CALLBACK_MEMBER(hbin); 322 TIMER_CALLBACK_MEMBER(yuv_convert_end); 323 TIMER_CALLBACK_MEMBER(endofrender_video); 324 TIMER_CALLBACK_MEMBER(endofrender_tsp); 325 TIMER_CALLBACK_MEMBER(endofrender_isp); 326 TIMER_CALLBACK_MEMBER(transfer_opaque_list_irq); 327 TIMER_CALLBACK_MEMBER(transfer_opaque_modifier_volume_list_irq); 328 TIMER_CALLBACK_MEMBER(transfer_translucent_list_irq); 329 TIMER_CALLBACK_MEMBER(transfer_translucent_modifier_volume_list_irq); 330 TIMER_CALLBACK_MEMBER(transfer_punch_through_list_irq); 331 TIMER_CALLBACK_MEMBER(pvr_dma_irq); 332 333 void pvr_dma_execute(address_space &space); 334 void pvr_scanline_timer(int vpos); 335 uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 336 337 typedef uint32_t(powervr2_device::*pix_sample_fn)(texinfo*,float,float,uint32_t,uint32_t); 338 339 inline uint32_t sample_nontextured(texinfo *ti, float u, float v, uint32_t offset_color, uint32_t base_color); 340 341 template <int tsinst, bool bilinear> 342 inline uint32_t sample_textured(texinfo *ti, float u, float v, uint32_t offset_color, uint32_t base_color); 343 344 protected: 345 virtual void device_start() override; 346 virtual void device_reset() override; 347 348 private: 349 devcb_write8 irq_cb; 350 required_ioport m_mamedebug; 351 352 // Core registers 353 uint32_t softreset; 354 uint32_t param_base, region_base; 355 uint32_t vo_border_col; 356 uint32_t fb_r_ctrl, fb_w_ctrl, fb_w_linestride, fb_r_sof1, fb_r_sof2, fb_r_size, fb_w_sof1, fb_w_sof2, fb_x_clip, fb_y_clip; 357 uint32_t fpu_param_cfg; 358 uint32_t isp_backgnd_t; 359 uint32_t spg_hblank_int, spg_vblank_int, spg_control, spg_hblank, spg_load, spg_vblank, spg_width; 360 uint32_t vo_control, vo_startx, vo_starty; 361 uint32_t text_control; 362 uint32_t pal_ram_ctrl; 363 364 // TA registers 365 uint32_t ta_ol_base, ta_ol_limit, ta_isp_base, ta_isp_limit; 366 uint32_t ta_next_opb, ta_itp_current, ta_alloc_ctrl, ta_next_opb_init; 367 uint32_t ta_yuv_tex_base, ta_yuv_tex_ctrl, ta_yuv_tex_cnt; 368 uint32_t ta_yuv_index; 369 int ta_yuv_x,ta_yuv_y; 370 int ta_yuv_x_size,ta_yuv_y_size; 371 uint8_t yuv_fifo[384]; 372 373 // Other registers 374 uint32_t fog_table[0x80]; 375 uint32_t palette[0x400]; 376 377 // PD DMA registers 378 uint32_t sb_pdstap, sb_pdstar, sb_pdlen, sb_pddir, sb_pdtsel, sb_pden, sb_pdst, sb_pdapro; 379 380 static uint32_t (*const blend_functions[64])(uint32_t s, uint32_t d); 381 382 static int uv_wrap(float uv, int size); 383 static int uv_flip(float uv, int size); 384 static int uv_clamp(float uv, int size); 385 386 static inline uint32_t float_argb_to_packed_argb(float argb[4]); 387 static inline void packed_argb_to_float_argb(float dst[4], uint32_t in); 388 389 static inline int32_t clamp(int32_t in, int32_t min, int32_t max); 390 static inline uint32_t bilinear_filter(uint32_t c0, uint32_t c1, uint32_t c2, uint32_t c3, float u, float v); 391 static inline uint32_t bla(uint32_t c, uint32_t a); 392 static inline uint32_t blia(uint32_t c, uint32_t a); 393 static inline uint32_t blc(uint32_t c1, uint32_t c2); 394 static inline uint32_t blic(uint32_t c1, uint32_t c2); 395 static inline uint32_t bls(uint32_t c1, uint32_t c2); 396 static inline uint32_t bls24(uint32_t c1, uint32_t c2); 397 398 static uint32_t bl00(uint32_t s, uint32_t d); 399 static uint32_t bl01(uint32_t s, uint32_t d); 400 static uint32_t bl02(uint32_t s, uint32_t d); 401 static uint32_t bl03(uint32_t s, uint32_t d); 402 static uint32_t bl04(uint32_t s, uint32_t d); 403 static uint32_t bl05(uint32_t s, uint32_t d); 404 static uint32_t bl06(uint32_t s, uint32_t d); 405 static uint32_t bl07(uint32_t s, uint32_t d); 406 static uint32_t bl10(uint32_t s, uint32_t d); 407 static uint32_t bl11(uint32_t s, uint32_t d); 408 static uint32_t bl12(uint32_t s, uint32_t d); 409 static uint32_t bl13(uint32_t s, uint32_t d); 410 static uint32_t bl14(uint32_t s, uint32_t d); 411 static uint32_t bl15(uint32_t s, uint32_t d); 412 static uint32_t bl16(uint32_t s, uint32_t d); 413 static uint32_t bl17(uint32_t s, uint32_t d); 414 static uint32_t bl20(uint32_t s, uint32_t d); 415 static uint32_t bl21(uint32_t s, uint32_t d); 416 static uint32_t bl22(uint32_t s, uint32_t d); 417 static uint32_t bl23(uint32_t s, uint32_t d); 418 static uint32_t bl24(uint32_t s, uint32_t d); 419 static uint32_t bl25(uint32_t s, uint32_t d); 420 static uint32_t bl26(uint32_t s, uint32_t d); 421 static uint32_t bl27(uint32_t s, uint32_t d); 422 static uint32_t bl30(uint32_t s, uint32_t d); 423 static uint32_t bl31(uint32_t s, uint32_t d); 424 static uint32_t bl32(uint32_t s, uint32_t d); 425 static uint32_t bl33(uint32_t s, uint32_t d); 426 static uint32_t bl34(uint32_t s, uint32_t d); 427 static uint32_t bl35(uint32_t s, uint32_t d); 428 static uint32_t bl36(uint32_t s, uint32_t d); 429 static uint32_t bl37(uint32_t s, uint32_t d); 430 static uint32_t bl40(uint32_t s, uint32_t d); 431 static uint32_t bl41(uint32_t s, uint32_t d); 432 static uint32_t bl42(uint32_t s, uint32_t d); 433 static uint32_t bl43(uint32_t s, uint32_t d); 434 static uint32_t bl44(uint32_t s, uint32_t d); 435 static uint32_t bl45(uint32_t s, uint32_t d); 436 static uint32_t bl46(uint32_t s, uint32_t d); 437 static uint32_t bl47(uint32_t s, uint32_t d); 438 static uint32_t bl50(uint32_t s, uint32_t d); 439 static uint32_t bl51(uint32_t s, uint32_t d); 440 static uint32_t bl52(uint32_t s, uint32_t d); 441 static uint32_t bl53(uint32_t s, uint32_t d); 442 static uint32_t bl54(uint32_t s, uint32_t d); 443 static uint32_t bl55(uint32_t s, uint32_t d); 444 static uint32_t bl56(uint32_t s, uint32_t d); 445 static uint32_t bl57(uint32_t s, uint32_t d); 446 static uint32_t bl60(uint32_t s, uint32_t d); 447 static uint32_t bl61(uint32_t s, uint32_t d); 448 static uint32_t bl62(uint32_t s, uint32_t d); 449 static uint32_t bl63(uint32_t s, uint32_t d); 450 static uint32_t bl64(uint32_t s, uint32_t d); 451 static uint32_t bl65(uint32_t s, uint32_t d); 452 static uint32_t bl66(uint32_t s, uint32_t d); 453 static uint32_t bl67(uint32_t s, uint32_t d); 454 static uint32_t bl70(uint32_t s, uint32_t d); 455 static uint32_t bl71(uint32_t s, uint32_t d); 456 static uint32_t bl72(uint32_t s, uint32_t d); 457 static uint32_t bl73(uint32_t s, uint32_t d); 458 static uint32_t bl74(uint32_t s, uint32_t d); 459 static uint32_t bl75(uint32_t s, uint32_t d); 460 static uint32_t bl76(uint32_t s, uint32_t d); 461 static uint32_t bl77(uint32_t s, uint32_t d); 462 static inline uint32_t cv_1555(uint16_t c); 463 static inline uint32_t cv_1555z(uint16_t c); 464 static inline uint32_t cv_565(uint16_t c); 465 static inline uint32_t cv_565z(uint16_t c); 466 static inline uint32_t cv_4444(uint16_t c); 467 static inline uint32_t cv_4444z(uint16_t c); 468 static inline uint32_t cv_yuv(uint16_t c1, uint16_t c2, int x); 469 uint32_t tex_r_yuv_n(texinfo *t, float x, float y); 470 uint32_t tex_r_yuv_tw(texinfo *t, float x, float y); 471 // uint32_t tex_r_yuv_vq(texinfo *t, float x, float y); 472 uint32_t tex_r_1555_n(texinfo *t, float x, float y); 473 uint32_t tex_r_1555_tw(texinfo *t, float x, float y); 474 uint32_t tex_r_1555_vq(texinfo *t, float x, float y); 475 uint32_t tex_r_565_n(texinfo *t, float x, float y); 476 uint32_t tex_r_565_tw(texinfo *t, float x, float y); 477 uint32_t tex_r_565_vq(texinfo *t, float x, float y); 478 uint32_t tex_r_4444_n(texinfo *t, float x, float y); 479 uint32_t tex_r_4444_tw(texinfo *t, float x, float y); 480 uint32_t tex_r_4444_vq(texinfo *t, float x, float y); 481 uint32_t tex_r_p4_1555_tw(texinfo *t, float x, float y); 482 uint32_t tex_r_p4_1555_vq(texinfo *t, float x, float y); 483 uint32_t tex_r_p4_565_tw(texinfo *t, float x, float y); 484 uint32_t tex_r_p4_565_vq(texinfo *t, float x, float y); 485 uint32_t tex_r_p4_4444_tw(texinfo *t, float x, float y); 486 uint32_t tex_r_p4_4444_vq(texinfo *t, float x, float y); 487 uint32_t tex_r_p4_8888_tw(texinfo *t, float x, float y); 488 uint32_t tex_r_p4_8888_vq(texinfo *t, float x, float y); 489 uint32_t tex_r_p8_1555_tw(texinfo *t, float x, float y); 490 uint32_t tex_r_p8_1555_vq(texinfo *t, float x, float y); 491 uint32_t tex_r_p8_565_tw(texinfo *t, float x, float y); 492 uint32_t tex_r_p8_565_vq(texinfo *t, float x, float y); 493 uint32_t tex_r_p8_4444_tw(texinfo *t, float x, float y); 494 uint32_t tex_r_p8_4444_vq(texinfo *t, float x, float y); 495 uint32_t tex_r_p8_8888_tw(texinfo *t, float x, float y); 496 uint32_t tex_r_p8_8888_vq(texinfo *t, float x, float y); 497 498 uint32_t tex_r_default(texinfo *t, float x, float y); 499 void tex_get_info(texinfo *t); 500 501 template <pix_sample_fn sample_fn, int group_no> 502 inline void render_hline(bitmap_rgb32 &bitmap, texinfo *ti, 503 int y, float xl, float xr, 504 float ul, float ur, float vl, float vr, 505 float wl, float wr, 506 float const bl[4], float const br[4], 507 float const offl[4], float const offr[4]); 508 509 template <pix_sample_fn sample_fn, int group_no> 510 inline void render_span(bitmap_rgb32 &bitmap, texinfo *ti, 511 float y0, float y1, 512 float xl, float xr, 513 float ul, float ur, 514 float vl, float vr, 515 float wl, float wr, 516 float const bl[4], float const br[4], 517 float const offl[4], float const offr[4], 518 float dxldy, float dxrdy, 519 float duldy, float durdy, 520 float dvldy, float dvrdy, 521 float dwldy, float dwrdy, 522 float const dbldy[4], float const dbrdy[4], 523 float const doldy[4], float const dordy[4]); 524 525 template <pix_sample_fn sample_fn, int group_no> 526 inline void render_tri_sorted(bitmap_rgb32 &bitmap, texinfo *ti, 527 const vert *v0, 528 const vert *v1, const vert *v2); 529 530 template <int group_no> 531 void render_tri(bitmap_rgb32 &bitmap, texinfo *ti, const vert *v); 532 533 template <int group_no> 534 void render_group_to_accumulation_buffer(bitmap_rgb32 &bitmap, const rectangle &cliprect); 535 536 void sort_vertices(const vert *v, int *i0, int *i1, int *i2); 537 void render_to_accumulation_buffer(bitmap_rgb32 &bitmap, const rectangle &cliprect); 538 void pvr_accumulationbuffer_to_framebuffer(address_space &space, int x, int y); 539 void pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle &cliprect); 540 static uint32_t dilate0(uint32_t value,int bits); 541 static uint32_t dilate1(uint32_t value,int bits); 542 void computedilated(); 543 void pvr_build_parameterconfig(); 544 void process_ta_fifo(); 545 void update_screen_format(); 546 547 void fb_convert_0555krgb_to_555rgb(address_space &space, int x, int y); 548 void fb_convert_0555krgb_to_565rgb(address_space &space, int x, int y); 549 void fb_convert_0555krgb_to_888rgb24(address_space &space, int x, int y); 550 void fb_convert_0555krgb_to_888rgb32(address_space &space, int x, int y); 551 552 void fb_convert_0565rgb_to_555rgb(address_space &space, int x, int y); 553 void fb_convert_0565rgb_to_565rgb(address_space &space, int x, int y); 554 void fb_convert_0565rgb_to_888rgb24(address_space &space, int x, int y); 555 void fb_convert_0565rgb_to_888rgb32(address_space &space, int x, int y); 556 557 void fb_convert_1555argb_to_555rgb(address_space &space, int x, int y); 558 void fb_convert_1555argb_to_565rgb(address_space &space, int x, int y); 559 void fb_convert_1555argb_to_888rgb24(address_space &space, int x, int y); 560 void fb_convert_1555argb_to_888rgb32(address_space &space, int x, int y); 561 562 void fb_convert_888rgb_to_555rgb(address_space &space, int x, int y); 563 void fb_convert_888rgb_to_565rgb(address_space &space, int x, int y); 564 void fb_convert_888rgb_to_888rgb24(address_space &space, int x, int y); 565 void fb_convert_888rgb_to_888rgb32(address_space &space, int x, int y); 566 567 void fb_convert_8888argb_to_555rgb(address_space &space, int x, int y); 568 void fb_convert_8888argb_to_565rgb(address_space &space, int x, int y); 569 void fb_convert_8888argb_to_888rgb24(address_space &space, int x, int y); 570 void fb_convert_8888argb_to_888rgb32(address_space &space, int x, int y); 571 572 }; 573 574 DECLARE_DEVICE_TYPE(POWERVR2, powervr2_device) 575 576 #endif // MAME_VIDEO_POWERVR2_H 577