Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Feb 2007
Online Last Active Today, 12:14 AM

#5172460 Creating resources in D3D11 with alignment constraints

Posted by Hodgman on 09 August 2014 - 08:25 AM

FWIW, I would expect current drivers to allocate all textures using at least 256 byte alignment wink.png

#5171982 Entity component systems

Posted by Hodgman on 06 August 2014 - 08:39 PM

It really depends on the style of ECS that you want to use. "ECS" isn't a formal term -- many studios mean it to mean many, many different things.


Sometimes the whole point of an ECS is that you can very easilly add temporary buffs and other micro-components / tags / etc onto game objects, to get complex behaviors through emergence.

Sometimes, ECS is just a knee jerk reaction to realizing that inheritance-addiction is bad, and it's just an attempt to move over to composition (see "composition vs inheritance").

Other times, ECS is about improving performance through OOD / cache oblivious algorithms.


Depending on what the purpose is, the resulting "ECS" system that you build can be extremely different. If you want to use lots of short-lived components for things like buffs, you can design your ECS so that this use-case is implemented optimally. If you use someone else's ECS design, then short-lived components may or may not work well...

#5171841 So there´s cheap 48 hour course nearby for C programming

Posted by Hodgman on 06 August 2014 - 04:42 AM

C is like the grandfather of programming languages biggrin.png

That's not a bad thing -- things were harder back in your grandfather's day, but at the same time, they're simpler in their own way. Sometimes it can be useful to learn the simple yet arduous ways first, to gain a solid understanding of the foundations of modern programming.


Most people wouldn't recommend C, because it doesn't hold your hand very much -- the computer does exactly what you tell it to do -- which means you really have to understand the computer and what exactly it is that you are telling it to do.

I made all sorts of horrible dangerous mistakes when learning C at an early age, but in the end, it was probably worth it for the eventual understanding that came from those mistakes happy.png


Also, from C++, to Java, C#, D, even as far as PHP, you can see that these languages are either derived from, or strongly influenced by C. Once you know C, it makes learning many other languages much easier.


Lastly, despite being very old, C is still in active use, and has a lot of fans who prefer it rather than modern languages too!

#5171782 Getting OpenGL Game Programming Book Source Code to compile.

Posted by Hodgman on 05 August 2014 - 10:04 PM

Looks like a visual studio project configuration problem. The "character set" is set to "Unicode" when it should be "Multibyte" or vice versa...

#5171774 OpenGL ES on desktops

Posted by Hodgman on 05 August 2014 - 08:19 PM

Is there a way to do it in reverse so something already existing using opengl can run in a browser or mobile with opengles? Is there a higher language that could be used across everything?

That's what game engines do - they make up their own higher level API and then implement it repeatedly for every back-end.
e.g. Not the best example, but the Horde3D graphics engine is originally built on GL, but then ported to GLES and D3D.

Do developers usually make multiple shaders for multiple targets?

The technique that I've seen most often is that you write your shaders in HLSL/Cg (pretty much the same language), with some #defines to cover up the differences between different HLSL-based back-ends. Then you use something like hlsl2glsl to support OpenGL.

#5171723 potatoe

Posted by Hodgman on 05 August 2014 - 04:27 PM

Add that small delta to the accumulated time and when the value you add to is big enough then - surprise - the accumulated time doesn't change anymore.

Sonthe moral of the story is: delta-time values are ok as floats, but absolute-time values have such a huge range while still demanding the same precision as a delta has, which means you have to store them in a double (or a 64bit integer).



I've had the same issue, where Gamebryo's animation system just started completely messing up (missing event triggers, etc) if you left the game running for too long. In their defense, "too long" was about 24hours, which they'd probably never tested, but in order for our product to pass certification, it did have to behave the same no matter how long you'd left it running...

From that point on, I've stopped using floats to store absolute time values wink.png

#5171521 Display draw/vsync flickering

Posted by Hodgman on 04 August 2014 - 05:37 PM

No answers sorry, (besides that it sounds like single-buffered rendering??) but if you've got a camera that can record at 60Hz (or ideally 120Hz), then you can use that as a debugging and reporting/communication aide ;-)

#5171221 potatoe

Posted by Hodgman on 02 August 2014 - 11:09 PM

