Why A Render API for Window System Is Bad!

cai posted @ 2012年7月14日 13:00 in 未分类 with tags quartz x11 Wayland Render Bad , 2708 阅读

To use a GUI, you need windows, which in turn means you need a Window System.

Window System  such as X11, Quartz , and Presantation Manager (Which is used by OS/2 and the fellowing Microsoft Windows), and of-course the comming Wayland.


What is a Window System? In short:

Window System provide a way to manage windows, to efficently share the "Screen Space".

Window System provide a way to manage inputs, keyboard focus etc.

Window System provide a way so that Apps can Coperate, clipboard, drag&drop, window embed, etc.

But Window System Does Not:

Provide a way to draw your windows. This the job of Render System.

Provide a way to draw TEXT. This is the job of   Text Layout & Font Rendering System which in turn use Render System to draw the text.

Provide a way to use GPU. This is of-course the job of Render System.

Provide Standard Widgets, such as Buttons, Check Boxs, etc

Take an Example of Prsentation Manager:

The Window System is provicded as a Client DLL -- USER32.DLL, the server side is inside the kernel called win32k.sys.

USER32.DLL is only responsable for Managing Windows and Inputs. For Drawing, it goes to GDI32.DLL.

USER32.DLL Does not provice Standard Widget, Instead,  you use commctl32.DLL for bottons,dialogs etc.

If you want to use GPU,  you need DirectX or OpenGL, not USER32.DLL itself.

For TEXT,  it goes to Uniscribe.


Ok Ok, so Window System is just a way of Sharing Screen and Inputs, not a way of Rendering, right?

Yes, indeed. And Window System itself is built on top of the Render System. Not the otherway around.

You may say, "You give the example, but don't tell me the reason why we shoud not include render api for a window system."

Here is the reason:

To defined a render api, you limited the future hardware capability support. also you duplicated the work done by OpenGL. And you make a confliction beteween external render api and your render api. make it harder to choose other render pipe line. graphics driver bug will affect every application and the server itself.



登录 *

loading captcha image...
or Ctrl+Enter