From e568c1a9757a5d4f8a52822cbbe772d0ac4da78b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 12 Nov 2017 20:43:40 +0100 Subject: Fix T53289: CUDA missing textures not showing pink, after recent changes. --- intern/cycles/device/device_cuda.cpp | 6 +++--- intern/cycles/render/image.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'intern') 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; -- cgit v1.2.3