Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_compat_cpu.h
| Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | ccl_always_inline float4 interp(float x, float y, bool periodic = true) | ||||
| else { | else { | ||||
| ix = wrap_clamp(ix, width); | ix = wrap_clamp(ix, width); | ||||
| iy = wrap_clamp(iy, height); | iy = wrap_clamp(iy, height); | ||||
| nix = wrap_clamp(ix+1, width); | nix = wrap_clamp(ix+1, width); | ||||
| niy = wrap_clamp(iy+1, height); | niy = wrap_clamp(iy+1, height); | ||||
| } | } | ||||
| if( interpolation == 0){ | |||||
dingto: Code Style (Spaces) | |||||
| float4 r = (1.0f - ty)*(1.0f - tx)*read(data[ix + iy*width]); | float4 r = (1.0f - ty)*(1.0f - tx)*read(data[ix + iy*width]); | ||||
| r += (1.0f - ty)*tx*read(data[nix + iy*width]); | r += (1.0f - ty)*tx*read(data[nix + iy*width]); | ||||
| r += ty*(1.0f - tx)*read(data[ix + niy*width]); | r += ty*(1.0f - tx)*read(data[ix + niy*width]); | ||||
| r += ty*tx*read(data[nix + niy*width]); | r += ty*tx*read(data[nix + niy*width]); | ||||
| return r; | return r; | ||||
| } else { // interpolation == 1 | |||||
dingtoUnsubmitted Not Done Inline Actions"else" in new line. dingto: "else" in new line. | |||||
| return read(data[ix + iy*width]); | |||||
| } | |||||
| } | } | ||||
| int interpolation; | |||||
| T *data; | T *data; | ||||
| int width, height; | int width, height; | ||||
| }; | }; | ||||
| typedef texture<float4> texture_float4; | typedef texture<float4> texture_float4; | ||||
| typedef texture<float2> texture_float2; | typedef texture<float2> texture_float2; | ||||
| typedef texture<float> texture_float; | typedef texture<float> texture_float; | ||||
| typedef texture<uint> texture_uint; | typedef texture<uint> texture_uint; | ||||
| typedef texture<int> texture_int; | typedef texture<int> texture_int; | ||||
| typedef texture<uint4> texture_uint4; | typedef texture<uint4> texture_uint4; | ||||
| typedef texture<uchar4> texture_uchar4; | typedef texture<uchar4> texture_uchar4; | ||||
| typedef texture_image<float4> texture_image_float4; | typedef texture_image<float4> texture_image_float4; | ||||
| typedef texture_image<uchar4> texture_image_uchar4; | typedef texture_image<uchar4> texture_image_uchar4; | ||||
| /* Macros to handle different memory storage on different devices */ | /* Macros to handle different memory storage on different devices */ | ||||
| #define kernel_tex_fetch(tex, index) (kg->tex.fetch(index)) | #define kernel_tex_fetch(tex, index) (kg->tex.fetch(index)) | ||||
| #define kernel_tex_fetch_m128(tex, index) (kg->tex.fetch_m128(index)) | #define kernel_tex_fetch_m128(tex, index) (kg->tex.fetch_m128(index)) | ||||
| #define kernel_tex_fetch_m128i(tex, index) (kg->tex.fetch_m128i(index)) | #define kernel_tex_fetch_m128i(tex, index) (kg->tex.fetch_m128i(index)) | ||||
| #define kernel_tex_lookup(tex, t, offset, size) (kg->tex.lookup(t, offset, size)) | #define kernel_tex_lookup(tex, t, offset, size) (kg->tex.lookup(t, offset, size)) | ||||
| #define kernel_tex_image_interp(tex, x, y) ((tex < MAX_FLOAT_IMAGES) ? kg->texture_float_images[tex].interp(x, y) : kg->texture_byte_images[tex - MAX_FLOAT_IMAGES].interp(x, y)) | #define kernel_tex_image_interp(tex, x, y) ((tex < MAX_FLOAT_IMAGES) ? kg->texture_float_images[tex].interp(x, y) : kg->texture_byte_images[tex - MAX_FLOAT_IMAGES].interp(x, y)) | ||||
| #define kernel_data (kg->__data) | #define kernel_data (kg->__data) | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
| #endif /* __KERNEL_COMPAT_CPU_H__ */ | #endif /* __KERNEL_COMPAT_CPU_H__ */ | ||||
Code Style (Spaces)