TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Let's Fix OpenGL [pdf]

103 pointsby madabout 8 years ago

11 comments

geokonabout 8 years ago
I&#x27;m not an OpenGL expert or anything, but I get the impression the author doesn&#x27;t really know what he&#x27;s talking about and sounds a bit amateurish (I&#x27;m a bit hesitant to say that given it&#x27;s a professor at Cornell..)<p>He seems to just hand-wave and says &quot;well just use C you idiots&quot;. He criticizes Metal for using a version of C++14 that doesn&#x27;t allow recursion, but offers no alternate solutions<p>The reason GLSL isn&#x27;t C is because you can&#x27;t do everything C does on a low end cellphone GPU - so obviously you have to restrict the language. The &quot;cognitive load&quot; of knowing the restrictions is overblown but also unavoidable.<p>SPIRV isn&#x27;t even mentioned. DSL&#x27;s are dismissed.<p>I didn&#x27;t really follow what he didn&#x27;t like about the preset input&#x2F;output variables that are predefined in the different shaders. It&#x27;s a bit ugly.. but that&#x27;s also pretty much a non issue.
评论 #14073896 未加载
评论 #14076332 未加载
评论 #14075532 未加载
评论 #14073776 未加载
评论 #14073872 未加载
评论 #14081881 未加载
33aabout 8 years ago
This author seems pretty clueless about how things actually work and a lot of the assumptions are just plain wrong. For example, ubershaders are preferred instead of many small shaders because the overhead of switching shaders and recompiling them is expensive. It is not something that people build because it is convenient (rather it is quite the opposite!) and then specialize with fixed parameters.
vvandersabout 8 years ago
As someone who&#x27;s a fan of PL languages(and spends a fair amount of time in the GPU space) I&#x27;m not sure I buy many of the arguments.<p>The reason that GPU drivers&#x2F;APIs have few safety checks is that in graphics code, performance is valued above all else. Even simple calls can introduce overhead that&#x27;s undesirable when you&#x27;re making thousands of the same type of calls.<p>His example of baked shaders doesn&#x27;t really seem to hold much value since interactive shader builders(ShaderToy, UE3&#x2F;4, etc) are all content driven anyway so the extra code generation isn&#x27;t a limiting constraint.<p>Nice effort but I don&#x27;t see it solving actual pain points in production.
评论 #14075873 未加载
评论 #14076258 未加载
评论 #14076259 未加载
nighthawk454about 8 years ago
John Carmack weighed in on Twitter:<p>&gt; ...some interesting thoughts, but the shading language is the least broken part of OpenGL.<p>&gt; Lots of people consider automating the computation rate determination between fragment and vertex shaders, but it is a terrible idea.<p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;ID_AA_Carmack&#x2F;status&#x2F;851258064909070336" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;ID_AA_Carmack&#x2F;status&#x2F;851258064909070336</a>
nhaehnleabout 8 years ago
A concrete problem that the author misses is the need for a better understanding of SPMD semantics. GLSL has the notion of &quot;dynamically uniform&quot; values, i.e. values that are the same across all shader threads that arise from one draw call, but this notion isn&#x27;t really properly defined anywhere. It involves an unholy mixture of data flow and control flow that doesn&#x27;t seem to appear anywhere else in PL theory.<p>Stuff kind of just works because GLSL doesn&#x27;t have unstructured control-flow (i.e., there&#x27;s no goto), and people have a mental model of what the hardware actually does and use that for the semantics.<p>But a proper study of those semantics, and how to carry it over to unstructured control-flow, or to what extent it is possible, would be awesome.
shurcooLabout 8 years ago
&gt; Potential solutions. Shader languages’ needs are not distinct enough from ordinary imperative programming languages to warrant ground-up domain-specific designs. They should should instead be implemented as extensions to general-purpose programming languages. There is a rich literature on language extensibility [27, 36, 39] that could let implementations add shader-specific functionality, such as vector operations, to ordinary languages.<p>I like this part.
评论 #14073197 未加载
评论 #14074164 未加载
评论 #14073719 未加载
评论 #14075425 未加载
评论 #14073145 未加载
anderspitmanabout 8 years ago
As someone who recently start learning to program GPUs, I enjoyed this read. I particularly find the concept of a linear algebra-aware type system compelling. I love the idea of the type system statically checking that I&#x27;m performing operation in and between correct vector spaces. Is the fact that Vulkan uses SPIR-V sufficient to support creation of languages to allow this to be implemented?
评论 #14076219 未加载
d33about 8 years ago
Flicking through the article made me wonder - would it be possible to have something like ACID tests for OpenGL?
评论 #14073125 未加载
评论 #14073741 未加载
nice_byteabout 8 years ago
I don&#x27;t think I fully understand the point about metaprogramming facilities. Sure, it would be nice to have compile-time ifs that get eliminated from the generated code if the condition isn&#x27;t met. But I don&#x27;t think this necessarily solves the problem of &quot;combinatoric explosion&quot; of different shader variants - you still have to generate a separate chunk of code for each possible combination of compile-time conditions. Unless a corresponding change is proposed at the level of shader bytecode (SPIR-V), which probably leads to opening a can of worms.
评论 #14074766 未加载
nice_byteabout 8 years ago
While I agree with the points about type safety with uniforms&#x2F;attributes, I&#x27;ve found that this class of bugs didn&#x27;t happen to me all that often in practice. The bug that happens way more often is calculations in the wrong coordinate system (or using two values in different coordinate systems in the same calculation), which the author also points out.
HugoDanielabout 8 years ago
I find it hard to test opengl. That would be my first approach to fix it: provide a good way to debug and test the compiled programs.
评论 #14073596 未加载
评论 #14074356 未加载
评论 #14073693 未加载