diff options
author | Kenneth Graunke <[email protected]> | 2010-06-09 14:42:41 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2010-06-09 14:44:39 -0700 |
commit | b843c7a20c2d65494f30eb82622ae7db380f581a (patch) | |
tree | d39710afa28855bbd8a7684b22e97c9fc0177600 /builtins | |
parent | cbd881da3fd2a68272988cf7fd21dfe006d47c8c (diff) |
Implement dFdx, dFdy, and fwidth via new expression opcodes.
Diffstat (limited to 'builtins')
-rw-r--r-- | builtins/110_fs/derivatives | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/builtins/110_fs/derivatives b/builtins/110_fs/derivatives new file mode 100644 index 00000000000..b79852ee1ff --- /dev/null +++ b/builtins/110_fs/derivatives @@ -0,0 +1,73 @@ +((function dFdx + (signature float + (parameters + (declare (in) float p)) + ((return (expression float dFdx (var_ref p))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 dFdx (var_ref p))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 dFdx (var_ref p))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 dFdx (var_ref p))))) + ) + + (function dFdy + (signature float + (parameters + (declare (in) float p)) + ((return (expression float dFdy (var_ref p))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 dFdy (var_ref p))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 dFdy (var_ref p))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 dFdy (var_ref p))))) + ) + + (function fwidth + (signature float + (parameters + (declare (in) float p)) + ((return (expression float + + (expression float abs (expression float dFdx (var_ref p))) + (expression float abs (expression float dFdy (var_ref p))))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 + + (expression vec2 abs (expression vec2 dFdx (var_ref p))) + (expression vec2 abs (expression vec2 dFdy (var_ref p))))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 + + (expression vec3 abs (expression vec3 dFdx (var_ref p))) + (expression vec3 abs (expression vec3 dFdy (var_ref p))))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 + + (expression vec4 abs (expression vec4 dFdx (var_ref p))) + (expression vec4 abs (expression vec4 dFdy (var_ref p))))))) +)) |