News for hackers. Stuff that matters.
Re:Valve Source Engine Running Faster on Linux than Windows by johnchristopher on Thursday August 02, 2012 @06:11AM (#4328055)
> We have been doing some fairly close analysis and it comes down to a few additional microseconds overhead per batch in Direct3D which does not affect OpenGL on Windows. Now that we know the hardware is capable of more performance, we will go back and figure out how to mitigate this effect under Direct3D.

Why wouldn't they switch back to OpenGL on windows then ?

Besides the absolute numbers I wonder how the hardware is behaving regarding resource intensive applications games are. From personnal experience every laptops and computers I have owned had had their fans spinning much louder when running ut2004 (and other games) on linux than on windows. Whether because it's getting hotter for less computational power or because of more aggressive default fan settings in distros.

Re:Valve Source Engine Running Faster on Linux than Windows by exDM69 on Thursday August 02, 2012 @06:22AM (#4328084)
> Why wouldn't they switch back to OpenGL on windows then ?

Because no-one likes to program with OpenGL. Because of it's history, it is one of the hairiest APIs out there. Try to propose using OpenGL to a game developer and you'll be laughed at.

Many GPU vendors have been doing a bad job with OpenGL windows drivers and they have been really buggy, but the situation is improving.

I write OpenGL because I don't use Windows. I still hate it.

Re:Valve Source Engine Running Faster on Linux than Windows by JabavuAdams on Thursday August 02, 2012 @08:37AM (#4328393)
Simply not true. If you're new to real-time 3d I'd ignore this advice. If you're experienced, then you probably have enough info and project-specific knowledge to make up your own mind.
Re:Valve Source Engine Running Faster on Linux than Windows by brooksbp on Thursday August 02, 2012 @12:51PM (#4329651)
+1 I am having a flippin blast working through this: http://www.arcsynthesis.org/gltut/
Re:Valve Source Engine Running Faster on Linux than Windows by dtf on Thursday August 02, 2012 @06:29AM (#4328099)
Do you write old-and-busted OpenGL or new-hotness OpenGL? Seems fairly clean to me when you leave out all that legacy crack the CAD vendors can't seem to give up.
Re:Valve Source Engine Running Faster on Linux than Windows by exDM69 on Thursday August 02, 2012 @06:36AM (#4328109)
> Do you write old-and-busted OpenGL or new-hotness OpenGL? Seems fairly clean to me when you leave out all that legacy crack the CAD vendors can't seem to give up.

I usually use the latest GL only. Today that would be GL 4.2 core profile. Or GLES2.

Sure the old fixed function pipeline and immediate mode are gone. But the API still sucks. Bind-to-modify semantics, using integers for handles, global state everywhere, etc. They are the big problems, for both, users and implementors.

Re:Valve Source Engine Running Faster on Linux than Windows by optymizer on Thursday August 02, 2012 @09:08AM (#4328519)
What's wrong with bind-to-modify and using integers for handles? What alternatives are there? With my limited knowledge of OpenGL, I know you get a number, describing a resource in video card memory. I bet for an OpenGL implementation, binding a resource id means finding a pointer to the resource. Sounds reasonable to me. Would you rather get an invalid pointer that you should refrain from dereferencing (because you'll be reading from RAM, not GPU RAM)? That would've been a disaster.

And I don't really know what 'global state everywhere' means. Do you mean that you keep OpenGL-related info in your program's global state? In that case, you should be using some AppState object to keep the state (and pass a pointer around). Otherwise, what global state is there "everywhere"?

Re:Valve Source Engine Running Faster on Linux than Windows by exDM69 on Thursday August 02, 2012 @09:28AM (#4328600)
> What's wrong with bind-to-modify and using integers for handles? What alternatives are there?

  glBindTexture(GL_TEXTURE_2D, my_texture_handle);
  glTexImage2D(GL_TEXTURE_2D, ....);
Why not:

  glTexImage(my_texture_handle, ....);
In addition to being used for accessing and modifying, the bindings are global values that affect rendering. In the example above, it affects which texture is used on the texture unit that has been selected by glActiveTexture. What a mess.

> With my limited knowledge of OpenGL, I know you get a number, describing a resource in video card memory. I bet for an OpenGL implementation, binding a resource id means finding a pointer to the resource. Sounds reasonable to me.

Wrong. There's a lot of software in between, before we start talking about GPU resources, so it refers to a structure on the CPU side. The integer-to-pointer lookup in between is another cache miss that we don't need (it has measurable L1 cache effects). This has, to some degree, been worked around by adding state objects like "Vertex Array Objects" (similar to D3D input layout).

> Would you rather get an invalid pointer that you should refrain from dereferencing (because you'll be reading from RAM, not GPU RAM)? That would've been a disaster.

Opaque pointers are used quite a lot in that way (e.g. D3D, via object pointers), it's a common idiom in C that adds a little type safety and documentation. In this case the pointers would be internal structures in the GL driver's user space. But you should not dereference them anyway. Unix uses integers as handles because the stuff it refers to is inside kernel memory, and you could poison the kernel by giving invalid pointers.

> Do you mean that you keep OpenGL-related info in your program's global state? In that case, you should be using some AppState object to keep the state (and pass a pointer around).

I don't. OpenGL does. In OpenGL, you have a global variable (actually: thread local) called the "context" which contains all the state of the rendering pipeline. In essence, it's a global variable that has side-effects when you access it.

Re:Valve Source Engine Running Faster on Linux than Windows by brooksbp on Thursday August 02, 2012 @12:54PM (#4329670)
> Why not: > glTexImage(my_texture_handle, ....);

Macro?

Re:Valve Source Engine Running Faster on Linux than Windows by cscheid on Friday August 03, 2012 @12:11PM (#4334600)
Macros here would make the problem worse. The problem is not notation, it's the call to glBindTexture.

It has 1) inescapable measurable performance overhead and 2) affects state that changes the rendering output.

So if you macro it, you're forcing yourself to calling glBindTexture even in the cases where that wasn't necessary. (say, if you had just called glBindTexture and knew that the right texture was bound anyway). And, in addition, you have to remember to store the previous state of the bound texture in case someone down the execution path wants to use that value. Macroing things which change global state is, in general, a terrible idea.

If you don't macro it, your code has to remember whether the right texture has been bound, and design around that. It can be done for sufficiently simple cases, but the general solution also has performance overhead (checking a local variable before calling glBindTexture will get you into branch misprediction problems)

You can imagine complicated solutions like state batching: writing a better, retained-mode domain-specific language atop OpenGL which will analyze the sequences of your calls before making it, and then remove all the unnecessary glBindTexture, etc. calls. But it's a major pain in the ass that simply shouldn't exist.

Re:Valve Source Engine Running Faster on Linux than Windows by nvoorhies on Thursday August 02, 2012 @01:30PM (#4329878)
You'll still have the driver doing the mapping from id to handle under the hood. It can get to be north of 25% of cpu cycles spent looking this up in some cases.
Re:Valve Source Engine Running Faster on Linux than Windows by jra101 on Thursday August 02, 2012 @01:34PM (#4329901)
You can use the EXT_direct_state_access instead of bind-to-modify.

  glBindTexture(GL_TEXTURE_2D, texId);
  glTexImage2D(GL_TEXTURE_2D, ...);
vs

  glTextureImage2DEXT(texId, GL_TEXTURE_2D, ...);
Re:Valve Source Engine Running Faster on Linux than Windows by exDM69 on Friday August 03, 2012 @05:33AM (#4333276)
EXT_direct_state_access is not very well maintained. And bind-to-modify is just one problem, there are others. Everything is mutable in OpenGL (a stark contrast to D3D), and that makes things complicated.
Re:Valve Source Engine Running Faster on Linux than Windows by jiggy2011 on Thursday August 02, 2012 @08:31AM (#4328369)
I thought stuff like SDL was used precisely because it abstracted away all the crappy parts of openGL and gave you an easier API to work with?
Re:Valve Source Engine Running Faster on Linux than Windows by exDM69 on Thursday August 02, 2012 @10:16AM (#4328828)
> I thought stuff like SDL was used precisely because it abstracted away all the crappy parts of openGL and gave you an easier API to work with?

No. SDL only deals with the platform specific parts like windowing and OpenGL initialization. It does not do any OpenGL for you.

GLFW is another popular tool for the same purpose.

Re:Valve Source Engine Running Faster on Linux than Windows by eropple on Thursday August 02, 2012 @09:23AM (#4328570)
If it meaningfully abstracted away the crap as it was originally billed to do, yes. It doesn't really do that, IMO, and mostly just makes you deal with even more mental state. It's very common to see people use SDL more or less only for creating a window and pulling input (which it does do pretty well).

SFML is better, but the developers are pretty uninterested (SFML 1.x was declared "legacy" while there was a bug that prevented it from running on modern AMD graphics cards) and I wouldn't trust it as far as I could throw it.

Re:Valve Source Engine Running Faster on Linux than Windows by peacemaker on Thursday August 02, 2012 @11:13AM (#4329111)
Can you explain why you wouldn't trust SFML? I've been using it for a few months now and haven't had any problems.
Re:Valve Source Engine Running Faster on Linux than Windows by eropple on Thursday August 02, 2012 @02:00PM (#4330037)
I don't trust people who leap to a new, breaking major version while ~40% of people can't run the in-theory-supported old one. Their prerogative, but I won't use their library because of it.
Re:Valve Source Engine Running Faster on Linux than Windows by darkstalker on Thursday August 02, 2012 @09:26AM (#4328588)
id Software writes all of it's games using OpenGL, and they always create state of the art engines
Re:Valve Source Engine Running Faster on Linux than Windows by naitbit on Thursday August 02, 2012 @11:21AM (#4329145)
Yes but Carmack also said that he now prefers D3D[1] and that difference between OpenGl and D3d does not really matter: "It’s interesting how little of the technology cares what API you’re using and what generation of the technology you’re on. You’ve got a small handful of files that care about what API they’re on, and millions of lines of code that are agnostic to the platform that they’re on." [2]

[1]http://news.ycombinator.com/item?id=2313661

[2] http://www.maximumpc.com/article/features/e3_2008_the_john_c...

Re:Valve Source Engine Running Faster on Linux than Windows by cobrausn on Thursday August 02, 2012 @11:24AM (#4329162)
It isn't because OpenGL is better. It's simply inertia. Don't take my word for it - take Carmack's.

http://www.tomshardware.com/news/john-Carmack-DirectX-OpenGL...

I do all my graphics work in OpenGL, but I'm aware of its shortcomings.

Re:Valve Source Engine Running Faster on Linux than Windows by huggyface on Thursday August 02, 2012 @09:54AM (#4328724)
Try to propose using OpenGL to a game developer and you'll be laughed at.

OpenGL dominates the massive mobile industry (those billion or so Android and iOS handsets run and live on OGL ES 2.0), and OpenGL was the premiere desktop gaming API until relatively recently.

Then it fell behind not because it was a defective API, but rather because the OpenGL working group was far too slow to adapt to hardware improvements -- mired in infighting and bureaucratic BS -- while DirectX raced ahead with things like geometry shaders.

Of course mobile has completely changed the equation, and suddenly people are writing OpenGL engines that only make sense to use against all other targets (Windows, Linux, etc)

Re:Valve Source Engine Running Faster on Linux than Windows by CJefferson on Thursday August 02, 2012 @06:16AM (#4328070)
> Why wouldn't they switch back to OpenGL on windows then ?

Because for many cards, the opengl drivers are awful. If you are only implementing one of DirectX and OpenGL on windows, there really is no contest. Of course, you could do both, but then you have another option to give users, and two very different codepaths to test.

Re:Valve Source Engine Running Faster on Linux than Windows by dtf on Thursday August 02, 2012 @06:24AM (#4328087)
The abundance of awful OpenGL drivers is one of the reasons given for the ANGLE project (http://code.google.com/p/angleproject/). I've often wondered what those cards are though? NVIDIA drivers at least always seemed to have solid OpenGL support.
Re:Valve Source Engine Running Faster on Linux than Windows by Nicole060 on Thursday August 02, 2012 @06:33AM (#4328105)
AMD (ATI) GPU drivers are the worst when it comes to OpenGL. id software is one of the few big companies that makes OpenGL games and they always run much slower on ATI cards (Doom 3 during the first few years of its release) or run with nearly game breaking glitches (Rage, textures that pop up 3 seconds too late on the screen)

John Carmack was seriously angry about ATI's drivers when the game "Rage" was released. http://kotaku.com/5847761/why-was-the-pc-launch-of-rage-such...

"The driver issues at launch have been a real cluster !@#$, [...] When launch day came around and the wrong driver got released, half of our PC customers got a product that basically didn't work. The fact that the working driver has incompatibilities with other titles doesn't help either. Issues with older / lower end /exotic setups are to be expected on a PC release, but we were not happy with the experience on what should be prime platforms."

I unfortunately made the mistake to buy an AMD 5770 when I assembled my last desktop computer. This hateful GPU. If you even care one bit about either OpenGL or Linux, you are *ed with AMD. The open source drivers for linux are too slow for anything that matters and the closed source drivers made by ATi are too buggy to be used at all, they couldn't even run Gnome 3 without so many glitches, for so many months without improvements to the drivers, that I felt true despair.

You want OpenGL or/and Linux, and you need performance ? Get a Nvidia. There's nothing but Nvidia that works well with either. If you don't need performance, then simply get something that has an integrated intel chip.

I will never, ever think about buying anything from AMD again. Pure garbage. Their newer CPU line, the Bulldozer, is also garbage that runs slower than the older generation on many tasks.

Re:Valve Source Engine Running Faster on Linux than Windows by JabavuAdams on Thursday August 02, 2012 @08:42AM (#4328412)
I've talked to some people who've worked on AMD (ATI) driver code, and at the time it was a mountain of unmaintainable co-op student code. The co-ops were allowed to write their crappy code, then when they left there was that much more technical debt.
Re:Valve Source Engine Running Faster on Linux than Windows by iliis on Thursday August 02, 2012 @08:06AM (#4328288)
On the other hand, Nvidia still has no proper support for multiple monitors under Linux. Yes, you can have two and yes, you can rotate them. But only both at the same time. Luckily, the opensource driver seems to work quite nicely on my system.

[OT: Why is your nick green?]

Re:Valve Source Engine Running Faster on Linux than Windows by Nicole060 on Thursday August 02, 2012 @08:47AM (#4328426)
I know nvidia's support is not perfect. But frankly which is better, something that's not perfect but achieving "good enough" support, or something like ATi that has so many bugs you couldn't even use Gnome 3, a desktop environment ? http://www.phoronix.com/scan.php?page=news_item&px=MTAyN... http://ati.cchtml.com/show_bug.cgi?id=99

I couldn't run any game under wine either without crashing, even older games that usually run ok like Baldur's Gate 2. The open source driver are much more stable but on the other hand they are MUCH slower. Like, turning a good, midrange card like the Radeon 5770, into what low end crap would do in Windows. But you're better off with that mid range or a high end card since a low end card is not going to be usable at all for anything that makes use of the GPU, with the open source drivers running even free games like Xonotic on a low end card is plain crazy.

http://www.phoronix.com/scan.php?page=article&item=amd_r...

On a game like Warsow, the difference between the open source driver and the catalyst can be as high as 34 fps vs 374 fps (34 fps is not enough for a fluid gaming experience, you need at least 50 to 60. Gaming is not like the 24 fps of motion pictures with each frame blurred giving the illusion of movement even with a low framerate since each frame rendered in a 3d game are sharp as hell.) on a high end card, and 17 fps vs 45 fps on a low end card, which means that the game is not playable at all on the open source driver, while it's tolerable on the catalyst.

AMD's stuff is not worth the pain. Don't buy AMD unless you have a masochist streak. I wish I had known before I built my desktop, I was being influenced by all the free software maniacs who were praising AMD to heaven because of their policy on giving out the GPU specs. Free software be damned, I will take nvidia's closed source driver over shit that is not working the next time. My previous GPU was a Nvidia Geforce 7600 GT and it worked like a clock.

Re:Valve Source Engine Running Faster on Linux than Windows by moonchrome on Thursday August 02, 2012 @09:31AM (#4328615)
Just wanted to say that I have the same graphics card and the exact same problems with it (Gnome 3 even with all the patches and everything would still "restart" once per hour at least), so seriously if you are interested in running Linux avoid AMD.
Re:Valve Source Engine Running Faster on Linux than Windows by Nicole060 on Thursday August 02, 2012 @09:39AM (#4328658)
And here I hoped that since the last time I tried that it would finally work.. many months have passed since the last time I gave Linux a go on this desktop. The fact that you're saying that you're still having this problem now is not making me feel any happier.

... if in the next 6 months the situation doesn't get any better I feel I am going to physically destroy the GPU with a hammer, send the pic to AMD and buy a nvidia before the need for a hardware upgrade even shows up. The fact that it has drivers problems even under windows doesn't help making AMD's case.

Re:Valve Source Engine Running Faster on Linux than Windows by moonchrome on Thursday August 02, 2012 @12:48PM (#4329633)
>The fact that you're saying that you're still having this problem now is not making me feel any happier.

TBH I also gave up about a month and a half ago it could have changed recently but I doubt it.

Re:Valve Source Engine Running Faster on Linux than Windows by ori_b on Thursday August 02, 2012 @10:35AM (#4328929)
No, avoid proprietary drivers. The open source ATI drivers are working beautifully for me. They're fast enough for everything I do, and they've been rock solid for me.
Re:Valve Source Engine Running Faster on Linux than Windows by moonchrome on Thursday August 02, 2012 @12:47PM (#4329622)
>They're fast enough for everything I do

Waay to slow for gaming (I tried HoN and NVN) also WebGL was really slow (software rendering kind slow), since this is a thread about games I think this use case is required - I didn't try the OSS drivers in ~6 months so it could have changed. But Gnome/desktop was really stable so if you only need desktop apps it does work.

Re:Valve Source Engine Running Faster on Linux than Windows by exDM69 on Thursday August 02, 2012 @08:24AM (#4328345)
> On the other hand, Nvidia still has no proper support for multiple monitors under Linux.

Multi monitor support should be fixed, latest Nvidia beta drivers have Xrandr. It's still a new feature so it can have a few rough edges, though.

Re:Valve Source Engine Running Faster on Linux than Windows by iliis on Saturday August 04, 2012 @05:39AM (#4338047)
Woah, you are right, thank you! So far, the beta driver seems to run somewhat smoother than the nouveau-version. 3D is certainly faster.
Re:Valve Source Engine Running Faster on Linux than Windows by Macha on Thursday August 02, 2012 @08:12AM (#4328309)
Nicks are green for users who have made less than a certain amount of comments. I think it's either 3 or 5, but I could be wrong.
Re:Valve Source Engine Running Faster on Linux than Windows by iliis on Thursday August 02, 2012 @05:58PM (#4331258)
Thanks, I always wondered about this. The threshold seems to be a bit higher though: Nicole060 has made 8 comments as of now.
Re:Valve Source Engine Running Faster on Linux than Windows by nitrogen on Thursday August 02, 2012 @06:54AM (#4328139)
I will never, ever think about buying anything from AMD again. Pure garbage. Their newer CPU line, the Bulldozer, is also garbage that runs slower than the older generation on many tasks.

In fairness to AMD, AIUI that is by design, with the intention to increase clock speeds and core counts to compensate. However, that line of thinking was the downfall of the Pentium 4.

Re:Valve Source Engine Running Faster on Linux than Windows by potkor on Thursday August 02, 2012 @08:40AM (#4328405)
> You want OpenGL or/and Linux, and you need performance ? Get a Nvidia.

Unfortunately they've dropped laptop support so not really an option these days. The open source Intel/Radeon drivers in Mesa look to be the only game in town in the future.

edit: to expand, they've said many times that they're not going to support Optimus and that covers all except the luggable laptops these days.

Re:Valve Source Engine Running Faster on Linux than Windows by Nicole060 on Thursday August 02, 2012 @09:01AM (#4328490)
Re:Valve Source Engine Running Faster on Linux than Windows by rat87 on Friday August 03, 2012 @08:33AM (#4333689)
You can simply disable the intel gpu in most of these.
Re:Valve Source Engine Running Faster on Linux than Windows by potkor on Tuesday August 07, 2012 @07:25AM (#4349555)
I must have bad luck so far then. Can you remember examples?
Re:Valve Source Engine Running Faster on Linux than Windows by dman on Thursday August 02, 2012 @09:55AM (#4328733)
Its funny but I have the opposite experience - the following amd devices have been rock solid for me on both windows and debian

a) radeon 3850

b) fusion e-350

c) a mobile x700

The only nvidia chip I have is some version of a mobile quadro and it has very bad thermals and will frequently segfault.

Re:Valve Source Engine Running Faster on Linux than Windows by Dylan16807 on Thursday August 02, 2012 @12:18PM (#4329451)
That's not really the opposite experience. Bad cooling on a piece of mobile hardware isn't nvidia's fault.

I'm glad for your sake that you haven't hit any driver bugs though.

Re:Valve Source Engine Running Faster on Linux than Windows by foamdino on Thursday August 02, 2012 @07:53AM (#4328262)
As someone who bought AMD/ATi to 'support' the idea of a more open linux, I regret the decision daily. Very little works on linux and performance on windows (I dual boot for gaming), is not very good.

I'll never buy ATi again after my experience with them.

Re:Valve Source Engine Running Faster on Linux than Windows by Nicole060 on Thursday August 02, 2012 @08:53AM (#4328452)
Yeah even when your run windows AMD's still not worth the pain. OpenGL games like Rage are bugged on release for AMD owners and the catalyst drivers often introduce terrible bugs. I don't upgrade my drivers unless I the older ones have a known bug with a newer game. http://www.youtube.com/watch?v=LsD3y3vnsM8 http://www.youtube.com/watch?v=2pSHOJKcFU8 (the youtube comment is wrong, it didn't happen only with skyrim, I had the antialiasing bug with lots of games after I upgraded to that version of the catalyst at the time) This is what happens (and happened to me) when you trust AMD with their drivers. That one of their mid or high end card can work like shit with one of the best sellers on the PC platform says it all about how much AMD cares for their customers : they're giving us the finger.

How could AMD stay in business with such subpar products is beyond me. I know they'll never regain my trust. That's just not possible. Too many problems on too many platforms.

Re:Valve Source Engine Running Faster on Linux than Windows by yuhong on Thursday August 02, 2012 @08:50PM (#4331900)
Because of the Windows world that generally don't care about OpenGL, of course.
Re:Valve Source Engine Running Faster on Linux than Windows by pjmlp on Thursday August 02, 2012 @07:55AM (#4328266)
> I've often wondered what those cards are though?

Intel cards, famous for lying about which set of OpenGL extensions are really available in hardware.

All the GPUs made in Taiwan and similar countries delivered with cheap desktop PCs (< 500 euro).

Re:Valve Source Engine Running Faster on Linux than Windows by rbanffy on Thursday August 02, 2012 @04:47PM (#4330908)
Last time I checked, Windows OpenGL support was half-hearted since the Vista days. From Microsoft's PoV, making OpenGL a viable target on Windows would make porting games to other platforms easier. My bet is that they'll try to avoid it if they can.
Re:Valve Source Engine Running Faster on Linux than Windows by junkbit on Thursday August 02, 2012 @08:35AM (#4328385)
Games like L4D are designed to run on Xbox which uses DirectX
Re:Valve Source Engine Running Faster on Linux than Windows by astrodust on Friday August 03, 2012 @12:47PM (#4334781)
What do you mean "designed to run"? Most big studios have a layer between their application code and the OpenGL or D3D interface to make it portable. They're no more designed for DirectX than they are for OpenGL.