OpenGL texture paging

Registered by Ferdinand Majerech

Problem:
Texture sizes used in Catom are fairly small - around 16x16 to 256x256 (more with GUI in future). Modern GPUs will have larger minimum texture sizes and so a 64x64 texture might end up taking as much VRAM as a 256x256 one.

Solution:
Multiple surfaces can be stored in a single large texture. E.g. we can store 512 basic terrain tiles (64x32) in a single 1024x1024 texture. We can upload surface data to parts of this texture using glTexSubImage2D. There is no need for files to contain multiple surfaces at once, all the work can be done by the video driver.

The video driver determines which surface is used by its texture coordinates that specify its part of the page texture. This also allows GLSurfaceGroups to cache draws of quads with multiple surfaces (all surfaces using a particular texture page)

As for texture size, 1024x1024 should be OK for anything since GeForce2, and has maximum overhead of 4MB (in case of a single empty texture page). However, the page size should be configurable with 256x256 as a minimum, 4096x4096 as a maximum.

Possible future GL3/4 driver can expect 2048x2048 as a default.

Of course, if a surface is larger or equal than texture page size, it would be allocated separately as its own page.

Blueprint information

Status:
Not started
Approver:
Catom Developers
Priority:
Low
Drafter:
Ferdinand Majerech
Direction:
Needs approval
Assignee:
Ferdinand Majerech
Definition:
New
Series goal:
Accepted for trunk
Implementation:
Not started
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.