Loading libs/rs/scriptc/rs_core.rsh 0 → 100644 +61 −0 Original line number Diff line number Diff line #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 libs/rs/scriptc/rs_math.rsh +2 −12 Original line number Diff line number Diff line #include "rs_cl.rsh" #include "rs_core.rsh" // Allocations Loading @@ -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); Loading libs/rs/scriptc/rs_types.rsh +0 −26 Original line number Diff line number Diff line Loading @@ -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; Loading Loading
libs/rs/scriptc/rs_core.rsh 0 → 100644 +61 −0 Original line number Diff line number Diff line #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
libs/rs/scriptc/rs_math.rsh +2 −12 Original line number Diff line number Diff line #include "rs_cl.rsh" #include "rs_core.rsh" // Allocations Loading @@ -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); Loading
libs/rs/scriptc/rs_types.rsh +0 −26 Original line number Diff line number Diff line Loading @@ -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; Loading