* @brief Encode a texel that is entirely LDR linear. * * Out-of-range inputs will be clamped to the valid UNORM range. * * @param data The RGBA data to encode. * @param lns_mask The mask for the HDR channels that need LNS encoding. */
| 127 | * @param lns_mask The mask for the HDR channels that need LNS encoding. |
| 128 | */ |
| 129 | static vfloat4 encode_texel_unorm( |
| 130 | vfloat4 data, |
| 131 | vmask4 lns_mask |
| 132 | ) { |
| 133 | (void)lns_mask; |
| 134 | vfloat4 raw_value = data * 65535.0f; |
| 135 | |
| 136 | // Unorm data must be in 0-1 range, so clamp because data can come from an |
| 137 | // unconstrained float. This will replace NaNs with zero. |
| 138 | return clamp(0.0f, 65535.0f, raw_value); |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * @brief Encode a texel that includes at least some HDR LNS texels. |
no test coverage detected