Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-10-25 00:23:16 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-10-25 00:53:09 +0300
commit34fe3f9c069fc93fde5ec5bafcdfb9294348b58f (patch)
treec227512b4ad25813f2590c8d77f35f6ec05a5317 /intern
parentfe253389e027c2da3a0d4ad7304f360be64e27e5 (diff)
Code refactor: remove MEM_WRITE_ONLY, always use MEM_READ_WRITE.
It's unlikely the driver can do useful optimizations with this, and if we sum multiple samples we are reading from the memory anyway.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/device_memory.cpp2
-rw-r--r--intern/cycles/device/device_memory.h3
-rw-r--r--intern/cycles/device/device_network.h2
-rw-r--r--intern/cycles/device/opencl/opencl_base.cpp4
-rw-r--r--intern/cycles/render/light.cpp2
-rw-r--r--intern/cycles/render/mesh_displace.cpp2
6 files changed, 4 insertions, 11 deletions
diff --git a/intern/cycles/device/device_memory.cpp b/intern/cycles/device/device_memory.cpp
index 9f4f60e7531..9c67345f39e 100644
--- a/intern/cycles/device/device_memory.cpp
+++ b/intern/cycles/device/device_memory.cpp
@@ -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);
}
diff --git a/intern/cycles/device/device_memory.h b/intern/cycles/device/device_memory.h
index e6b2d059ef3..09b6602a102 100644
--- a/intern/cycles/device/device_memory.h
+++ b/intern/cycles/device/device_memory.h
@@ -33,7 +33,6 @@ class Device;
enum MemoryType {
MEM_READ_ONLY,
- MEM_WRITE_ONLY,
MEM_READ_WRITE,
MEM_TEXTURE,
MEM_PIXELS
@@ -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();
}
diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h
index a38d962c0af..b2be7e23147 100644
--- a/intern/cycles/device/device_network.h
+++ b/intern/cycles/device/device_network.h
@@ -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;
}
}
diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp
index 5e9debc3b17..e6c0961afd7 100644
--- a/intern/cycles/device/opencl/opencl_base.cpp
+++ b/intern/cycles/device/opencl/opencl_base.cpp
@@ -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;
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index b3804f34963..2ce65ec055f 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -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);
diff --git a/intern/cycles/render/mesh_displace.cpp b/intern/cycles/render/mesh_displace.cpp
index ab3ae40d931..1f5f0481dec 100644
--- a/intern/cycles/render/mesh_displace.cpp
+++ b/intern/cycles/render/mesh_displace.cpp
@@ -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();