diff options
author | Andreas Baierl <[email protected]> | 2019-08-01 11:35:28 +0200 |
---|---|---|
committer | Qiang Yu <[email protected]> | 2019-08-03 08:04:12 +0000 |
commit | 5254e53debe3bcfe3d8dc1ba4110fda8b6a616f9 (patch) | |
tree | 02cd097f3b1354a9704b372819b8ea0e790c19be | |
parent | b62b0cfa7141250622229face8a8b338c344f9d2 (diff) |
lima/ppir: Add gl_FrontFace handling
Signed-off-by: Andreas Baierl <[email protected]>
Reviewed-by: Qiang Yu <[email protected]>
-rw-r--r-- | src/gallium/drivers/lima/ir/pp/codegen.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/lima/ir/pp/nir.c | 29 | ||||
-rw-r--r-- | src/gallium/drivers/lima/ir/pp/node.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/lima/ir/pp/node_to_instr.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/lima/ir/pp/ppir.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/lima/lima_screen.c | 1 |
6 files changed, 35 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, diff --git a/src/gallium/drivers/lima/lima_screen.c b/src/gallium/drivers/lima/lima_screen.c index 3ae70b87ef1..26a7051e67e 100644 --- a/src/gallium/drivers/lima/lima_screen.c +++ b/src/gallium/drivers/lima/lima_screen.c @@ -118,6 +118,7 @@ lima_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL: case PIPE_CAP_TGSI_FS_POINT_IS_SYSVAL: + case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL: return 1; case PIPE_CAP_MAX_TEXTURE_2D_SIZE: |