Re: [Mesa-dev] [PATCH 1/2] mesa/vbo: Plumb ctx through to the conv_i(10|2)_to_norm_float functions.

2012-11-26 Thread Brian Paul
On Wed, Nov 21, 2012 at 9:44 PM, Kenneth Graunke kenn...@whitecape.org wrote:
 The rules for converting these values actually depend on the current
 context API and version.  The next patch will implement those changes.
 ---
  src/mesa/vbo/vbo_attrib_tmp.h | 118 
 +-
  1 file changed, 59 insertions(+), 59 deletions(-)

 diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
 index 077ca31..7ebc94e0 100644
 --- a/src/mesa/vbo/vbo_attrib_tmp.h
 +++ b/src/mesa/vbo/vbo_attrib_tmp.h
 @@ -113,14 +113,14 @@ static inline float conv_i2_to_i(int i2)
 return (float)val.x;
  }

 -static inline float conv_i10_to_norm_float(int i10)
 +static inline float conv_i10_to_norm_float(struct gl_context *ctx, int i10)

const qualifier?

-Brian
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] mesa/vbo: Plumb ctx through to the conv_i(10|2)_to_norm_float functions.

2012-11-21 Thread Kenneth Graunke
The rules for converting these values actually depend on the current
context API and version.  The next patch will implement those changes.
---
 src/mesa/vbo/vbo_attrib_tmp.h | 118 +-
 1 file changed, 59 insertions(+), 59 deletions(-)

diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index 077ca31..7ebc94e0 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -113,14 +113,14 @@ static inline float conv_i2_to_i(int i2)
return (float)val.x;
 }
 
-static inline float conv_i10_to_norm_float(int i10)
+static inline float conv_i10_to_norm_float(struct gl_context *ctx, int i10)
 {
struct attr_bits_10 val;
val.x = i10;
return (2.0F * (float)val.x + 1.0F) * (1.0F  / 1023.0F);
 }
 
-static inline float conv_i2_to_norm_float(int i2)
+static inline float conv_i2_to_norm_float(struct gl_context *ctx, int i2)
 {
struct attr_bits_2 val;
val.x = i2;
@@ -142,21 +142,21 @@ static inline float conv_i2_to_norm_float(int i2)
conv_i2_to_i(((I10)  30)  0x3))
 
 
-#define ATTRI10N_1( A, I10 ) ATTR( A, 1, GL_FLOAT, 
conv_i10_to_norm_float((I10)  0x3ff), 0, 0, 1 )
-#define ATTRI10N_2( A, I10 ) ATTR( A, 2, GL_FLOAT, \
-   conv_i10_to_norm_float((I10)  0x3ff),  
\
-   conv_i10_to_norm_float(((I10)  10)  0x3ff), 
0, 1 )
-#define ATTRI10N_3( A, I10 ) ATTR( A, 3, GL_FLOAT, \
-   conv_i10_to_norm_float((I10)  0x3ff),  \
-   conv_i10_to_norm_float(((I10)  10)  0x3ff), \
-   conv_i10_to_norm_float(((I10)  20)  0x3ff), 
1 )
-#define ATTRI10N_4( A, I10 ) ATTR( A, 4, GL_FLOAT, \
-   conv_i10_to_norm_float((I10)  0x3ff),  
\
-   conv_i10_to_norm_float(((I10)  10)  0x3ff), \
-   conv_i10_to_norm_float(((I10)  20)  0x3ff), \
-   conv_i2_to_norm_float(((I10)  30)  0x3))
-
-#define ATTR_UI(val, type, normalized, attr, arg) do { \
+#define ATTRI10N_1(ctx, A, I10) ATTR(A, 1, GL_FLOAT, 
conv_i10_to_norm_float(ctx, (I10)  0x3ff), 0, 0, 1 )
+#define ATTRI10N_2(ctx, A, I10) ATTR(A, 2, GL_FLOAT, \
+   conv_i10_to_norm_float(ctx, (I10)  0x3ff), 
\
+   conv_i10_to_norm_float(ctx, ((I10)  10)  
0x3ff), 0, 1 )
+#define ATTRI10N_3(ctx, A, I10) ATTR(A, 3, GL_FLOAT, \
+   conv_i10_to_norm_float(ctx, (I10)  0x3ff), 
\
+   conv_i10_to_norm_float(ctx, ((I10)  10)  
0x3ff), \
+   conv_i10_to_norm_float(ctx, ((I10)  20)  
0x3ff), 1 )
+#define ATTRI10N_4(ctx, A, I10) ATTR(A, 4, GL_FLOAT, \
+   conv_i10_to_norm_float(ctx, (I10)  0x3ff), 
\
+   conv_i10_to_norm_float(ctx, ((I10)  10)  
0x3ff), \
+   conv_i10_to_norm_float(ctx, ((I10)  20)  
0x3ff), \
+   conv_i2_to_norm_float(ctx, ((I10)  30)  0x3))
+
+#define ATTR_UI(ctx, val, type, normalized, attr, arg) do {\
if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \
   if (normalized) {\
 ATTRUI10N_##val((attr), (arg));\
@@ -165,7 +165,7 @@ static inline float conv_i2_to_norm_float(int i2)
   }\
}   else if ((type) == GL_INT_2_10_10_10_REV) { \
   if (normalized) {\
-ATTRI10N_##val((attr), (arg)); \
+ATTRI10N_##val(ctx, (attr), (arg));\
   } else { \
 ATTRI10_##val((attr), (arg));  \
   }\
@@ -173,11 +173,11 @@ static inline float conv_i2_to_norm_float(int i2)
   ERROR(GL_INVALID_VALUE); \
} while(0)
 
-#define ATTR_UI_INDEX(val, type, normalized, index, arg) do {  \
+#define ATTR_UI_INDEX(ctx, val, type, normalized, index, arg) do { \
   if ((index) == 0) {  \
-ATTR_UI(val, (type), normalized, 0, (arg));\
+ATTR_UI(ctx, val, (type), normalized, 0, (arg));   \
   } else if ((index)  MAX_VERTEX_GENERIC_ATTRIBS) {   \
-ATTR_UI(val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), 
(arg)); \
+ATTR_UI(ctx, val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), 
(arg)); \
   } else   \
 ERROR(GL_INVALID_VALUE);   \