From ec25060a05e394560ec92388b347c45bd9eba0ed Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Thu, 27 Apr 2017 09:34:51 +0200 Subject: Unlimited number of textures for Cycles This patch allows for an unlimited number of textures in Cycles where the hardware allows. It replaces a number static arrays with dynamic arrays and changes the way the flat_slot indices are calculated. Eventually, I'd like to get to a point where there are only flat slots left and textures off all kinds are stored in a single array. Note that the arrays in DeviceScene are changed from containing device_vector objects to device_vector* pointers. Ideally, I'd like to store objects, but dynamic resizing of a std:vector in pre-C++11 calls the copy constructor, which for a good reason is not implemented for device_vector. Once we require C++11 for Cycles builds, we can implement a move constructor for device_vector and store objects again. The limits for CUDA Fermi hardware still apply. Reviewers: tod_baudais, InsigMathK, dingto, #cycles Reviewed By: dingto, #cycles Subscribers: dingto, smellslikedonkey Differential Revision: https://developer.blender.org/D2650 --- intern/cycles/kernel/kernel_globals.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'intern/cycles/kernel/kernel_globals.h') diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h index c9c97ea977e..dd0971e4a06 100644 --- a/intern/cycles/kernel/kernel_globals.h +++ b/intern/cycles/kernel/kernel_globals.h @@ -19,6 +19,10 @@ #ifndef __KERNEL_GLOBALS_H__ #define __KERNEL_GLOBALS_H__ +#ifdef __KERNEL_CPU__ +#include "util/util_vector.h" +#endif + CCL_NAMESPACE_BEGIN /* On the CPU, we pass along the struct KernelGlobals to nearly everywhere in @@ -38,12 +42,12 @@ struct Intersection; struct VolumeStep; typedef struct KernelGlobals { - texture_image_uchar4 texture_byte4_images[TEX_NUM_BYTE4_CPU]; - texture_image_float4 texture_float4_images[TEX_NUM_FLOAT4_CPU]; - texture_image_half4 texture_half4_images[TEX_NUM_HALF4_CPU]; - texture_image_float texture_float_images[TEX_NUM_FLOAT_CPU]; - texture_image_uchar texture_byte_images[TEX_NUM_BYTE_CPU]; - texture_image_half texture_half_images[TEX_NUM_HALF_CPU]; + vector texture_byte4_images; + vector texture_float4_images; + vector texture_half4_images; + vector texture_float_images; + vector texture_byte_images; + vector texture_half_images; # define KERNEL_TEX(type, ttype, name) ttype name; # define KERNEL_IMAGE_TEX(type, ttype, name) -- cgit v1.2.3