[Bf-blender-cvs] [17e562311f9] blender-v3.4-release: Draw: Use 32-bit floats for custom color attributes

Miguel Pozo noreply at git.blender.org
Thu Nov 24 13:36:23 CET 2022


Commit: 17e562311f9f273f842bd169c22062dba0ecc618
Author: Miguel Pozo
Date:   Thu Nov 24 13:36:11 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB17e562311f9f273f842bd169c22062dba0ecc618

Draw: Use 32-bit floats for custom color attributes

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

M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc

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

diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
index 39f6fb6d9a2..f1a0636ceba 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
@@ -117,7 +117,6 @@ static GPUVertFetchMode get_fetch_mode_for_type(eCustomDataType type)
     case CD_PROP_INT8:
     case CD_PROP_INT32:
       return GPU_FETCH_INT_TO_FLOAT;
-    case CD_PROP_COLOR:
     case CD_PROP_BYTE_COLOR:
       return GPU_FETCH_INT_TO_FLOAT_UNIT;
     default:
@@ -131,8 +130,9 @@ static GPUVertCompType get_comp_type_for_type(eCustomDataType type)
     case CD_PROP_INT8:
     case CD_PROP_INT32:
       return GPU_COMP_I32;
-    case CD_PROP_COLOR:
     case CD_PROP_BYTE_COLOR:
+      /* This should be u8,
+       * but u16 is required to store the color in linear space without precission loss */
       return GPU_COMP_U16;
     default:
       return GPU_COMP_F32;
@@ -309,7 +309,7 @@ static void extract_attr(const MeshRenderData *mr,
       extract_attr_generic<float3>(mr, vbo, request);
       break;
     case CD_PROP_COLOR:
-      extract_attr_generic<MPropCol, gpuMeshCol>(mr, vbo, request);
+      extract_attr_generic<float4>(mr, vbo, request);
       break;
     case CD_PROP_BYTE_COLOR:
       extract_attr_generic<ColorGeometry4b, gpuMeshCol>(mr, vbo, request);



More information about the Bf-blender-cvs mailing list