Cycles: Synchronize images after building mesh BVH
This way memory overhead caused by the BVH building is not so visible and peak memory usage will be reduced. Implementing this idea is not so straightforward actually, because we need to synchronize images used for true displacement before meshes. Detecting whether image is used for true displacement is not so striaghtforward, so for now all all displacement types will synchronize images used for them. Such change brings memory usage from 4.1G to 4.0G with the 01_01_01_D scene from gooseberry. With 01_01_01_G scene it's 7.6G vs. 6.8G (before and after the patch). Reviewers: campbellbarton, juicyfruit, brecht Subscribers: eyecandy Differential Revision: https://developer.blender.org/D1217
This commit is contained in:
@@ -55,13 +55,28 @@ public:
|
||||
|
||||
/* Nodes */
|
||||
|
||||
/* Any node which uses image manager's slot should be a subclass of this one. */
|
||||
class ImageSlotNode : public ShaderNode {
|
||||
public:
|
||||
ImageSlotNode(const char *name_) : ShaderNode(name_) {
|
||||
special_type = SHADER_SPECIAL_TYPE_IMAGE_SLOT;
|
||||
}
|
||||
int slot;
|
||||
};
|
||||
|
||||
class TextureNode : public ShaderNode {
|
||||
public:
|
||||
TextureNode(const char *name_) : ShaderNode(name_) {}
|
||||
TextureMapping tex_mapping;
|
||||
};
|
||||
|
||||
class ImageTextureNode : public TextureNode {
|
||||
class ImageSlotTextureNode : public ImageSlotNode {
|
||||
public:
|
||||
ImageSlotTextureNode(const char *name_) : ImageSlotNode(name_) {}
|
||||
TextureMapping tex_mapping;
|
||||
};
|
||||
|
||||
class ImageTextureNode : public ImageSlotTextureNode {
|
||||
public:
|
||||
SHADER_NODE_NO_CLONE_CLASS(ImageTextureNode)
|
||||
~ImageTextureNode();
|
||||
@@ -69,7 +84,6 @@ public:
|
||||
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
||||
|
||||
ImageManager *image_manager;
|
||||
int slot;
|
||||
int is_float;
|
||||
bool is_linear;
|
||||
bool use_alpha;
|
||||
@@ -85,7 +99,7 @@ public:
|
||||
static ShaderEnum projection_enum;
|
||||
};
|
||||
|
||||
class EnvironmentTextureNode : public TextureNode {
|
||||
class EnvironmentTextureNode : public ImageSlotTextureNode {
|
||||
public:
|
||||
SHADER_NODE_NO_CLONE_CLASS(EnvironmentTextureNode)
|
||||
~EnvironmentTextureNode();
|
||||
@@ -93,7 +107,6 @@ public:
|
||||
void attributes(Shader *shader, AttributeRequestSet *attributes);
|
||||
|
||||
ImageManager *image_manager;
|
||||
int slot;
|
||||
int is_float;
|
||||
bool is_linear;
|
||||
bool use_alpha;
|
||||
|
Reference in New Issue
Block a user