diff options
author | Samuel Iglesias Gonsálvez <[email protected]> | 2018-07-09 09:46:59 +0200 |
---|---|---|
committer | Andres Gomez <[email protected]> | 2019-09-17 23:39:18 +0300 |
commit | 1e0e3ed15a8cfb98a182714bcb3e55cfab5c3df7 (patch) | |
tree | f43a7a815e6e9ac306651ca21bf1ee7dd2ec79d4 /src/compiler/nir/nir_lower_alu_to_scalar.c | |
parent | f097247dd831da9b6e48baebc8b91efec3afcd28 (diff) |
nir: fix denorms in unpack_half_1x16()
According to VK_KHR_shader_float_controls:
"Denormalized values obtained via unpacking an integer into a vector
of values with smaller bit width and interpreting those values as
floating-point numbers must: be flushed to zero, unless the entry
point is declared with the code:DenormPreserve execution mode."
v2:
- Add nir_op_unpack_half_2x16_flush_to_zero opcode (Connor).
v3:
- Adapt to use the new NIR lowering framework (Andres).
v4:
- Updated to renamed shader info member and enum values (Andres).
v5:
- Simplify flags logic operations (Caio).
Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]>
Signed-off-by: Andres Gomez <[email protected]>
Reviewed-by: Connor Abbott <[email protected]> [v2]
Diffstat (limited to 'src/compiler/nir/nir_lower_alu_to_scalar.c')
-rw-r--r-- | src/compiler/nir/nir_lower_alu_to_scalar.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_lower_alu_to_scalar.c b/src/compiler/nir/nir_lower_alu_to_scalar.c index bcd92908253..c0b7cc604ef 100644 --- a/src/compiler/nir/nir_lower_alu_to_scalar.c +++ b/src/compiler/nir/nir_lower_alu_to_scalar.c @@ -145,13 +145,23 @@ lower_alu_instr_scalar(nir_builder *b, nir_instr *instr, void *_data) */ return NULL; + case nir_op_unpack_half_2x16_flush_to_zero: case nir_op_unpack_half_2x16: { if (!b->shader->options->lower_unpack_half_2x16) return NULL; nir_ssa_def *packed = nir_ssa_for_alu_src(b, alu, 0); - return nir_vec2(b, nir_unpack_half_2x16_split_x(b, packed), - nir_unpack_half_2x16_split_y(b, packed)); + if (alu->op == nir_op_unpack_half_2x16_flush_to_zero) { + return nir_vec2(b, + nir_unpack_half_2x16_split_x_flush_to_zero(b, + packed), + nir_unpack_half_2x16_split_y_flush_to_zero(b, + packed)); + } else { + return nir_vec2(b, + nir_unpack_half_2x16_split_x(b, packed), + nir_unpack_half_2x16_split_y(b, packed)); + } } case nir_op_pack_uvec2_to_uint: { |