Annotation of nono/vm/planevram.h, revision 1.1.1.1

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2022 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // プレーン VRAM (垂直 VRAM)
                      9: // Lunafb と X68k TVRAM の共通部分
                     10: //
                     11: 
                     12: #pragma once
                     13: 
                     14: #include "device.h"
                     15: #include "renderer.h"
                     16: #include <vector>
                     17: 
                     18: class PlaneVRAMDevice : public IODevice
                     19: {
                     20:        using inherited = IODevice;
                     21: 
                     22:  protected:
                     23:        // ショートカット
                     24:        static const int BLKX = Renderer::BLKX;
                     25:        static const int BLKY = Renderer::BLKY;
                     26: 
                     27:  public:
                     28:        PlaneVRAMDevice(const std::string& objname_, int width_, int height_);
                     29:        virtual ~PlaneVRAMDevice() override;
                     30: 
                     31:        void ResetHard(bool poweron) override;
                     32: 
                     33:        // レンダリング時に使うテーブルを事前に計算する。
                     34:        void InitDeptable();
                     35: 
                     36:        // プレーン数を取得
                     37:        int GetPlaneCount() const { return nplane; }
                     38: 
                     39:        // 更新情報を取得
                     40:        ModifyInfo GetModify() const;
                     41: 
                     42:        // 更新フラグをクリア
                     43:        void ClearDirty();
                     44: 
                     45:        // 画面を合成する
                     46:        bool Render(BitmapRGB& dst, const ModifyInfo& modify);
                     47: 
                     48:        // 合成ビットマップを取得する
                     49:        const BitmapI8& GetComposite() const { return composite; }
                     50: 
                     51: #if defined(PERF_HIT)
                     52:        // ブロックのヒット効率(?)を調べる
                     53:        std::array<bool, 65536> dirty_word {};
                     54: #endif
                     55: 
                     56:  protected:
                     57:        // 全画面の更新フラグを立てる
                     58:        void Invalidate();
                     59: 
                     60:        // 垂直 VRAM から BitmapI8 バッファを作成する
                     61:        void RenderVRAMToComposite(const ModifyInfo& modify);
                     62: 
                     63:        // BitmapI8 バッファから BitmapRGB を作成する。
                     64:        void RenderCompositeToRGB(BitmapRGB& dst, const ModifyInfo& modify);
                     65: 
                     66:        // ビットマッププレーン。
                     67:        // メモリを確保する時のサイズ計算のため型を uint8 にしているが、
                     68:        // 運用はロングワードでホストバイトオーダー。
                     69:        // Lunafb では 1枚 256KBで 1 or 4枚。TVRAM では 512KB。
                     70:        std::unique_ptr<uint8[]> mem {};
                     71: 
                     72:        // プレーン数 (TVRAM なら 4 固定、LUNA は設定による)
                     73:        int nplane {};
                     74: 
                     75:        // テキスト画面の合成ビットマップ
                     76:        BitmapI8 composite {};
                     77: 
                     78:        // 更新フラグ。
                     79:        // Lunafb では 1024、TVRAM では 512個。
                     80:        std::vector<uint8> dirty {};
                     81: 
                     82:        // ModifyInfo.bits に対するマスク。横方向のブロック数によって決まり、
                     83:        // Lunafb では 0xffff、TVRAM では 0xff00。
                     84:        uint16 modify_mask {};
                     85: 
                     86:        // レンダリング時に使う変換テーブル
                     87:        std::unique_ptr<uint64[]> deptable {};
                     88: 
                     89:        // ホストパレット
                     90:        const ColorXBGR *palette {};
                     91: 
                     92:        // スクロール
                     93:        int xscroll {};
                     94:        int yscroll {};
                     95: };
                     96: 
                     97: extern PlaneVRAMDevice *gPlaneVRAM;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.