gpu,舊硬件,3d加速和lib - gpu, old hardware, 3d acceleration and a lib -开发者知识库

gpu,舊硬件,3d加速和lib - gpu, old hardware, 3d acceleration and a lib -开发者知识库,第1张

i am writing a 2d lib which will have 3d acceleration but i'd like to do it in a way that it will efficiently run on older HW. Possibly typedefs to hide options/functions that your targeted mode does not support. (also there may be emulation func turned on)

我正在編寫一個2d lib,它將具有3d加速功能,但我想以一種能夠在舊硬件上高效運行的方式來實現。可能是typedef,用於隱藏目標模式不支持的選項/功能。 (也可能有仿真功能打開)

What are some of the things older HW do? here is a list of questions and things i know of.


  • Tiles, this will be unsupported. Its to old, my lib will support pixel access
  • Tiles,這將不受支持。它的舊版本,我的lib將支持像素訪問

  • Single pixel buffer with scrolling. Example GBA
  • 帶滾動的單像素緩沖區。例GBA

  • multiple surface with surface to surface quick blt (no stretch)
  • 多個表面,表面到表面快速blt(無拉伸)

  • multiple surface with surface to surface quick blt with stretch (maybe this was emulated? does any HW stretch images for you?)
  • 具有表面到表面的多個表面,帶有拉伸的快速blt(也許這是模擬的?是否有任何HW拉伸圖像?)

  • HW pixel fill (i thought i saw the option in DX)
  • HW像素填充(我以為我看到DX中的選項)

  • HW transparent colour? (colour which is transparent, thought i seen in DX specs)
  • HW透明色? (我認為在DX規格中看到的是透明的顏色)

  • Textures, older use to be a power of 2. The width does not have to be the same power of 2 as height? (example 64x256), does any require them to be the same
  • 紋理,較舊的使用是2的冪。寬度不必與2的高度相同? (例如64x256),是否要求它們是相同的

  • Textures, newer HW can have them any width and height (or is this a lie?)
  • 紋理,較新的HW可以任意寬度和高度(或者這是謊言嗎?)

  • Textures can be in crazy formats (ARGB 8888, ABGR 8888, ABGR 2 10 10 10)
  • 紋理可以是瘋狂的格式(ARGB 8888,ABGR 8888,ABGR 2 10 10 10)

Also, i cannot do a texture to texture blit? as in copy 60x40 from texture A to B in HW ? Also can textures be in palette? (i wont support this) and finally i should keep in mind about shaders 8)

另外,我不能做紋理到紋理blit?在HW中從紋理A到B的復制60x40中?紋理也可以在調色板中? (我不支持這個)最后我應該記住着色器8)

What else am i missing?


1 个解决方案



What 3D accelleration are you referring to? If it is OpenGL compatible hardware:


  • Textures need to be power of 2, width and height can have arbitrary power of two.
  • 紋理需要2的冪,寬度和高度可以具有2的任意冪。

  • Textures without power of 2 constraint are enabled with an openGL extension which you can test for (and is present on almost all new hardware).
  • 沒有2約束功能的紋理使用openGL擴展啟用,您可以測試它(並且幾乎存在於所有新硬件上)。

  • Several different texture formats are standardized in OpenGL, I don't know extensions to have arbitrary texture formats.
  • OpenGL中標准化了幾種不同的紋理格式,我不知道具有任意紋理格式的擴展。

About 2D:

  • Normal hardware 2D acceleration supports blitting, but not stretching. Stretching is available as "video acceleration". For example, in X11 you can use the xv extension to get accelerated stretching, but only in YUV color space.
  • 普通硬件2D加速支持blitting,但不支持拉伸。拉伸可用作“視頻加速”。例如,在X11中,您可以使用xv擴展來獲得加速拉伸,但僅限於YUV顏色空間。

  • For really fast image drawing operations, check out Imlib2. It does everything in software, but blazingly fast. Perhaps the right way to go if 3D hardware acceleration is not available. 2D hw acceleration differs in performance, and for example the X11 RENDER acceleration is often beaten by Imlib2.
  • 要獲得真正快速的圖像繪制操作,請查看Imlib2。它在軟件中完成所有工作,但速度極快。如果3D硬件加速不可用,也許是正確的方法。 2D hw加速度性能不同,例如X11 RENDER加速度經常被Imlib2擊敗。

An interesting project for you to look at could also be DirectFB, which tries to heavily use HW 2D acceleration:

一個有趣的項目供您查看也可能是DirectFB,它試圖大量使用HW 2D加速: