diff --git a/src/include/OSL/variant.h b/src/include/OSL/variant.h index 5a48e9021..a29ebd908 100644 --- a/src/include/OSL/variant.h +++ b/src/include/OSL/variant.h @@ -132,99 +132,93 @@ template class ArgVariant { return false; } - template T get() const - { - OSL_DASSERT(false); - return T(); - } - - template<> inline TBuiltinArg get() const + TBuiltinArg get_builtin() const { OSL_DASSERT(is_holding()); return m_builtin; } - template<> inline bool get() const + bool get_bool() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_bool; } - template<> inline int8_t get() const + int8_t get_int8() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_int8; } - template<> inline int16_t get() const + int16_t get_int16() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_int16; } - template<> inline int32_t get() const + int32_t get_int32() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_int32; } - template<> inline int64_t get() const + int64_t get_int64() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_int64; } - template<> inline uint8_t get() const + uint8_t get_uint8() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_uint8; } - template<> inline uint16_t get() const + uint16_t get_uint16() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_uint16; } - template<> inline uint32_t get() const + uint32_t get_uint32() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_uint32; } - template<> inline uint64_t get() const + uint64_t get_uint64() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_uint64; } - template<> inline float get() const + float get_float() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_float; } - template<> inline double get() const + double get_double() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_double; } - template<> inline void* get() const + void* get_ptr() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_ptr; } - template<> inline ustring get() const + ustring get_ustring() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_ustring; } - template<> inline ustringhash get() const + ustringhash get_ustringhash() const { - OSL_DASSERT(is_holding()); + return OSL_DASSERT(is_holding()); return m_ustringhash; } }; diff --git a/src/liboslexec/llvm_gen.cpp b/src/liboslexec/llvm_gen.cpp index 670f4f412..ef1986994 100644 --- a/src/liboslexec/llvm_gen.cpp +++ b/src/liboslexec/llvm_gen.cpp @@ -3310,46 +3310,46 @@ append_constant_arg(BackendLLVM& rop, const TArgVariant& arg, case TArgVariant::Type::Unspecified: case TArgVariant::Type::Builtin: OSL_DASSERT(false); break; case TArgVariant::Type::Bool: - args.push_back(rop.ll.constant_bool(arg.get())); + args.push_back(rop.ll.constant_bool(arg.get_bool())); break; case TArgVariant::Type::Int8: - args.push_back(rop.ll.constant8(arg.get())); + args.push_back(rop.ll.constant8(arg.get_int8())); break; case TArgVariant::Type::Int16: - args.push_back(rop.ll.constant16(arg.get())); + args.push_back(rop.ll.constant16(arg.get_int16())); break; case TArgVariant::Type::Int32: - args.push_back(rop.ll.constant(arg.get())); + args.push_back(rop.ll.constant(arg.get_int32())); break; case TArgVariant::Type::Int64: - args.push_back(rop.ll.constanti64(arg.get())); + args.push_back(rop.ll.constanti64(arg.get_int64())); break; case TArgVariant::Type::UInt8: - args.push_back(rop.ll.constant8(arg.get())); + args.push_back(rop.ll.constant8(arg.get_uint8())); break; case TArgVariant::Type::UInt16: - args.push_back(rop.ll.constant16(arg.get())); + args.push_back(rop.ll.constant16(arg.get_uint16())); break; case TArgVariant::Type::UInt32: - args.push_back(rop.ll.constant(arg.get())); + args.push_back(rop.ll.constant(arg.get_uint32())); break; case TArgVariant::Type::UInt64: - args.push_back(rop.ll.constant64(arg.get())); + args.push_back(rop.ll.constant64(arg.get_uint64())); break; case TArgVariant::Type::Float: - args.push_back(rop.ll.constant(arg.get())); + args.push_back(rop.ll.constant(arg.get_float())); break; case TArgVariant::Type::Double: - args.push_back(rop.ll.constant64(arg.get())); + args.push_back(rop.ll.constant64(arg.get_double())); break; case TArgVariant::Type::Pointer: - args.push_back(rop.ll.constant_ptr(arg.get())); + args.push_back(rop.ll.constant_ptr(arg.get_ptr())); break; case TArgVariant::Type::UString: - args.push_back(rop.ll.constant(arg.get())); + args.push_back(rop.ll.constant(arg.get_ustring())); break; case TArgVariant::Type::UStringHash: - args.push_back(rop.ll.constant(ustring(arg.get()))); + args.push_back(rop.ll.constant(ustring(arg.get_ustringhash()))); break; } } @@ -3428,7 +3428,7 @@ LLVMGEN(llvm_gen_getattribute) for (size_t index = 0; index < spec.arg_count(); ++index) { const auto& arg = spec.arg(index); if (arg.is_holding()) { - switch (arg.get()) { + switch (arg.get_builtin()) { default: OSL_DASSERT(false); break; case AttributeSpecBuiltinArg::ShaderGlobalsPointer: args.push_back(rop.sg_void_ptr());