<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lost in the Triangles &#187; rant</title>
	<atom:link href="http://aras-p.info/blog/tags/rant/feed/" rel="self" type="application/rss+xml" />
	<link>http://aras-p.info/blog</link>
	<description>Random thoughts of a triangle pusher</description>
	<lastBuildDate>Sun, 01 Apr 2012 07:27:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Prophets and duct-tapers or: useful programmer traits</title>
		<link>http://aras-p.info/blog/2011/09/09/prophets-and-duct-tapers-or-useful-programmer-traits/</link>
		<comments>http://aras-p.info/blog/2011/09/09/prophets-and-duct-tapers-or-useful-programmer-traits/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 16:52:38 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=795</guid>
		<description><![CDATA[I liked Pierre&#8217;s The Prophet Programmer post. Go read it now. Now of course that post is a rant. It exaggerates. It puts everything into one bit grayscale colors. There&#8217;s never one person completely like this &#8220;prophet programmer&#8221; and another like the idolized &#8220;best programmer&#8230; not afraid of anything!!1&#8243;. But it does highlight at least [...]]]></description>
			<content:encoded><![CDATA[<p>I liked Pierre&#8217;s <a href="http://www.codercorner.com/blog/?p=502">The Prophet Programmer</a> post. Go read it now.</p>
<p>Now <em>of course</em> that post is a rant. It exaggerates. It puts everything into one bit grayscale colors. There&#8217;s never one person completely like this &#8220;prophet programmer&#8221; and another like the idolized &#8220;best programmer&#8230; not afraid of anything!!1&#8243;.</p>
<p>But it does highlight at least this thing: some aspects of programmer&#8217;s behavior are either useful or not.</p>
<p>Obsessing over latest hypes, &#8220;the proper ways&#8221;, following books by the letter just by itself <em>is not useful</em>. Sure, sometimes a dash of &#8220;proper ways&#8221; or recommendations is good, but the benefits of doing that are really, really tiny. Hence it&#8217;s not worth thinking/arguing much about.</p>
<p><strong>Here&#8217;s some actually useful programmer traits</strong> instead.</strong> I&#8217;m thinking about real actual people I&#8217;m working with here, even if I&#8217;m not telling names.</p>
<p>He <em>feels what needs to be done</em> to get the solution, in the big picture. Sometimes these are unusual ideas that probably no one is doing &#8211; because everyone has always been seeing the problem in the standard way. The solutions seem obvious once you see them, but require some sort of step function in thinking to get there. Zero iteration way of hooking up touchscreen device input to test the game is to play the game on PC, stream images into the device and stream inputs back. Least hassle free asset pipeline is when there is no &#8220;export/import asset&#8221; step. Or a more famous outside example, tablets <a href="http://aras-p.info/blog/wp-content/uploads/2011/09/tablets-before-and-after-ipad.jpeg">before and after</a> the iPad. You rarely, if ever, can do things like that by doing user surveys or improving on existing solutions; you need someone who can see through and find what&#8217;s the <em>actual</em> problem you want to solve. This guy is worth gold.</p>
<p>She can <em>cut things</em>. &#8220;Perfection is achieved, not when there is nothing more to add, but when there is nothing left to cut away&#8221;, quoth Saint-Exupéry. To be good at doing anything you (both you and your team) need to focus, which means cutting things. Let go of bad ideas and blind alleys. If your justification for doing it is &#8220;but we already spent so much time on it&#8221;, just don&#8217;t &#8211; it will only get worse. Cut features that aren&#8217;t quite ready by the deadlines. Remove old things that aren&#8217;t useful anymore. Doing that can and will make some people upset; it&#8217;s really, <em>really</em> hard to postpone or even completely abandon a thing that someone put a lot of effort into. But it needs to be done; and you need her on the team to make these hard decisions.</p>
<p>That other guy is <em>freaking fast</em>. And not in a sense of &#8220;types tons of code real fast and then sometimes it works, and two weeks after someone else has to clean it up&#8221;. No &#8211; he&#8217;s cranking out good, solid, tested, working code at incredible speeds. Got ten bugs; they are fixed by next day. Got a new feature to do; commits with everything implemented (and working!) are pushed in a few days. When he goes on vacation your burndown chart changes slope. How he does it? I don&#8217;t know. But by all means, keep onto him!</p>
<p>The other girl can figure out any <em>complex problem real fast</em>. Be it a tricky bug, unexpected behavior, really weird interaction with other systems &#8211; others could be spending hours, if not days, trying to figure out what&#8217;s going on. She, on the other hand, checks just a handful of things and goes &#8220;ha! the problem&#8217;s right there&#8221;. As if applying binary search to the whole problem space, except to everyone else the space seems unsorted and they don&#8217;t even know what they&#8217;re looking for!</p>
<p>This dude can keep <em>a ton of context in his head</em> while doing anything. How will this feature interact with dozens or even hundreds of other features; he&#8217;s able to think about all of them and majority of corner cases and get everything right in one go. Would take dozens of roundtrips between coding &#038; QA for someone else to get right. When estimating effort for new things, he can immediately list all the tricky work that will need to be done; whereas others would go &#8220;sounds easy&#8221; only to find out it&#8217;s a month of work.</p>
<p>She&#8217;s <em>not satisfied with the status quo</em>. No this isn&#8217;t good enough, she says; and let me show you where &#038; how spectacularly it breaks. And it does not matter if everyone else is doing it this way; here&#8217;s why putting that stuff into uniform grid isn&#8217;t good. A lot of times you need this extra bump to snap out of your own &#8220;this is good enough, no one will care&#8221; thoughts.</p>
<p>He&#8217;s doing a lot of <em>boring work to get others more productive</em>. There&#8217;s <em>a ton</em> of boring work on even the most exciting projects, and someone has to do it. He&#8217;s often the unsung hero, quietly working on infrastructure, build times, fixing annoyances in the tools, processes and workflows; all just so that others can be better at doing <em>exciting</em> things. You could call him a janitor or a plumber if you wish, but any place gets rotten and broken real fast without those people.</p>
<p>&#8230;and the list could go on. Unlike obsessing over irrelevant details, <strong>these make a difference</strong>. Makes your team run circles around others. Helps you solve <em>hard</em> problems, invent things, moves you forward at enormous velocity.</p>
<p>You need people with those traits and attitudes.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2011/09/09/prophets-and-duct-tapers-or-useful-programmer-traits/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Notes on Native Client &amp; Pepper Plugin API</title>
		<link>http://aras-p.info/blog/2011/06/02/notes-on-native-client-pepper-plugin-api/</link>
		<comments>http://aras-p.info/blog/2011/06/02/notes-on-native-client-pepper-plugin-api/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 08:24:48 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=744</guid>
		<description><![CDATA[Google&#8217;s Native Client (NaCl) is a brilliant idea. TL;DR: it allows native code to be run securely in the browser. But is it secure? &#8220;Bububut, waitaminnit! Native code is not secure by definition&#8221; you say. Turns out, that isn&#8217;t necessarily true. With a specially massaged compiler, some runtime support and careful native code validation it [...]]]></description>
			<content:encoded><![CDATA[<p>Google&#8217;s <a href="http://code.google.com/p/nativeclient/">Native Client</a> (NaCl) is a brilliant idea. <a href="http://en.wikipedia.org/wiki/Wikipedia:Too_long;_didn%27t_read">TL;DR</a>: it allows <em>native</em> code to be run <em>securely</em> in the browser.</p>
<p><strong>But is it secure?</strong></p>
<p><em>&#8220;Bububut, waitaminnit! Native code is not secure by definition&#8221;</em> you say. Turns out, that isn&#8217;t necessarily true. With a specially massaged compiler, some runtime support and careful native code validation it is possible to ensure native code, when ran in the browser, can&#8217;t cause harm to user&#8217;s machine. I suggest taking a look at the original <a href="http://src.chromium.org/viewvc/native_client/data/docs_tarball/nacl/googleclient/native_client/documentation/nacl_paper.pdf">NaCl for x86 paper</a> and more recently, how similar techniques would apply to <a href="http://www.chromium.org/nativeclient/reference/arm-overview">ARM CPUs</a>.</p>
<p><strong>But what can you do with it?</strong></p>
<p><span id="more-744"></span>So that&#8217;s great. It means it is possible to take C/C++ code, compile it with NaCl SDK (a gcc derived toolchain) and have it run in the browser. We can make a loop in C that multiplies a ton of floating point numbers, and it will run at native speed. That&#8217;s wonderful, except you can&#8217;t really do much interesting stuff with your own C code in isolation&#8230;</p>
<p>You need access to the hardware and/or OS. As game developers, we need pixels to appear on the screen. Preferably lots of them, with the help of something like a <a href="http://en.wikipedia.org/wiki/Graphics_processing_unit">GPU</a>. Audio waves to come out of the speakers. Mouse moves and keyboard presses to translate to some fancy actions. Post a high score to the internets. And so on.</p>
<p>NaCl surely can&#8217;t just allow my C code to call <a href="http://msdn.microsoft.com/en-us/library/bb219685(v=vs.85).aspx"><tt>Direct3DCreate9</tt></a> and run with it, while keeping the promise of &#8220;it&#8217;s secure&#8221;? Or a more extreme case, <tt>FILE* f = fopen("/etc/passwd", "rt");</tt>?!</p>
<p>And that&#8217;s true; NaCl does not allow you to use completely arbitrary APIs. It has it&#8217;s own set of APIs to interface with &#8220;the system&#8221;.</p>
<p><strong>Ok, how do I interface with the system?</strong></p>
<p>&#8230;and that&#8217;s where the current state of NaCl gets a bit confusing.</p>
<p>Initially Google developed an improved &#8220;browser plugin model&#8221; and called it Pepper. This Pepper thing would then take care of actually putting your code <em>into the browser</em>. Starting it up, tearing it down, controlling repaints, processing events and so on. But then apparently they realized that building on top of a decade-old Netscape plugin API (<a href="http://en.wikipedia.org/wiki/NPAPI">NPAPI</a>) isn&#8217;t going to really work, so they developed Pepper2 or PPAPI (Pepper Plugin API) which ditches NPAPI completely. To write a native client plugin, you only interface with PPAPI.</p>
<p>So some of the pages on the internets reference the &#8220;old API&#8221; (which is gone as far as I can see), and some others reference the new one. It does not help that Native Client&#8217;s own documentation are scattered around in <a href="http://www.chromium.org/nativeclient">Chromium</a>, <a href="http://code.google.com/p/nativeclient/">NaCl</a>, <a href="http://code.google.com/p/nativeclient-sdk/">NaCl SDK</a> and <a href="http://code.google.com/p/ppapi/">PPAPI</a> sites. Seriously, <em>it&#8217;s a mess</em>, with seemingly no high level, up to date &#8220;introduction&#8221; page that tells what exactly PPAPI can and can&#8217;t do. <em>Edit</em>: I&#8217;m told that the definitive entry point to NaCl right now is this page: <a href="http://code.google.com/chrome/nativeclient/"><strong>http://code.google.com/chrome/nativeclient/</strong></a> which clears up some mess.</p>
<p><strong>Here&#8217;s what I think it can do</strong></p>
<p><em>Note: At <a href="http://unity3d.com/">work</a> we have an in-progress Unity NaCl port using this PPAPI. However, I am not working on it, so my knowledge may or may not be true. Take everything with a grain of NaCl ;)</em></p>
<p>Most of things below found by poking around at <a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/">PPAPI source tree</a>, and by looking into Unity&#8217;s NaCl platform dependent bits.</p>
<p><em><strong>Graphics</strong></em></p>
<p>PPAPI provides an OpenGL ES 2.0 implementation for your 3D needs. You need to setup the context and initial surfaces via PPAPI (<tt><a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/cpp/dev/context_3d_dev.h?view=markup">ppapi/cpp/dev/context_3d_dev.h</a>, <a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/cpp/dev/surface_3d_dev.h?view=markup">ppapi/cpp/dev/surface_3d_dev.h</a></tt>) &#8211; similar to what you&#8217;d use EGL on other platforms for &#8211; and beyond that you just include <tt>GLES2/gl2.h, GLES2/gl2ext.h</tt> and call ye olde GLES2.0 functions.</p>
<p>Behind the scenes, all your GLES2.0 calls will be put into a <a href="http://src.chromium.org/viewvc/chrome/trunk/src/gpu/command_buffer/">command buffer</a> and transferred to actual &#8220;3D server&#8221; process for consuming them. Chrome splits up itself into various processes like that for security reasons &#8212; so that each process has the minimum set of privileges, and a crash or a security exploit in one of them can&#8217;t easily transfer over to other parts of the browser.</p>
<p><em><strong>Audio</strong></em></p>
<p>For audio needs, PPAPI provides a simple buffer based API in <tt><a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/cpp/audio_config.h?view=markup">ppapi/cpp/audio_config.h</a></tt> and <tt><a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/cpp/audio.h?view=markup">ppapi/cpp/audio.h</a></tt>. Your own callback will be called whenever audio buffer needs to be filled with new samples. That means you do all sound mixing yourself and just fill in the final buffer.</p>
<p><em><strong>Input</strong></em></p>
<p>Your plugin instance (subclass of <tt>pp::Instance</tt>) will get input events via HandleInputEvent virtual function override. Each event is a simple <a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/c/pp_input_event.h?view=markup"><tt>PPInputEvent</tt> struct</a> and can represent keyboard &#038; mouse. No support for gamepads or touch input so far, it seems.</p>
<p><em><strong>Other stuff</strong></em></p>
<p>Doing WWW requests is possible via <tt><a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/cpp/url_loader.h?view=markup">ppapi/cpp/url_loader.h</a></tt> and friends.</p>
<p>Timer &#038; time queries via <tt><a href="http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/cpp/core.h?view=markup">ppapi/cpp/core.h</a></tt> (e.g. <tt>pp::Module::Get()->core()->CallOnMainThread(...)</tt>).</p>
<p>And, well, a bunch of other stuff is there, like ability to rasterize blocks of text into bitmaps, pop up file selection dialogs, use the browser to decode video streams and so on. Everything &#8211; or almost everything &#8211; is there to make it possible to do games on it.</p>
<p><strong>Summary</strong></p>
<p>Like <a href="http://chadaustin.me/2011/01/in-defense-of-language-democracy/">Chad says</a>, it would be good to end <em>&#8220;thou shalt only use Javascript&#8221;</em> on the web. Javascript is a very nice language &#8211; especially considering how it came into existence &#8211; but <em>forcing</em> it on everyone is quite silly. And no matter how hard V8/JägerMonkey/Nitro folks are trying, it is very, very hard to <a href="http://chadaustin.me/2011/01/digging-into-javascript-performance/">beat performance</a> of a simple, static, compiled language (like C) that has direct access to memory and the programmer is in almost full control of both the code flow and the memory layout. Steve rightly <a href="http://twitter.com/#!/stevestreeting/status/76216985888882688">points out</a> that even if for some tasks a super-optimized Javascript engine will approach the speed of C, it will burn much more energy to do so &#8212; a very important aspect in the increasingly mobile world.</p>
<p>Native Client does give some hope that there will be a way to run native code, at native speeds, in the browser, without compromising on security. Let it happen.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2011/06/02/notes-on-native-client-pepper-plugin-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Stories of Universities</title>
		<link>http://aras-p.info/blog/2011/04/01/stories-of-universities/</link>
		<comments>http://aras-p.info/blog/2011/04/01/stories-of-universities/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 18:55:26 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=658</guid>
		<description><![CDATA[I was doing a talk and a Q&#038;A session at a local university. Unaware of the consequences, one guy asked about the usefulness of the programming courses they have in real work&#8230; Oh boy. Do you really want to go there? Now before I go ranting full steam, let me tell that there were really [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing a talk and a Q&#038;A session at a local university. Unaware of the consequences, one guy asked about the usefulness of the programming courses they have in real work&#8230;</p>
<p>Oh boy. Do you really want to go there?<br />
<span id="more-658"></span></p>
<blockquote><p>Now before I go ranting full steam, let me tell that there were really good courses and really bright teachers at my (otherwise unspectacular) university. Most of the math, physics and related fundamental sciences courses were good &#038; taught by people who know their stuff. Even some of the computer science / programming courses were good!
</p></blockquote>
<p>With that aside, let&#8217;s bet back to ranting.</p>
<p><strong>What is OOP?</strong></p>
<p>Somehow conversation drifted to the topics of code design, architecture and whatnot. I asked the audience, for example, what do they think are the benefits of object oriented programming (OOP)? The answers were the following:</p>
<ul>
<li>Mumble mumble&#8230; weeelll&#8230; something something mumble. This was the majority&#8217;s opinion.</li>
<li>OOP makes it very easy for a new guy to start at work, because everything nicely separated and he can just work on this one file without knowing anything else.</li>
<li>Without OOP there&#8217;s no way to separate things out; everything becomes a mess.</li>
<li>OOP uses classes, and they are nicer than not using classes. Because a class lets you&#8230; uhm&#8230; well I don&#8217;t know, but classes are nicer than no classes. I think it had something to do with something being in separate files. Or maybe in one file. I don&#8217;t actually know&#8230;</li>
<li><em>I forget if there was anything else really.</em></li>
</ul>
<p>Let me tell you how easy it is for a guy to start at work. You come to new place all inspired and excited. You&#8217;re being put into some unholy codebase that grew in a chaotic way over last N years and being assigned to do some random feature or fix some bugs. When you encounter anything smelly in the codebase (this happens fairly often), the answer to &#8220;WTF is this?&#8221; is most often &#8220;it came from the past, yeah, we don&#8217;t like it either&#8221; or &#8220;I dunno, this guy who left last year wrote it&#8221; or &#8220;yeah, I wrote it but it was ages ago, I don&#8217;t remember anything about it&#8230; wow! this is idiotic code indeed! just be careful, touching it might break everything&#8221;. All this is totally independent of whether the codebase used OOP or not.</p>
<p>I am exaggerating of course; the codebase doesn&#8217;t have to be that bad. But still; whether it&#8217;s good or not, or whether it&#8217;s easy for a new guy to start there is really not related to it being OOP.</p>
<p>Interesting!</p>
<p>Clearly they have no frigging clue what OOP is, besides of whatever they&#8217;ve been told by the teacher. And the teacher in turn knows about OOP based on what he read in one or two books. And the author of the books&#8230; well, we don&#8217;t know; depends on the book I guess. But this is at least a second-order disconnect from reality, if not more!</p>
<p>Why is that?</p>
<p>I guess part of the problem is teachers having no real actual work experience except by reading books. This can work for math. For a lot of programming courses&#8230; not so much. Another part is students learning in a vacuum, trying to <em>kind of</em> get what the lectures are about and pass the tests.</p>
<p>In both cases it&#8217;s totally separated from doing some real actual work and trying to apply what you&#8217;re trying to learn. Which leads to some funny things like&#8230;</p>
<p><strong>How are floating point numbers stored?</strong></p>
<p>I saw this about 11 years ago in one lecture of a C++ course. The teacher quickly explained how various types are stored in memory. He got over the integer types without trouble and started explaining floats.</p>
<blockquote><p>So there&#8217;s one bit for the sign. Then come the digits before the decimal point. Since there are 10 possible choices for each digit, you need four bits of memory for each digit. Then comes one bit for the decimal point. After the decimal point, again you have four bits per digit. Done!
</p></blockquote>
<p>ORLY? This was awesome, especially trying to imagine how to store the decimal point.</p>
<p><a href="http://aras-p.info/blog/wp-content/uploads/2011/04/pifloat.png"><img src="http://aras-p.info/blog/wp-content/uploads/2011/04/pifloat.png" alt="" title="π in floating point representation, beware!" width="342" height="51" class="alignnone size-full wp-image-661" /></a></p>
<p>See that decimal digit bit, haha! <em>You see, it&#8217;s one bit and you can&#8217;t&#8230; what do you mean you don&#8217;t get it? And not only that; this needs variable length and&#8230; really? You&#8217;re going to a party instead?</em> I wasn&#8217;t very popular.</p>
<p>Funny or not, this is not exactly telling a correct story on how floats are stored in memory on 101% of the architectures you&#8217;d ever care about.</p>
<p>I could tell a ton of other examples of little disconnects with reality, which I think are caused by not ever having to put your knowledge into practice.</p>
<p><strong>Where do we go from here?</strong></p>
<p>Now of course, the university I went to is not something that would be considered &#8220;good&#8221; by world standards. I went to several lectures by <a href="http://graphics.ucsd.edu/~henrik/">Henrik Wann Jensen</a> at DTU at that was like night and day! But how many of these not-too-good-only-passable universities are around the world? I&#8217;d imagine certainly more than one, and certainly less than the number of MITs, Stanfords et al combined.</p>
<p>As a student, I <em>somehow</em> figured I should take a lot of things with a grain of <del>salt</del> doubt. And in a lot of cases, trying to do something for real trumps lab work / tests / exams in how much you&#8217;ll be able to learn. Go make a techdemo, a small game, play around with some techniques, try to implement that clever sounding paper from siggraph and observe it burst in flames, team up with friends while doing any of the above. <a href="http://www.youtube.com/watch?v=u6ALySsPXt0">Do it</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2011/04/01/stories-of-universities/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Non-Uniform Work Distribution</title>
		<link>http://aras-p.info/blog/2011/02/16/a-non-uniform-work-distribution/</link>
		<comments>http://aras-p.info/blog/2011/02/16/a-non-uniform-work-distribution/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 15:47:57 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=630</guid>
		<description><![CDATA[Warning: a post with stupid questions and no answers whatsoever! You need to do ten thousand things for the gold master / release / ShipIt(tm) moment. And you have 40 people who do the actual work&#8230; this means each of them only has to do 10000/40=250 things, which is not that bad. Right? Meanwhile in [...]]]></description>
			<content:encoded><![CDATA[<p><em>Warning: a post with stupid questions and no answers whatsoever!</em></p>
<p>You need to do ten thousand things for the gold master / release / ShipIt(tm) moment. And you have 40 people who do the actual work&#8230; this means each of them <em>only</em> has to do 10000/40=250 things, which is not that bad. Right?</p>
<p><span id="more-630"></span>Meanwhile in the real world&#8230; it does not actually work like that. And that&#8217;s something that has been on my mind for a long time. I don&#8217;t know how much of this is truth vs. perception, or what to do about it. But here&#8217;s my feeling, simplified:</p>
<p><strong>20 percent of the people are responsible for getting 80 percent of the work done</strong></p>
<p>I am somewhat exaggerating just to keep it consistent with the <a href="http://en.wikipedia.org/wiki/Pareto_principle">Pareto principle</a>. But my feeling is that &#8220;work done&#8221; distribution is highly non uniform everywhere I worked where the team was more than a handful of people.</p>
<p>Here are some stupid statistics to illustrate my point (with graphs, and everyone loves graphs!):</p>
<p>Graph of bugs fixed per developer, over one week during the bug fixing phase. Red/yellow/green corresponds to priority 1,2,3 issues:<br />
<a href="http://aras-p.info/blog/wp-content/uploads/2011/02/graphbugs.png"><img src="http://aras-p.info/blog/wp-content/uploads/2011/02/graphbugs.png" alt="" title="Bugs fixed per developer" width="375" height="309" class="alignnone size-full wp-image-631" /></a></p>
<p>The distribution of bugs fixes is, shall we say, <em>somewhat</em> non uniform.</p>
<p>Is it a valid measure of &#8220;productivity&#8221;? Absolutely not. Some people probably haven&#8217;t been fixing bugs at all that week. Some bugs are <em>way</em> harder to fix than others. Some people could have made major part of the fix, but the finishing touches &#038; the act of actually resolving the bug was made by someone else. So yes, this statistics is absolutely flawed, but do we have anything else?</p>
<p>We could be checking version control commits.</p>
<p><a href="http://aras-p.info/blog/wp-content/uploads/2011/02/svntimeline.png"><img src="http://aras-p.info/blog/wp-content/uploads/2011/02/svntimeline-500x243.png" alt="" title="Source code commits over time period" width="500" height="243" class="alignnone size-medium wp-image-637" /></a></p>
<p>Or putting the same into &#8220;commits by developer&#8221;:</p>
<p><a href="http://aras-p.info/blog/wp-content/uploads/2011/02/svnauthor.png"><img src="http://aras-p.info/blog/wp-content/uploads/2011/02/svnauthor-500x269.png" alt="" title="Source code commits by author" width="500" height="269" class="alignnone size-medium wp-image-638" /></a></p>
<p>Of course this is even easier to game than resolving bugs. <em>&#8220;Moving buttons to the left&#8221;, &#8220;Whoops, that was wrong, moving them to the right again&#8221;</em> anyone? And people will be trolling statistics just because they can.<br />
<a href="http://aras-p.info/blog/wp-content/uploads/2011/02/svntroll.png"><img src="http://aras-p.info/blog/wp-content/uploads/2011/02/svntroll.png" alt="" title="svn trolling!" width="330" height="108" class="alignnone size-full wp-image-633" /></a></p>
<p>However, there is still this highly subjective &#8220;feeling&#8221; that some folks are way, <em>way</em> faster than others. And not in just &#8220;can do some mess real fast&#8221; way, but in the &#8220;gets actual work done, and done well&#8221; way.</p>
<p>Or is it just my experience? How is it in your company? What can be done about it? Should something be done about it? I don&#8217;t know the answers&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2011/02/16/a-non-uniform-work-distribution/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Improving C#/Mono for Games</title>
		<link>http://aras-p.info/blog/2009/11/14/improving-cmono-for-games/</link>
		<comments>http://aras-p.info/blog/2009/11/14/improving-cmono-for-games/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 19:07:24 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=442</guid>
		<description><![CDATA[A tweet by Michael Hutchinson on C#/Mono usage in games caused me to do a couple of short replies (one, two). But then I started thinking a bit more, and here&#8217;s a longer post on what is needed for C# (and more specifically Mono) to be used in games more. In Unity we use Mono [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://twitter.com/mjhutchinson/status/5643232459">tweet by Michael Hutchinson</a> on C#/Mono usage in games caused me to do a couple of short replies (<a href="http://twitter.com/aras_p/status/5643338294">one</a>, <a href="http://twitter.com/aras_p/status/5643361286">two</a>). But then I started thinking a bit more, and here&#8217;s a longer post on what is needed for C# (and more specifically Mono) to be used in games more.</p>
<p>In <a href="http://unity3d.com/">Unity</a> we use Mono to do game code (well, Unity users are doing that, not us). Overall it&#8217;s great; it has tons of advantages, loads of awesome and a flying ninja here and there. But no technology is perfect, right?</p>
<p><strong>Edit</strong>: Miguel rightly points out in the comments that Mono team is solving or has already solved some of these issues already. In some areas they are moving so fast that we at Unity can&#8217;t keep up!</p>
<p><span id="more-442"></span><br />
<strong>#1: Garbage Collector</strong></p>
<p>Most game developers do not like Garbage Collection (GC) very much. Typically, the more limited/hardcore their target platform is, the more they dislike GC. The reason? Most GC implementations cause rather unpredictable spikes.</p>
<p>Here&#8217;s a run of something recorded in the <em>(awesome)</em> Unity 2.6 profiler. Horizontal axis is time, vertical is CPU time spent in that frame:<br />
<a href="http://aras-p.info/blog/wp-content/uploads/2009/11/gcspikes.png"><img src="http://aras-p.info/blog/wp-content/uploads/2009/11/gcspikes.png" alt="Garbage collection spikes" title="Garbage collection spikes" width="563" height="187" class="alignnone size-full wp-image-441" /></a></p>
<p>At the bottom you see dark red thingies appearing once in a while. This is garbage collector kicking in, because some script code is allocating some memory at runtime.</p>
<p>Now of course, it <em>is possible</em> to write your script code so that it does no allocations (or almost no allocations). Preallocate your objects into pools, manually invoke GC when there&#8217;s a game situation when a small hickup won&#8217;t affect gameplay, etc. In fact, a lot of iPhone games made with Unity do that.</p>
<p>But that kind of side steps the whole advantage of &#8220;garbage collector almost frees you from doing memory management&#8221;. If you&#8217;re not allocating anything anyway, GC could just as well not be there!</p>
<p>A little side story. Me and Unity&#8217;s iPhone tech lead ReJ tried to explain what GC is to a non-programmer. Here&#8217;s what we came up with:</p>
<blockquote><p>
Garbage Collection is this cleaning service for lazy people. They can just leave any garbage on the floor in their house, and once in a while a garbage guy comes, collects all the garbage and takes it outside. Now, there are some intricacies in the service.</p>
<p>First, you never know when the garbage guy will come. You might be taking a shower, doing a meditation or having some &#8220;sexy time&#8221; &#8211; and it&#8217;s in the service agreement that when a garbage guy comes, you have to let him in to do his work.</p>
<p>Second thing is, the garbage guy is usually some homeless drunkard. He smells so bad that when he comes, you have to stop whatever you were doing, go outside and wait until he&#8217;s done with the garbage collection. Even your neighbors, who might be doing something entirely else in parallel, actually have to stop and idle while garbage is being collected in your house!</p>
<p>There are variations of this GC service. One variation is called &#8220;moving GC&#8221;, where the garbage guy also rearranges your furniture while collecting the garbage &#8211; he moves it all into one side of your house. This is so that you can buy a bigger piece of furniture, or throw a huge piece of garbage &#8211; and there will be enough unused space for you to do that! Of course this way GC process takes somewhat longer, but hey, you get all your stuff nicely packed into one corner.</p>
<p>Can&#8217;t you see that this service is the greatest idea of all time?
</p></blockquote>
<p>This is quite a harsh attitude towards GC, and of course it&#8217;s exaggerated. But there is some truth to it. So how could GC be fixed?</p>
<p><em>GC fix #1: more control</em></p>
<p>More explicit control on when &#038; how long GC runs. I want to say to the garbage guy, &#8220;come everyday at 4PM and do your work for 20 minutes&#8221;. In the game, I&#8217;d want to call GC with an upper time limit, say 1 millisecond for each call, and I would be calling that 30 times per second.</p>
<p><em>GC fix #2: sometimes I want to clean garbage myself</em></p>
<p>Inefficiencies and unpredictability of GC cause people to do even more work than a normal, oldskool memory allocation. Why not provide an option to deal with deallocations manually? I.e. a keyword <code>reallynew</code> could allocate an object that is not part of garbage collected world. It would function as a regular .NET object, just it would be user&#8217;s responsibility to <code>reallydelete</code> it.</p>
<p>Mono is already extending .NET (see <a href="http://tirania.org/blog/archive/2008/Nov-03.html">SIMD</a> and <a href="http://tirania.org/blog/archive/2009/Apr-09.html">continuations</a>). Maybe it makes sense to add some way to bypass garbage collector?</p>
<p><strong>#2: Distribution Size</strong></p>
<p>Using C#/.NET in a game requires having .NET runtime. None of the interesting platforms are guaranteed to have it, and even on Windows you can&#8217;t count on it being present. Mono is great here in a sense that it can be used on many more platforms than Microsoft&#8217;s own .NET. It&#8217;s also great on distribution size, but only if you compare it to Microsoft&#8217;s .NET.</p>
<p>In Unity Web Player, we package Mono DLL + mscorlib assembly into something like 1.5 megabytes (after LZMA compression). Which is great compared to 20+ megabytes of .NET runtime, but not that great it you compare it so, say, <a href="http://www.lua.org/">Lua</a> runtime (which is less than 100 kilobytes).</p>
<p>On some platforms (iPhone, Xbox 360, PS3, &#8230;) it&#8217;s not possible to generate code at runtime, so Mono&#8217;s JIT does not work. All code that&#8217;s written in C# has to be precompiled to machine code ahead of time (AOT compilation). This is not a problem per se, but because .NET framework was never designed with small size and few dependencies in mind, <em>doing anything</em> will ultimately pull in a lot of code.</p>
<p>We joke that doing anything in C# will result in an XML parser being included <em>somewhere</em>. This is not that far from the truth; e.g. calling <code>float.ToString()</code> will pull in whole internationalization system, which <em>probably</em> somewhere needs to read some global XML configuration file to figure out whether daylight savings time is active when Eastern European Brazilian Chinese calendar is used.</p>
<p><em>Size fix #1: custom core .NET libraries?</em></p>
<p>For game uses, most of &#8220;fat&#8221; stuff in .NET runtime is not really needed. <code>float.ToString()</code> could just always use period as a decimal separator. Core libraries could consist just of essential collections (list, array, hash table) and maybe a String class, with just essential methods. Maybe it&#8217;s worth sacrificing some of the generality of .NET if that could shave off a couple of megabytes from your iPhone game size?</p>
<p>Of course this is very much doable; &#8220;all that is needed&#8221; &#8482; is writing custom mscorlib+friends, and telling C# compiler to not ever reference <em>any</em> of the &#8220;real&#8221; libraries.</p>
<p><em>Size fix #2: make Mono runtime smaller</em></p>
<p>Uncompressed Mono DLL in our Windows build is 1.5 megabytes. We have turned off all the easy stuff (profiler, debugger, logging, COM, AOT etc.). But <em>probably</em> some more could be stripped away. Do our games really need multiple AppDomains? Some fancy marshalling? I don&#8217;t know, it just <em>feels</em> that 1.5MB is a lot.</p>
<p><strong>#3: Porting to New Platforms</strong></p>
<p>You know this classic: &#8220;There&#8217;s no portable code. There&#8217;s only code that&#8217;s been ported.&#8221;</p>
<p>Most existing gaming platforms are quite weird. Most upcoming smartphone platforms also are quite weird, each in their own interesting way. Porting a large project like Mono is not easy, especially since parts of it (JIT or AOT engine) highly depend on the platform.</p>
<p>For Unity iPhone, unexpected discovery that it&#8217;s not possible to JIT on iPhone made the initial release be delayed by something like 4 months. It did not help that in early iPhone SDK builds JIT was actually possible, and Apple decided to disable runtime generated code later. Making Mono actually work there required significant work both from Mono team and from Unity. We still have one guy working almost exclusively on Mono+iPhone issues!</p>
<p>Of course, <em>maybe</em> all the Mono iPhone work made porting to new platforms easier as a byproduct. But so far we don&#8217;t have Mono ported to any other platform, up to production quality. So judging from experience, we now always assume Mono port will be a pain, just because &#8220;some nasty surprises will come up&#8221; (and they always do).</p>
<p><strong>#4: Small Stuff</strong></p>
<p>There is a ton of small bits where extending .NET would benefit gaming scenarios. For example:</p>
<p>Suppose there is some array on the native engine side; for example vertex positions in a mesh (3xFloat for each vertex). Is it possible to make that piece of memory be represented as a native struct array for .NET side? So that it would not involve any extra memory copies, but N vertices somewhere in memory would look just like Vector3[N] for C#?</p>
<p>On a similar note, having &#8220;strided arrays&#8221; would be useful. For example, mesh data is often interleaved, so for each vertex there is a position, normal, UVs and so on. It would be cool if in C# position array would still look like Vector3[N], but internally the distance between each element would be larger than 12 bytes required for Vector3.</p>
<p><strong>Where do we go from here?</strong></p>
<p>The above are just random ideas, and I&#8217;m not complaining about Mono. It is great! It&#8217;s just not perfect. Mono being open source is a very good thing, which means pretty much any interested party can improve it as needed. So rock on.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/11/14/improving-cmono-for-games/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Shaders must die</title>
		<link>http://aras-p.info/blog/2009/05/05/shaders-must-die/</link>
		<comments>http://aras-p.info/blog/2009/05/05/shaders-must-die/#comments</comments>
		<pubDate>Tue, 05 May 2009 12:59:48 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[gpu]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[rendering]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=324</guid>
		<description><![CDATA[It came in as a simple thought, and now I can&#8217;t shake it off. So I say: Ok, now that the controversial bits are done, let&#8217;s continue. Most of this can be (and probably is) wrong, and I haven&#8217;t given it enough thought yet. But here&#8217;s my thinking about shaders of &#8220;regular scene objects&#8221;. All [...]]]></description>
			<content:encoded><![CDATA[<p>It came in as a simple <a href="http://twitter.com/aras_p/status/1651784380">thought</a>, and now I can&#8217;t shake it off. So I say:<br />
<a href="http://aras-p.info/blog/wp-content/uploads/2009/05/shadersmustdie.jpg"><img src="http://aras-p.info/blog/wp-content/uploads/2009/05/shadersmustdie.jpg" alt="Shaders Must Die" title="Shaders Must Die" width="550" height="550" class="alignnone size-full wp-image-325" /></a></p>
<p>Ok, now that the controversial bits are done, let&#8217;s continue.</p>
<p><span id="more-324"></span><br />
Most of this can be (and probably is) wrong, and I haven&#8217;t given it enough thought yet. But here&#8217;s my thinking about shaders of &#8220;regular scene objects&#8221;. All of below is about things that need to interact with lighting; I&#8217;m not talking about shaders for postprocessing, one-off uses, special effects, GPGPU or kitchen sinks.</p>
<p><strong>Operating on vertex/pixel shader level is a wrong abstraction level</strong></p>
<p>Instead, it should be separated out into &#8220;<em>surface shader</em>&#8221; (albedo, normal, specularity, &#8230;), &#8220;<em>lighting model</em>&#8221; (Lambertian, Blinn Phong, &#8230;) and &#8220;<em>light shader</em>&#8221; (attenuation, cookies, shadows).</p>
<ul>
<li>Probably 90% of the cases would only touch the surface shader (mostly mix textures/colors in various ways), and choose from some precooked lighting models.</li>
<li>9% of the cases would tweak the lighting model. Most of the things would settle for &#8220;standard&#8221; (Blinn-Phong or similar), with some stuff using skin or anisotropic or &#8230;</li>
<li>The &#8220;light shader&#8221; only needs to be touched once in a blue moon by ninjas. Once the shadowing and attenuation systems are implemented, there&#8217;s almost no reason for shader authors to see all the dirty bits.</li>
</ul>
<p>Yes, current hardware operates on vertex/geometry/pixel shaders, which is a logical thing to do for hardware. After all, these are the primitives it works on when rendering. But those primitives are <em>not</em> the things you work on when authoring how a surface should look or how it should react to a light.</p>
<p><strong>Simple code; no redundant info; sensible defaults</strong></p>
<p>In the ideal world, here&#8217;s a simple surface shader (the syntax is deliberately stupid):</p>
<blockquote><p>
Haz Texture;<br />
Albedo = sample Texture;
</p></blockquote>
<p>Or with bump mapping added:</p>
<blockquote><p>
Haz Texture;<br />
Haz NormalMap;<br />
Albedo = sample Texture;<br />
Normal = sample_normal NormalMap;
</p></blockquote>
<p>And this should be <em>all</em> the info you have to provide. This would choose the lighting model based on used things (in this case, Lambertian). It would <em>somehow</em> just work with all kinds of lights, shadows, ambient occlusion and whatnot.</p>
<p>Compare to how much has to be written to implement a simple surface in your current shader technology, so that it would work &#8220;with everything&#8221;.</p>
<p>From the above shader, proper hardware shaders can be generated for DX9, DX11, DX1337, OpenGL, next-gen and next-next-gen consoles, mobile platforms with capable hardware, etc.</p>
<p>It can be used in accumulative forward rendering, forward rendering with multiple lights per pass, hybrid (light pre-pass / prelight) rendering, deferred rendering etc. Heck, even for a raytracer if you have one at hand.</p>
<p>I want!</p>
<p>Now of course, it won&#8217;t be as nice as more complex materials have to be expressed. Some might not even be possible. But shader text complexity should grow with material complexity; and all information that is redundant, implied, inferred or useless should be eliminated. <em>There&#8217;s no good reason to stick to conventions and limits of current hardware just because it operates like that</em>.</p>
<p>Shaders must die!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/05/05/shaders-must-die/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Another Vista review (after 6 months of usage)</title>
		<link>http://aras-p.info/blog/2009/03/18/another-vista-review-after-6-months-of-usage/</link>
		<comments>http://aras-p.info/blog/2009/03/18/another-vista-review-after-6-months-of-usage/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 12:16:37 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=294</guid>
		<description><![CDATA[Ok, I don&#8217;t exactly like Windows Vista. But I just spent 6 months using Vista as my primary OS at work&#8230; because everyone else was using XP, and someone had to make sure everything works on Vista as well. So it was me. In summary, Vista is not that bad. Once you get used to [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I <a href="http://aras-p.info/blog/2008/06/03/the-problem-with-vista/">don&#8217;t exactly like Windows Vista</a>. But I just spent 6 months using Vista as my primary OS at work&#8230; because everyone else was using XP, and <em>someone</em> had to make sure everything works on Vista as well. So it was me.</p>
<p>In summary, Vista is not <em>that bad</em>.</p>
<p>Once you get used to changes in Explorer, different skin and so on &#8211; it&#8217;s actually usable. I think they have made some real improvements in the underlying technology, too bad they managed to &#8220;compensate&#8221; for all of that by inconsistencies and lack of polish in user interface.</p>
<p>At this point it&#8217;s minor quirks in UI that annoy me, but apart from that, Vista is okay. Look:</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-iconoverlay.png" alt="Icon overlay blending" title="Icon overlay blending" width="144" height="152" class="alignnone size-full wp-image-295" /><br />
Who implemented blending of icon overlays and do they still have a job? No sir, that shield icon is <em>not</em> properly blended here!</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-burn.png" alt="Burn icon" title="Burn icon" width="323" height="132" class="alignnone size-full wp-image-296" /><br />
Who thought it&#8217;s a good idea to make the Burn icon bright red? In 6 months, I <em>never</em> used it. Why is it the brightest thing in the whole Explorer window?</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-upfolder.png" alt="Up one folder" title="Up one folder" width="366" height="143" class="alignnone size-full wp-image-297" /><br />
Try going one folder up without resorting to this drop down menu. Utilities is the <em>current</em> folder here. <del datetime="2009-03-18T12:52:27+00:00">And no, there&#8217;s no keyboard shortcut for &#8220;go up&#8221; either (there was in XP, which was perfect)</del>.</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-shutdown.png" alt="Shutdown awesome" title="Shutdown awesome" width="283" height="158" class="alignnone size-full wp-image-298" /><br />
And of course, the awesome shutdown menu. The two buttons &#8211; <em>never</em> used them. What I always use is &#8220;Shut Down&#8221; from the menu. And let&#8217;s not even talk about all the choices in the menu (no, more choices is not always better).</p>
<p>So yeah. It&#8217;s not stellar, it has tons of small annoyances (and some large ones &#8211; try developing web plugins with UAC on&#8230;), but it&#8217;s usable. I might have gotten used to it by now, actually.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/03/18/another-vista-review-after-6-months-of-usage/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How view on C++ changes over time</title>
		<link>http://aras-p.info/blog/2009/03/01/how-view-on-c-changes-over-time/</link>
		<comments>http://aras-p.info/blog/2009/03/01/how-view-on-c-changes-over-time/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 17:23:40 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=287</guid>
		<description><![CDATA[It&#8217;s funny how one&#8217;s view on things change over time. Back in 2002, I wrote something that would be roughly translated like &#8220;C++ amazes me more and more&#8221;. In a positive sense! And I was talking about what is Boost.Spirit now. A reply on local game development forums I wrote today (again, rough translation): &#8220;C++ [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s funny how one&#8217;s view on things change over time.</p>
<p>Back in 2002, I <a href="http://aras-p.info/relyzai00.html">wrote</a> something that would be roughly translated like &#8220;C++ amazes me more and more&#8221;. In a positive sense! And I was talking about what is <a href="http://spirit.sourceforge.net/">Boost.Spirit</a> now.</p>
<p>A <a href="http://www.gamedev.lt/viewtopic.php?p=19644#p19644">reply</a> on local game development forums I wrote today (again, rough translation): &#8220;C++ is very hard and quite a horrible language, maybe you should not use it unless there are no alternatives&#8221;.</p>
<p>That&#8217;s quite a change in attitude we have here!</p>
<p>I feel like much of C++ horrors are a consequence of &#8220;it just somehow happened&#8221; (the whole template metaprogramming thing) or as a backwards compatibility with C requirement. Or maybe not, but I do agree with what <a href="https://mollyrocket.com/forums/viewtopic.php?p=1955#1955">ryg says here</a>. Let&#8217;s play the internet memes:<br />
<img src="http://aras-p.info/blog/wp-content/uploads/2009/03/cppaccident.jpg" alt="C++ Accident" title="cppaccident" width="513" height="437" class="alignnone size-full wp-image-291" /></p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/03/01/how-view-on-c-changes-over-time/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Achievement of the week: MakeVistaDWMHappyDance</title>
		<link>http://aras-p.info/blog/2008/12/11/achievement-of-the-week-makevistadwmhappydance/</link>
		<comments>http://aras-p.info/blog/2008/12/11/achievement-of-the-week-makevistadwmhappydance/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 16:16:05 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=247</guid>
		<description><![CDATA[This was the function that I added: void GUIView::MakeVistaDWMHappyDance() { // Looks like Vista has some bug in DWM. Whenever we maximize or dock // a view, we must do something magic, otherwise // white stuff appears in place of the view. // See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4208117&#038;SiteID=1 bool earlierThanVista = systeminfo::GetOperatingSystemNumeric() &#60; 600; if( earlierThanVista ) return; [...]]]></description>
			<content:encoded><![CDATA[<p>This was the function that I added:</p>
<blockquote><pre>void GUIView::<strong>MakeVistaDWMHappyDance</strong>()
{
    // Looks like Vista has some bug in DWM. Whenever we maximize or dock
    // a view, we must do something magic, otherwise
    // white stuff appears in place of the view.
    // See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4208117&#038;SiteID=1

    bool earlierThanVista = systeminfo::GetOperatingSystemNumeric() &lt; 600;
    if( earlierThanVista )
        return;

    // What seems to work is drawing one pixel via GDI.
    // We draw it at (1,1) with usual background color.
    int grayColor = 0.61f * 255.0f;
    PAINTSTRUCT ps;
    BeginPaint(m_View, &#038;ps);
    SetPixel(ps.hdc, 1, 1, RGB(grayColor,grayColor,grayColor));
    EndPaint(m_View, &#038;ps);
}</pre>
</blockquote>
<p>I know. Reading from screen when Aero is on is slow, bad and wrong. But then, what do you do? It&#8217;s better than users staring an all-white window just because Vista decided to draw it white, no matter what you think you&#8217;re drawing into it.</p>
<p>&#8230;still, <code>MakeVistaDWMHappyDance</code> is not nearly as cool as </p>
<blockquote><p>internal interface ICanHazCustomMenu { &#8230; }</p></blockquote>
<p> that Nicholas added a while ago.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/12/11/achievement-of-the-week-makevistadwmhappydance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cool tech vs. boring details</title>
		<link>http://aras-p.info/blog/2008/11/22/cool-tech-vs-boring-details/</link>
		<comments>http://aras-p.info/blog/2008/11/22/cool-tech-vs-boring-details/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 19:24:37 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=243</guid>
		<description><![CDATA[Some of the stuff I&#8217;ve been working on last week: Fixed import progress bar for movies with no audio Fixed first context menu click not working on Windows Eye dropper backend on Windows Export Package actually works on Windows Compare Binary works on Windows Add checkbox to project wizard to always open it on startup [...]]]></description>
			<content:encoded><![CDATA[<p>Some of the stuff I&#8217;ve been working on last week:</p>
<ul>
<li>Fixed import progress bar for movies with no audio</li>
<li>Fixed first context menu click not working on Windows</li>
<li>Eye dropper backend on Windows</li>
<li>Export Package actually works on Windows</li>
<li>Compare Binary works on Windows</li>
<li>Add checkbox to project wizard to always open it on startup</li>
<li>F1 in bundled text editor goes to scripting docs for current word</li>
<li>Fixed q/w/e/r keys in password fields and text areas toggling active Tool on Windows</li>
<li>Fixed panes not repainting on Windows after some change is done via context menu on them</li>
<li>&#8230;and so on.</li>
</ul>
<p><em>Boring tiny little details.</em></p>
<p>This probably best summarizes where lion&#8217;s share of time goes when developing anything. I&#8217;m not working on some cool spherical harmonics lightmap compression. Or on cunning ways to encode shadow map information for better filtering. Or on using CUDA to compute something interesting.</p>
<p>In other words, I&#8217;m not working on cool technology. Instead I&#8217;m adding missing menu items. Fixing obscure corner cases. Fighting inconsistencies in operating system APIs. Spotting misplaced pixels. Adding missing keyboard shortcuts.</p>
<p><em>Nothing interesting to blog about!</em></p>
<p>But still, methinks the difference between software that is merely &#8220;good&#8221; and software that is &#8220;great&#8221; is in the details. And <em>only</em> in the details.</p>
<p>I&#8217;ll just take care of tons of more details. Maybe it will result in something good.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/11/22/cool-tech-vs-boring-details/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Crunchtime!</title>
		<link>http://aras-p.info/blog/2008/11/10/crunchtime/</link>
		<comments>http://aras-p.info/blog/2008/11/10/crunchtime/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 13:09:14 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=239</guid>
		<description><![CDATA[A few weeks ago it was all calm in the source control. Now it&#8217;s crunchtime! I&#8217;m the master of svn deception. I do tons of useless commits just so that the stats look good. Yeah! &#8230;ok, back to work.]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://aras-p.info/blog/2008/10/29/unite-2008/">few weeks ago</a> it was all calm in the source control. Now it&#8217;s crunchtime!</p>
<p><a href="http://aras-p.info/blog/wp-content/uploads/2008/11/crunch.png"><img src="http://aras-p.info/blog/wp-content/uploads/2008/11/crunch.png" alt="" title="Crunchtime!" class="alignnone size-full wp-image-240" /></a></p>
<p>I&#8217;m the master of svn deception. I do tons of useless commits just so that the stats look good. Yeah!</p>
<p>&#8230;ok, back to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/11/10/crunchtime/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The awesome support we do</title>
		<link>http://aras-p.info/blog/2008/10/30/the-awesome-support-we-do/</link>
		<comments>http://aras-p.info/blog/2008/10/30/the-awesome-support-we-do/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 07:00:47 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=235</guid>
		<description><![CDATA[Yesterday&#8217;s experience catching up with Unity forums, as I remember it: Take a quick look at zillions of new posts. Answer about five questions with &#8220;what&#8217;s the value of your camera&#8217;s near plane?&#8221;. There should be some way to automate all of this. For every 20th question, reply with &#8220;increase your near plane!&#8221;, or something.]]></description>
			<content:encoded><![CDATA[<p>Yesterday&#8217;s experience catching up with Unity forums, as I remember it:</p>
<p>Take a quick look at zillions of new posts.</p>
<p>Answer about five questions with &#8220;what&#8217;s the value of your camera&#8217;s near plane?&#8221;.</p>
<p>There should be some way to automate all of this. For every 20th question, reply with &#8220;increase your near plane!&#8221;, or something.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/10/30/the-awesome-support-we-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implicit to-pointer operators must die!</title>
		<link>http://aras-p.info/blog/2008/10/09/implicit-to-pointer-operators-must-die/</link>
		<comments>http://aras-p.info/blog/2008/10/09/implicit-to-pointer-operators-must-die/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 13:15:26 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=223</guid>
		<description><![CDATA[For the sake of the nation, this operator must die! Seriously. Suppose there is some class, let&#8217;s say ColorRGBAf. That has four floats inside. Now, someone at some point decided to add this operator to it: operator float* () { /**/ } operator const float* () const { /**/ } Probably because it&#8217;s easier to [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>For the sake of the nation,<br />
this operator must die!</p></blockquote>
<p>Seriously. Suppose there is some class, let&#8217;s say <code>ColorRGBAf</code>. That has four floats inside. Now, someone at some point decided to add this operator to it:</p>
<blockquote><p>operator float* () { /**/ }<br />
operator const float* () const { /**/ }</p></blockquote>
<p>Probably because it&#8217;s easier to pass color to OpenGL this way, or something like that.</p>
<p>This is evil. Like, really <strong>evil</strong>. Especially if that class did not have comparison operators defined, and some totally unrelated code four years later does:</p>
<blockquote><p>if (color != oldColor) { /* &#8230; */ }</p></blockquote>
<p>Ouch! Sounds like someone will spend four hours debugging something that looks like an event routing issue that <em>only</em> happens on Windows and <em>only</em> with optimizations on <em>(yes, I just did that&#8230;)</em>.</p>
<p>What happens here? The compiler takes pointers to two colors and compares <em>the pointers</em>. If for some reason both colors are temporary objects, then it can even happen that <em>both</em> get folded into the same variable/register/whatnot. The pointers are the same. Ouch!</p>
<p>Implicit &#8220;nice&#8221; operators are just disguised evil. Remove that operator, add something like <code>GetPointer()</code> to class if someone really wants to use that, and better even make the comparison operators private and without implementations. Yes. Much better.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/10/09/implicit-to-pointer-operators-must-die/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OpenGL 3: a big step in no direction at all?</title>
		<link>http://aras-p.info/blog/2008/08/20/opengl-3-a-big-step-in-no-direction-at-all/</link>
		<comments>http://aras-p.info/blog/2008/08/20/opengl-3-a-big-step-in-no-direction-at-all/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 09:28:03 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=195</guid>
		<description><![CDATA[Well, the post title pretty much summarizes my take on it, doesn&#8217;t it? I guess I could just stop typing now&#8230; but I won&#8217;t! So after some promises, delays and a period of deadly silence, OpenGL 3.0 was released. Response to it was &#8220;interesting&#8220;, to say at least. Some part of that response is related [...]]]></description>
			<content:encoded><![CDATA[<p>Well, the post title pretty much summarizes my take on it, doesn&#8217;t it? I guess I could just stop typing now&#8230; but I won&#8217;t!</p>
<p>So after some promises, delays and a period of deadly silence, OpenGL 3.0 was <a href="http://www.khronos.org/news/press/releases/khronos_releases_opengl_30_specifications_to_support_latest_generations_of/">released</a>.</p>
<p>Response to it was &#8220;<a href="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&#038;Number=243193">interesting</a>&#8220;, to say at least. Some part of that response is related to seriously mishandled communication on Khronos part. Some part is because GL 3.0 is not what it was promised to be. Let&#8217;s just ignore the communication issue, it does not affect OpenGL <em>itself</em> in a direct way (it affects the developer community though).</p>
<p><em>By the way, I borrowed part of the post title from a <a href="http://fireuser.com/blog/opengl_30_a_big_step_in_the_right_direction/">blog post</a> linked from opengl.org. In general, I do not agree with that blog post, but it&#8217;s a valid point of view. Unlike some other <a href="http://zerias.blogspot.com/2008/08/why-fud-against-opengl-30.html">blog posts</a> linked from opengl.org that are just pure garbage&#8230;<br />
</em></p>
<p>I am not sure what are the goals of OpenGL at this point. OpenGL&#8217;s current position, as far as games are concerned, seems to be roughly this:</p>
<blockquote><p>Be the graphics API on various platforms where no alternatives are available.</p></blockquote>
<p>Why? Because Windows has got D3D, which is far more stable, comes with useful tools, more often updated and actually works for variety of users (I&#8217;ll get to this point in a second). Mobile platforms have OpenGL ES, which is decent. All consoles have their own APIs (some of them similar to D3D, <em>none</em> of them similar to GL). So that leaves OpenGL as the choice on OS X, Linux and such. Not because it&#8217;s better. Because it&#8217;s the only choice.</p>
<p><em>&#8220;Oh, but look, <a href="http://www.idsoftware.com/">id</a> uses OpenGL! Two other games use OpenGL as well!&#8221;</em> Well, good for them. But they are in a different league than &#8220;the rest of us&#8221;. For <em>some games</em>, driver writers will do whatever it takes to get those games running correct &#038; fast. Surprise surprise, id games fall into this category. For the rest of us &#8211; no such luxury. Hey, try talking to your friendly IHV, the most likely answer is <em>&#8220;yeah, but are really busy with some high profile games right now, ping us back in two months&#8221;</em>. After two months, repeat.</p>
<p>So the rest comes from somone who is <em>not</em> working on the high-profile games that IHVs specially tune drivers to.</p>
<p>If OpenGL&#8217;s goals are to stay in this current position, then GL 3.0 is okay. It adds some new features, brings some extensions into core, hey, it even says &#8220;it&#8217;s quite likely that maybe perhaps someday some of the old cruft in the API will be removed, if we feel like it&#8221;. No problem with that.</p>
<p>However, OpenGL is advertised as something different, as if it wants to:</p>
<blockquote><p>Be <strong>the</strong> graphics API on <strong>various platforms</strong>.</p></blockquote>
<p>Which is quite different from it&#8217;s current position. I&#8217;m not sure if that&#8217;s the goal of OpenGL. Myself, I don&#8217;t care about the mythical cross-platform API that would <em>actually work</em> on those different platforms. API is a tool to do stuff; if different platforms have different APIs &#8211; no problem with that.</p>
<p>However, if OpenGL <em>wants</em> to achieve this advertised goal, it has to do several things. First and foremost:</p>
<p><strong>Actually work</strong></p>
<p>Stable drivers and runtime. In it&#8217;s current state, GL is too complex to implement good quality drivers/runtime. Complexity can be reduced in several ways:</p>
<ul>
<li>Cleanup the API. This was what GL 3.0 was supposed to be. Actual 3.0 did not do any of that, instead it just postponed the cleanup &#8220;until we feel like it&#8221;.</li>
<li>Share some of the hard work. Why does everyone and their dog have to write GLSL preprocessor, lexer, parser and basic optimizer themselves? Define precompiled shader format, write frontend once, make it open. This would also be actually useful to reduce load times.</li>
</ul>
<p>GL 3.0 could have done both of the above, instead it did none. It could have cleaned up the API, and provide one platform independent GL 1.x/2.x library that calls into actual 3.0 runtime. All the fixed function, immediate mode, display lists, whatever would be in one nice library. Even existing apps could continue to function transparently this way (with the benefit of actually simpler = more stable drivers).</p>
<p><strong>Support platforms/hardware/features user needs</strong></p>
<p>This is of course dependent on the user in question. For someone like <a href="http://unity3d.com/">us</a>, we still have to support 10 year old hardware.</p>
<p>D3D9 does a fine job for that (provided you have drivers installed, and DX9 runtime installed &#8211; which comes included in XP SP2 and upwards). OpenGL 2.1 and earlier would do a fine job for that, provided it would &#8220;actually work&#8221; (see above).</p>
<p>If GL 3.0 would be as was originally promised &#8211; almost new API, shader model 2.0+ hardware, it would be sort of fine. In our case, that would mean writing and supporting two renderers &#8211; &#8220;old GL&#8221; and &#8220;new GL&#8221;, where old one would be used on old hardware or old platforms where &#8220;new GL&#8221; is not available. If the new runtime were much leaner, much more stable and generally nicer, this would not be a big problem.</p>
<p>With actual GL 3.0, in theory one does not have to write two renderers. Minimum hardware level for GL 3.0 is shader model 4+ though. So to support both old hardware/platforms and new hardware/platforms, quite a lot of duplication has to be done. Especially if you intend to go towards proposed &#8220;future GL path&#8221;, i.e. start dropping deprecated functionality from the codebase. At which point you&#8217;ll probably write two separate renderers already. So we&#8217;re back to where original GL 3.0 would have been, just without any extra niceness/stability/leanness right now.</p>
<p>Oh, and look at <a href="http://www.khronos.org/library/detail/2008_siggraph_opengl_bof_slides/">vendor announcements</a> from 2008 OpenGL BOF. NVIDIA: we have almost full drivers now. AMD: we&#8217;re committed to having drivers. Intel: look for GL 3.0 on future platforms. In other words, looks like current Intel&#8217;s cards won&#8217;t ever have GL 3.0 drivers. And in our target market, Intel has the majority of cards.</p>
<p>That sounds very much like &#8220;just ignore whole GL 3.0 thing&#8221; plan to me.</p>
<p><strong>Be nice</strong></p>
<p>This is a point of far lesser importance than &#8220;actually work&#8221; and &#8220;support what is needed&#8221; ones. Having good tools (PIX, &#8230;), documentation, code examples etc. is nice. But not much more; being nicest API in the world does not do much if it does not actually work or does not support what you need. Even in this area, actual GL 3.0 is <em>not</em> nice &#8211; it&#8217;s full of redundancies and crap that goes 15 years back in history.</p>
<p><strong>Summing it up</strong></p>
<p>To me, GL 3.0 looks like a blunder. Instead of fixing the core problems, they just postponed that. Well, <em>Keep up the good work!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/08/20/opengl-3-a-big-step-in-no-direction-at-all/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Invincible shutdown buttons!</title>
		<link>http://aras-p.info/blog/2008/07/09/invincible-shutdown-buttons/</link>
		<comments>http://aras-p.info/blog/2008/07/09/invincible-shutdown-buttons/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 06:29:07 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=184</guid>
		<description><![CDATA[I booted into Vista yesterday to test something. It offered a bunch of updates to install. After they were installed, I got this: I am not sure what shutdown buttons do when they look like this. I guess they are invincible, or something. Ha, I&#8217;m your log off button! You can&#8217;t kill me! Yes, one [...]]]></description>
			<content:encoded><![CDATA[<p>I booted into Vista yesterday to test something. It offered a bunch of updates to install. After they were installed, I got this:</p>
<p><a href='http://aras-p.info/blog/wp-content/uploads/2008/07/invincibleshutdown.jpg'><img src="http://aras-p.info/blog/wp-content/uploads/2008/07/invincibleshutdown.jpg" alt="Invincible buttons" title="invincibleshutdown" class="alignnone size-full wp-image-185" /></a></p>
<p>I am not sure what shutdown buttons do when they look like this. I guess they are invincible, or something. <em>Ha, I&#8217;m your log off button! You can&#8217;t kill me!</em></p>
<p>Yes, one of the updates installed was the ATI driver update, so I <em>guess</em> there&#8217;s some glitch <em>somewhere</em> in the driver update that makes <em>some buttons</em> be displayed like this&#8230; But hey, this is not some random driver that I found on the net, it&#8217;s the one that is officially suggested by Vista&#8217;s update!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/07/09/invincible-shutdown-buttons/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The problem with Vista</title>
		<link>http://aras-p.info/blog/2008/06/03/the-problem-with-vista/</link>
		<comments>http://aras-p.info/blog/2008/06/03/the-problem-with-vista/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 16:25:35 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=174</guid>
		<description><![CDATA[Jeff Atwood notes the lack of polish in Windows Vista UI. Long Zheng has started Windows UI Taskforce. I agree &#8211; Vista&#8217;s UI has tons of polish problems. You know, little things that would seem unimportant, but screams something like &#8220;I was made in a hurry by people who don&#8217;t really love me&#8221;. Aliased shield [...]]]></description>
			<content:encoded><![CDATA[<p>Jeff Atwood <a href="http://www.codinghorror.com/blog/archives/001126.html">notes the lack of polish</a> in Windows Vista UI. Long Zheng has started <a href="http://www.istartedsomething.com/20080531/windows-ui-taskforce-your-help-wanted/">Windows UI Taskforce</a>. I agree &#8211; Vista&#8217;s UI has <em>tons</em> of polish problems. </p>
<p>You know, little things that would seem unimportant, but screams something like &#8220;I was made in a hurry by people who don&#8217;t really love me&#8221;. Aliased shield icon overlays? Check. Horrible screen flickering when logging in or UAC prompt pops up? Check. The infamous <a href="http://moishelettvin.blogspot.com/2006/11/windows-shutdown-crapfest.html">Shut Down</a> menu? Check. Awful file copy progress dialogs? Check. Explorer window title bar sometimes displaying green progress bar inside of it for some reason I can never understand? Check. General lack of unified style for UI? Check. The list goes on.</p>
<p>But still, I wonder whether lack of polish is the real problem with Vista. From my point of view, lack of direction or lack of vision seems to be a problem of similar size, if not larger. What <em>is</em> the vision for Vista?</p>
<p>&#8220;Security!&#8221; is not a vision. However hard it is to make something secure, &#8220;more security&#8221; is an improvement in one area, and not a vision on what a product should be. And second, &#8220;security&#8221; does not explain everything else about Vista. At start, it looked like some architecture astronauts had some fancy visions, like &#8220;all your filesystem is a database now!&#8221;&#8230; Well, that did not end up in Vista, and it is something that users genuinely don&#8217;t care about.</p>
<p>I might sound like an Apple fanboy (and indeed, OS X grows on you after a while), but when upgrading from OS X 10.4 (Tiger) to 10.5 (Leopard) I had a pretty clear list of what will be more useful to me:</p>
<ul>
<li>New version <em>feels</em> faster (on the same machine). I am not sure if it is actually faster; or it&#8217;s only a perceived improvement. Maybe they optimized something, maybe they multithreaded something, I don&#8217;t really care. It feels faster and smoother. That&#8217;s good.</li>
<li><a href="http://en.wikipedia.org/wiki/Quick_Look">Quick Look</a> is amazing. A seemingly simple feature &#8211; press Space over a file to preview it. With added polish, like when pressing space over multiple images selected, you can go into slideshow mode. Simple, yet highly effective.</li>
<li><a href="http://en.wikipedia.org/wiki/Spotlight_(software)">Spotlight</a> (desktop search) that is fast.</li>
<li>&#8230;and so on.</li>
</ul>
<p>Those are things I, as a user, care about. I want computer to feel faster. I want to instantly preview files. I want to search for something fast.</p>
<p>A filesystem that <a href="http://en.wikipedia.org/wiki/WinFS">is a database</a>? I can almost see the regular user salivating over that&#8230; <em>Yeah right.</em> Users don&#8217;t want a <em>platform</em>, users want <em>useful features</em>.</p>
<p>And this is where Vista fails &#8211; it does not have obvious new useful features or improvements. Aside from Direct3D 10 &#8211; which I am not using yet &#8211; all so called &#8220;improvements&#8221; just feel like gimmicks.</p>
<ul>
<li>It feels slower (I don&#8217;t care whether it actually <em>is faster but just feels sluggish</em>). And yes, it feels slower on a quad-core CPU with 4 gigs of RAM and a fast graphics card, so no &#8220;Vista runs circles around XP on a new box&#8221; please.</li>
<li>The reorganized menus, title bars and layout of Explorer just scream &#8220;I totally don&#8217;t understand what users need&#8221; at you. Previews are too small to be useable, organization of menus and buttons is horrible, and the constantly fading-in-and-fading-out user interface elements (folders tree view) are just distracting. I dig the new <a href="http://en.wikipedia.org/wiki/Office_2007#User_interface">Office 2007 UI</a> and I can see some understanding of users and vision behind it (see <a href="http://blogs.msdn.com/jensenh/archive/2008/03/12/the-story-of-the-ribbon.aspx">Jensen Harris</a>), but Vista&#8217;s UI feels like it was designed by a bunch of people who never talked to each other. And it&#8217;s not just lack of polish, the &#8220;design&#8221; of it is wrong.</li>
<li>The <a href="http://en.wikipedia.org/wiki/Windows_Sidebar">Sidebar</a>? Again, an attempt at doing something that seemed good, but without any understanding. Yes, I know that Apple might have taken the idea and implemented it right, but that does not leave Sidebar as being useful.</li>
<li>The new skin? Oh come on. How many users did upgrade because window close buttons now glow in red when you hover over them?</li>
<li>Was there anything else new in Vista? I didn&#8217;t notice anything.</li>
</ul>
<p>So this pretty much sums up my view on Vista. Zero new useful things, many annoyances. Microsoft, here&#8217;s you chance to execute it better next time around.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/06/03/the-problem-with-vista/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Argh MFC!</title>
		<link>http://aras-p.info/blog/2008/05/20/argh-mfc/</link>
		<comments>http://aras-p.info/blog/2008/05/20/argh-mfc/#comments</comments>
		<pubDate>Tue, 20 May 2008 07:02:32 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=172</guid>
		<description><![CDATA[When introductory documentation for something has this, you know it won&#8217;t be pretty: CAsyncMonikerFile is derived from CMonikerFile, which in turn is derived from COleStreamFile. A COleStreamFile object represents a stream of data; a CMonikerFile object uses an IMoniker to obtain the data, and a CAsyncMonikerFile object does so asynchronously. So yeah, I am dealing [...]]]></description>
			<content:encoded><![CDATA[<p>When introductory documentation for something <a href="http://msdn.microsoft.com/en-us/library/35a0c067.aspx">has this</a>, you know it won&#8217;t be pretty:</p>
<blockquote><p>CAsyncMonikerFile is derived from CMonikerFile, which in turn is derived from COleStreamFile. A COleStreamFile object represents a stream of data; a CMonikerFile object uses an IMoniker to obtain the data, and a CAsyncMonikerFile object does so asynchronously.</p></blockquote>
<p>So yeah, I am dealing with downloading something from the internet inside an ActiveX control that is written in MFC. A seemingly simple task &#8211; I give you an URL, you give me back the bytes. But no! That would not be a proper architecture, so instead it has asynchronous monikers which are based on monikers which are based on stream files which use some interfaces and whatnot. And for ActiveX controls the docs suggest using CDataPathProperty or CCachedDataPathProperty, which are abstractions build on top of the above crap. And I don&#8217;t even know <em>what</em> &#8220;a moniker&#8221; is!</p>
<p>Of course all this complexity fails spectacularly in some quite common situations. For example, try downloading something when the web server serves gzip compressed html output. Good luck trying to figure out why everything seemingly works, you are notified of downloading progress, but never get the actual downloaded bytes.</p>
<p>Turns out the solution is to change downloading behaviour of the above pile of abstractions to <a href="http://groups.google.be/group/microsoft.public.inetsdk.programming.urlmonikers/browse_thread/thread/45315a0d0860d61a/cfa2bbabad8ff438?hl=en">use &#8220;pull data&#8221; model</a>, instead of default &#8220;push data&#8221; model. The default behaviour just seems to be broken (though it is not broken in that pile of abstractions, instead it is broken somewhere deeper in Windows code). Is this mentioned <em>anywhere</em> in the docs? Of course not!</p>
<p>This is pretty much how a code comment looks like for this:</p>
<blockquote><p>We don&#8217;t use CCachedDataPathProperty because it&#8217;s awfully slow, doing data reallocations for each 1KB received. For 8MB file it&#8217;s 8000 reallocations and 32 GB (!) of data copied for no good reason!</p>
<p>While we&#8217;re at it, we don&#8217;t use CDataPathProperty either, because it&#8217;s a useless wrapper over CAsyncMonikerFile.</p>
<p>Oh, and we don&#8217;t use CAsyncMonikerFile either, because it has bugs in VS2003&#8242; MFC where it never notifies the container that it is done with download, making IE still display &#8220;X items remaining&#8221; indefinitely. Some smart coder was converting information message and returning &#8220;out of memory&#8221; error if result was NULL, even if input message was NULL (which it often was). So we use our own &#8220;fixed&#8221; version of CAsyncMonikerFile instead.
</p></blockquote>
<p>Oh MFC, how we love thee.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/05/20/argh-mfc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>On job titles and design patterns</title>
		<link>http://aras-p.info/blog/2008/05/09/on-job-titles-and-design-patterns/</link>
		<comments>http://aras-p.info/blog/2008/05/09/on-job-titles-and-design-patterns/#comments</comments>
		<pubDate>Fri, 09 May 2008 11:25:20 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=168</guid>
		<description><![CDATA[I just changed my job title to say &#8220;Code Chef&#8220;. I like it, and it represents my current understanding of programming pretty well. I cook code. That&#8217;s my job. Some N years ago I would have liked a title with &#8220;Architect&#8221; or &#8220;Analyst&#8221; or something like that. I would have called myself &#8220;developer&#8221; instead of [...]]]></description>
			<content:encoded><![CDATA[<p>I just changed my job title to say &#8220;<a href="http://www.linkedin.com/in/nearaz">Code Chef</a>&#8220;. I like it, and it represents my current understanding of programming pretty well. I cook code. That&#8217;s my job.</p>
<p>Some N years ago I would have liked a title with &#8220;Architect&#8221; or &#8220;Analyst&#8221; or something like that. I would have called myself &#8220;developer&#8221; instead of &#8220;programmer&#8221; because hey, a developer thinks up things, whereas a programmer is a mere &#8220;code monkey&#8221;. More on code monkeys below.</p>
<p>But wait! Back then I also believed that knowing and using <a href="http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29">Design Patterns</a> is essential for a programmer! In one place when I was interviewing new hires, design pattern knowledge was something I would look for&#8230; <em>how stupid!</em> Nowadays my view of patterns is more along the lines of &#8220;yeah, whatever&#8221;. I don&#8217;t exactly think of them as <a href="http://realtimecollisiondetection.net/blog?p=44">things from hell</a>, but they could have caused more harm than good already.</p>
<p>Back to job titles. Code monkey is actually the key employee. A software product is largely defined by the code, heck, it <em>is</em> code. Sure, it also has the user interface, the fancy icons, the documentation, the website, the support, the roadmap and whatnot, but the code <em>is</em> the product, whereas everything else is more or less addons (possibly excluding UI&#8230; UI also defines the product).</p>
<p>Code design? Design patterns? Who cares about that.</p>
<p>It&#8217;s the final result that matters. <a href="http://meshula.net/wordpress?p=168">Futurist programming</a> for the win.</p>
<p><em>On the other hand, <a href="http://realtimecollisiondetection.net/blog/?p=44#comment-662">Memento Observer</a> is probably very cool.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/05/09/on-job-titles-and-design-patterns/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>My experience with Crysis so far</title>
		<link>http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/</link>
		<comments>http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 13:37:10 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/</guid>
		<description><![CDATA[So I decided to check out Crysis myself. A demo for a non-gamer like me would be perfect, I thought. It&#8217;s probably three frames per second. In the menu! I did not see the game itself yet, got bored while waiting for the after-menu-but-before-game intro movie to end (it&#8217;s not skippable, and it also ran [...]]]></description>
			<content:encoded><![CDATA[<p>So I decided to check out <a href="http://en.wikipedia.org/wiki/Crysis">Crysis</a> myself. A demo for a non-gamer like me would be perfect, I thought.</p>
<p>It&#8217;s probably three frames per second. <em>In the menu</em>!</p>
<p>I did not see the game itself yet, got bored while waiting for the after-menu-but-before-game intro movie to end (it&#8217;s not skippable, <em>and</em> it also ran at about three FPS). This is after watching half a dozen obligatory before-menu intro movies at 3 FPS with stuttering sound (&#8220;nvidia,vidia,vidia,vidia&#8230; the way it&#8217;s meant,meant,meant,meant&#8230;&#8221; &#8211; <a href="http://www.nzone.com/object/nzone_twimtbp_gameslist.html">TWIMTBP</a>).</p>
<p>All of this on a half-decent PC, I think &#8211; Intel Core 2 Quad, 4GB RAM, Radeon 3850, Windows XP, latest drivers, none of extra stuff running; the PC is able to run other 3D stuff just fine. I&#8217;m sure the developers and EA&#8217;s testing labs have tested everything extensively, but sometimes something completely random apparently can make things be <em>oh so slow</em>. Oh well. Get back to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Holy FPU precision, Batman!</title>
		<link>http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/</link>
		<comments>http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 09:46:38 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[d3d]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/</guid>
		<description><![CDATA[(cross-posted from blogs.unity3d.com) One of our customers found an interesting bug the other day: embedding Unity Web Player into a web page makes some javascript animation libraries not work correctly. For example, script.aculo.us or Dojo Toolkit would stop doing some of their tasks. But only on Windows, and only on some browsers (Firefox and Safari). [...]]]></description>
			<content:encoded><![CDATA[<p><em>(cross-posted from <a href="http://blogs.unity3d.com/2008/01/22/holy-fpu-precision-batman/">blogs.unity3d.com</a>)</em></p>
<p>One of our customers found an interesting bug the other day: embedding Unity Web Player into a web page makes some javascript animation libraries not work correctly. For example, <a href="http://script.aculo.us/">script.aculo.us</a> or <a href="http://dojotoolkit.org/">Dojo Toolkit</a> would stop doing some of their tasks. But only on Windows, and only on some browsers (Firefox and Safari).</p>
<p>Wait a moment&#8230; Unity plugin makes nice wobbling web page elements not wobble anymore!? Sounds like an <em>interesting</em> issue&#8230;</p>
<p>So I prepared for a debug session and tried the usual &#8220;divide by two until you locate the problem&#8221; approach.</p>
<ul>
<li>Unity Web Player is composed of two parts: a small browser plugin, and the actual &#8220;engine&#8221; (let&#8217;s call it &#8220;runtime&#8221;). First I change the plugin so that it only loads the data, but never loads or starts the runtime. Everything works. So the problem is not in the plugin. <em>Good</em>.</li>
<li>Load the runtime and do basic initialization (create child window, load Mono, &#8230;), but never actually start playing the content &#8211; everything works.</li>
<li>Load the runtime and <em>fully</em> initialize everything, but never actually start playing the content &#8211; the bug appears! By now I know that the problem is <em>somewhere</em> in the initialization.</li>
</ul>
<p>Initialization reads some settings from the data file, creates some &#8220;manager objects&#8221; for the runtime,     initializes graphics device, loads first game &#8220;level&#8221; and then the game can play.</p>
<p>What of the above could cause <em>something</em> inside browser&#8217;s JavaScript engine stop working? And do that only on Windows, and only on some browsers? My first guess was the most platform-specific part: intialization of the graphics device, which on Windows usually happens to be Direct3D.</p>
<p>So I continued:</p>
<ul>
<li>Try using OpenGL instead of Direct3D &#8211; everything works. By now it&#8217;s confirmed that initializing Direct3D causes something else in the browser not work.</li>
<li>&#8220;A-ha!&#8221; moment: tell Direct3D to not change floating point precision (via a <a href="http://msdn2.microsoft.com/en-us/library/bb172527(VS.85).aspx">create flag</a>). Voilà, everything works!</li>
</ul>
<p>I don&#8217;t know how I <em>actually</em> came up with the idea of testing floating point precision flag. Maybe I remembered some related problems we had a while ago, where Direct3D would cause timing calculations be &#8220;off&#8221;, if the user&#8217;s machine was not rebooted for a couple of weeks or more. That time around we properly changed our timing code to use 64 bit integers, but left Direct3D precision setting intact.</p>
<blockquote><p>
Side note: Intel x86 floating point unit (FPU) can operate in various <a href="http://www.stereopsis.com/FPU.html">precision modes</a>, usually 32, 64 or 80 bit. By default Direct3D 9 sets FPU precision to 32 bit (i.e. single precision). Telling D3D to not change FPU settings <em>could</em> lower performance somewhat, but in my tests it did not have any noticeable impact.
</p></blockquote>
<p>So there it was. A debugging session, one line of change in the code, and fancy javascript webpage animations work on Windows in Firefox and Safari. This is coming out in Unity 2.0.2 update soon.</p>
<p>The moral? Something in one place can affect seemingly <em>completely</em> unrelated things in another place!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can you set OpenGL states independently?</title>
		<link>http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/</link>
		<comments>http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/#comments</comments>
		<pubDate>Wed, 25 Jul 2007 20:50:11 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/</guid>
		<description><![CDATA[Most of the time, yes, you can just set the needed states! You can set alpha blending on and turn light #0 off, and often nothing bad will happen. Blending will be on, and light #0 will be off. Fine. Until you hit a graphics card (quite new &#8211; from 2006, it can even do [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the time, yes, you can just set the needed states! You can set alpha blending on and turn light #0 off, and often nothing bad will happen. Blending will be on, and light #0 will be off. Fine.</p>
<p>Until you hit a graphics card (quite new &#8211; from 2006, it can even do pixel shader 2.0) that completely hangs up the machine in one of your unit tests. In fact, in the first unit test, that does almost nothing. Debugging that thing is <em>total awesomeness</em> &#8211; try something out, and the machine either hangs up or it does not. Reboot, repeat.</p>
<p>After something like 30 hang-ups I found the cause: <em>you are damned</em> if you set GL_SEPARATE_SPECULAR_COLOR and GL_COLOR_SUM to different values (i.e. use separate specular but don&#8217;t turn on color sum). Because, you know, some code was there that did not see a point in changing light mode color control when no lighting was on. So yeah, always set those two in sync. Just to please this card&#8217;s drivers.</p>
<p>It&#8217;s hard for me to have any faith in driver developers. I know that their job is hard, walking the fine line between correctness and getting decent benchmark scores&#8230; But still &#8211; hanging up the machine when two OpenGL 1.2 states are set to different values? Would you trust those people to write <a href="http://www.opengl.org/documentation/glsl">full fledged compilers</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL pbuffers suck!</title>
		<link>http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/</link>
		<comments>http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 16:22:03 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/</guid>
		<description><![CDATA[Aaargh! Well, the blog title is about as much as I wanted to say on this topic. &#8230;this is just me venting out, during the process of chasing a video memory leak for 4 days already. It involves p-buffers, depth textures, shared OpenGL contexts and other delicious things. Still didn&#8217;t find the cause, but I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>Aaargh! Well, the blog title is about as much as I wanted to say on this topic.</p>
<p>&#8230;this is just me venting out, during the process of chasing a video memory leak for 4 days already. It involves p-buffers, depth textures, shared OpenGL contexts and other delicious things. Still didn&#8217;t find the cause, but I&#8217;m getting close.</p>
<p>Pbuffer my a**.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s harder than &#8220;just use shaders&#8221;!</title>
		<link>http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/</link>
		<comments>http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/#comments</comments>
		<pubDate>Mon, 07 May 2007 15:17:58 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/</guid>
		<description><![CDATA[I&#8217;m always puzzled why people think that some interesting effect is &#8220;shaders&#8221;. The most recent example I saw is this message on Dir3d mailing list &#8211; it&#8217;s about NVIDIA&#8217;s skin rendering demo (*). The most interesting effects are in fact not achieved by the use of shaders &#8211; rather it&#8217;s the complex interplay of render-to-textures, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always puzzled why people think that some interesting effect is &#8220;shaders&#8221;. The most recent example I saw is <a href="http://nuttybar.drama.uga.edu/pipermail/dir3d-l/2007-May/013005.html">this message</a> on Dir3d mailing list &#8211; it&#8217;s about NVIDIA&#8217;s skin rendering demo (*).</p>
<p>The most interesting effects are in fact not achieved by the use of shaders &#8211; rather it&#8217;s the complex interplay of render-to-textures, postprocessing them, using them somewhere else, postprocessing that, using them somewhere else again, combine the intermediate results in various interesting ways, and finally get something that represents the colors on the screen.</p>
<p>So the effect is much more than the shaders; it&#8217;s more like &#8220;an orchestration of different stuff&#8221;. It&#8217;s the shaders, textures, models (often with custom data that is required for the effect to work), specially precomputed textures (more custom data for the effect), multiple render textures to store intermediate results, and finally some sort of &#8220;script&#8221; that controls the whole process.</p>
<p>Shaders are (relatively) small, isolated thingies that operate on small, isolated pieces of data. So they are only a small part of the whole picture, and in fact often they are the easiest part. Both to the effect author, and even for the &#8220;engine&#8221; to support.</p>
<p>Adding &#8220;shader support&#8221; to the engine/toolset is a piece of cake. The hard parts are:</p>
<ul>
<li>How shaders integrate with the lighting? Once you start doing shaders, you lose <em>all</em> lighting that used to be computed for you.</li>
<li>How shaders integrate with various data the mesh may have or it might not? For example, to support per-vertex colors you either have to write a single (sub-optimal) shader that always assumes vertex colors are present, or write multiple shaders: when vertex colors are present, and when they are not.</li>
<li>How shaders integrate with &#8230; lots of other things that were taken for granted in fixed function world. Scaled meshes. Various fog types. Texture transforms. The list goes on.</li>
<li>How do you expose the rest of the &#8220;stuff&#8221; that makes interesting effects possible? Shaders alone are nothing. You need render-to-texture with various interesting formats. You need to store custom data in the meshes. You need to store custom data in the textures, in various interesting formats. You need custom cameras to render intermediate results into render textures. You need a way to replace object shaders with some other shaders so that these objects <em>can</em> render these intermediate results. The list goes on.</li>
<li>Hardware support. Once you enter shader world, you get a totally new set of inconsistencies between operating systems, graphics APIs, hardware vendors, graphics card models and driver versions. And a new bag of driver bugs of course.</li>
</ul>
<p>So shaders do present three big challenges.</p>
<p>1) Shader explosion. How do you do lighting? Do you say &#8220;there shall only ever be a single directional light&#8221; (that is what most tech-demos do)? Do you try to support the general case and write some dozen shader combinations? How do you handle all other cases that were &#8220;just handled&#8221; by fixed function pipeline? Vertex formats, fog, texture transforms, etc. Congratulations, multiply your shader count by 10 or so. <em>Or</em> don&#8217;t multiply the shader count, but use static/dynamic branching <em>if</em> you have hardware support for it.</p>
<p>2) Platform differences. How you write shaders in the general case, when some things don&#8217;t work on AMD cards, some other things don&#8217;t work on NVIDIA cards, yet some other things don&#8217;t work in OpenGL, some other things don&#8217;t work in Direct3D, and something entirely else does not work on Mac OS X (with different things not working on PPC vs Intel, yay)? Congratulations again, multiply your already large shader count by 10 or so.</p>
<p>3) Shaders are just a small part of the equation. You need the whole infrastructure around them to <em>actually</em> enable those interesting effects.</p>
<p>To return to the original message about the skin rendering demo: no, &#8220;just shaders&#8221; won&#8217;t enable that. You need render textures in several formats (color &amp; depth) at least. And some dozen shaders to do the effect for a single light type, for a single mesh configuration, and for a single hardware platform. Multiply the shader count by, hmm&#8230;, hundred or so to cover the general case.</p>
<p>Real life is harder than a tech demo. Real life is more than just the shaders.</p>
<p>(*) I&#8217;m taking the message out of the context on purpose. Nothing is wrong with noisecrime&#8217;s message, I just want to point out that <em>just</em> exposing shaders does not get you very far.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Who writes software nowadays?</title>
		<link>http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/</link>
		<comments>http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 09:48:14 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/</guid>
		<description><![CDATA[Ok, I got an USB memory stick (PQI something). Now it has two partitions on it by default, one of them to store some sort of &#8220;USB Notebook&#8221; data. I am pretty sure I really don&#8217;t need that, so I was looking around for a way to merge those partitions. I ran this &#8220;USB Notebook&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I got an USB memory stick (PQI something). Now it has two partitions on it by default, one of them to store some sort of &#8220;USB Notebook&#8221; data. I am pretty sure I really don&#8217;t need that, so I was looking around for a way to merge those partitions. I ran this &#8220;USB Notebook&#8221; application in a hope that setup wizard will let me choose &#8220;no thanks, I don&#8217;t need this stuff&#8221;. Of course, it does not have such an option.</p>
<p>Pressing Cancel somewhere in there results in this dialog:</p>
<p><a href="http://aras-p.info/blog/wp-content/uploads/2007/04/allyourbase.png" title="Oooh the error message"><img src="http://aras-p.info/blog/wp-content/uploads/2007/04/allyourbase.png" alt="Oooh the error message" /></a></p>
<p>Pretty cool, I must say. Some advice I&#8217;d like to give for the application developers, if I may:</p>
<ul>
<li>Instead of trying to copy Aqua&#8217;s GUI, make the application actually do useful things. &#8220;I don&#8217;t need your stuff, please give me a single partition&#8221; is a pretty common use case. And please don&#8217;t make error messages like that be the topmost windows (now it stays on top even when I switch to another app).</li>
<li>Either get someone to write English messages, or leave the message as is and change the caption to &#8220;All your base are belong to us&#8221;. For such an exciting error message I&#8217;d also change the button text to &#8220;YES!!!&#8221;. Let the user enjoy your software!</li>
</ul>
<p>From the software manual: <em>&#8220;Thanks a lot to you that are use our company&#8217;s product&#8221;</em>. Gee, thank you that you are use your software on me!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ARB_vertex_buffer_object is stupid</title>
		<link>http://aras-p.info/blog/2007/03/22/arb_vertex_buffer_object-is-stupid/</link>
		<comments>http://aras-p.info/blog/2007/03/22/arb_vertex_buffer_object-is-stupid/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 21:51:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=105</guid>
		<description><![CDATA[OpenGL vertex buffer functionality, I mock thee too! Why couldn&#8217;t they make the specification simple&#038;clear, and then why can&#8217;t the implementations work as expected? It started out like this: converting some existing code that generates geometry on the fly. It used to generate that into in-memory arrays and then Just Draw Them. Probably not the [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">OpenGL vertex buffer functionality, I <a href="http://www.stevestreeting.com/?p=489">mock thee</a> too! Why couldn&#8217;t they make the <a href="http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt">specification</a> simple&#038;clear, and then why can&#8217;t the implementations work as expected?</p>
<p>It started out like this: converting some existing code that generates geometry on the fly. It used to generate that into in-memory arrays and then Just Draw Them. Probably not the most optimal solution, but that&#8217;s fine. Of course we can optimize that, right?</p>
<p>So with all my knowledge how things used to work in D3D I start &#8220;I&#8217;ll just do the same in OpenGL&#8221; adventure. Create a single big dynamic vertex buffer, a single big dynamic element buffer; update small portions of it with glBufferSubData, &#8220;discard&#8221; it (=glBufferData with null pointer) when the end is reached, rinse &#038; repeat.</p>
<p>Now, let&#8217;s for a moment ignore the fact that updating portions of index buffer does not actually work on Mac OS X&#8230; Everything else is fine and it actually works! Except for&#8230; it&#8217;s quite a lot <span style="font-style: italic;">slower</span> than just doing the old &#8220;render from memory&#8221; thing. Ok, must be some OS X specific thing&#8230; Nope, on a Windows box with GeForce 6800GT it is still slower.</p>
<p>Now, there are three things that could have gone wrong: 1) I did something stupid (quite likely), 2) VBOs for dynamically updated chunks of geometry suck (could be&#8230; they don&#8217;t have a way to update just one chunk without one extra memory copy at least), 3) both me and VBOs are stupid. If I was me I&#8217;d bet on the third option.</p>
<p>What I don&#8217;t get is: D3D has had a buffer model that is simple to understand and actually works for, like, 6 years now! Why ARB_vertex_buffer_object guys couldn&#8217;t <span style="font-style: italic;">just copy</span> that? The world would be a better place! No, instead they make a way to map only <span style="font-style: italic;">whole </span>buffer; updating chunks is extra memory copy; there are confusing usage parameters (when should I use STREAM and when DYNAMIC?); performance costs are unclear (when is <a href="http://www.stevestreeting.com/?p=491">glBufferSubData faster than glMapBuffer</a>?) etc. And in the end when an OpenGL noob like me tries to actually make them work &#8211; he can&#8217;t! It&#8217;s slow!
</div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/03/22/arb_vertex_buffer_object-is-stupid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A steam of random things</title>
		<link>http://aras-p.info/blog/2006/08/14/a-steam-of-random-things/</link>
		<comments>http://aras-p.info/blog/2006/08/14/a-steam-of-random-things/#comments</comments>
		<pubDate>Sun, 13 Aug 2006 21:24:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[demos]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=96</guid>
		<description><![CDATA[Awards: Hey, we&#8216;ve got a &#8220;runner up&#8221; award in Apple Design Awards 2006, Best Use of Graphics category! Yeah, a runner up is more like &#8220;the first of the losers&#8221;, but oh well. Got beaten by modo 201, which probably is a fair trade. It&#8217;s just that we thought we&#8217;d be in Best Developer Tool [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;"><span style="font-weight: bold;">Awards:</span> Hey, <a href="http://unity3d.com">we</a>&#8216;ve got a &#8220;runner up&#8221; award in <a href="http://developer.apple.com/ada/">Apple Design Awards 2006</a>, Best Use of Graphics category! Yeah, a runner up is more like &#8220;the first of the losers&#8221;, but oh well. Got beaten by <span style="font-style: italic;">modo 201</span>, which probably is a fair trade. It&#8217;s just that we thought we&#8217;d be in <span style="font-style: italic;">Best Developer Tool</span> category, but that is apparently for text editors and scripting languages :)</p>
<p><span style="font-weight: bold;">Demos: </span>In the other news, fellow <a href="http://nesnausk.org/members.php">ReJ</a> with TBL just won Assembly 2006 demo competition with an <a href="http://www.pouet.net/prod.php?which=25778">Amiga demo</a>, putting all PC demos faces&#8217; to dust. Check it out. Art direction over hardware capabilities, one more time.</p>
<p><span style="font-weight: bold;">Drivers:</span> why oh why the graphics drivers must be so bad? The other day I was thinking why can&#8217;t they auto-update themselves (with an option to turn it off for corporate users etc.). Now you&#8217;ve got a (not so recent!) driver that is able to parse vertex programs wrong, and a user who does not have a clue that he should update it. It&#8217;s bad enough to have a bug in the first place, but auto-update at least would fix&#8230;</p>
<p>Or you have a driver that says <span style="font-style: italic;">&#8220;I&#8217;m OpenGL 1.2!&#8221;</span> but the 3D texture functions are null. <span style="font-style: italic;">And</span> it&#8217;s the most recent driver for a particular graphics card that you can buy today! <span style="font-style: italic;">And</span> it&#8217;s not even a hard problem! What the developers are thinking &#8211; they go over the required GL 1.2 functionality, see that some is actually missing and decide <span style="font-style: italic;">&#8220;ah, screw it, we&#8217;ll say it&#8217;s 1.2 anyways&#8221;</span>?!</p>
<p>I just don&#8217;t get it. I could use some enlightenment on this.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2006/08/14/a-steam-of-random-things/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Threading woes</title>
		<link>http://aras-p.info/blog/2006/03/27/threading-woes/</link>
		<comments>http://aras-p.info/blog/2006/03/27/threading-woes/#comments</comments>
		<pubDate>Mon, 27 Mar 2006 08:20:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=89</guid>
		<description><![CDATA[Getting multithreaded code right is just so damn hard. Reasoning about it&#8217;s behavior or correctness is even harder! We&#8217;ll be doomed until we get something of much higher level than threads and locks. Why I&#8217;m writing this? Because my head hurts from trying to make the renderer run in one thread, and the containing application [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">Getting multithreaded code right is just so damn hard. Reasoning about it&#8217;s behavior or correctness is even harder! We&#8217;ll be doomed until we get something of much higher level than threads and locks.</p>
<p>Why I&#8217;m writing this? Because my head hurts from trying to make the renderer run in one thread, and the containing application in the other. With added spice that most (win32) GUI stuff must happen in one thread, OpenGL contexts can only be active in a single thread, simple functions must be split into complex chains of inter-threading calls, etc. etc. The result is a mess that nobody can understand.</p>
<p>I hope I&#8217;m not missing something obvious (well, aside from the suggestion &#8220;just don&#8217;t use threads&#8221;).
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2006/03/27/threading-woes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>InteraMotion closes offices</title>
		<link>http://aras-p.info/blog/2005/09/14/interamotion-closes-offices/</link>
		<comments>http://aras-p.info/blog/2005/09/14/interamotion-closes-offices/#comments</comments>
		<pubDate>Wed, 14 Sep 2005 16:57:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=65</guid>
		<description><![CDATA[The company I was working at for some three years, closed it&#8217;s offices in Kaunas recently. Well, it was almost a year when both intera and motion parts of the name didn&#8217;t already make any sense&#8230; At start we were doing computer vision, various game/graphics/entertainment stuff, but in the last year all development was about [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">The company I was <a href="http://aras-p.info/cv.html">working at</a> for some three years, closed it&#8217;s offices in Kaunas recently. Well, it was almost a year when both <span style="font-style: italic;">intera</span> and <span style="font-style: italic;">motion</span> parts of the name didn&#8217;t already make any sense&#8230; At start we were doing computer vision, various game/graphics/entertainment stuff, but in the last year all development was about some computer networks management system. A couple of programmers will stay for some time to support existing systems, but afaik any new development is suspended.</p>
<p>I feel kinda sad, even if I blame the management for the failures mostly <span style="font-style: italic;">(we programmers never blame ourselves, you know :))</span>. Yes, I/we could have worked harder, done better etc., but all the way I (and probably &#8216;we&#8217;) felt that the ambitions were too unrealistic<sup>*</sup>, the business plans were too non-existant, the management was just a bit too poor, and some forward-thinking was &#8216;just a bit missing&#8217;.</p>
<p>I guess that&#8217;s just my attempt to transfer blame to someone else :)</p>
<p>That said, it&#8217;s still sad. Oh well, just keep going on.</p>
<p><span style="color: rgb(102, 102, 102);font-size:85%;" >* Ambitions: &#8220;by that time Sony, Nintendo and Konami will be years behind us&#8221; doesn&#8217;t sound very realistic, does it? :)</span>
</div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/09/14/interamotion-closes-offices/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Doing something</title>
		<link>http://aras-p.info/blog/2005/08/30/doing-something/</link>
		<comments>http://aras-p.info/blog/2005/08/30/doing-something/#comments</comments>
		<pubDate>Tue, 30 Aug 2005 13:09:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[demos]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=62</guid>
		<description><![CDATA[After taking a break, I already want to do something programming-related in my free time. What should I? The standard thing: do a demo. I have some ideas for that, but for various reasons I&#8217;m not in the mood right now to start a big/long project. Read some books. I&#8217;m doing this a bit. Learn [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">After taking a break, I already want to do something programming-related in my free time. What should I?
</div>
<ul style="text-align: justify;">
<li>The standard thing: do a demo. I have some ideas for that, but for various reasons I&#8217;m not in the mood right now to start a big/long project.</li>
<li>Read some books. I&#8217;m doing this a bit.
 </li>
<li>Learn something. Do something with <a href="http://www.wxwidgets.org/">wxWidgets</a> or some <a href="http://www.lua.org/">Lua</a>-only programming, but didn&#8217;t start anything yet.</li>
<li>I already <span style="font-style: italic;">should </span>do something related to the next version of <a href="http://aras-p.info/projHoshimi.html">Project Hoshimi</a> for Imagine Cup 2006. I&#8217;m trying to!
  </li>
</ul>
<div style="text-align: justify;">On the unrelated note, I&#8217;m doing a <a href="http://aras-p.info/blog/2005/08/23/software-of-the-week/">Oracle</a> and XSLT related project at work. While Oracle stuff I&#8217;m dealing with really sucks, XSLT isn&#8217;t bad at all. Sure, it&#8217;s not &#8220;programming&#8221; that I&#8217;d love very much, but the whole concept is very powerful.</p>
<p>Maybe XML isn&#8217;t such a bad thing afterall, especially once you start doing funky things with XSLT and XPath. <span style="font-style: italic;">I still love the quote &#8220;XML is a giant step in no direction at all&#8221; though :)</span>
</div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/08/30/doing-something/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software of the week</title>
		<link>http://aras-p.info/blog/2005/08/23/software-of-the-week/</link>
		<comments>http://aras-p.info/blog/2005/08/23/software-of-the-week/#comments</comments>
		<pubDate>Tue, 23 Aug 2005 15:45:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=61</guid>
		<description><![CDATA[It&#8217;s never too early for Software Of The Week awards, even if it&#8217;s only Tuesday. Ladies and gentlement, Aras&#8217; picks are: Software That Rocks award goes to TortoiseSVN and PmWiki. Both are slick, sexy and do not try to annoy you. They actually work (that&#8217;s already something!), they do not crash whenever I do just-a-bit-non-usual [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">It&#8217;s never too early for <span style="font-style: italic;">Software Of The Week</span> awards, even if it&#8217;s only Tuesday. Ladies and gentlement, Aras&#8217; picks are:</p>
<ul>
<li><span style="font-weight: bold;">Software That Rocks</span> award goes to <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> and <a href="http://www.pmwiki.org/">PmWiki</a>. Both are slick, sexy and do not try to annoy you. They actually work (that&#8217;s already something!), they do not crash whenever I do just-a-bit-non-usual action, they do not corrupt my files behind my back.</li>
<li><span style="font-weight: bold;">Software That Sucks</span> award this week goes to Oracle <a href="http://www.oracle.com/technology/products/reports/index.html">Reports</a> and <a href="http://www.oracle.com/technology/products/designer/index.html">Designer</a> 10g. Sorry dear Oracle, but the best description I have for those is <span style="font-style: italic;">&#8220;Ugh&#8221;</span>. For a longer description, just invert everything that&#8217;s written in the first point.</li>
</ul>
<p> See you later!
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/08/23/software-of-the-week/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

