forked from bartvdbraak/blender
Fix Cycles debug build assert on some platforms, tighten checks to avoid this in the future.
This commit is contained in:
parent
055001111e
commit
24d53f79b2
@ -343,11 +343,11 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml
|
|||||||
|
|
||||||
if(node_name == "image_texture") {
|
if(node_name == "image_texture") {
|
||||||
ImageTextureNode *img = (ImageTextureNode*) snode;
|
ImageTextureNode *img = (ImageTextureNode*) snode;
|
||||||
img->filename = path_join(state.base, img->filename);
|
img->filename = path_join(state.base, img->filename.string());
|
||||||
}
|
}
|
||||||
else if(node_name == "environment_texture") {
|
else if(node_name == "environment_texture") {
|
||||||
EnvironmentTextureNode *env = (EnvironmentTextureNode*) snode;
|
EnvironmentTextureNode *env = (EnvironmentTextureNode*) snode;
|
||||||
env->filename = path_join(state.base, env->filename);
|
env->filename = path_join(state.base, env->filename.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(snode) {
|
if(snode) {
|
||||||
|
@ -619,7 +619,7 @@ static ShaderNode *add_node(Scene *scene,
|
|||||||
/* TODO(sergey): Does not work properly when we change builtin type. */
|
/* TODO(sergey): Does not work properly when we change builtin type. */
|
||||||
if(b_image.is_updated()) {
|
if(b_image.is_updated()) {
|
||||||
scene->image_manager->tag_reload_image(
|
scene->image_manager->tag_reload_image(
|
||||||
image->filename,
|
image->filename.string(),
|
||||||
image->builtin_data,
|
image->builtin_data,
|
||||||
get_image_interpolation(b_image_node),
|
get_image_interpolation(b_image_node),
|
||||||
get_image_extension(b_image_node));
|
get_image_extension(b_image_node));
|
||||||
@ -665,7 +665,7 @@ static ShaderNode *add_node(Scene *scene,
|
|||||||
/* TODO(sergey): Does not work properly when we change builtin type. */
|
/* TODO(sergey): Does not work properly when we change builtin type. */
|
||||||
if(b_image.is_updated()) {
|
if(b_image.is_updated()) {
|
||||||
scene->image_manager->tag_reload_image(
|
scene->image_manager->tag_reload_image(
|
||||||
env->filename,
|
env->filename.string(),
|
||||||
env->builtin_data,
|
env->builtin_data,
|
||||||
get_image_interpolation(b_env_node),
|
get_image_interpolation(b_env_node),
|
||||||
EXTENSION_REPEAT);
|
EXTENSION_REPEAT);
|
||||||
|
@ -82,6 +82,12 @@ void Node::set(const SocketType& input, int value)
|
|||||||
get_socket_value<int>(this, input) = value;
|
get_socket_value<int>(this, input) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node::set(const SocketType& input, uint value)
|
||||||
|
{
|
||||||
|
assert(input.type == SocketType::UINT);
|
||||||
|
get_socket_value<uint>(this, input) = value;
|
||||||
|
}
|
||||||
|
|
||||||
void Node::set(const SocketType& input, float value)
|
void Node::set(const SocketType& input, float value)
|
||||||
{
|
{
|
||||||
assert(input.type == SocketType::FLOAT);
|
assert(input.type == SocketType::FLOAT);
|
||||||
@ -198,6 +204,12 @@ int Node::get_int(const SocketType& input) const
|
|||||||
return get_socket_value<int>(this, input);
|
return get_socket_value<int>(this, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint Node::get_uint(const SocketType& input) const
|
||||||
|
{
|
||||||
|
assert(input.type == SocketType::UINT);
|
||||||
|
return get_socket_value<uint>(this, input);
|
||||||
|
}
|
||||||
|
|
||||||
float Node::get_float(const SocketType& input) const
|
float Node::get_float(const SocketType& input) const
|
||||||
{
|
{
|
||||||
assert(input.type == SocketType::FLOAT);
|
assert(input.type == SocketType::FLOAT);
|
||||||
|
@ -38,6 +38,7 @@ struct Node
|
|||||||
/* set values */
|
/* set values */
|
||||||
void set(const SocketType& input, bool value);
|
void set(const SocketType& input, bool value);
|
||||||
void set(const SocketType& input, int value);
|
void set(const SocketType& input, int value);
|
||||||
|
void set(const SocketType& input, uint value);
|
||||||
void set(const SocketType& input, float value);
|
void set(const SocketType& input, float value);
|
||||||
void set(const SocketType& input, float2 value);
|
void set(const SocketType& input, float2 value);
|
||||||
void set(const SocketType& input, float3 value);
|
void set(const SocketType& input, float3 value);
|
||||||
@ -60,6 +61,7 @@ struct Node
|
|||||||
/* get values */
|
/* get values */
|
||||||
bool get_bool(const SocketType& input) const;
|
bool get_bool(const SocketType& input) const;
|
||||||
int get_int(const SocketType& input) const;
|
int get_int(const SocketType& input) const;
|
||||||
|
uint get_uint(const SocketType& input) const;
|
||||||
float get_float(const SocketType& input) const;
|
float get_float(const SocketType& input) const;
|
||||||
float2 get_float2(const SocketType& input) const;
|
float2 get_float2(const SocketType& input) const;
|
||||||
float3 get_float3(const SocketType& input) const;
|
float3 get_float3(const SocketType& input) const;
|
||||||
|
@ -41,6 +41,7 @@ size_t SocketType::size(Type type)
|
|||||||
case BOOLEAN: return sizeof(bool);
|
case BOOLEAN: return sizeof(bool);
|
||||||
case FLOAT: return sizeof(float);
|
case FLOAT: return sizeof(float);
|
||||||
case INT: return sizeof(int);
|
case INT: return sizeof(int);
|
||||||
|
case UINT: return sizeof(uint);
|
||||||
case COLOR: return sizeof(float3);
|
case COLOR: return sizeof(float3);
|
||||||
case VECTOR: return sizeof(float3);
|
case VECTOR: return sizeof(float3);
|
||||||
case POINT: return sizeof(float3);
|
case POINT: return sizeof(float3);
|
||||||
|
@ -39,6 +39,7 @@ struct SocketType
|
|||||||
BOOLEAN,
|
BOOLEAN,
|
||||||
FLOAT,
|
FLOAT,
|
||||||
INT,
|
INT,
|
||||||
|
UINT,
|
||||||
COLOR,
|
COLOR,
|
||||||
VECTOR,
|
VECTOR,
|
||||||
POINT,
|
POINT,
|
||||||
@ -154,7 +155,7 @@ const NodeType *structname::register_type()
|
|||||||
#define SOCKET_DEFINE(name, ui_name, default_value, datatype, TYPE, flags, ...) \
|
#define SOCKET_DEFINE(name, ui_name, default_value, datatype, TYPE, flags, ...) \
|
||||||
{ \
|
{ \
|
||||||
static datatype defval = default_value; \
|
static datatype defval = default_value; \
|
||||||
assert(SOCKET_SIZEOF(T, name) == sizeof(datatype)); \
|
CHECK_TYPE_PAIR(((T *)1)->name, datatype); \
|
||||||
type->register_input(ustring(#name), ustring(ui_name), TYPE, SOCKET_OFFSETOF(T, name), &defval, NULL, NULL, flags, ##__VA_ARGS__); \
|
type->register_input(ustring(#name), ustring(ui_name), TYPE, SOCKET_OFFSETOF(T, name), &defval, NULL, NULL, flags, ##__VA_ARGS__); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +163,8 @@ const NodeType *structname::register_type()
|
|||||||
SOCKET_DEFINE(name, ui_name, default_value, bool, SocketType::BOOLEAN, 0, ##__VA_ARGS__)
|
SOCKET_DEFINE(name, ui_name, default_value, bool, SocketType::BOOLEAN, 0, ##__VA_ARGS__)
|
||||||
#define SOCKET_INT(name, ui_name, default_value, ...) \
|
#define SOCKET_INT(name, ui_name, default_value, ...) \
|
||||||
SOCKET_DEFINE(name, ui_name, default_value, int, SocketType::INT, 0, ##__VA_ARGS__)
|
SOCKET_DEFINE(name, ui_name, default_value, int, SocketType::INT, 0, ##__VA_ARGS__)
|
||||||
|
#define SOCKET_UINT(name, ui_name, default_value, ...) \
|
||||||
|
SOCKET_DEFINE(name, ui_name, default_value, uint, SocketType::UINT, 0, ##__VA_ARGS__)
|
||||||
#define SOCKET_FLOAT(name, ui_name, default_value, ...) \
|
#define SOCKET_FLOAT(name, ui_name, default_value, ...) \
|
||||||
SOCKET_DEFINE(name, ui_name, default_value, float, SocketType::FLOAT, 0, ##__VA_ARGS__)
|
SOCKET_DEFINE(name, ui_name, default_value, float, SocketType::FLOAT, 0, ##__VA_ARGS__)
|
||||||
#define SOCKET_COLOR(name, ui_name, default_value, ...) \
|
#define SOCKET_COLOR(name, ui_name, default_value, ...) \
|
||||||
|
@ -108,6 +108,11 @@ void xml_read_node(XMLReader& reader, Node *node, pugi::xml_node xml_node)
|
|||||||
node->set(socket, (int)atoi(attr.value()));
|
node->set(socket, (int)atoi(attr.value()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SocketType::UINT:
|
||||||
|
{
|
||||||
|
node->set(socket, (uint)atoi(attr.value()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SocketType::INT_ARRAY:
|
case SocketType::INT_ARRAY:
|
||||||
{
|
{
|
||||||
vector<string> tokens;
|
vector<string> tokens;
|
||||||
@ -310,6 +315,11 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
|
|||||||
attr = node->get_int(socket);
|
attr = node->get_int(socket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SocketType::UINT:
|
||||||
|
{
|
||||||
|
attr = node->get_uint(socket);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SocketType::INT_ARRAY:
|
case SocketType::INT_ARRAY:
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
@ -32,12 +32,12 @@ NODE_DEFINE(Background)
|
|||||||
{
|
{
|
||||||
NodeType* type = NodeType::add("background", create);
|
NodeType* type = NodeType::add("background", create);
|
||||||
|
|
||||||
SOCKET_INT(ao_factor, "AO Factor", 0.0f);
|
SOCKET_FLOAT(ao_factor, "AO Factor", 0.0f);
|
||||||
SOCKET_FLOAT(ao_distance, "AO Distance", FLT_MAX);
|
SOCKET_FLOAT(ao_distance, "AO Distance", FLT_MAX);
|
||||||
|
|
||||||
SOCKET_BOOLEAN(use_shader, "Use Shader", true);
|
SOCKET_BOOLEAN(use_shader, "Use Shader", true);
|
||||||
SOCKET_BOOLEAN(use_ao, "Use AO", false);
|
SOCKET_BOOLEAN(use_ao, "Use AO", false);
|
||||||
SOCKET_INT(visibility, "Visibility", PATH_RAY_ALL_VISIBILITY);
|
SOCKET_UINT(visibility, "Visibility", PATH_RAY_ALL_VISIBILITY);
|
||||||
SOCKET_BOOLEAN(transparent, "Transparent", false);
|
SOCKET_BOOLEAN(transparent, "Transparent", false);
|
||||||
|
|
||||||
SOCKET_NODE(shader, "Shader", &Shader::node_type);
|
SOCKET_NODE(shader, "Shader", &Shader::node_type);
|
||||||
|
@ -68,7 +68,7 @@ NODE_DEFINE(Camera)
|
|||||||
|
|
||||||
SOCKET_FLOAT(aperturesize, "Aperture Size", 0.0f);
|
SOCKET_FLOAT(aperturesize, "Aperture Size", 0.0f);
|
||||||
SOCKET_FLOAT(focaldistance, "Focal Distance", 10.0f);
|
SOCKET_FLOAT(focaldistance, "Focal Distance", 10.0f);
|
||||||
SOCKET_INT(blades, "Blades", 0);
|
SOCKET_UINT(blades, "Blades", 0);
|
||||||
SOCKET_FLOAT(bladesrotation, "Blades Rotation", 0.0f);
|
SOCKET_FLOAT(bladesrotation, "Blades Rotation", 0.0f);
|
||||||
|
|
||||||
SOCKET_TRANSFORM(matrix, "Matrix", transform_identity());
|
SOCKET_TRANSFORM(matrix, "Matrix", transform_identity());
|
||||||
|
@ -85,7 +85,7 @@ NODE_DEFINE(Mesh)
|
|||||||
displacement_method_enum.insert("both", DISPLACE_BOTH);
|
displacement_method_enum.insert("both", DISPLACE_BOTH);
|
||||||
SOCKET_ENUM(displacement_method, "Displacement Method", displacement_method_enum, DISPLACE_BUMP);
|
SOCKET_ENUM(displacement_method, "Displacement Method", displacement_method_enum, DISPLACE_BUMP);
|
||||||
|
|
||||||
SOCKET_INT(motion_steps, "Motion Steps", 3);
|
SOCKET_UINT(motion_steps, "Motion Steps", 3);
|
||||||
SOCKET_BOOLEAN(use_motion_blur, "Use Motion Blur", false);
|
SOCKET_BOOLEAN(use_motion_blur, "Use Motion Blur", false);
|
||||||
|
|
||||||
SOCKET_INT_ARRAY(triangles, "Triangles", array<int>());
|
SOCKET_INT_ARRAY(triangles, "Triangles", array<int>());
|
||||||
|
@ -257,7 +257,7 @@ ImageTextureNode::ImageTextureNode()
|
|||||||
ImageTextureNode::~ImageTextureNode()
|
ImageTextureNode::~ImageTextureNode()
|
||||||
{
|
{
|
||||||
if(image_manager) {
|
if(image_manager) {
|
||||||
image_manager->remove_image(filename,
|
image_manager->remove_image(filename.string(),
|
||||||
builtin_data,
|
builtin_data,
|
||||||
interpolation,
|
interpolation,
|
||||||
extension);
|
extension);
|
||||||
@ -298,7 +298,7 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
|
|||||||
image_manager = compiler.image_manager;
|
image_manager = compiler.image_manager;
|
||||||
if(is_float == -1) {
|
if(is_float == -1) {
|
||||||
bool is_float_bool;
|
bool is_float_bool;
|
||||||
slot = image_manager->add_image(filename,
|
slot = image_manager->add_image(filename.string(),
|
||||||
builtin_data,
|
builtin_data,
|
||||||
animated,
|
animated,
|
||||||
0,
|
0,
|
||||||
@ -360,13 +360,13 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
|
|||||||
if(is_float == -1) {
|
if(is_float == -1) {
|
||||||
if(builtin_data == NULL) {
|
if(builtin_data == NULL) {
|
||||||
ImageManager::ImageDataType type;
|
ImageManager::ImageDataType type;
|
||||||
type = image_manager->get_image_metadata(filename, NULL, is_linear);
|
type = image_manager->get_image_metadata(filename.string(), NULL, is_linear);
|
||||||
if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4)
|
if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4)
|
||||||
is_float = 1;
|
is_float = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bool is_float_bool;
|
bool is_float_bool;
|
||||||
slot = image_manager->add_image(filename,
|
slot = image_manager->add_image(filename.string(),
|
||||||
builtin_data,
|
builtin_data,
|
||||||
animated,
|
animated,
|
||||||
0,
|
0,
|
||||||
@ -456,7 +456,7 @@ EnvironmentTextureNode::EnvironmentTextureNode()
|
|||||||
EnvironmentTextureNode::~EnvironmentTextureNode()
|
EnvironmentTextureNode::~EnvironmentTextureNode()
|
||||||
{
|
{
|
||||||
if(image_manager) {
|
if(image_manager) {
|
||||||
image_manager->remove_image(filename,
|
image_manager->remove_image(filename.string(),
|
||||||
builtin_data,
|
builtin_data,
|
||||||
interpolation,
|
interpolation,
|
||||||
EXTENSION_REPEAT);
|
EXTENSION_REPEAT);
|
||||||
@ -495,7 +495,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
|
|||||||
image_manager = compiler.image_manager;
|
image_manager = compiler.image_manager;
|
||||||
if(slot == -1) {
|
if(slot == -1) {
|
||||||
bool is_float_bool;
|
bool is_float_bool;
|
||||||
slot = image_manager->add_image(filename,
|
slot = image_manager->add_image(filename.string(),
|
||||||
builtin_data,
|
builtin_data,
|
||||||
animated,
|
animated,
|
||||||
0,
|
0,
|
||||||
@ -548,13 +548,13 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler)
|
|||||||
if(is_float == -1) {
|
if(is_float == -1) {
|
||||||
if(builtin_data == NULL) {
|
if(builtin_data == NULL) {
|
||||||
ImageManager::ImageDataType type;
|
ImageManager::ImageDataType type;
|
||||||
type = image_manager->get_image_metadata(filename, NULL, is_linear);
|
type = image_manager->get_image_metadata(filename.string(), NULL, is_linear);
|
||||||
if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4)
|
if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4)
|
||||||
is_float = 1;
|
is_float = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bool is_float_bool;
|
bool is_float_bool;
|
||||||
slot = image_manager->add_image(filename,
|
slot = image_manager->add_image(filename.string(),
|
||||||
builtin_data,
|
builtin_data,
|
||||||
animated,
|
animated,
|
||||||
0,
|
0,
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
int is_float;
|
int is_float;
|
||||||
bool is_linear;
|
bool is_linear;
|
||||||
bool use_alpha;
|
bool use_alpha;
|
||||||
string filename;
|
ustring filename;
|
||||||
void *builtin_data;
|
void *builtin_data;
|
||||||
NodeImageColorSpace color_space;
|
NodeImageColorSpace color_space;
|
||||||
NodeImageProjection projection;
|
NodeImageProjection projection;
|
||||||
@ -118,7 +118,7 @@ public:
|
|||||||
int is_float;
|
int is_float;
|
||||||
bool is_linear;
|
bool is_linear;
|
||||||
bool use_alpha;
|
bool use_alpha;
|
||||||
string filename;
|
ustring filename;
|
||||||
void *builtin_data;
|
void *builtin_data;
|
||||||
NodeImageColorSpace color_space;
|
NodeImageColorSpace color_space;
|
||||||
NodeEnvironmentProjection projection;
|
NodeEnvironmentProjection projection;
|
||||||
|
@ -39,8 +39,8 @@ NODE_DEFINE(Object)
|
|||||||
|
|
||||||
SOCKET_NODE(mesh, "Mesh", &Mesh::node_type);
|
SOCKET_NODE(mesh, "Mesh", &Mesh::node_type);
|
||||||
SOCKET_TRANSFORM(tfm, "Transform", transform_identity());
|
SOCKET_TRANSFORM(tfm, "Transform", transform_identity());
|
||||||
SOCKET_INT(visibility, "Visibility", ~0);
|
SOCKET_UINT(visibility, "Visibility", ~0);
|
||||||
SOCKET_INT(random_id, "Random ID", 0);
|
SOCKET_UINT(random_id, "Random ID", 0);
|
||||||
SOCKET_INT(pass_id, "Pass ID", 0);
|
SOCKET_INT(pass_id, "Pass ID", 0);
|
||||||
SOCKET_BOOLEAN(use_holdout, "Use Holdout", false);
|
SOCKET_BOOLEAN(use_holdout, "Use Holdout", false);
|
||||||
SOCKET_POINT(dupli_generated, "Dupli Generated", make_float3(0.0f, 0.0f, 0.0f));
|
SOCKET_POINT(dupli_generated, "Dupli Generated", make_float3(0.0f, 0.0f, 0.0f));
|
||||||
|
Loading…
Reference in New Issue
Block a user