types update.
Change-Id: I3bd43e163c919be4c3a38e0dd228cee220c62b76
diff --git a/scriptc/rs_core.rsh b/scriptc/rs_core.rsh
new file mode 100644
index 0000000..a2a5bab
--- /dev/null
+++ b/scriptc/rs_core.rsh
@@ -0,0 +1,61 @@
+#ifndef __RS_CORE_RSH__
+#define __RS_CORE_RSH__
+
+uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b);
+uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a);
+
+uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b)
+{
+ uchar4 c;
+ c.x = (uchar)(r * 255.f);
+ c.y = (uchar)(g * 255.f);
+ c.z = (uchar)(b * 255.f);
+ c.w = 255;
+ return c;
+}
+
+uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a)
+{
+ uchar4 c;
+ c.x = (uchar)(r * 255.f);
+ c.y = (uchar)(g * 255.f);
+ c.z = (uchar)(b * 255.f);
+ c.w = (uchar)(a * 255.f);
+ return c;
+}
+
+
+/*
+static uchar4 __attribute__((overloadable)) rsPackColorTo8888(float3 color)
+{
+ color *= 255.f;
+ uchar4 c = {color.x, color.y, color.z, 255};
+ return c;
+}
+
+static uchar4 __attribute__((overloadable)) rsPackColorTo8888(float4 color)
+{
+ color *= 255.f;
+ uchar4 c = {color.x, color.y, color.z, color.w};
+ return c;
+}
+
+static float4 rsUnpackColor8888(uchar4 c)
+{
+ float4 ret = {
+ c.x * (1.f / 255.f),
+ c.y * (1.f / 255.f),
+ c.z * (1.f / 255.f),
+ c.w * (1.f / 255.f),
+ };
+ return ret;
+}
+
+extern uchar4 __attribute__((overloadable)) rsPackColorTo565(float r, float g, float b);
+extern uchar4 __attribute__((overloadable)) rsPackColorTo565(float3);
+extern float4 rsUnpackColor565(uchar4);
+*/
+
+
+#endif
+
diff --git a/scriptc/rs_math.rsh b/scriptc/rs_math.rsh
index 91c4303..a26491f 100644
--- a/scriptc/rs_math.rsh
+++ b/scriptc/rs_math.rsh
@@ -1,4 +1,6 @@
#include "rs_cl.rsh"
+#include "rs_core.rsh"
+
// Allocations
@@ -11,18 +13,6 @@
-// Color conversion
-extern uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b);
-extern uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a);
-extern uchar4 __attribute__((overloadable)) rsPackColorTo8888(float3);
-extern uchar4 __attribute__((overloadable)) rsPackColorTo8888(float4);
-extern float4 rsUnpackColor8888(uchar4);
-
-extern uchar4 __attribute__((overloadable)) rsPackColorTo565(float r, float g, float b);
-extern uchar4 __attribute__((overloadable)) rsPackColorTo565(float3);
-extern float4 rsUnpackColor565(uchar4);
-
-
// Debugging
extern void __attribute__((overloadable))rsDebug(const char *, float);
extern void __attribute__((overloadable))rsDebug(const char *, float2);
diff --git a/scriptc/rs_types.rsh b/scriptc/rs_types.rsh
index 185bb83..2ac81e5 100644
--- a/scriptc/rs_types.rsh
+++ b/scriptc/rs_types.rsh
@@ -68,32 +68,6 @@
typedef int int16 __attribute__((ext_vector_type(16)));
-// RS_KIND_POSITION
-typedef float rs_position1;
-typedef float2 rs_position2;
-typedef float3 rs_position3;
-typedef float4 rs_position4;
-
-// RS_KIND_COLOR
-typedef float3 rs_color3f;
-typedef float4 rs_color4f;
-typedef uchar4 rs_color4u;
-
-// RS_KIND_NORMAL
-typedef float3 rs_normal;
-
-// RS_KIND_POINT_SIZE
-typedef float rs_point_size;
-
-// RS_KIND_TEXTURE
-typedef float rs_texture_coord1;
-typedef float2 rs_texture_coord2;
-typedef float3 rs_texture_coord3;
-typedef float4 rs_texture_coord4;
-
-// RS_KIND_INDEX
-typedef ushort rs_index;
-
typedef struct {
float m[16];
} rs_matrix4x4;