From edaed7bda17dea0511a594729563bcb3ed02bce6 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 7 Jan 2025 16:12:11 +0100 Subject: [PATCH] Add missing layout for ribbon vertex buffer --- Source/Engine/Particles/Particles.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Particles/Particles.cpp b/Source/Engine/Particles/Particles.cpp index 9305c7931..fc645bb60 100644 --- a/Source/Engine/Particles/Particles.cpp +++ b/Source/Engine/Particles/Particles.cpp @@ -94,6 +94,16 @@ PACK_STRUCT(struct RibbonParticleVertex { uint32 PrevParticleIndex; float Distance; // TODO: pack into half/uint16 data + + static GPUVertexLayout* GetLayout() + { + return GPUVertexLayout::Get({ + { VertexElement::Types::TexCoord0, 0, 0, 0, PixelFormat::R32_UInt }, + { VertexElement::Types::TexCoord1, 0, 0, 0, PixelFormat::R32_UInt }, + { VertexElement::Types::TexCoord2, 0, 0, 0, PixelFormat::R32_UInt }, + { VertexElement::Types::TexCoord3, 0, 0, 0, PixelFormat::R32_Float }, + }); + } }); struct EmitterCache @@ -306,7 +316,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa else buffer->GPU.RibbonIndexBufferDynamic->Clear(); if (!buffer->GPU.RibbonVertexBufferDynamic) - buffer->GPU.RibbonVertexBufferDynamic = New(0, (uint32)sizeof(RibbonParticleVertex), TEXT("RibbonVertexBufferDynamic")); + buffer->GPU.RibbonVertexBufferDynamic = New(0, (uint32)sizeof(RibbonParticleVertex), TEXT("RibbonVertexBufferDynamic"), RibbonParticleVertex::GetLayout()); else buffer->GPU.RibbonVertexBufferDynamic->Clear(); auto& indexBuffer = buffer->GPU.RibbonIndexBufferDynamic->Data;