From 58bad55d425e6fb0dbee9dcb6320a14157eddb50 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 14 Feb 2023 20:31:36 -0800 Subject: [PATCH] Avoid branch in half2float in gl_compatibility renderer --- drivers/gles3/shaders/stdlib_inc.glsl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gles3/shaders/stdlib_inc.glsl b/drivers/gles3/shaders/stdlib_inc.glsl index 0b76c4334aa4..92bf2d87e4c7 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) {