Quantcast
Channel: Questions in topic: "compute shader"
Viewing all articles
Browse latest Browse all 287

Pass to ComputeShader my define value

$
0
0
I have the Compute Shader: #pragma kernel CSRed #pragma kernel CSGreen #pragma kernel CSBlue RWTexture2D _Texture; //#define SIZE 32 [numthreads(SIZE,SIZE,1)] void CSRed (uint2 id : SV_DispatchThreadID) { float w, h; _Texture.GetDimensions(w, h); _Texture[id] = float4(id.x/w, 0, 0, 1); #endif } [numthreads(SIZE,SIZE,1)] void CSGreen (uint2 id : SV_DispatchThreadID) { float w, h; _Texture.GetDimensions(w, h); _Texture[id] = float4(0, id.x/w, 0, 1); } [numthreads(SIZE,SIZE,1)] void CSBlue (uint2 id : SV_DispatchThreadID) { float w, h; _Texture.GetDimensions(w, h); _Texture[id] = float4(0, 0, id.x/w, 1); } And I want to pass **#define SIZE 32** from C# code. How can I do it?

Viewing all articles
Browse latest Browse all 287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>