Search Unity

static variables in compute shader?

Discussion in 'Shaders' started by mahdiii, Apr 27, 2017.

  1. mahdiii

    mahdiii

    Joined:
    Oct 30, 2014
    Posts:
    856
    plz explain completely about static variables into compute shader codes
    local static and global static variables
    I want to store a local variable(for example the previous position of a point) for each thread
    but when I use local static variable it doesn't keep(restore) its value, I tested global static variables too. they don't restore previous values.
    How can I restore variables for each thread?
    and when do we use static variables?