summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima/ir
diff options
context:
space:
mode:
authorAndreas Baierl <[email protected]>2019-08-01 11:35:28 +0200
committerQiang Yu <[email protected]>2019-08-03 08:04:12 +0000
commit5254e53debe3bcfe3d8dc1ba4110fda8b6a616f9 (patch)
tree02cd097f3b1354a9704b372819b8ea0e790c19be /src/gallium/drivers/lima/ir
parentb62b0cfa7141250622229face8a8b338c344f9d2 (diff)
lima/ppir: Add gl_FrontFace handling
Signed-off-by: Andreas Baierl <[email protected]> Reviewed-by: Qiang Yu <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima/ir')
-rw-r--r--src/gallium/drivers/lima/ir/pp/codegen.c7
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c29
-rw-r--r--src/gallium/drivers/lima/ir/pp/node.c7
-rw-r--r--src/gallium/drivers/lima/ir/pp/node_to_instr.c3
-rw-r--r--src/gallium/drivers/lima/ir/pp/ppir.h1
5 files changed, 34 insertions, 13 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/codegen.c b/src/gallium/drivers/lima/ir/pp/codegen.c
index 7259eb6ec02..96f1ffce000 100644
--- a/src/gallium/drivers/lima/ir/pp/codegen.c
+++ b/src/gallium/drivers/lima/ir/pp/codegen.c
@@ -57,7 +57,8 @@ static void ppir_codegen_encode_varying(ppir_node *node, void *code)
assert(node->op == ppir_op_load_varying ||
node->op == ppir_op_load_coords ||
node->op == ppir_op_load_fragcoord ||
- node->op == ppir_op_load_pointcoord);
+ node->op == ppir_op_load_pointcoord ||
+ node->op == ppir_op_load_frontface);
f->imm.dest = index >> 2;
f->imm.mask = dest->write_mask << (index & 0x3);
@@ -79,6 +80,10 @@ static void ppir_codegen_encode_varying(ppir_node *node, void *code)
case ppir_op_load_pointcoord:
f->imm.source_type = 3;
break;
+ case ppir_op_load_frontface:
+ f->imm.source_type = 3;
+ f->imm.perspective = 1;
+ break;
default:
break;
}
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 552dbdbe057..b0714c8363f 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -271,21 +271,28 @@ static ppir_node *ppir_emit_intrinsic(ppir_block *block, nir_instr *ni)
return &lnode->node;
case nir_intrinsic_load_frag_coord:
- if (!instr->dest.is_ssa)
- mask = u_bit_consecutive(0, instr->num_components);
-
- lnode = ppir_node_create_dest(block, ppir_op_load_fragcoord, &instr->dest, mask);
- if (!lnode)
- return NULL;
-
- lnode->num_components = instr->num_components;
- return &lnode->node;
-
case nir_intrinsic_load_point_coord:
+ case nir_intrinsic_load_front_face:
if (!instr->dest.is_ssa)
mask = u_bit_consecutive(0, instr->num_components);
- lnode = ppir_node_create_dest(block, ppir_op_load_pointcoord, &instr->dest, mask);
+ ppir_op op;
+ switch (instr->intrinsic) {
+ case nir_intrinsic_load_frag_coord:
+ op = ppir_op_load_fragcoord;
+ break;
+ case nir_intrinsic_load_point_coord:
+ op = ppir_op_load_pointcoord;
+ break;
+ case nir_intrinsic_load_front_face:
+ op = ppir_op_load_frontface;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ lnode = ppir_node_create_dest(block, op, &instr->dest, mask);
if (!lnode)
return NULL;
diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c
index 5e1264d6cd9..c62e4cc2e57 100644
--- a/src/gallium/drivers/lima/ir/pp/node.c
+++ b/src/gallium/drivers/lima/ir/pp/node.c
@@ -252,6 +252,13 @@ const ppir_op_info ppir_op_infos[] = {
PPIR_INSTR_SLOT_VARYING, PPIR_INSTR_SLOT_END
},
},
+ [ppir_op_load_frontface] = {
+ .name = "ld_frontface",
+ .type = ppir_node_type_load,
+ .slots = (int []) {
+ PPIR_INSTR_SLOT_VARYING, PPIR_INSTR_SLOT_END
+ },
+ },
[ppir_op_load_uniform] = {
.name = "ld_uni",
.type = ppir_node_type_load,
diff --git a/src/gallium/drivers/lima/ir/pp/node_to_instr.c b/src/gallium/drivers/lima/ir/pp/node_to_instr.c
index 478c4f66f2d..baf5b0d815a 100644
--- a/src/gallium/drivers/lima/ir/pp/node_to_instr.c
+++ b/src/gallium/drivers/lima/ir/pp/node_to_instr.c
@@ -233,7 +233,8 @@ static bool ppir_do_node_to_instr(ppir_block *block, ppir_node *node)
}
else if (node->op == ppir_op_load_varying ||
node->op == ppir_op_load_fragcoord ||
- node->op == ppir_op_load_pointcoord) {
+ node->op == ppir_op_load_pointcoord ||
+ node->op == ppir_op_load_frontface) {
/* delay the load varying dup to scheduler */
if (!create_new_instr(block, node))
return false;
diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h
index f5119b0cb11..63494bab2af 100644
--- a/src/gallium/drivers/lima/ir/pp/ppir.h
+++ b/src/gallium/drivers/lima/ir/pp/ppir.h
@@ -100,6 +100,7 @@ typedef enum {
ppir_op_load_coords,
ppir_op_load_fragcoord,
ppir_op_load_pointcoord,
+ ppir_op_load_frontface,
ppir_op_load_texture,
ppir_op_load_temp,