summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_nir.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 63a44c7b79..559d47831c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -1058,6 +1058,16 @@ fs_visitor::get_nir_src(nir_src src)
return retype(reg, BRW_REGISTER_TYPE_D);
}
+/**
+ * Return an IMM for constants; otherwise call get_nir_src() as normal.
+ */
+fs_reg
+fs_visitor::get_nir_src_imm(nir_src src)
+{
+ nir_const_value *val = nir_src_as_const_value(src);
+ return val ? fs_reg(val->i[0]) : get_nir_src(src);
+}
+
fs_reg
fs_visitor::get_nir_dest(nir_dest dest)
{