mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-09 22:01:36 +00:00
Avoid atomic ops on vector members
* This doesn't translate well to metalsl and is in general not very useful - we were only doing it to avoid packing issues which in some cases are moot anyway. E.g. the histogram buffer doesn't have to be std140 and packed like an array of vectors, it can be std430 and packed like an array of uints.
This commit is contained in:
5 files changed
+18
-22
No files matched your search
@@ -24,9 +24,9 @@
|
||||
|
||||
//#include "texsample.h" // while includes aren't supported in glslang, this will be added in code
|
||||
|
||||
layout(binding=0, std140) buffer minmaxresultdest
|
||||
layout(binding=0, std430) buffer minmaxresultdest
|
||||
{
|
||||
uvec4 result[HGRAM_NUM_BUCKETS];
|
||||
uint result[HGRAM_NUM_BUCKETS];
|
||||
} dest;
|
||||
|
||||
layout (local_size_x = HGRAM_TILES_PER_BLOCK, local_size_y = HGRAM_TILES_PER_BLOCK) in;
|
||||
@@ -183,8 +183,8 @@ void main()
|
||||
}
|
||||
#endif
|
||||
|
||||
if(bucketIdx >= 0 && bucketIdx < HGRAM_NUM_BUCKETS)
|
||||
atomicAdd(dest.result[bucketIdx].x, 1U);
|
||||
if(bucketIdx < HGRAM_NUM_BUCKETS)
|
||||
atomicAdd(dest.result[bucketIdx], 1U);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,12 @@ layout(binding = 2, std430) readonly buffer index_data
|
||||
|
||||
layout(binding = 3, std140) buffer pickresult_buffer
|
||||
{
|
||||
uvec4 counter;
|
||||
uint counter;
|
||||
// individual padding to prevent uint/uint3 packing woes
|
||||
uint pad0;
|
||||
uint pad1;
|
||||
uint pad2;
|
||||
|
||||
uvec4 results[];
|
||||
} pickresult;
|
||||
|
||||
@@ -162,7 +167,7 @@ void trianglePath(uint threadID)
|
||||
float dist1 = distance(pos1.xyz/pos1.w, hitPosition);
|
||||
float dist2 = distance(pos2.xyz/pos2.w, hitPosition);
|
||||
|
||||
uint result_idx = atomicAdd(pickresult.counter.x, 1u);
|
||||
uint result_idx = atomicAdd(pickresult.counter, 1u);
|
||||
|
||||
uint meshVert = vertid0;
|
||||
if (dist1 < dist0 && dist1 < dist2)
|
||||
@@ -208,7 +213,7 @@ void defaultPath(uint threadID)
|
||||
float len = length(scr - meshpick.coords);
|
||||
if(len < 35.0f)
|
||||
{
|
||||
uint result_idx = atomicAdd(pickresult.counter.x, 1u);
|
||||
uint result_idx = atomicAdd(pickresult.counter, 1u);
|
||||
pickresult.results[result_idx] = uvec4(vertid, idx, floatBitsToUint(len), floatBitsToUint(wpos.z));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user