[Mesa-dev] [RFC PATCH 5/5] glsl: add interpolateAtOffset builtin

Chris Forbes chrisf at ijw.co.nz
Sun Nov 10 00:51:11 PST 2013


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/glsl/builtin_functions.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 3ea3a3f..c55115c 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -565,6 +565,7 @@ private:
    B1(usubBorrow)
    B1(mulExtended)
    B1(interpolateAtCentroid)
+   B1(interpolateAtOffset)
 
    ir_function_signature *_atomic_intrinsic(builtin_available_predicate avail);
    ir_function_signature *_atomic_op(const char *intrinsic,
@@ -2099,6 +2100,12 @@ builtin_builder::create_builtins()
                 _interpolateAtCentroid(glsl_type::vec3_type),
                 _interpolateAtCentroid(glsl_type::vec4_type),
                 NULL);
+   add_function("interpolateAtOffset",
+                _interpolateAtOffset(glsl_type::float_type),
+                _interpolateAtOffset(glsl_type::vec2_type),
+                _interpolateAtOffset(glsl_type::vec3_type),
+                _interpolateAtOffset(glsl_type::vec4_type),
+                NULL);
 
    add_function("atomicCounter",
                 _atomic_op("__intrinsic_atomic_read",
@@ -3988,6 +3995,18 @@ builtin_builder::_interpolateAtCentroid(const glsl_type *type)
 }
 
 ir_function_signature *
+builtin_builder::_interpolateAtOffset(const glsl_type *type)
+{
+   ir_variable *interpolant = new(mem_ctx) ir_variable(type, "interpolant", ir_var_shader_in);
+   ir_variable *offset = in_var(glsl_type::vec2_type, "offset");
+   MAKE_SIG(type, gpu_shader5, 2, interpolant, offset);
+
+   body.emit(ret(interpolate_at_offset(interpolant, offset)));
+
+   return sig;
+}
+
+ir_function_signature *
 builtin_builder::_atomic_intrinsic(builtin_available_predicate avail)
 {
    ir_variable *counter = in_var(glsl_type::atomic_uint_type, "counter");
-- 
1.8.4.2



More information about the mesa-dev mailing list