diff options
author | 2010-05-28 18:08:16 -0700 | |
---|---|---|
committer | 2010-05-28 19:13:20 -0700 | |
commit | c9d0a87d504b3f0322b43f971f9cb4838ee521fb (patch) | |
tree | 8056c172df00a20b2645853157e61a9cc0c860f1 | |
parent | 3678f1989e6ced6d97afaa5bb28743b1955d39a3 (diff) |
types update.
Change-Id: I3bd43e163c919be4c3a38e0dd228cee220c62b76
-rw-r--r-- | libs/rs/scriptc/rs_core.rsh | 61 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_math.rsh | 14 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_types.rsh | 26 |
3 files changed, 63 insertions, 38 deletions
diff --git a/libs/rs/scriptc/rs_core.rsh b/libs/rs/scriptc/rs_core.rsh new file mode 100644 index 000000000000..a2a5bab16830 --- /dev/null +++ b/libs/rs/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/libs/rs/scriptc/rs_math.rsh b/libs/rs/scriptc/rs_math.rsh index 91c4303b70ba..a26491f0e0b4 100644 --- a/libs/rs/scriptc/rs_math.rsh +++ b/libs/rs/scriptc/rs_math.rsh @@ -1,4 +1,6 @@ #include "rs_cl.rsh" +#include "rs_core.rsh" + // Allocations @@ -11,18 +13,6 @@ extern uint32_t rsAllocationGetDimFaces(rs_allocation); -// 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/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh index 185bb83f3b56..2ac81e52b3b8 100644 --- a/libs/rs/scriptc/rs_types.rsh +++ b/libs/rs/scriptc/rs_types.rsh @@ -68,32 +68,6 @@ typedef int int8 __attribute__((ext_vector_type(8))); 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; |