In the 90's, float calculations were performed by software routines, so they were much, muh slower than ints.
Then, mid 90's, every desktop CPU started to add actual hardware support for float operations, which made them cost about the same as into operations.

One of the most common performance statistics is FLOPS - floating-point operations per second - because float ops are about one of the simplest things a CPU can do these days!

As mentioned above, GPUs have taken an opposite path, where initially, they only worked with floats, and integer operations had to be emulated! Recently, GPUs have added real hardware support for int operations, but it may still be slower.

#5170854 Reading linearized Texture as sRGB, then doing Gamma conversion: Different re...

Posted by Hodgman on 01 August 2014 - 05:56 AM

One thing still puzzles me. Most HDR samples I see do not use sRGBWrite, but perform the pow in their tonemapping instead. Why is that? Is there an advantage to doing it manually?

Ideally, everyone's TV/monitor would follow the sRGB standard exactly, but unfortunately, many don't. Worse, many do, but the factory default settings use extreme contrast/gamma, and the user is unlikely to go through the settings and activate sRGB mode :(

Because of this, lots of games show you a 'calibration' image and a slider to choose a game value (e.g. "Move the slider until the left image is barely visible").
If you do the final gamma correction manually, you can use this custom gamma value.

On the console games I've worked on, we routinely test on many different monitors and TVs, and have found that most look ok with gamma values all the way from 1.8 to 2.4!

According to the CardCaps.xls file included with the DirectX SDK, sRGB Writes and Reads on A8R8G8B8 surfaces are supported on almost all hardware except some released in 2002 (Geforce 4 MX 420). Is that true, or do recent adapters exist which don't support it?

as of D3D10, it became a required feature, so all modern cards will support it.

#5170784 Blender just made Rendering for Games Better.

Posted by Hodgman on 31 July 2014 - 09:38 PM

Blender just added Baking in Cycles.
Awesome news. Cycles is a great renderer, so being able to use it for all sorts of baking tasks opens up all sorts of opportunities.

#5170764 Getting a work visa

Posted by Hodgman on 31 July 2014 - 07:36 PM

Usually to hire a foreigner on a visa, you have to first try to hire a local candidate to fill the role. Only after you've proved that there are no local candidates can you try to hire a foreigner...

In this case, graphics/engine programmers are in short supply at the moment, so you've probably got a better chance at getting a visa for one of those roles, than an entry level gameplay role ;)

#5170761 GTX 750 problem - SOLVED

Posted by Hodgman on 31 July 2014 - 07:25 PM

That's really quite bizzare! If you've got time, it would be worthwhile submitting a bug report to nVidia, including the code that makes this happen. Unfortunately it's usually a non-trivial amount of work to put together minimal example code :/

This sounds like a dangerous bug though! Firstly, D3D9 should validate all your commands so that you can't crash the GPU. Secondly, the Windows Kernel should detect a hung GPU, shutdown the driver and then reinitialize everything.
Apparently the GPU get itself in such a bad state that it can't even be soft rebooted - which is pretty bad!
e.g. WebGL on chrome is emulated via D3D9 -- it might be possible to use your bug to make a web page that forces people to reboot! I imagine nVidia would want to know about that.

#5170211 MSAA custom sampling pattern

Posted by Hodgman on 29 July 2014 - 08:08 PM

I would bet a sizable sum that this functionality will be present in future APIs.
(There's hardware on the market that supports this) :D

#5169663 GTX 750 problem - SOLVED

Posted by Hodgman on 27 July 2014 - 11:23 PM

What OS are you using? It should be almost impossible to fully lock up a Windows Vista/7/8 with bad GPU code -- at worst it should just reboot the driver (and your application will get "device lost").

Are you handling lost device events properly? Maybe try removing your lost device handling code, and have it just quit your game instead, to see if that's related to the problem.

Do any other games cause these kinds of errors? If so, it might be damaged hardware sad.png

Maximum debug mode for DX, when did anisotropic become a bad setting for MAG & MIP Filter? Wasn't for the 250, dropped down to LINEAR

It's always been undefined behavior to use anisotropic for Mip filtering. Mag should be ok though.

#5169612 MSAA in Deferred shading

Posted by Hodgman on 27 July 2014 - 04:10 PM

Instead of using a Texture2d, declare yor input textures as Texture2dMS. The Load function then lets you specify which sample number you want (0,1,2,3...) along with the texel u,v coordinate.