1 // license:LGPL-2.1+ 2 // copyright-holders:Ville Linde, Angelo Salese, hap 3 4 #ifndef MAME_VIDEO_TC0780FPA_H 5 #define MAME_VIDEO_TC0780FPA_H 6 7 #pragma once 8 9 #include "video/poly.h" 10 11 12 struct tc0780fpa_polydata 13 { 14 int tex_base_x; 15 int tex_base_y; 16 int tex_wrap_x; 17 int tex_wrap_y; 18 }; 19 20 21 class tc0780fpa_renderer : public poly_manager<float, tc0780fpa_polydata, 6, 10000> 22 { 23 public: 24 tc0780fpa_renderer(device_t &parent, screen_device &screen, const uint8_t *texture_ram); 25 26 void render_solid_scan(int32_t scanline, const extent_t &extent, const tc0780fpa_polydata &extradata, int threadid); 27 void render_shade_scan(int32_t scanline, const extent_t &extent, const tc0780fpa_polydata &extradata, int threadid); 28 void render_texture_scan(int32_t scanline, const extent_t &extent, const tc0780fpa_polydata &extradata, int threadid); 29 30 void render(uint16_t *polygon_fifo, int length); 31 void draw(bitmap_ind16 &bitmap, const rectangle &cliprect); 32 void swap_buffers(); 33 34 private: 35 std::unique_ptr<bitmap_ind16> m_fb[2]; 36 std::unique_ptr<bitmap_ind16> m_zb; 37 const uint8_t *m_texture; 38 39 rectangle m_cliprect; 40 41 int m_current_fb; 42 }; 43 44 45 class tc0780fpa_device : public device_t, public device_video_interface 46 { 47 public: 48 tc0780fpa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 49 50 void draw(bitmap_ind16 &bitmap, const rectangle &cliprect); 51 52 uint16_t tex_addr_r(); 53 void tex_addr_w(uint16_t data); 54 void tex_w(uint16_t data); 55 void poly_fifo_w(uint16_t data); 56 void render_w(uint16_t data); 57 58 protected: 59 // device-level overrides 60 virtual void device_start() override; 61 virtual void device_stop() override; 62 virtual void device_reset() override; 63 64 private: 65 std::unique_ptr<uint8_t[]> m_texture; 66 std::unique_ptr<uint16_t[]> m_poly_fifo; 67 int m_poly_fifo_ptr; 68 69 std::unique_ptr<tc0780fpa_renderer> m_renderer; 70 71 uint16_t m_tex_address; 72 uint16_t m_tex_offset; 73 int m_texbase_x; 74 int m_texbase_y; 75 }; 76 77 DECLARE_DEVICE_TYPE(TC0780FPA, tc0780fpa_device) 78 79 #endif // MAME_VIDEO_TC0780FPA_H 80