Jump to content

  • Log In with Google      Sign In   
  • Create Account

JoeJ

Member Since 30 Aug 2006
Offline Last Active Today, 02:50 PM

Posts I've Made

In Topic: Atomic Add for Float Type

Yesterday, 10:13 AM

Often it's best to avoid atomics, e.g. to sum up all numbers from an array, a prefix scan method should be much faster.

OpenCL sample:

 

accSum[lID] = lacc; // lID = thread index, each thread puts its value to the array, but we want to compute the sum of all values

    barrier (CLK_LOCAL_MEM_FENCE);

    uint step = 0;
    while (true)
    {
        uint add = (1<<step);
        uint index = lID + add; // neighbour array index
        if ((lID & ((~1)<<step)) == lID) accSum[lID] += accSum[index]; // add neighbour value to own value
        barrier (CLK_LOCAL_MEM_FENCE);
        if (add == (wgS>>1)) break; // wgS = total number of threads btw. array entries
        step++;
    }
 
// accSum[0] contains sum now

 

how this works illustrated is:

 

11111111
2 2 2 2
4   4
8

 

So for an array of 256 entries you need only 8 loop iterations without any atomic conflicts.

 

To make this fast you need compute, where all threads have acces to the array stored in LDS memory.

 

If that's new to you look it up! ;)


In Topic: Atomic Add for Float Type

26 May 2016 - 03:48 PM

Assuming you know that your added numbers sum will never get higher than 100:

 

int fromFloat = int (floatColor * (float(0x7fffffff) / 100.0f));

float backFromInt = float(fromFloat) * (100.0f / float(0x7fffffff));

 

I may have introduced a bug, but you get the point: Make a large integer from a small floating point number to get as much precission as possible.


In Topic: Atomic Add for Float Type

26 May 2016 - 08:18 AM

https://www.opengl.org/registry/specs/NV/shader_atomic_float.txt

 

Only NV has atomics on floats. But 32bit integers might work well enough for colors?


In Topic: Are Third Party Game Engines the Future

26 May 2016 - 06:56 AM

"As technology improves and third party tools improve, do you think that the bigger AAA game studios that have internal engines will eventually switch to using third party engines or will the industry continue as is for the foreseeable future?"

 

What a nightmare - the end of game "developement", and the rise of the game "maker" area.

 

Fortunately this will not happen so soon. If you look closely, UE4, Cryengine and Unity are mainly indie engines today.

(Nothing against that - it's very welcome)

 

For me it would be MUCH more work to tweak those engines to my needs than to write a new one from scratch.

Same for AAA companies - few people are enough to do this, a fraction of what is necessary for content creation.

It makes more sense to pay for something secialized like Umbra, Natural Motion, Simplygon etc.

 

The only downside of in house engine is missing public reward. Lots of people out there fell in love with UE4 demos or still think Crysis is best graphics ever.

They run around screaming 'downgrade!' and 'upscaled!' knowing nothing about the work they criticize or the limitations of their favorized engines.

At least that's my impression after reading sites related to pc gaming... there's something going wrong here.


In Topic: Cracks between patches with same the LOD level.

25 May 2016 - 11:28 PM

An indexing bug? Instead of using the same hight twice for both borders, you use hight(n) for one and height(n+1) for the other?


PARTNERS