[Bf-blender-cvs] [869f2940c2] blender2.8: Gawain: allow use of final 2 bits of 10_10_10_2 format

Mike Erwin noreply at git.blender.org
Thu Mar 2 09:16:53 CET 2017


Commit: 869f2940c2bd17f46695f9213fedd78e6b7c5ac2
Author: Mike Erwin
Date:   Thu Mar 2 03:16:02 2017 -0500
Branches: blender2.8
https://developer.blender.org/rB869f2940c2bd17f46695f9213fedd78e6b7c5ac2

Gawain: allow use of final 2 bits of 10_10_10_2 format

Requested by @fclem

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

M	source/blender/gpu/gawain/vertex_format.c
M	source/blender/gpu/gawain/vertex_format.h

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

diff --git a/source/blender/gpu/gawain/vertex_format.c b/source/blender/gpu/gawain/vertex_format.c
index 671b979a81..d42398f3a4 100644
--- a/source/blender/gpu/gawain/vertex_format.c
+++ b/source/blender/gpu/gawain/vertex_format.c
@@ -120,8 +120,10 @@ unsigned add_attrib(VertexFormat* format, const char* name, VertexCompType comp_
 			break;
  #if USE_10_10_10
 		case COMP_I10:
-			assert(comp_ct == 3); // 10_10_10 format intended for normals (xyz) or colors (rgb)
-			assert(fetch_mode == NORMALIZE_INT_TO_FLOAT);
+			// 10_10_10 format intended for normals (xyz) or colors (rgb)
+			// extra component packed.w can be manually set to { -2, -1, 0, 1 }
+			assert(comp_ct == 3 || comp_ct == 4);
+			assert(fetch_mode == NORMALIZE_INT_TO_FLOAT); // not strictly required, may relax later
 			break;
  #endif
 		default:
diff --git a/source/blender/gpu/gawain/vertex_format.h b/source/blender/gpu/gawain/vertex_format.h
index 66477b0cfc..4ed9e58f37 100644
--- a/source/blender/gpu/gawain/vertex_format.h
+++ b/source/blender/gpu/gawain/vertex_format.h
@@ -74,7 +74,7 @@ typedef struct {
 	int x : 10;
 	int y : 10;
 	int z : 10;
-	int w : 2;	// ignored for our purposes
+	int w : 2;	// 0 by default, can manually set to { -2, -1, 0, 1 }
 } PackedNormal;
 
 PackedNormal convert_i10_v3(const float data[3]);




More information about the Bf-blender-cvs mailing list