From d0c8685ce752eec228a26e0c0b912953f905094a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Wed, 30 Dec 2020 18:52:06 +0100 Subject: [PATCH] Added SetData for single struct --- GlitchyEngine/src/Renderer/Buffer.bf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/GlitchyEngine/src/Renderer/Buffer.bf b/GlitchyEngine/src/Renderer/Buffer.bf index da7854a..532a1de 100644 --- a/GlitchyEngine/src/Renderer/Buffer.bf +++ b/GlitchyEngine/src/Renderer/Buffer.bf @@ -144,6 +144,17 @@ namespace GlitchyEngine.Renderer _description = description; } + /** + * @param data The struct containing the data that will be copied into the buffer. + * @param destinationByteOffset The offset in bytes form the start of the destination buffer. + * @param mapType Only relevant for dynamic buffers... + */ + public Result SetData(T data, uint32 destinationByteOffset = 0, MapType mapType = .Write) where T : struct + { + var data; + return PlatformSetData(&data, (uint32)(sizeof(T)), destinationByteOffset, mapType); + } + /** * @param data The span containing the data that will be copied into the buffer. * @param destinationByteOffset The offset in bytes form the start of the destination buffer.