Merge branch 'master' into blender2.8
This commit is contained in:
commit
1e107fa514
|
@ -163,7 +163,7 @@ if(WITH_CODEC_FFMPEG)
|
|||
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENJPEG OR WITH_CODEC_FFMPEG)
|
||||
if(WITH_IMAGE_OPENJPEG OR WITH_CODEC_FFMPEG)
|
||||
# use openjpeg from libdir that is linked into ffmpeg
|
||||
set(OPENJPEG ${LIBDIR}/openjpeg)
|
||||
set(WITH_SYSTEM_OPENJPEG ON)
|
||||
|
@ -293,6 +293,7 @@ if(WITH_OPENIMAGEIO)
|
|||
${JPEG_LIBRARIES}
|
||||
${TIFF_LIBRARY}
|
||||
${OPENEXR_LIBRARIES}
|
||||
${OPENJPEG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
)
|
||||
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${LIBDIR}/ffmpeg/lib/libwebp.a)
|
||||
|
|
|
@ -85,7 +85,6 @@ void device_memory::device_free()
|
|||
|
||||
void device_memory::device_copy_to()
|
||||
{
|
||||
assert(type != MEM_PIXELS && type != MEM_WRITE_ONLY);
|
||||
if(data_size) {
|
||||
device->mem_copy_to(*this);
|
||||
}
|
||||
|
@ -99,7 +98,6 @@ void device_memory::device_copy_from(int y, int w, int h, int elem)
|
|||
|
||||
void device_memory::device_zero()
|
||||
{
|
||||
assert(type != MEM_PIXELS && type != MEM_WRITE_ONLY);
|
||||
if(data_size) {
|
||||
device->mem_zero(*this);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ class Device;
|
|||
|
||||
enum MemoryType {
|
||||
MEM_READ_ONLY,
|
||||
MEM_WRITE_ONLY,
|
||||
MEM_READ_WRITE,
|
||||
MEM_TEXTURE,
|
||||
MEM_PIXELS
|
||||
|
@ -297,13 +296,13 @@ public:
|
|||
device_free();
|
||||
host_free(data_pointer, sizeof(T)*data_size);
|
||||
data_pointer = host_alloc(sizeof(T)*new_size);
|
||||
assert(device_pointer == 0);
|
||||
}
|
||||
|
||||
data_size = new_size;
|
||||
data_width = width;
|
||||
data_height = height;
|
||||
data_depth = depth;
|
||||
assert(device_pointer == 0);
|
||||
|
||||
return get_data();
|
||||
}
|
||||
|
@ -325,13 +324,13 @@ public:
|
|||
device_free();
|
||||
host_free(data_pointer, sizeof(T)*data_size);
|
||||
data_pointer = new_ptr;
|
||||
assert(device_pointer == 0);
|
||||
}
|
||||
|
||||
data_size = new_size;
|
||||
data_width = width;
|
||||
data_height = height;
|
||||
data_depth = depth;
|
||||
assert(device_pointer == 0);
|
||||
|
||||
return get_data();
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
foreach(SubDevice& sub, devices) {
|
||||
mem.device = sub.device;
|
||||
mem.device_pointer = 0;
|
||||
mem.device_size = 0;
|
||||
|
||||
sub.device->mem_alloc(mem);
|
||||
sub.ptr_map[key] = mem.device_pointer;
|
||||
|
@ -120,16 +121,19 @@ public:
|
|||
|
||||
mem.device = this;
|
||||
mem.device_pointer = key;
|
||||
stats.mem_alloc(mem.device_size);
|
||||
}
|
||||
|
||||
void mem_copy_to(device_memory& mem)
|
||||
{
|
||||
device_ptr existing_key = mem.device_pointer;
|
||||
device_ptr key = (existing_key)? existing_key: unique_key++;
|
||||
size_t existing_size = mem.device_size;
|
||||
|
||||
foreach(SubDevice& sub, devices) {
|
||||
mem.device = sub.device;
|
||||
mem.device_pointer = (existing_key)? sub.ptr_map[existing_key]: 0;
|
||||
mem.device_size = existing_size;
|
||||
|
||||
sub.device->mem_copy_to(mem);
|
||||
sub.ptr_map[key] = mem.device_pointer;
|
||||
|
@ -137,6 +141,7 @@ public:
|
|||
|
||||
mem.device = this;
|
||||
mem.device_pointer = key;
|
||||
stats.mem_alloc(mem.device_size - existing_size);
|
||||
}
|
||||
|
||||
void mem_copy_from(device_memory& mem, int y, int w, int h, int elem)
|
||||
|
@ -163,10 +168,12 @@ public:
|
|||
{
|
||||
device_ptr existing_key = mem.device_pointer;
|
||||
device_ptr key = (existing_key)? existing_key: unique_key++;
|
||||
size_t existing_size = mem.device_size;
|
||||
|
||||
foreach(SubDevice& sub, devices) {
|
||||
mem.device = sub.device;
|
||||
mem.device_pointer = (existing_key)? sub.ptr_map[existing_key]: 0;
|
||||
mem.device_size = existing_size;
|
||||
|
||||
sub.device->mem_zero(mem);
|
||||
sub.ptr_map[key] = mem.device_pointer;
|
||||
|
@ -174,15 +181,18 @@ public:
|
|||
|
||||
mem.device = this;
|
||||
mem.device_pointer = key;
|
||||
stats.mem_alloc(mem.device_size - existing_size);
|
||||
}
|
||||
|
||||
void mem_free(device_memory& mem)
|
||||
{
|
||||
device_ptr key = mem.device_pointer;
|
||||
size_t existing_size = mem.device_size;
|
||||
|
||||
foreach(SubDevice& sub, devices) {
|
||||
mem.device = sub.device;
|
||||
mem.device_pointer = sub.ptr_map[key];
|
||||
mem.device_size = existing_size;
|
||||
|
||||
sub.device->mem_free(mem);
|
||||
sub.ptr_map.erase(sub.ptr_map.find(key));
|
||||
|
@ -190,6 +200,8 @@ public:
|
|||
|
||||
mem.device = this;
|
||||
mem.device_pointer = 0;
|
||||
mem.device_size = 0;
|
||||
stats.mem_free(existing_size);
|
||||
}
|
||||
|
||||
void const_copy_to(const char *name, void *host, size_t size)
|
||||
|
|
|
@ -282,7 +282,7 @@ public:
|
|||
|
||||
/* Can't transfer OpenGL texture over network. */
|
||||
if(mem.type == MEM_PIXELS) {
|
||||
mem.type = MEM_WRITE_ONLY;
|
||||
mem.type = MEM_READ_WRITE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -319,8 +319,6 @@ void OpenCLDeviceBase::mem_alloc(device_memory& mem)
|
|||
|
||||
if(mem.type == MEM_READ_ONLY || mem.type == MEM_TEXTURE)
|
||||
mem_flag = CL_MEM_READ_ONLY;
|
||||
else if(mem.type == MEM_WRITE_ONLY || mem.type == MEM_PIXELS)
|
||||
mem_flag = CL_MEM_WRITE_ONLY;
|
||||
else
|
||||
mem_flag = CL_MEM_READ_WRITE;
|
||||
|
||||
|
@ -484,8 +482,6 @@ device_ptr OpenCLDeviceBase::mem_alloc_sub_ptr(device_memory& mem, int offset, i
|
|||
cl_mem_flags mem_flag;
|
||||
if(mem.type == MEM_READ_ONLY || mem.type == MEM_TEXTURE)
|
||||
mem_flag = CL_MEM_READ_ONLY;
|
||||
else if(mem.type == MEM_WRITE_ONLY || mem.type == MEM_PIXELS)
|
||||
mem_flag = CL_MEM_WRITE_ONLY;
|
||||
else
|
||||
mem_flag = CL_MEM_READ_WRITE;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static void shade_background_pixels(Device *device, DeviceScene *dscene, int res
|
|||
int height = res;
|
||||
|
||||
device_vector<uint4> d_input(device, "background_input", MEM_READ_ONLY);
|
||||
device_vector<float4> d_output(device, "background_output", MEM_WRITE_ONLY);
|
||||
device_vector<float4> d_output(device, "background_output", MEM_READ_WRITE);
|
||||
|
||||
uint4 *d_input_data = d_input.alloc(width*height);
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me
|
|||
return false;
|
||||
|
||||
/* run device task */
|
||||
device_vector<float4> d_output(device, "displace_output", MEM_WRITE_ONLY);
|
||||
device_vector<float4> d_output(device, "displace_output", MEM_READ_WRITE);
|
||||
d_output.alloc(d_input_size);
|
||||
d_output.zero_to_device();
|
||||
d_input.copy_to_device();
|
||||
|
|
|
@ -42,10 +42,12 @@ if(WITH_CYCLES_OSL)
|
|||
${LLVM_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
if(WITH_IMAGE_OPENJPEG AND NOT WITH_SYSTEM_OPENJPEG)
|
||||
list(APPEND ALL_CYCLES_LIBRARIES
|
||||
extern_openjpeg
|
||||
)
|
||||
if(WITH_IMAGE_OPENJPEG)
|
||||
if(WITH_SYSTEM_OPENJPEG)
|
||||
list(APPEND ALL_CYCLES_LIBRARIES ${OPENJPEG_LIBRARIES})
|
||||
else()
|
||||
list(APPEND ALL_CYCLES_LIBRARIES extern_openjpeg)
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_CYCLES_OPENSUBDIV)
|
||||
add_definitions(-DWITH_OPENSUBDIV)
|
||||
|
|
Loading…
Reference in New Issue