Skip to content

Commit a0d129c

Browse files
authored
Align Type::NONE with default constructor for TypeDesc (#2337)
I don't believe there is an intentional difference between `TYPE::NONE` and `TypeDesc()`. So we choose to align the two here.
1 parent df61483 commit a0d129c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

source/MaterialXGenShader/TypeDesc.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class MX_GENSHADER_API TypeDesc
8282

8383
/// Empty constructor.
8484
constexpr TypeDesc() noexcept :
85-
_id(0),
85+
_id(constexpr_hash("none")),
8686
_basetype(BASETYPE_NONE),
8787
_semantic(SEMANTIC_NONE),
8888
_size(0),
@@ -261,9 +261,10 @@ namespace Type
261261
{
262262

263263
//
264-
/// Define type descriptors for standard types.
264+
// Define type descriptors for standard types.
265265
//
266-
TYPEDESC_DEFINE_TYPE(NONE, "none", TypeDesc::BASETYPE_NONE, TypeDesc::SEMANTIC_NONE, 1)
266+
267+
static const TypeDesc NONE; // Type::NONE matches the TypeDesc default constructor
267268
TYPEDESC_DEFINE_TYPE(BOOLEAN, "boolean", TypeDesc::BASETYPE_BOOLEAN, TypeDesc::SEMANTIC_NONE, 1)
268269
TYPEDESC_DEFINE_TYPE(INTEGER, "integer", TypeDesc::BASETYPE_INTEGER, TypeDesc::SEMANTIC_NONE, 1)
269270
TYPEDESC_DEFINE_TYPE(FLOAT, "float", TypeDesc::BASETYPE_FLOAT, TypeDesc::SEMANTIC_NONE, 1)

0 commit comments

Comments
 (0)