Skip to content

Instantly share code, notes, and snippets.

@ancillarymagnet
Last active February 1, 2020 19:53
Show Gist options
  • Select an option

  • Save ancillarymagnet/80ed0cacb4332a8731592d988a1fc16e to your computer and use it in GitHub Desktop.

Select an option

Save ancillarymagnet/80ed0cacb4332a8731592d988a1fc16e to your computer and use it in GitHub Desktop.
CCA_compute_020120v01
#pragma kernel ResetKernel
#pragma kernel StepKernel
Texture2D<float> readTex;
SamplerState sampler_readTex;
RWTexture2D<float> writeTex;
RWTexture2D<float4> outTex;
int rez;
/*
*
*
* RESET
*
*
*/
[numthreads(1,1,1)]
void ResetKernel(uint3 id : SV_DispatchThreadID)
{
writeTex[id.xy] = 0;
}
/*
*
*
* STEP
*
*
*/
void Render(uint3 id, float state)
{
outTex[id.xy] = state;
}
[numthreads(1,1,1)]
void StepKernel(uint3 id : SV_DispatchThreadID)
{
writeTex[id.xy] = readTex[id.xy] + .1;
Render(id, writeTex[id.xy]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment