[Bf-blender-cvs] [e568c1a9757] master: Fix T53289: CUDA missing textures not showing pink, after recent changes.

Brecht Van Lommel noreply at git.blender.org
Sun Nov 12 20:49:29 CET 2017


Commit: e568c1a9757a5d4f8a52822cbbe772d0ac4da78b
Author: Brecht Van Lommel
Date:   Sun Nov 12 20:43:40 2017 +0100
Branches: master
https://developer.blender.org/rBe568c1a9757a5d4f8a52822cbbe772d0ac4da78b

Fix T53289: CUDA missing textures not showing pink, after recent changes.

===================================================================

M	intern/cycles/device/device_cuda.cpp
M	intern/cycles/render/image.cpp

===================================================================

diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index a38340cb286..305e5e9f1af 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -908,7 +908,7 @@ public:
 			cmem->texobject = 0;
 			cmem->array = array_3d;
 		}
-		else if(mem.data_height > 1) {
+		else if(mem.data_height > 0) {
 			/* 2D texture, using pitch aligned linear memory. */
 			int alignment = 0;
 			cuda_assert(cuDeviceGetAttribute(&alignment, CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, cuDevice));
@@ -962,7 +962,7 @@ public:
 				resDesc.res.array.hArray = array_3d;
 				resDesc.flags = 0;
 			}
-			else if(mem.data_height > 1) {
+			else if(mem.data_height > 0) {
 				resDesc.resType = CU_RESOURCE_TYPE_PITCH2D;
 				resDesc.res.pitch2D.devPtr = mem.device_pointer;
 				resDesc.res.pitch2D.format = format;
@@ -1012,7 +1012,7 @@ public:
 			if(array_3d) {
 				cuda_assert(cuTexRefSetArray(texref, array_3d, CU_TRSA_OVERRIDE_FORMAT));
 			}
-			else if(mem.data_height > 1) {
+			else if(mem.data_height > 0) {
 				CUDA_ARRAY_DESCRIPTOR array_desc;
 				array_desc.Format = format;
 				array_desc.Height = mem.data_height;
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 9358b40a689..482442cce29 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -723,6 +723,7 @@ void ImageManager::device_load_image(Device *device,
 		                                            *tex_img))
 		{
 			/* on failure to load, we set a 1x1 pixels pink image */
+			thread_scoped_lock device_lock(device_mutex);
 			float *pixels = (float*)tex_img->alloc(1, 1);
 
 			pixels[0] = TEX_IMAGE_MISSING_R;
@@ -748,6 +749,7 @@ void ImageManager::device_load_image(Device *device,
 		                                            *tex_img))
 		{
 			/* on failure to load, we set a 1x1 pixels pink image */
+			thread_scoped_lock device_lock(device_mutex);
 			float *pixels = (float*)tex_img->alloc(1, 1);
 
 			pixels[0] = TEX_IMAGE_MISSING_R;
@@ -770,6 +772,7 @@ void ImageManager::device_load_image(Device *device,
 		                                            *tex_img))
 		{
 			/* on failure to load, we set a 1x1 pixels pink image */
+			thread_scoped_lock device_lock(device_mutex);
 			uchar *pixels = (uchar*)tex_img->alloc(1, 1);
 
 			pixels[0] = (TEX_IMAGE_MISSING_R * 255);
@@ -794,6 +797,7 @@ void ImageManager::device_load_image(Device *device,
 		                                            texture_limit,
 		                                            *tex_img)) {
 			/* on failure to load, we set a 1x1 pixels pink image */
+			thread_scoped_lock device_lock(device_mutex);
 			uchar *pixels = (uchar*)tex_img->alloc(1, 1);
 
 			pixels[0] = (TEX_IMAGE_MISSING_R * 255);
@@ -815,6 +819,7 @@ void ImageManager::device_load_image(Device *device,
 		                                          texture_limit,
 		                                          *tex_img)) {
 			/* on failure to load, we set a 1x1 pixels pink image */
+			thread_scoped_lock device_lock(device_mutex);
 			half *pixels = (half*)tex_img->alloc(1, 1);
 
 			pixels[0] = TEX_IMAGE_MISSING_R;
@@ -839,6 +844,7 @@ void ImageManager::device_load_image(Device *device,
 		                                          texture_limit,
 		                                          *tex_img)) {
 			/* on failure to load, we set a 1x1 pixels pink image */
+			thread_scoped_lock device_lock(device_mutex);
 			half *pixels = (half*)tex_img->alloc(1, 1);
 
 			pixels[0] = TEX_IMAGE_MISSING_R;



More information about the Bf-blender-cvs mailing list