diff options
author | Kenneth Graunke <[email protected]> | 2012-12-01 23:49:26 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2013-02-28 13:18:59 -0800 |
commit | 93066ce1299a7be8f670e527f249940c635605b4 (patch) | |
tree | 1e7c958b7feb9a605a6c9f482bc68798990c89f4 /src/glsl/builtins | |
parent | 18281d60889c7bb0ef14d2aa8a080cdaead7adb3 (diff) |
glsl: Convert mix() to use a new ir_triop_lrp opcode.
Many GPUs have an instruction to do linear interpolation which is more
efficient than simply performing the algebra necessary (two multiplies,
an add, and a subtract).
Pattern matching or peepholing this is more desirable, but can be
tricky. By using an opcode, we can at least make shaders which use the
mix() built-in get the more efficient behavior.
Currently, all consumers lower ir_triop_lrp. Subsequent patches will
actually generate different code.
v2 [mattst88]:
- Add LRP_TO_ARITH flag to ir_to_mesa.cpp. Will be removed in a
subsequent patch and ir_triop_lrp translated directly.
v3 [mattst88]:
- Move changes from the next patch to opt_algebraic.cpp to accept
3-src operations.
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/builtins')
-rw-r--r-- | src/glsl/builtins/ir/mix.ir | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/glsl/builtins/ir/mix.ir b/src/glsl/builtins/ir/mix.ir index 70ae13c9f3f..e6665321143 100644 --- a/src/glsl/builtins/ir/mix.ir +++ b/src/glsl/builtins/ir/mix.ir @@ -4,49 +4,49 @@ (declare (in) float arg0) (declare (in) float arg1) (declare (in) float arg2)) - ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2)))))) + ((return (expression float lrp (var_ref arg0) (var_ref arg1) (var_ref arg2))))) (signature vec2 (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1) (declare (in) vec2 arg2)) - ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec2 lrp (var_ref arg0) (var_ref arg1) (var_ref arg2))))) (signature vec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1) (declare (in) vec3 arg2)) - ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec3 lrp (var_ref arg0) (var_ref arg1) (var_ref arg2))))) (signature vec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1) (declare (in) vec4 arg2)) - ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec4 lrp (var_ref arg0) (var_ref arg1) (var_ref arg2))))) (signature vec2 (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1) (declare (in) float arg2)) - ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec2 lrp (var_ref arg0) (var_ref arg1) (var_ref arg2))))) (signature vec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1) (declare (in) float arg2)) - ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec3 lrp (var_ref arg0) (var_ref arg1) (var_ref arg2))))) (signature vec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1) (declare (in) float arg2)) - ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec4 lrp (var_ref arg0) (var_ref arg1) (var_ref arg2))))) (signature float (parameters |