Fio:Caching

From Fio

(Difference between revisions)

Revision as of 14:19, 28 August 2006

Contents

Image Caching

Now Fio's renderer is implemented using DirectX(8.1). To render fast in DX images should be first loaded into back surface then blt onto the primary surface(what you see on the screen). For the video memory which hold the surfaces is limited - it isn't big enough to hold an entire level, we need an image cache to manage the back surface:

  • load only images need to show up on the screen into back surface;
  • and unload those ones out of screen (when the map scrolls, critter steps outof viewport, dialog sinks etc.);
  • tell the renderer where to find the cached image on the back surface;
  • avoid duplicated images load into back surface.

How It Works

The cache is basically a big rect(represent the back surface) and will be fraged by tokens(represent the dimension of an image) when caching in/out happens. These tokens will be arranged line by line from top to bottom of the cache. When renderer need to draw an image, it'll ask the cache to find out where the image is located then use the returned rect to blt the image from back surface onto primary surface. Let's check the details:

  • Token


  • Cache In
  • Cache Out
  • Cache Operation
  • When The Cache Overflow

Isolate Cache from Surface

Isolate Cache from Component

Strategy: Active or Inactive

Personal tools