summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima/ir
diff options
context:
space:
mode:
authorAndreas Baierl <[email protected]>2019-05-31 09:54:27 +0200
committerQiang Yu <[email protected]>2019-07-18 13:20:39 +0000
commit4627a0c4ebc777716e7cadfd80e4f9d5b411762b (patch)
treea2f1f45b36ae3a9b313af754ad66dc46f57300ca /src/gallium/drivers/lima/ir
parent35232330274cff321e746b219db9ec9de23172d0 (diff)
lima/ppir: Add gl_PointCoord handling
Treat gl_PointCoord as a system value and add the necessary bits for correct codegen. Signed-off-by: Andreas Baierl <[email protected]> Reviewed-by: Qiang Yu <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima/ir')
-rw-r--r--src/gallium/drivers/lima/ir/pp/codegen.c16
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c11
-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, 33 insertions, 5 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/codegen.c b/src/gallium/drivers/lima/ir/pp/codegen.c
index 09cf5e623bd..6a90dc6ede7 100644
--- a/src/gallium/drivers/lima/ir/pp/codegen.c
+++ b/src/gallium/drivers/lima/ir/pp/codegen.c
@@ -56,7 +56,8 @@ static void ppir_codegen_encode_varying(ppir_node *node, void *code)
if (num_components) {
assert(node->op == ppir_op_load_varying ||
node->op == ppir_op_load_coords ||
- node->op == ppir_op_load_fragcoord);
+ node->op == ppir_op_load_fragcoord ||
+ node->op == ppir_op_load_pointcoord);
f->imm.dest = index >> 2;
f->imm.mask = dest->write_mask << (index & 0x3);
@@ -70,9 +71,16 @@ static void ppir_codegen_encode_varying(ppir_node *node, void *code)
else
f->imm.index = load->index >> alignment;
- if (node->op == ppir_op_load_fragcoord) {
- f->imm.source_type = 2;
- f->imm.perspective = 3;
+ switch (node->op) {
+ case ppir_op_load_fragcoord:
+ f->imm.source_type = 2;
+ f->imm.perspective = 3;
+ break;
+ case ppir_op_load_pointcoord:
+ f->imm.source_type = 3;
+ break;
+ default:
+ break;
}
}
else {
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 55d96191910..c7858640f01 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -285,6 +285,17 @@ static ppir_node *ppir_emit_intrinsic(ppir_block *block, nir_instr *ni)
lnode->num_components = instr->num_components;
return &lnode->node;
+ case nir_intrinsic_load_point_coord:
+ 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);
+ if (!lnode)
+ return NULL;
+
+ lnode->num_components = instr->num_components;
+ return &lnode->node;
+
case nir_intrinsic_load_uniform:
if (!instr->dest.is_ssa)
mask = u_bit_consecutive(0, instr->num_components);
diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c
index 5522b875269..280e08e9e2d 100644
--- a/src/gallium/drivers/lima/ir/pp/node.c
+++ b/src/gallium/drivers/lima/ir/pp/node.c
@@ -254,6 +254,13 @@ const ppir_op_info ppir_op_infos[] = {
PPIR_INSTR_SLOT_VARYING, PPIR_INSTR_SLOT_END
},
},
+ [ppir_op_load_pointcoord] = {
+ .name = "ld_pointcoord",
+ .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 22678ae3349..fc1671985e3 100644
--- a/src/gallium/drivers/lima/ir/pp/node_to_instr.c
+++ b/src/gallium/drivers/lima/ir/pp/node_to_instr.c
@@ -240,7 +240,8 @@ static bool ppir_do_node_to_instr(ppir_block *block, ppir_node *node)
load->dest.pipeline = ppir_pipeline_reg_uniform;
}
else if (node->op == ppir_op_load_varying ||
- node->op == ppir_op_load_fragcoord) {
+ node->op == ppir_op_load_fragcoord ||
+ node->op == ppir_op_load_pointcoord) {
/* 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 dafbd942532..3395a13ee56 100644
--- a/src/gallium/drivers/lima/ir/pp/ppir.h
+++ b/src/gallium/drivers/lima/ir/pp/ppir.h
@@ -103,6 +103,7 @@ typedef enum {
ppir_op_load_varying,
ppir_op_load_coords,
ppir_op_load_fragcoord,
+ ppir_op_load_pointcoord,
ppir_op_load_texture,
ppir_op_load_temp,