GLSL: Handle more math functions correctly

Map intrinsics to correct GLSL functions:
- trigonometric functions (sin, cos, tan, asin, acos, atan, atan2)
- exponential functions (pow, exp, log)
- general functions (floor, ceil, lerp)

Since GLSL doesn't support bit arithmetic, don't use C backend to generate
code for "Mod" and "Div".
Correct implementation of sdiv by casting to float and back to int
Simplify common type casts in GLSL

Since small integer types are represented as floats, a lot of redundant type
casts were generated (e.g., float(uint8(expr)) -> float(float(expr))).

In some cases, this almost halves the number of temporary variables generated.
Correctly map lerp() to mix intrinsic
Fix indentation
Handle wider range of types when mapping filter Params to uniforms.

For example, uint8_t parameters are stored as float uniforms. This patch
fixed the parameter declaration in the special comment preceding
the shader as well as correctly setting the uniforms at runtime.
GLSL: Improve copy_to_dev and copy_to_host

- don't use GL_UNPACK_ROW_LENGTH, which is unavailable in OpenGL ES
- only transfer directly to/from host buffer if memory is contiguous
- honor min[] values of associated buffer
Merge branch 'master' into glsl_codegen
Pass string by const ref instead of by value
GLSL: fix codegen for mod function, add small test for special functions
Merge branch 'master' into glsl_codegen
Use simplify() instead of home-grown simplification

Also add an internal test for CodeGen_GLSL.
GLSL supports integer division, no need to use sdiv()
Directly map Halide intrinsics to corresponding GLSL builtins

There is actually no need to use #defines for this purpose. This also allows
us to emit better error messages when unsupported intrinsics (such as
reinterpret or bit operations) are used in a filter.
Merge branch 'master' into glsl_codegen
Implement correct integer division in GLSL
Merge pull request #381 from halide/glsl_codegen

GLSL: Handle more intrinsics, fix bugs in code generation and texture transfer