summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima
diff options
context:
space:
mode:
authorAndreas Baierl <[email protected]>2019-06-21 16:13:44 +0200
committerAndreas Baierl <[email protected]>2019-06-24 16:41:33 +0200
commitfa6ea16a8daf82886b7fc67c18f9ea87d2388cfd (patch)
tree3a03fb43c9896b45489fdbe2ed37618f3d0bbac5 /src/gallium/drivers/lima
parentf1d89bbc2fdb9952471e8e726453526fcf68d835 (diff)
lima/ppir: Add fsat op
Signed-off-by: Andreas Baierl <[email protected]> Reviewed-by: Qiang Yu <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima')
-rw-r--r--src/gallium/drivers/lima/ir/pp/lower.c15
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c1
-rw-r--r--src/gallium/drivers/lima/ir/pp/node.c3
-rw-r--r--src/gallium/drivers/lima/ir/pp/ppir.h1
4 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/lower.c b/src/gallium/drivers/lima/ir/pp/lower.c
index 2e87754d893..11a0027c768 100644
--- a/src/gallium/drivers/lima/ir/pp/lower.c
+++ b/src/gallium/drivers/lima/ir/pp/lower.c
@@ -427,6 +427,20 @@ static bool ppir_lower_neg(ppir_block *block, ppir_node *node)
return true;
}
+static bool ppir_lower_sat(ppir_block *block, ppir_node *node)
+{
+ /* Turn it into a mov with the saturate output modifier */
+ ppir_alu_node *alu = ppir_node_to_alu(node);
+
+ assert(alu->num_src == 1);
+
+ ppir_dest *move_dest = &alu->dest;
+ move_dest->modifier = ppir_outmod_clamp_fraction;
+ node->op = ppir_op_mov;
+
+ return true;
+}
+
static bool ppir_lower_branch(ppir_block *block, ppir_node *node)
{
ppir_branch_node *branch = ppir_node_to_branch(node);
@@ -480,6 +494,7 @@ static bool (*ppir_lower_funcs[ppir_op_num])(ppir_block *, ppir_node *) = {
[ppir_op_load_texture] = ppir_lower_texture,
[ppir_op_select] = ppir_lower_select,
[ppir_op_trunc] = ppir_lower_trunc,
+ [ppir_op_sat] = ppir_lower_sat,
[ppir_op_branch] = ppir_lower_branch,
};
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 4ad85635399..907cb1105d2 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -152,6 +152,7 @@ static int nir_to_ppir_opcodes[nir_num_opcodes] = {
[nir_op_fcsel] = ppir_op_select,
[nir_op_inot] = ppir_op_not,
[nir_op_ftrunc] = ppir_op_trunc,
+ [nir_op_fsat] = ppir_op_sat,
};
static ppir_node *ppir_emit_alu(ppir_block *block, nir_instr *ni)
diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c
index 425329bb713..5522b875269 100644
--- a/src/gallium/drivers/lima/ir/pp/node.c
+++ b/src/gallium/drivers/lima/ir/pp/node.c
@@ -43,6 +43,9 @@ const ppir_op_info ppir_op_infos[] = {
[ppir_op_neg] = {
.name = "neg",
},
+ [ppir_op_sat] = {
+ .name = "sat",
+ },
[ppir_op_mul] = {
.name = "mul",
.slots = (int []) {
diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h
index bf4bb544261..2da4ea35a1d 100644
--- a/src/gallium/drivers/lima/ir/pp/ppir.h
+++ b/src/gallium/drivers/lima/ir/pp/ppir.h
@@ -34,6 +34,7 @@ typedef enum {
ppir_op_mov,
ppir_op_abs,
ppir_op_neg,
+ ppir_op_sat,
ppir_op_add,
ppir_op_ddx,