[Bf-blender-cvs] [c6e5b3f42df] master: Fix T84095: Eevee vextex color isn't working with hair

Jeroen Bakker noreply at git.blender.org
Mon Jan 4 15:26:20 CET 2021


Commit: c6e5b3f42dfc05e911ef30df12821138e1225e91
Author: Jeroen Bakker
Date:   Mon Jan 4 15:05:37 2021 +0100
Branches: master
https://developer.blender.org/rBc6e5b3f42dfc05e911ef30df12821138e1225e91

Fix T84095: Eevee vextex color isn't working with hair

Regression introduced by {c766d9b9dc56}. When converting the vertex
buffer to a texture buffer the fetch mode wasn't checked and the short
was bitwise interpreted as a float. This change checks the fetch_mode
and select the correct texture buffer.

This could also be added to other places when needed. At this time it is
only added here to support vertex colors when used with hair particles.

===================================================================

M	source/blender/gpu/intern/gpu_texture_private.hh

===================================================================

diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh
index efa8be2a547..4197d5c55fc 100644
--- a/source/blender/gpu/intern/gpu_texture_private.hh
+++ b/source/blender/gpu/intern/gpu_texture_private.hh
@@ -540,7 +540,18 @@ static inline eGPUTextureFormat to_texture_format(const GPUVertFormat *format)
         case GPU_COMP_I16:
           return GPU_RGBA16I;
         case GPU_COMP_U16:
-          return GPU_RGBA16UI;
+          /* Note: Checking the fetch mode to select the right GPU texture format. This can be
+           * added to other formats as well. */
+          switch (format->attrs[0].fetch_mode) {
+            case GPU_FETCH_INT:
+              return GPU_RGBA16UI;
+            case GPU_FETCH_INT_TO_FLOAT_UNIT:
+              return GPU_RGBA16;
+            case GPU_FETCH_INT_TO_FLOAT:
+              return GPU_RGBA16F;
+            case GPU_FETCH_FLOAT:
+              return GPU_RGBA16F;
+          }
         case GPU_COMP_I32:
           return GPU_RGBA32I;
         case GPU_COMP_U32:



More information about the Bf-blender-cvs mailing list