<p>In a webgl pixel shader, all functions are inlined as i understand it, however you can have parameters that are marked as <strong><em>in</em></strong> versus being <strong><em>inout</em></strong> meaning that their value can change but the value won't persist outside of the function call.</p>

<p>Does this mean that the shader must make a copy of the value for the function to work with when it is an <strong><em>in</em></strong> value?</p>

<p>Are shader compilers/optimizers smart enough to know when they don't need to make a copy, or is it best to really just mark up all parameters as <strong><em>inout</em></strong> and make sure and not modify the ones you don't want modified, if performance is the primary concern?</p>

<p>Thanks!</p>

<webgl><pixel-shader><efficiency>
Cost of parameter passing in webgl pixel shaders?
Alan Wolfe
# Cost of parameter passing in webgl pixel shaders?

(Asked by: username_0 on 2016-02-03)

In a webgl pixel shader, all functions are inlined as i understand it, however you can have parameters that are marked as ***in*** versus being ***inout*** meaning that their value can change but the value won't persist outside of the function call.

Does this mean that the shader must make a copy of the value for the function to work with when it is an ***in*** value?

Are shader compilers/optimizers smart enough to know when they don't need to make a copy, or is it best to really just mark up all parameters as ***inout*** and make sure and not modify the ones you don't want modified, if performance is the primary concern?

Thanks!

**Tags:** webgl, pixel-shader, efficiency

---

## 0 answers

