2010-07-07 11:55:51 -07:00
|
|
|
#ifndef __RS_MATH_RSH__
|
|
|
|
#define __RS_MATH_RSH__
|
|
|
|
|
2011-01-28 15:49:07 -08:00
|
|
|
/**
|
|
|
|
* Copy reference to the specified object.
|
|
|
|
*
|
|
|
|
* @param dst
|
|
|
|
* @param src
|
|
|
|
*/
|
2010-08-16 12:41:48 -07:00
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_element *dst, rs_element src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_type *dst, rs_type src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_allocation *dst, rs_allocation src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_sampler *dst, rs_sampler src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_script *dst, rs_script src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_mesh *dst, rs_mesh src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_program_fragment *dst, rs_program_fragment src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_program_vertex *dst, rs_program_vertex src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_program_raster *dst, rs_program_raster src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_program_store *dst, rs_program_store src);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSetObject(rs_font *dst, rs_font src);
|
|
|
|
|
2011-01-28 15:49:07 -08:00
|
|
|
/**
|
|
|
|
* Sets the object to NULL.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2010-08-16 12:41:48 -07:00
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_element *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_type *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_allocation *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_sampler *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_script *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_mesh *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_program_fragment *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_program_vertex *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_program_raster *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_program_store *dst);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsClearObject(rs_font *dst);
|
|
|
|
|
2011-01-28 15:49:07 -08:00
|
|
|
/**
|
|
|
|
* Tests if the object is valid. Returns true if the object is valid, false if
|
|
|
|
* it is NULL.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2010-08-16 12:41:48 -07:00
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_element);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_type);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_allocation);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_sampler);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_script);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_mesh);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_program_fragment);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_program_vertex);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_program_raster);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_program_store);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsIsObject(rs_font);
|
|
|
|
|
|
|
|
|
2011-01-28 15:49:07 -08:00
|
|
|
/**
|
|
|
|
* Returns the Allocation for a given pointer. The pointer should point within
|
|
|
|
* a valid allocation. The results are undefined if the pointer is not from a
|
|
|
|
* valid allocation.
|
|
|
|
*/
|
2010-07-28 11:17:53 -07:00
|
|
|
extern rs_allocation __attribute__((overloadable))
|
|
|
|
rsGetAllocation(const void *);
|
2010-07-29 17:31:14 -07:00
|
|
|
|
2011-01-28 15:49:07 -08:00
|
|
|
/**
|
|
|
|
* Mark the contents of an allocation as dirty. This forces any other scripts
|
|
|
|
* using the allocation to receive the updated
|
|
|
|
*/
|
2010-09-01 16:34:48 -07:00
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsAllocationMarkDirty(rs_allocation);
|
|
|
|
|
2011-01-28 15:49:07 -08:00
|
|
|
/**
|
|
|
|
* Query the dimension of an allocation.
|
|
|
|
*
|
|
|
|
* @return uint32_t The X dimension of the allocation.
|
|
|
|
*/
|
2010-07-28 11:17:53 -07:00
|
|
|
extern uint32_t __attribute__((overloadable))
|
|
|
|
rsAllocationGetDimX(rs_allocation);
|
2011-01-28 15:49:07 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the dimension of an allocation.
|
|
|
|
*
|
|
|
|
* @return uint32_t The Y dimension of the allocation.
|
|
|
|
*/
|
2010-07-28 11:17:53 -07:00
|
|
|
extern uint32_t __attribute__((overloadable))
|
|
|
|
rsAllocationGetDimY(rs_allocation);
|
2011-01-28 15:49:07 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the dimension of an allocation.
|
|
|
|
*
|
|
|
|
* @return uint32_t The Z dimension of the allocation.
|
|
|
|
*/
|
2010-07-28 11:17:53 -07:00
|
|
|
extern uint32_t __attribute__((overloadable))
|
|
|
|
rsAllocationGetDimZ(rs_allocation);
|
2011-01-28 15:49:07 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query an allocation for the presence of more than one LOD.
|
|
|
|
*
|
|
|
|
* @return uint32_t Returns 1 if more than one LOD is present, 0 otherwise.
|
|
|
|
*/
|
2010-07-28 11:17:53 -07:00
|
|
|
extern uint32_t __attribute__((overloadable))
|
|
|
|
rsAllocationGetDimLOD(rs_allocation);
|
2011-01-28 15:49:07 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query an allocation for the presence of more than one face.
|
|
|
|
*
|
|
|
|
* @return uint32_t Returns 1 if more than one face is present, 0 otherwise.
|
|
|
|
*/
|
2010-07-28 11:17:53 -07:00
|
|
|
extern uint32_t __attribute__((overloadable))
|
|
|
|
rsAllocationGetDimFaces(rs_allocation);
|
2010-05-19 17:22:57 -07:00
|
|
|
|
2010-07-29 17:31:14 -07:00
|
|
|
// Extract a single element from an allocation.
|
2010-07-19 15:38:19 -07:00
|
|
|
extern const void * __attribute__((overloadable))
|
|
|
|
rsGetElementAt(rs_allocation, uint32_t x);
|
|
|
|
extern const void * __attribute__((overloadable))
|
|
|
|
rsGetElementAt(rs_allocation, uint32_t x, uint32_t y);
|
|
|
|
extern const void * __attribute__((overloadable))
|
|
|
|
rsGetElementAt(rs_allocation, uint32_t x, uint32_t y, uint32_t z);
|
2010-05-19 17:22:57 -07:00
|
|
|
|
2010-07-29 17:31:14 -07:00
|
|
|
// Return a random value between 0 (or min_value) and max_malue.
|
|
|
|
extern int __attribute__((overloadable))
|
|
|
|
rsRand(int max_value);
|
|
|
|
extern int __attribute__((overloadable))
|
|
|
|
rsRand(int min_value, int max_value);
|
|
|
|
extern float __attribute__((overloadable))
|
|
|
|
rsRand(float max_value);
|
|
|
|
extern float __attribute__((overloadable))
|
|
|
|
rsRand(float min_value, float max_value);
|
|
|
|
|
|
|
|
// return the fractional part of a float
|
|
|
|
// min(v - ((int)floor(v)), 0x1.fffffep-1f);
|
|
|
|
extern float __attribute__((overloadable))
|
|
|
|
rsFrac(float);
|
2010-05-19 17:22:57 -07:00
|
|
|
|
2010-07-29 17:31:14 -07:00
|
|
|
// Send a message back to the client. Will not block and returns true
|
|
|
|
// if the message was sendable and false if the fifo was full.
|
|
|
|
// A message ID is required. Data payload is optional.
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsSendToClient(int cmdID);
|
|
|
|
extern bool __attribute__((overloadable))
|
|
|
|
rsSendToClient(int cmdID, const void *data, uint len);
|
|
|
|
|
|
|
|
// Send a message back to the client, blocking until the message is queued.
|
|
|
|
// A message ID is required. Data payload is optional.
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSendToClientBlocking(int cmdID);
|
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsSendToClientBlocking(int cmdID, const void *data, uint len);
|
2010-05-19 17:22:57 -07:00
|
|
|
|
2010-08-11 13:26:28 -07:00
|
|
|
|
2010-05-28 18:23:22 -07:00
|
|
|
// Script to Script
|
2010-08-11 13:26:28 -07:00
|
|
|
enum rs_for_each_strategy {
|
|
|
|
RS_FOR_EACH_STRATEGY_SERIAL,
|
|
|
|
RS_FOR_EACH_STRATEGY_DONT_CARE,
|
|
|
|
RS_FOR_EACH_STRATEGY_DST_LINEAR,
|
|
|
|
RS_FOR_EACH_STRATEGY_TILE_SMALL,
|
|
|
|
RS_FOR_EACH_STRATEGY_TILE_MEDIUM,
|
|
|
|
RS_FOR_EACH_STRATEGY_TILE_LARGE
|
|
|
|
};
|
|
|
|
|
2010-07-15 17:11:13 -07:00
|
|
|
typedef struct rs_script_call {
|
2010-08-11 13:26:28 -07:00
|
|
|
enum rs_for_each_strategy strategy;
|
2010-07-09 15:34:32 -07:00
|
|
|
uint32_t xStart;
|
|
|
|
uint32_t xEnd;
|
|
|
|
uint32_t yStart;
|
|
|
|
uint32_t yEnd;
|
|
|
|
uint32_t zStart;
|
|
|
|
uint32_t zEnd;
|
|
|
|
uint32_t arrayStart;
|
|
|
|
uint32_t arrayEnd;
|
2010-07-15 17:11:13 -07:00
|
|
|
} rs_script_call_t;
|
|
|
|
|
2010-07-29 17:31:14 -07:00
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsForEach(rs_script script, rs_allocation input,
|
|
|
|
rs_allocation output, const void * usrData);
|
2010-07-09 15:34:32 -07:00
|
|
|
|
2010-07-29 17:31:14 -07:00
|
|
|
extern void __attribute__((overloadable))
|
|
|
|
rsForEach(rs_script script, rs_allocation input,
|
|
|
|
rs_allocation output, const void * usrData,
|
|
|
|
const rs_script_call_t *);
|
2010-05-28 18:23:22 -07:00
|
|
|
|
2010-07-07 11:55:51 -07:00
|
|
|
#endif
|