Pārlūkot izejas kodu

avoid using flat qualifier in shaders

- causing slowdown
Alexander Rose 2 gadi atpakaļ
vecāks
revīzija
b563c773c1

+ 1 - 0
CHANGELOG.md

@@ -10,6 +10,7 @@ Note that since we don't clearly distinguish between a public and private interf
 - Bind shared textures only once per pass, not for each render item
 - Fix missing 'material' annotation for some uniforms, causing unnecessary uniform updates
 - Remove use of ``isnan`` in impostor shaders, not needed and causing slowdown
+- Avoid using ``flat`` qualifier in shaders, causing slowdown
 
 ## [v3.11.0] - 2022-07-04
 

+ 4 - 4
src/mol-gl/shader/chunks/common-frag-params.glsl.ts

@@ -14,10 +14,10 @@ uniform int uMarkingType;
     uniform vec3 uClipObjectScale[dClipObjectCount];
 
     #if defined(dClipping)
-        #if __VERSION__ == 100
+        #if __VERSION__ == 100 || defined(dClippingType_instance)
             varying float vClipping;
         #else
-            flat in float vClipping;
+            flat in float vClipping; // avoid if possible, causes slowdown, ASR
         #endif
     #endif
 #endif
@@ -32,10 +32,10 @@ uniform int uMarkingType;
 
 #if defined(dNeedsMarker)
     uniform float uMarker;
-    #if __VERSION__ == 100
+    #if __VERSION__ == 100 || defined(dMarkerType_instance)
         varying float vMarker;
     #else
-        flat in float vMarker;
+        flat in float vMarker; // avoid if possible, causes slowdown, ASR
     #endif
 #endif
 

+ 4 - 4
src/mol-gl/shader/chunks/common-vert-params.glsl.ts

@@ -21,10 +21,10 @@ uniform int uPickType;
     #if defined(dClipping)
         uniform vec2 uClippingTexDim;
         uniform sampler2D tClipping;
-        #if __VERSION__ == 100
+        #if __VERSION__ == 100 || defined(dClippingType_instance)
             varying float vClipping;
         #else
-            flat out float vClipping;
+            flat out float vClipping; // avoid if possible, causes slowdown, ASR
         #endif
     #endif
 #endif
@@ -33,10 +33,10 @@ uniform int uPickType;
     uniform float uMarker;
     uniform vec2 uMarkerTexDim;
     uniform sampler2D tMarker;
-    #if __VERSION__ == 100
+    #if __VERSION__ == 100 || defined(dMarkerType_instance)
         varying float vMarker;
     #else
-        flat out float vMarker;
+        flat out float vMarker; // avoid if possible, causes slowdown, ASR
     #endif
 #endif