Max Barashev f995cf6721 Fixed crpc dll thread freezing
- Added Cancellation token and cancelling task waiting before deinit execution
 - Removed trash
 - Added important fields to BlendShader
2026-05-20 15:37:46 +03:00

24 lines
834 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> Camera1;
RWTexture2D<float4> Camera2;
RWTexture2D<float4> Result;
RWStructuredBuffer<float> MonoChannelResult;
float ResX;
float Offset;
float FarClipPlane;
[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
int2 idxy1 = int2(clamp(id.x + Offset, 0, ResX), id.y);
int2 idxy2 = int2(clamp(id.x - Offset, 0, ResX), id.y);
float diffFactor = saturate(id.x - Offset) * saturate(ResX - (id.x + Offset));
float4 resVal = float4(((Camera1[idxy1] * diffFactor + Camera2[idxy2] * diffFactor) / 2).xyz, 1);
Result[id.xy] = resVal;
MonoChannelResult[id.x + id.y * ResX] = resVal.r * FarClipPlane;
}