summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2023-02-15 22:46:47 +0100
committerGitHub <noreply@github.com>2023-02-15 22:46:47 +0100
commitaa6ec763179e5bf1d1300aa72dc5f4172d810efa (patch)
tree9d883d7299459d39d0b0da077291598b4bb49643
parent2874961309853dce3019dfef7bfa2d4f4afb03d9 (diff)
parent58bad55d425e6fb0dbee9dcb6320a14157eddb50 (diff)
Merge pull request #73332 from clayjohn/GL-h2f-branch
Avoid branch in half2float in gl_compatibility renderer
-rw-r--r--drivers/gles3/shaders/stdlib_inc.glsl6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/gles3/shaders/stdlib_inc.glsl b/drivers/gles3/shaders/stdlib_inc.glsl
index 0b76c4334a..92bf2d87e4 100644
--- a/drivers/gles3/shaders/stdlib_inc.glsl
+++ b/drivers/gles3/shaders/stdlib_inc.glsl
@@ -14,11 +14,7 @@ uint float2half(uint f) {
uint half2float(uint h) {
uint h_e = h & uint(0x7c00);
- if (h_e == uint(0x0000)) {
- return uint(0);
- } else {
- return ((h & uint(0x8000)) << uint(16)) | ((h_e + uint(0x1c000)) << uint(13)) | ((h & uint(0x03ff)) << uint(13));
- }
+ return ((h & uint(0x8000)) << uint(16)) | uint((h_e >> uint(10)) != uint(0)) * (((h_e + uint(0x1c000)) << uint(13)) | ((h & uint(0x03ff)) << uint(13)));
}
uint packHalf2x16(vec2 v) {