Home | History | Annotate | Download | only in include
      1 #ifndef __RS_MATH_RSH__
      2 #define __RS_MATH_RSH__
      3 
      4 /**
      5  * Copy reference to the specified object.
      6  *
      7  * @param dst
      8  * @param src
      9  */
     10 extern void __attribute__((overloadable))
     11     rsSetObject(rs_element *dst, rs_element src);
     12 extern void __attribute__((overloadable))
     13     rsSetObject(rs_type *dst, rs_type src);
     14 extern void __attribute__((overloadable))
     15     rsSetObject(rs_allocation *dst, rs_allocation src);
     16 extern void __attribute__((overloadable))
     17     rsSetObject(rs_sampler *dst, rs_sampler src);
     18 extern void __attribute__((overloadable))
     19     rsSetObject(rs_script *dst, rs_script src);
     20 extern void __attribute__((overloadable))
     21     rsSetObject(rs_mesh *dst, rs_mesh src);
     22 extern void __attribute__((overloadable))
     23     rsSetObject(rs_program_fragment *dst, rs_program_fragment src);
     24 extern void __attribute__((overloadable))
     25     rsSetObject(rs_program_vertex *dst, rs_program_vertex src);
     26 extern void __attribute__((overloadable))
     27     rsSetObject(rs_program_raster *dst, rs_program_raster src);
     28 extern void __attribute__((overloadable))
     29     rsSetObject(rs_program_store *dst, rs_program_store src);
     30 extern void __attribute__((overloadable))
     31     rsSetObject(rs_font *dst, rs_font src);
     32 
     33 /**
     34  * Sets the object to NULL.
     35  *
     36  * @return bool
     37  */
     38 extern void __attribute__((overloadable))
     39     rsClearObject(rs_element *dst);
     40 extern void __attribute__((overloadable))
     41     rsClearObject(rs_type *dst);
     42 extern void __attribute__((overloadable))
     43     rsClearObject(rs_allocation *dst);
     44 extern void __attribute__((overloadable))
     45     rsClearObject(rs_sampler *dst);
     46 extern void __attribute__((overloadable))
     47     rsClearObject(rs_script *dst);
     48 extern void __attribute__((overloadable))
     49     rsClearObject(rs_mesh *dst);
     50 extern void __attribute__((overloadable))
     51     rsClearObject(rs_program_fragment *dst);
     52 extern void __attribute__((overloadable))
     53     rsClearObject(rs_program_vertex *dst);
     54 extern void __attribute__((overloadable))
     55     rsClearObject(rs_program_raster *dst);
     56 extern void __attribute__((overloadable))
     57     rsClearObject(rs_program_store *dst);
     58 extern void __attribute__((overloadable))
     59     rsClearObject(rs_font *dst);
     60 
     61 /**
     62  * Tests if the object is valid.  Returns true if the object is valid, false if
     63  * it is NULL.
     64  *
     65  * @return bool
     66  */
     67 extern bool __attribute__((overloadable))
     68     rsIsObject(rs_element);
     69 extern bool __attribute__((overloadable))
     70     rsIsObject(rs_type);
     71 extern bool __attribute__((overloadable))
     72     rsIsObject(rs_allocation);
     73 extern bool __attribute__((overloadable))
     74     rsIsObject(rs_sampler);
     75 extern bool __attribute__((overloadable))
     76     rsIsObject(rs_script);
     77 extern bool __attribute__((overloadable))
     78     rsIsObject(rs_mesh);
     79 extern bool __attribute__((overloadable))
     80     rsIsObject(rs_program_fragment);
     81 extern bool __attribute__((overloadable))
     82     rsIsObject(rs_program_vertex);
     83 extern bool __attribute__((overloadable))
     84     rsIsObject(rs_program_raster);
     85 extern bool __attribute__((overloadable))
     86     rsIsObject(rs_program_store);
     87 extern bool __attribute__((overloadable))
     88     rsIsObject(rs_font);
     89 
     90 
     91 /**
     92  * Returns the Allocation for a given pointer.  The pointer should point within
     93  * a valid allocation.  The results are undefined if the pointer is not from a
     94  * valid allocation.
     95  */
     96 extern rs_allocation __attribute__((overloadable))
     97     rsGetAllocation(const void *);
     98 
     99 /**
    100  * Query the dimension of an allocation.
    101  *
    102  * @return uint32_t The X dimension of the allocation.
    103  */
    104 extern uint32_t __attribute__((overloadable))
    105     rsAllocationGetDimX(rs_allocation);
    106 
    107 /**
    108  * Query the dimension of an allocation.
    109  *
    110  * @return uint32_t The Y dimension of the allocation.
    111  */
    112 extern uint32_t __attribute__((overloadable))
    113     rsAllocationGetDimY(rs_allocation);
    114 
    115 /**
    116  * Query the dimension of an allocation.
    117  *
    118  * @return uint32_t The Z dimension of the allocation.
    119  */
    120 extern uint32_t __attribute__((overloadable))
    121     rsAllocationGetDimZ(rs_allocation);
    122 
    123 /**
    124  * Query an allocation for the presence of more than one LOD.
    125  *
    126  * @return uint32_t Returns 1 if more than one LOD is present, 0 otherwise.
    127  */
    128 extern uint32_t __attribute__((overloadable))
    129     rsAllocationGetDimLOD(rs_allocation);
    130 
    131 /**
    132  * Query an allocation for the presence of more than one face.
    133  *
    134  * @return uint32_t Returns 1 if more than one face is present, 0 otherwise.
    135  */
    136 extern uint32_t __attribute__((overloadable))
    137     rsAllocationGetDimFaces(rs_allocation);
    138 
    139 // Extract a single element from an allocation.
    140 extern const void * __attribute__((overloadable))
    141     rsGetElementAt(rs_allocation, uint32_t x);
    142 extern const void * __attribute__((overloadable))
    143     rsGetElementAt(rs_allocation, uint32_t x, uint32_t y);
    144 extern const void * __attribute__((overloadable))
    145     rsGetElementAt(rs_allocation, uint32_t x, uint32_t y, uint32_t z);
    146 
    147 // Return a random value between 0 (or min_value) and max_malue.
    148 extern int __attribute__((overloadable))
    149     rsRand(int max_value);
    150 extern int __attribute__((overloadable))
    151     rsRand(int min_value, int max_value);
    152 extern float __attribute__((overloadable))
    153     rsRand(float max_value);
    154 extern float __attribute__((overloadable))
    155     rsRand(float min_value, float max_value);
    156 
    157 // return the fractional part of a float
    158 // min(v - ((int)floor(v)), 0x1.fffffep-1f);
    159 extern float __attribute__((overloadable))
    160     rsFrac(float);
    161 
    162 // Send a message back to the client.  Will not block and returns true
    163 // if the message was sendable and false if the fifo was full.
    164 // A message ID is required.  Data payload is optional.
    165 extern bool __attribute__((overloadable))
    166     rsSendToClient(int cmdID);
    167 extern bool __attribute__((overloadable))
    168     rsSendToClient(int cmdID, const void *data, uint len);
    169 
    170 // Send a message back to the client, blocking until the message is queued.
    171 // A message ID is required.  Data payload is optional.
    172 extern void __attribute__((overloadable))
    173     rsSendToClientBlocking(int cmdID);
    174 extern void __attribute__((overloadable))
    175     rsSendToClientBlocking(int cmdID, const void *data, uint len);
    176 
    177 
    178 // Script to Script
    179 enum rs_for_each_strategy {
    180     RS_FOR_EACH_STRATEGY_SERIAL,
    181     RS_FOR_EACH_STRATEGY_DONT_CARE,
    182     RS_FOR_EACH_STRATEGY_DST_LINEAR,
    183     RS_FOR_EACH_STRATEGY_TILE_SMALL,
    184     RS_FOR_EACH_STRATEGY_TILE_MEDIUM,
    185     RS_FOR_EACH_STRATEGY_TILE_LARGE
    186 };
    187 
    188 typedef struct rs_script_call {
    189     enum rs_for_each_strategy strategy;
    190     uint32_t xStart;
    191     uint32_t xEnd;
    192     uint32_t yStart;
    193     uint32_t yEnd;
    194     uint32_t zStart;
    195     uint32_t zEnd;
    196     uint32_t arrayStart;
    197     uint32_t arrayEnd;
    198 } rs_script_call_t;
    199 
    200 extern void __attribute__((overloadable))
    201     rsForEach(rs_script script, rs_allocation input,
    202               rs_allocation output, const void * usrData);
    203 
    204 extern void __attribute__((overloadable))
    205     rsForEach(rs_script script, rs_allocation input,
    206               rs_allocation output, const void * usrData,
    207               const rs_script_call_t *);
    208 
    209 #endif
    210