diff options
author | Eric Anholt <[email protected]> | 2018-09-18 14:09:25 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-10-15 17:16:44 -0700 |
commit | 8ec83dc51e407fa0987d636752497509278c0dbb (patch) | |
tree | fa6234c585a2df6041667ed3db0031577a6ecb09 /src | |
parent | 7d77fe1bcc8e84a30ddc5d4bc6b0c571dfd64b22 (diff) |
v3d: Add support for hardware pack/unpack of half floats.
Cuts the formerly 7-minute simulation time of fs-packHalf2x16.shader_test
in half.
Diffstat (limited to 'src')
-rw-r--r-- | src/broadcom/compiler/nir_to_vir.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3d_screen.c | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 158c1c3e9f3..714d76f58ba 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -845,6 +845,20 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr) vir_uniform_ui(c, 0))); break; + case nir_op_pack_half_2x16_split: + result = vir_VFPACK(c, src[0], src[1]); + break; + + case nir_op_unpack_half_2x16_split_x: + result = vir_FMOV(c, src[0]); + vir_set_unpack(c->defs[result.index], 0, V3D_QPU_UNPACK_L); + break; + + case nir_op_unpack_half_2x16_split_y: + result = vir_FMOV(c, src[0]); + vir_set_unpack(c->defs[result.index], 0, V3D_QPU_UNPACK_H); + break; + default: fprintf(stderr, "unknown NIR ALU inst: "); nir_print_instr(&instr->instr, stderr); @@ -1917,6 +1931,8 @@ const nir_shader_compiler_options v3d_nir_options = { .lower_pack_snorm_4x8 = true, .lower_unpack_unorm_4x8 = true, .lower_unpack_snorm_4x8 = true, + .lower_pack_half_2x16 = true, + .lower_unpack_half_2x16 = true, .lower_fdiv = true, .lower_find_lsb = true, .lower_ffma = true, diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index efde220c891..5a8400dcf01 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -109,6 +109,7 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET: case PIPE_CAP_TGSI_CAN_READ_OUTPUTS: + case PIPE_CAP_TGSI_PACK_HALF_FLOAT: return 1; case PIPE_CAP_INDEP_BLEND_ENABLE: |