21 lines
480 B
Plaintext
21 lines
480 B
Plaintext
// Each #kernel tells which function to compile; you can have many kernels
|
|
#pragma kernel CSMain
|
|
|
|
// Create a RenderTexture with enableRandomWrite flag and set it
|
|
// with cs.SetTexture
|
|
RWTexture2D<float4> Result;
|
|
|
|
//RWStructuredBuffer<float3> Color;
|
|
RWStructuredBuffer<int> Full;
|
|
|
|
int limit;
|
|
|
|
[numthreads(8,8,1)]
|
|
void CSMain (uint3 id : SV_DispatchThreadID)
|
|
{
|
|
if(max(max(Result[id.xy].r,Result[id.xy].g),Result[id.xy].b)>0.01)
|
|
{
|
|
InterlockedAdd(Full[0],1);
|
|
}
|
|
}
|