summaryrefslogtreecommitdiff
path: root/tools/gfx-util/shader-cursor.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-05-21 16:38:33 -0700
committerGitHub <noreply@github.com>2021-05-21 16:38:33 -0700
commit7f8a9994d0bd99a171a1daa0bce46d92c02ccffd (patch)
tree0b187e63ab5b9ce6f5ab41266fedaec44091a217 /tools/gfx-util/shader-cursor.h
parent172538fdb418f7a2faab1f5a410f3b2cb8e18ba5 (diff)
[gfx] Support StructuredBuffer<IInterface>. (#1851)
Co-authored-by: T. Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tools/gfx-util/shader-cursor.h')
-rw-r--r--tools/gfx-util/shader-cursor.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/gfx-util/shader-cursor.h b/tools/gfx-util/shader-cursor.h
index 24008cf24..7512c62ee 100644
--- a/tools/gfx-util/shader-cursor.h
+++ b/tools/gfx-util/shader-cursor.h
@@ -26,6 +26,7 @@ struct ShaderCursor
{
IShaderObject* m_baseObject = nullptr;
slang::TypeLayoutReflection* m_typeLayout = nullptr;
+ ShaderObjectContainerType m_containerType = ShaderObjectContainerType::None;
ShaderOffset m_offset;
/// Get the type (layout) of the value being pointed at by the cursor
@@ -78,6 +79,7 @@ struct ShaderCursor
ShaderCursor(IShaderObject* object)
: m_baseObject(object)
, m_typeLayout(object->getElementTypeLayout())
+ , m_containerType(object->getContainerType())
{}
SlangResult setData(void const* data, size_t size) const
@@ -116,9 +118,13 @@ struct ShaderCursor
/// Produce a cursor to the element or field with the given `index`.
///
/// This is a convenience wrapper around `getElement()`.
- ShaderCursor operator[](SlangInt index) const
- {
- return getElement(index);
- }
+ ShaderCursor operator[](int64_t index) const { return getElement((SlangInt)index); }
+ ShaderCursor operator[](uint64_t index) const { return getElement((SlangInt)index); }
+ ShaderCursor operator[](int32_t index) const { return getElement((SlangInt)index); }
+ ShaderCursor operator[](uint32_t index) const { return getElement((SlangInt)index); }
+ ShaderCursor operator[](int16_t index) const { return getElement((SlangInt)index); }
+ ShaderCursor operator[](uint16_t index) const { return getElement((SlangInt)index); }
+ ShaderCursor operator[](int8_t index) const { return getElement((SlangInt)index); }
+ ShaderCursor operator[](uint8_t index) const { return getElement((SlangInt)index); }
};
}