--- nono/vm/planevram.h 2026/04/29 17:05:11 1.1 +++ nono/vm/planevram.h 2026/04/29 17:05:25 1.1.1.3 @@ -19,14 +19,9 @@ class PlaneVRAMDevice : public IODevice { using inherited = IODevice; - protected: - // ショートカット - static const int BLKX = Renderer::BLKX; - static const int BLKY = Renderer::BLKY; - public: - PlaneVRAMDevice(const std::string& objname_, int width_, int height_); - virtual ~PlaneVRAMDevice() override; + PlaneVRAMDevice(int width_, int height_); + ~PlaneVRAMDevice() override; void ResetHard(bool poweron) override; @@ -43,15 +38,13 @@ class PlaneVRAMDevice : public IODevice void ClearDirty(); // 画面を合成する - bool Render(BitmapRGB& dst, const ModifyInfo& modify); + bool Render(BitmapRGBX& dst, const ModifyInfo& modify); // 合成ビットマップを取得する const BitmapI8& GetComposite() const { return composite; } -#if defined(PERF_HIT) - // ブロックのヒット効率(?)を調べる - std::array dirty_word {}; -#endif + // 座標位置の情報を出力 (GUI 用) + virtual void UpdateInfo(TextScreen&, int x, int y) const = 0; protected: // 全画面の更新フラグを立てる @@ -60,8 +53,11 @@ class PlaneVRAMDevice : public IODevice // 垂直 VRAM から BitmapI8 バッファを作成する void RenderVRAMToComposite(const ModifyInfo& modify); - // BitmapI8 バッファから BitmapRGB を作成する。 - void RenderCompositeToRGB(BitmapRGB& dst, const ModifyInfo& modify); + // BitmapI8 バッファから BitmapRGBX を作成する。 + void RenderCompositeToRGBX(BitmapRGBX& dst, const ModifyInfo& modify); + + // X 方向にはみ出したときに対応する仮想画面の Y 座標を返す。 + virtual int GetWrapY(int) const = 0; // ビットマッププレーン。 // メモリを確保する時のサイズ計算のため型を uint8 にしているが、 @@ -75,14 +71,10 @@ class PlaneVRAMDevice : public IODevice // テキスト画面の合成ビットマップ BitmapI8 composite {}; - // 更新フラグ。 - // Lunafb では 1024、TVRAM では 512個。 + // 仮想画面の更新フラグ。仮想 Y 座標に対応するので + // Lunafb も TVRAM も 1024個。 std::vector dirty {}; - // ModifyInfo.bits に対するマスク。横方向のブロック数によって決まり、 - // Lunafb では 0xffff、TVRAM では 0xff00。 - uint16 modify_mask {}; - // レンダリング時に使う変換テーブル std::unique_ptr deptable {}; @@ -92,6 +84,17 @@ class PlaneVRAMDevice : public IODevice // スクロール int xscroll {}; int yscroll {}; + + private: + void RenderI8toRGBX_gen(BitmapRGBX& dst, const BitmapI8& view, + const std::vector& view_mod); +#if defined(HAVE_AVX2) + void RenderI8toRGBX_avx2(BitmapRGBX& dst, const BitmapI8& view, + const std::vector& view_mod); + bool enable_avx2 {}; +#endif }; -extern PlaneVRAMDevice *gPlaneVRAM; +static inline PlaneVRAMDevice *GetPlaneVRAMDevice() { + return Object::GetObject(OBJ_PLANEVRAM); +}