News for hackers. Stuff that matters.
Re:I Am Graphics and So Can You by lfowles on Wednesday July 12, 2017 @10:32AM (#14752795)
Interesting article, I ended up getting the OpenGL SuperBible to take advantage of yesterday's kindle promotion. I thought about the Vulkan programming guide, but ended up deciding modern OpenGL would be an easier starting point. Did anyone else pick up Vulkan as their intro to graphics programming?

(In a twist of fate, the SuperBible example code only supports OpenGL 4.0+ and my primary computer is stuck at 3.3)

Re:I Am Graphics and So Can You by planteen on Wednesday July 12, 2017 @10:55AM (#14753023)
The future of OpenGL is most likely OpenGL ES. You might want to try OpenGL ES 2.0 Programming Guide (or OpenGL ES 3.0 Programming Guide). It is far less daunting than the OpenGL Superbible. The differences between OpenGL ES 2 and 3 are small and OGLES2 is modern in the sense of shaders unlike OGLES1.
Re:I Am Graphics and So Can You by vvanders on Wednesday July 12, 2017 @10:59AM (#14753080)
Vulkan is great when you want to wring every last bit of performance out of something. OpenGL ES is a much more straightforward API and will get you something that runs practically anywhere.

Most people don't care about tiled vs immediate mode GPUs when they're starting. They just want to get pixels on the screen and there's a ton of resources out there on OpenGL ES. Once you've got your feet under you(seriously, you need to understand matrices, texture formats, shaders, and a host of other things) then look at Vulkan.

Re:I Am Graphics and So Can You by laythea on Wednesday July 12, 2017 @03:38PM (#14755880)
Vulkan is not just about performance - it increases reliability. If you have ever attempted the hopelessly frustrating task of trying to manage GPU memory from an OpenGl application in a consistent manner, then you will have felt the pain caused by the vagueness of spec/variety of opengl driver differences.

From a product point of view, you don't need to sacrifice perf for the ability to run on more hardware types.

Re:I Am Graphics and So Can You by nhaehnle on Wednesday July 12, 2017 @04:50PM (#14756556)
Eh, I would say Vulkan decreases reliability.

Precisely because Vulkan drivers are much thinner and do no error checking, it becomes very likely that you will end up writing code that works on one system but fails on the next.

Granted, OpenGL has some of the same issues. It's incredibly frustrating when vendor B accepts some GLSL that is forbidden by the spec, and then some application fails on the more conformant driver of vendor A because the developer failed to test properly.

The thing is, Vulkan multiplies these issues significantly. You still have a compiler in the driver, so you still get the same potential for shader incompatibilities. But you also get to manage barriers and texture transitions yourself, and boy is it likely that you'll get something wrong there. And since memory models are different across vendors (and even different between different generations of hardware from the same vendor), it is extremely likely that you end up with code that works on card A but fails subtly on card B.

There are tools that try to catch these kinds of errors, but they're far from perfect.

On the issue of memory management, I am unaware of any OpenGL issues here that make applications unreliable. Sure, drivers may not always manage memory optimally, but having an application that runs a bit less than optimally is very different from an application that renders garbage because you failed to allocate your textures with sufficient alignment -- which is something you can do in Vulkan.

So really, at the end of the day, Vulkan is about giving graphics developers foot-guns in order to reduce CPU overhead. That was explicitly its mission statement from the beginning!

Re:I Am Graphics and So Can You by laythea on Wednesday July 12, 2017 @07:13PM (#14757486)
Thanks for the info! I'm no Vulkan expert. I'm coming from OpenGL, hoping that Vulkan will make things better eg at allowing the app to manage GPU memory explicitly to suit the application use-case. Agreed, reliable was the wrong word. Depending on the use-case, the ability for a program to tune its memory usage to effect performance in some beneficial way can mean the difference between a program that is usable or not - for an application trying to extract max perf. It is my understanding that Vulkan will help with this. Can you confirm?
Re:I Am Graphics and So Can You by nhaehnle on Wednesday July 12, 2017 @08:51PM (#14757984)
I'm honestly uncertain. My best guess right now is: If you know what you're doing, it's possible that you might do memory management better in Vulkan. Then again, it's possible that by trying to exploit the freedom Vulkan gives you, you're actually making things worse.

I suspect it's similar to prefetching and non-temporal moves on the CPU in that way. If you're targeting a specific machine and spend a lot of time on optimizations, then using those advanced features can give you a performance boost. But then a new machine comes along, and your fancy tweaks turn out to have made thing worse -- this happened with some games when Ryzen came out, and I suspect it's likely to happen with Vulkan as well.

The main benefit of Vulkan is that it cuts CPU overhead because the driver no longer has to do state tracking. The state tracking is done (almost) entirely by the game engine, which knows precisely what is needed and can therefore do the job more efficiently. This is totally unrelated to memory management.

Though keep in mind I'm speaking from a Linux perspective. On Windows, video memory is managed somewhat differently at least in WDDM2. Still, I'd be surprised if the story is much different. Vulkan doesn't expose the details of video memory swapping.

Re:I Am Graphics and So Can You by laythea on Thursday July 13, 2017 @02:15PM (#14763739)
Thanks again.
Re:I Am Graphics and So Can You by slezyr on Wednesday July 12, 2017 @11:38AM (#14753439)
Save yourself some time and forget about Superbible. You won't make it.

Start from learnopengl.com and then you can try Superbible

Re:I Am Graphics and So Can You by lfowles on Thursday July 13, 2017 @12:55PM (#14762896)
Thanks, I have been using learnopengl.com because of the 3.3 support. That said, I have been reading the superbible on the side and it has been an incredibly useful resource for getting in the mindset.
Re:I Am Graphics and So Can You by malkia on Wednesday July 12, 2017 @10:52AM (#14752990)
I wanted to learn Vulkan, but as it happened my laptop of choice is Mac, and there is only a commercial implementation of Vulkan there (or maybe there is one now that I can use without paying?). It's not the money, it's just the spending on things just to learn.
Re:I Am Graphics and So Can You by corysama on Wednesday July 12, 2017 @12:08PM (#14753703)
Vulkan is not a good first-step path to learning graphics. It's maintainers will tell you to start out by learning OpenGL or DX11.

However, even though its unpopular for many reasons, Metal is a very good compromise as a starter API. It's design is very close to Vulkan/DX12, but its complexity is much lower. It can even be said to be less complex than OGL in the way that memcpy is less complex than glSubBufferData.

Re:I Am Graphics and So Can You by malkia on Thursday July 20, 2017 @04:47AM (#14810912)
Thanks, but your message has a bit of an assumption. I'm not graphics pro, but had my ways through VGA 320x200x256 colors in 0xA0000, then a bit of 3Dfx, some OpenGL 1.1, and DX3 then quickly DX5, a bit of DreamCast (but very shy), etc.

No, I'm bit familiar with OpenGL, again not at the level of graphics-pros, more like overall knowledge, and my DX knowledge goes pretty much to DX8 or DX9, but instead of learning DX11 or 12, I think Vulkan might be a better choice.

I've returned my company laptop week ago, as I left it, and now I'm stuck with my chromebook + crouton, looks like Vulkan is good there (almost).

I certainly don't want to get stuck in Metal.

Re:I Am Graphics and So Can You by corysama on Thursday July 20, 2017 @12:59PM (#14814244)
Don't worry about getting stuck with Metal any more than you'd worry that learning C# will prevent you from learning C++. What you need to learn are the fundamentals of modern techniques.

I wrote up a recommended path from nothing -> OpenGL -> Vulkan here https://www.reddit.com/r/GraphicsProgramming/comments/6hcri4...

I honestly haven't worked with Vulkan yet, but I hang out with pros from different companies who do and they complain about Vulkan a lot. A whole lot. Part of it is that it is very difficult even for pros to avoid undefined behavior and timing issues. Another is that the only semi-solid shading language front-end for SPIR-V is glsl. Lots of people prefer to work in hlsl and really would like to see Metal's shading language everywhere.

Re:I Am Graphics and So Can You by pfranz on Wednesday July 12, 2017 @04:41PM (#14756470)
> Vulkan is not a good first-step path to learning graphics. It's maintainers will tell you to start out by learning OpenGL or DX11.

This article is literally advocating the opposite. 'So how did I finally break through that wall of understanding? ... "But Vulkan is the hardz" I hear you saying. "Shouldn't I start with something easy like OpenGL?" Emphatically I say NO.'