diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index ea1e20d1500..3c0fb880948 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -173,10 +173,10 @@ public: virtual void tex_alloc(const char * /*name*/, device_memory& /*mem*/, InterpolationType interpolation = INTERPOLATION_NONE, - bool periodic = false) + ExtensionType extension = EXTENSION_REPEAT) { (void)interpolation; /* Ignored. */ - (void)periodic; /* Ignored. */ + (void)extension; /* Ignored. */ }; virtual void tex_free(device_memory& /*mem*/) {}; diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index ec82b3805c4..f06963c146e 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -126,7 +126,7 @@ public: void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, - bool periodic) + ExtensionType extension) { VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; kernel_tex_copy(&kernel_globals, @@ -136,7 +136,7 @@ public: mem.data_height, mem.data_depth, interpolation, - periodic); + extension); mem.device_pointer = mem.data_pointer; mem.device_size = mem.memory_size(); stats.mem_alloc(mem.device_size); diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 4a9c27f5429..9703b786289 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -416,7 +416,10 @@ public: cuda_pop_context(); } - void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic) + void tex_alloc(const char *name, + device_memory& mem, + InterpolationType interpolation, + ExtensionType extension) { /* todo: support 3D textures, only CPU for now */ VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; @@ -510,7 +513,7 @@ public: cuda_assert(cuTexRefSetFlags(texref, CU_TRSF_READ_AS_INTEGER)); } - if(periodic) { + if(extension == EXTENSION_REPEAT) { cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_WRAP)); cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_WRAP)); } diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index c61e550151f..8fb841b2b0d 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -169,13 +169,17 @@ public: sub.device->const_copy_to(name, host, size); } - void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic) + void tex_alloc(const char *name, + device_memory& mem, + InterpolationType + interpolation, + ExtensionType extension) { VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; foreach(SubDevice& sub, devices) { mem.device_pointer = 0; - sub.device->tex_alloc(name, mem, interpolation, periodic); + sub.device->tex_alloc(name, mem, interpolation, extension); sub.ptr_map[unique_ptr] = mem.device_pointer; } diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp index 1d6066c94dc..d1f941ad9f2 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -163,7 +163,10 @@ public: snd.write_buffer(host, size); } - void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic) + void tex_alloc(const char *name, + device_memory& mem, + InterpolationType interpolation, + ExtensionType extension) { VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; @@ -178,7 +181,7 @@ public: snd.add(name_string); snd.add(mem); snd.add(interpolation); - snd.add(periodic); + snd.add(extension); snd.write(); snd.write_buffer((void*)mem.data_pointer, mem.memory_size()); } @@ -571,13 +574,13 @@ protected: network_device_memory mem; string name; InterpolationType interpolation; - bool periodic; + ExtensionType extension_typr; device_ptr client_pointer; rcv.read(name); rcv.read(mem); rcv.read(interpolation); - rcv.read(periodic); + rcv.read(extension); lock.unlock(); client_pointer = mem.device_pointer; @@ -593,7 +596,7 @@ protected: rcv.read_buffer((uint8_t*)mem.data_pointer, data_size); - device->tex_alloc(name.c_str(), mem, interpolation, periodic); + device->tex_alloc(name.c_str(), mem, interpolation, extension); pointer_mapping_insert(client_pointer, mem.device_pointer); } diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 0cc49e846cc..fee9a8a803d 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -1179,7 +1179,7 @@ public: void tex_alloc(const char *name, device_memory& mem, InterpolationType /*interpolation*/, - bool /*periodic*/) + ExtensionType /*extension*/) { VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; mem_alloc(mem, MEM_READ_ONLY); diff --git a/intern/cycles/kernel/kernel.h b/intern/cycles/kernel/kernel.h index 5c34ddcfbcb..b2596d10ee7 100644 --- a/intern/cycles/kernel/kernel.h +++ b/intern/cycles/kernel/kernel.h @@ -39,7 +39,7 @@ void kernel_tex_copy(KernelGlobals *kg, size_t height, size_t depth, InterpolationType interpolation=INTERPOLATION_LINEAR, - bool periodic = true); + ExtensionType extension = EXTENSION_REPEAT); void kernel_cpu_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride); diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index a780c356a18..be8e54b3d3d 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -138,7 +138,7 @@ template struct texture_image { if(interpolation == INTERPOLATION_CLOSEST) { frac(x*(float)width, &ix); frac(y*(float)height, &iy); - if(periodic) { + if(extension == EXTENSION_REPEAT) { ix = wrap_periodic(ix, width); iy = wrap_periodic(iy, height); @@ -153,7 +153,7 @@ template struct texture_image { float tx = frac(x*(float)width - 0.5f, &ix); float ty = frac(y*(float)height - 0.5f, &iy); - if(periodic) { + if(extension == EXTENSION_REPEAT) { ix = wrap_periodic(ix, width); iy = wrap_periodic(iy, height); @@ -180,7 +180,7 @@ template struct texture_image { const float tx = frac(x*(float)width - 0.5f, &ix); const float ty = frac(y*(float)height - 0.5f, &iy); int pix, piy, nnix, nniy; - if(periodic) { + if(extension == EXTENSION_REPEAT) { ix = wrap_periodic(ix, width); iy = wrap_periodic(iy, height); @@ -251,7 +251,7 @@ template struct texture_image { frac(y*(float)height, &iy); frac(z*(float)depth, &iz); - if(periodic) { + if(extension == EXTENSION_REPEAT) { ix = wrap_periodic(ix, width); iy = wrap_periodic(iy, height); iz = wrap_periodic(iz, depth); @@ -269,7 +269,7 @@ template struct texture_image { float ty = frac(y*(float)height - 0.5f, &iy); float tz = frac(z*(float)depth - 0.5f, &iz); - if(periodic) { + if(extension == EXTENSION_REPEAT) { ix = wrap_periodic(ix, width); iy = wrap_periodic(iy, height); iz = wrap_periodic(iz, depth); @@ -309,7 +309,7 @@ template struct texture_image { const float tz = frac(z*(float)depth - 0.5f, &iz); int pix, piy, piz, nnix, nniy, nniz; - if(periodic) { + if(extension == EXTENSION_REPEAT) { ix = wrap_periodic(ix, width); iy = wrap_periodic(iy, height); iz = wrap_periodic(iz, depth); @@ -392,7 +392,7 @@ template struct texture_image { T *data; int interpolation; - bool periodic; + ExtensionType extension; int width, height, depth; #undef SET_CUBIC_SPLINE_WEIGHTS }; diff --git a/intern/cycles/kernel/kernels/cpu/kernel.cpp b/intern/cycles/kernel/kernels/cpu/kernel.cpp index 2dbd9e62ee7..2c8d3503c1a 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel.cpp +++ b/intern/cycles/kernel/kernels/cpu/kernel.cpp @@ -45,7 +45,7 @@ void kernel_tex_copy(KernelGlobals *kg, size_t height, size_t depth, InterpolationType interpolation, - bool periodic) + ExtensionType extension) { if(0) { } @@ -71,7 +71,7 @@ void kernel_tex_copy(KernelGlobals *kg, tex->data = (float4*)mem; tex->dimensions_set(width, height, depth); tex->interpolation = interpolation; - tex->periodic = periodic; + tex->extension = extension; } } else if(strstr(name, "__tex_image")) { @@ -87,7 +87,7 @@ void kernel_tex_copy(KernelGlobals *kg, tex->data = (uchar4*)mem; tex->dimensions_set(width, height, depth); tex->interpolation = interpolation; - tex->periodic = periodic; + tex->extension = extension; } } else diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index dc9aeeefc6d..7bceb8a8bfa 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -714,7 +714,7 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl device->tex_alloc(name.c_str(), tex_img, img->interpolation, - img->extension == EXTENSION_REPEAT); + img->extension); } } else { @@ -749,7 +749,7 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl device->tex_alloc(name.c_str(), tex_img, img->interpolation, - img->extension == EXTENSION_REPEAT); + img->extension); } }