From 6a517a48e292601499daf4463cfc564b3bbcff1e Mon Sep 17 00:00:00 2001 From: Chris Cummings Date: Tue, 21 Jan 2025 12:39:45 +0000 Subject: [PATCH] NativeType->NativeMarshall --- src/sgl/utils/python/slangpy.cpp | 26 +++++++++++++------------- src/sgl/utils/python/slangpy.h | 16 ++++++++-------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/sgl/utils/python/slangpy.cpp b/src/sgl/utils/python/slangpy.cpp index 14047828..6e81b6d9 100644 --- a/src/sgl/utils/python/slangpy.cpp +++ b/src/sgl/utils/python/slangpy.cpp @@ -19,7 +19,7 @@ extern void write_shader_cursor(ShaderCursor& cursor, nb::object value); namespace sgl::slangpy { -void NativeType::write_shader_cursor_pre_dispatch( +void NativeMarshall::write_shader_cursor_pre_dispatch( CallContext* context, NativeBoundVariableRuntime* binding, ShaderCursor cursor, @@ -665,28 +665,28 @@ SGL_PY_EXPORT(utils_slangpy) D_NA(NativeSlangType, type_reflection) ); - nb::class_(slangpy, "NativeType") // + nb::class_(slangpy, "NativeMarshall") // .def( "__init__", - [](NativeType& self) { new (&self) PyNativeType(); }, - D_NA(NativeType, NativeType) + [](NativeMarshall& self) { new (&self) PyNativeMarshall(); }, + D_NA(NativeMarshall, NativeMarshall) ) .def_prop_rw( "concrete_shape", - &NativeType::get_concrete_shape, - &NativeType::set_concrete_shape, - D_NA(NativeType, concrete_shape) + &NativeMarshall::get_concrete_shape, + &NativeMarshall::set_concrete_shape, + D_NA(NativeMarshall, concrete_shape) ) .def( "write_shader_cursor_pre_dispatch", - &NativeType::write_shader_cursor_pre_dispatch, - D_NA(NativeType, write_shader_cursor_pre_dispatch) + &NativeMarshall::write_shader_cursor_pre_dispatch, + D_NA(NativeMarshall, write_shader_cursor_pre_dispatch) ) - .def("create_calldata", &NativeType::create_calldata, D_NA(NativeType, create_calldata)) - .def("read_calldata", &NativeType::read_calldata, D_NA(NativeType, read_calldata)) - .def("create_output", &NativeType::create_output, D_NA(NativeType, create_output)) - .def("read_output", &NativeType::read_output, D_NA(NativeType, read_output)); + .def("create_calldata", &NativeMarshall::create_calldata, D_NA(NativeMarshall, create_calldata)) + .def("read_calldata", &NativeMarshall::read_calldata, D_NA(NativeMarshall, read_calldata)) + .def("create_output", &NativeMarshall::create_output, D_NA(NativeMarshall, create_output)) + .def("read_output", &NativeMarshall::read_output, D_NA(NativeMarshall, read_output)); nb::class_(slangpy, "NativeBoundVariableRuntime") // .def(nb::init<>(), D_NA(NativeBoundVariableRuntime, NativeBoundVariableRuntime)) diff --git a/src/sgl/utils/python/slangpy.h b/src/sgl/utils/python/slangpy.h index bbc9d768..017b7e5b 100644 --- a/src/sgl/utils/python/slangpy.h +++ b/src/sgl/utils/python/slangpy.h @@ -57,9 +57,9 @@ class NativeSlangType : public Object { }; /// Base class for a marshal to a slangpy supported type. -class NativeType : public Object { +class NativeMarshall : public Object { public: - virtual ~NativeType() = default; + virtual ~NativeMarshall() = default; /// Get the concrete shape of the type. For none-concrete types such as buffers, /// this will return an invalid shape. @@ -135,9 +135,9 @@ class NativeType : public Object { Shape m_concrete_shape; }; -/// Nanobind trampoline class for NativeType -struct PyNativeType : public NativeType { - NB_TRAMPOLINE(NativeType, 10); +/// Nanobind trampoline class for NativeMarshall +struct PyNativeMarshall : public NativeMarshall { + NB_TRAMPOLINE(NativeMarshall, 10); Shape get_shape(nb::object data) const override { NB_OVERRIDE(get_shape, data); } @@ -196,10 +196,10 @@ class NativeBoundVariableRuntime : public Object { void set_transform(const Shape& transform) { m_transform = transform; } /// Get the python type marshal. - ref get_python_type() const { return m_python_type; } + ref get_python_type() const { return m_python_type; } /// Set the python type marshal. - void set_python_type(const ref& python_type) { m_python_type = python_type; } + void set_python_type(const ref& python_type) { m_python_type = python_type; } /// Get the vector slang type. ref get_vector_type() const { return m_vector_type; } @@ -255,7 +255,7 @@ class NativeBoundVariableRuntime : public Object { private: std::pair m_access{AccessType::none, AccessType::none}; Shape m_transform; - ref m_python_type; + ref m_python_type; Shape m_shape; std::string m_variable_name; std::optional>> m_children;