Hi,
Owen wrote:Brendan wrote:Owen wrote:No newly designed compositing window system does server side decoration (Quartz and Wayland follow this) - that is to say, the decorations are already drawn around the buffers that the client submits (often by the mandatory to use windowing library). So, lets go with the decorated window sizes; 21525px each. The 20000px per window cost previously accounted for can therefore be disregarded (because you would just draw into the buffer eventually presented)
So to work around the problem of being badly designed, they force application's to use a mandatory windowing library and make things worse in a different way? This is good news!
So to work around the problem of being badly designed, you force every application to re-implement its' own GUI support library?
There's no GUI support library needed. Each application just sends its list of commands to it's parent; and doesn't need to know or care what its parent is; regardless of whether the parent happens to be one of many very different GUIs, or something like a debugger, or another application (e.g. a word-processor where the document contains a picture that you're editing), or if its parent is the "virtual screen layer" (e.g. application running full screen with no GUI installed on the computer at all).
Owen wrote:Brendan wrote:I tried to make the example simple/generic, so that people can see the point clearly. I was hoping that the point I was trying to make wouldn't be taken out back and bludgeoned to death with implementation details. Let's just assume the video driver is using an LFB buffer that was setup by the boot loader and all rendering is done in software (unless you're volunteering to write hardware accelerated video drivers for all of our OSs).
OK, so your only consideration is software rendering because you can't be bothered to write hardware accelerated graphics drivrs?
I wrote a simplified description of "raw pixel" and a simplified description "list of commands", deliberately omitting implementation details that would do little more than obscure the point. You are including all sort of complexities/optimisations for the "raw pixel" case that I deliberately didn't include, and you're failing to recognise that the "list of commands" can also have complexities/optimisations that I deliberately didn't include. The end result is an extremely unfair comparison between "complex/optimised vs. deliberately simplified".
To avoid this extremely unfair comparison; we can both write several books describing all of the intricate details (that nobody will want to read); or we can try to avoid all the irrelevant implementation details that do nothing more than obscure the point. Assuming "LFB with software rendering" is a good way to focus on the important part (the abstractions themselves, rather than special cases of which pieces of hardware are capable of doing what behind the abstractions).
In addition, assuming "LFB with software rendering" does have obvious practical value - no hobby OS developer will ever have a native driver for every video card. It would be very foolish to ignore software rendering; and it makes a lot more sense to ignore hardware acceleration (as anything that works for software rendering will just work faster when hardware acceleration is involved anyway).
Owen wrote:Brendan wrote:I see you're using the new "quantum entanglement" video cards where the same texture magically appears in 2 completely separate video card's memory at the same time. Nice...
You pretend that DMA and GPU IOMMUs (or for obsolete AGP machines, the GART) don't exist
I only said "pixels are created for the second video card's display". I didn't say how the pixels are created (e.g. by hardware or software, or by copying using IOMMUs or whatever else) because this is mostly irrelevant (they're still created regardless of how).
Owen wrote:Brendan wrote:Owen wrote:I believe the two different display depths to largely be a red herring: when did you last see a 16bpp monitor?
I didn't specify any specific colour depth for either display. Let's assume one is using 24-bpp
XvYCC and the other is using 30-bpp "
deep colour" sRGB.
So you run the framebuffer in 30-bit sRGB and convert once.
And, among dual monitor setups, how common is this scenario?
It's an intentionally manufactured scenario which is comparatively rare.
An abstraction is either flexible or it's not. You are complaining because your abstraction is not as flexible.
Owen wrote:Brendan wrote:Owen wrote:Given the following simple OpenGL snippet, and assuming everything else is in its' default case - i.e. no vertex buffers/etc bound to the pipeline
Code: Select all
glUseProgram(aShader);
glDrawArrays(GL_TRIANGLES, 0, 3);
Can you discern what is going to be drawn? Note that I just provoked the processing of 3 vertices with no buffers bound -
yes this is legal. Actually, even if I'd bound a bunch of buffers that wouldn't help, because all the render system would know is something along the lines of "The buffer has a stride of 8 bytes and offset 0 in each stride contains a 4-vector of half floats bound to shader input slot 0"
Have I ever done or said anything to make you think I care about OpenGL compatibility?
Note: Current graphics systems are so lame that application/game developers feel the need to cobble together their own shaders. On one hand this disgusts me (in a "how did potentially smart people let things get this bad" way), but on the other hand it makes me very very happy (in a "Hahaha, I can make this so much easier for application developers" way).
I was saying nothing about OpenGL support. I was using it as an example of one way in which making sense of the commands that people pass to modern renderers are difficult to understand from the perspective of the people receiving them.
It was an example of one way that certain commands are difficult to understand, that ignores the fact that (in my opinion) those commands should never have existed in the first place.
Owen wrote:So what is your proposed alternative to developers shaders?
The physics of light do not change. The only thing that does change is the "scene"; and this is the only thing an application needs to describe. This means describing:
- the location of solid/liquids and gases consisting of "materials"
- the properties of those "materials", which are limited to:
- reflection
- absorption
- refraction (in theory - likely to be ignored/not supported due to the overhead of modelling it)
- diffraction
- the location of light sources and their properties:
- the colour of light it generates
- the intensity of the light it generates
- the direction/s of the light it generates and how focused the light is (e.g. narrow beam vs. "all directions")
- ambient light (because it'd cost too much overhead to rely on diffraction alone)
- the camera's position and direction
Whatever is doing the rendering is responsible for doing the rendering; but that has nothing to do with applications. For example, if a video card driver is responsible for doing the rendering then it can use the video card's shader/s for anything it likes; but that has nothing to do with applications.
Owen wrote:Brendan wrote:Owen wrote:Except this is an utter falsehood. Any practical GUI involves alpha blending, because otherwise things like curved window borders look awful and you can't have things like drop shadows which users appreciate for giving the UI a sense of depth. So, actually, display 1 draws
22500 (background) + ~8000 (background window) + 2048px (texture 1) + ~16000 (decorated window) + 7200 (texture 3) + 640 (app2's text) = ~56388
while display 2 draws
22500 (background) + ~15000 (window containing T2) + 1600 (Texture 2) + ~7200 (window containing T4) + 1500 (T4) = ~47800
That gives a total of 104188px. We know from above that each window is 21515px, so the actual figure is 10138. Add in the caching you proposed and you're at 104138. Note that you can't optimize out any of those draws unless you know that nothing being drawn has any translucent segments.
It's obvious (from the pictures I created) that nothing was transparent except for each application's text. If you want to assume that the window borders had rounded corners, and that each application's smaller textures also had transparency, then that changes nothing anyway. The only place where transparency would make a difference is if the second application's background was transparent; but that's a plain white rectangle.
How does that change nothing? If you have transparency, you need to alpha blend things.
If something creates a pixel by combining 2 or more pixels from elsewhere then it creates 1 pixel; and if something creates a pixel by merely copying a pixel from elsewhere then it creates 1 pixel. In either case the number of pixels created is 1.
The number of pixels created only changes if alpha blending would mean that other pixels elsewhere would need to be created when otherwise (without transparency) they wouldn't. For example, if the second application's background is "solid white" then the pixels for the textures underneath don't need to be created; and if the second application's background is transparent then the pixels for the textures underneath it do need to be created.
Except for the second application's background (which obscures the 2 textures behind it), there are no other textures obscuring anything that isn't already being created.
Of course the "number of pixels created" metric is a simplification that ignores the actual cost of creating a pixel (which depends on which specific methods were used for implementation; like whether a Z-buffer was involved or if there was overdraw or whether we're doing sub-pixel accurate anti-aliasing or whatever else); but it's impossible to have specific details like that in a discussion that's generic enough to be useful.
Brendan wrote:Owen wrote:Your display list system also received a texture update for texture 1. It also set a clipping rectangle and then drew the background+window1bg+texture1+window2bg+texture3, at a total cost of... 10240px. Of course, the compositor scales O(n) in the number of windows, while your display list system scales O(n) in the number of layers
Um, why is my system suddenly drawing things that it knows aren't visible?
Because what was the last UI system that users actually wanted to use (as opposed to things which look like Motif which only programmers want to use) which didn't have rounded corners, alpha transparency or drop shadows somewhere?[/quote]
I see now - you're ignoring an advantage of "list of commands" in one scenario by redefining the scenario. Nice!
I think most of the GUIs I've seen support transparent windows; but I can't be sure because every single application I've used doesn't have transparent backgrounds (I did enable transparent backgrounds for the terminal emulator in KDE once, but I disabled it after about 10 minutes). The only place I actually see any transparency is in window decoration (e.g. slightly rounded corners in KDE, and actual transparency in Windows/Aero); but none of the window decorations in my example were obscuring any textures.
Owen wrote:Brendan wrote:Owen wrote:An alternate situation: the user picks up one of the windows and drags it.
The damage rectangle per frame is going to be slightly higher than 20000px because that is the size of the window, so we will take that figure (the actual number is irrelevant). None of the window contents are changing in this scenario, and we'll assume the user is moving the topmost window left, and 16000px of the background window are covered. The display list system draws the 20000px of background, 16000px of background window decorations/background, 2048px of texture 1, 20000px of foreground window decorations/background, 7200+1500px of T3+T4: 66748px
I'm not too sure what's going on with the 2 completely different systems that you seem to have invented.
For my "list of commands" (as described), if the second application's window (the topmost window) is being dragged to the left; then the GUI would send its main list of commands each frame, causing the first video driver to redraw 22500 pixels and the second video driver to redraw 22500 pixels for most frames (there are 2 textures that were never drawn, that would need to be drawn once when they become exposed).
However, my "list of commands" (as described) is only a simplified description because I didn't want to bury the concept with irrelevant details. Nothing prevents the video driver's from comparing the GUI's main list of commands with the previous version and figuring out what needs to be redrawn and only redrawing the minimum it has to. This would make it as good as your system/s without any "damage events" or toolkits or whatever other extra burdens you want to force the unfortunate application developers to deal with.
So your application developers are going to write their UI drawing code from scratch for every application they develop?
Yes; but don't worry, I've got clean abstractions - application developers will be able to make their applications impressive and unique without dealing with a truckload of trash (or unwanted "widget toolkit" dependencies).
Owen wrote:Of course not, they're going to use a widget toolkit that, hopefully, your OS will provide. Supporting said damage events in a widget toolkit isn't difficult. In the worst case, implementing it is no more complex than implementing the same feature in the GUI system.
Why would I want to inflict this on application developers and users?
Owen wrote:Brendan wrote:Owen wrote:And Brendan has yet to answer, in his scenario, particularly considering he has said he doesn't plan to allow buffer readbacks, he intends to support composition effects like dynamic exposure HDR
In HDR, the scene is rendered to a HDR buffer, normally in RGB_11f_11f_10f floating point format. A shader then takes exposure information to produce an LDR image suitable for a feasible monitor by scaling the values from this buffer. It often also reads a texture in order to do "tonemapping", or create the curve (and sometimes colouration) that the developers intended.
In dynamic exposure HDR, the CPU (or on modern cards a compute shader) averages all the pixels on screen in order to calculate an average intensity, and from this calculates an exposure value. This is then normally integrated via a weighted and/or moving average and fed back to the HDR shader (with a few frames delay for pipelining reasons)
In his system, either the entire scene needs to get rendered on both GPUs (so the adjustment can be made on both), or you'll get different exposures on each and everything is going to look awful.
You're right - the video drivers would need to send a "max brightness for this video card" back to the virtual screen layer, and the virtual screen layer would need to send a "max brightness for all video cards" back to the video cards. That's going to cost a few extra cycles; but then there's no reason the virtual screen layer can check for bright light sources beforehand and tell the video cards not to bother if it detects that everything is just ambient lighting (e.g. normal applications rather than games).
I've had a little more time to think about this. The goal would be to simulate the human iris, which doesn't react immediately. The virtual screen layer would keep track of the "current iris setting", and when it tells the video driver/s to draw a frame it'd also tell it the current iris setting without caring how the new frame effects things; then the video driver/s would send back a "max brightness" after they've drawn the frame, and the virtual screen layer would use these "max brightness" responses to modify the current iris setting (that will be used for subsequent frames).
Owen wrote:So now your graphics drivers need to understand all the intricacies of HDR lighting? What about all the different variations of tonemapping things could want?
What about global illumination, boekh, dynamic particle systems, cloth, etc? Are you going to offload those in their infinite variations on the graphics driver too?
As if graphics drivers weren't complex enough already...
A renderer's job is to render (static) images. Why would I want to spread the complexity of rendering all over the place? Do I win a lollipop if I manage to spread it so far that even people writing (e.g.) FTP servers that don't use any graphics at all have to deal with parts of the render's job?
Of course this works both ways. For example, things like physics (inertia, acceleration, fluid dynamics, collisions, deformations, etc) aren't the render's job (you'd want a physics engine for that).
Cheers,
Brendan