Refactor Vertex Shader input vertex layout to use GPUVertexLayout defined on Vertex Buffer rather than Vertex Shader

#3044 #2667
This commit is contained in:
Wojtek Figat
2024-12-15 22:10:45 +01:00
parent 666efb7675
commit b3f37ca041
66 changed files with 786 additions and 579 deletions

View File

@@ -19,6 +19,7 @@
#include "Engine/Graphics/RenderTools.h"
#include "Engine/Graphics/DynamicBuffer.h"
#include "Engine/Graphics/Shaders/GPUConstantBuffer.h"
#include "Engine/Graphics/Shaders/GPUVertexLayout.h"
#include "Engine/Graphics/Shaders/GPUShader.h"
#include "Engine/Animations/AnimationUtils.h"
#include "Engine/Profiler/Profiler.h"
@@ -689,7 +690,7 @@ void DebugDrawService::Update()
// Vertex buffer
if (DebugDrawVB == nullptr)
DebugDrawVB = New<DynamicVertexBuffer>((uint32)(DEBUG_DRAW_INITIAL_VB_CAPACITY * sizeof(Vertex)), (uint32)sizeof(Vertex), TEXT("DebugDraw.VB"));
DebugDrawVB = New<DynamicVertexBuffer>((uint32)(DEBUG_DRAW_INITIAL_VB_CAPACITY * sizeof(Vertex)), (uint32)sizeof(Vertex), TEXT("DebugDraw.VB"), Vertex::GetLayout());
}
void DebugDrawService::Dispose()
@@ -710,6 +711,14 @@ void DebugDrawService::Dispose()
DebugDrawShader = nullptr;
}
GPUVertexLayout* DebugDraw::Vertex::GetLayout()
{
return GPUVertexLayout::Get({
{ VertexElement::Types::Position, 0, 0, 0, PixelFormat::R32G32B32_Float },
{ VertexElement::Types::Color, 0, 12, 0, PixelFormat::R8G8B8A8_UNorm },
});
}
#if USE_EDITOR
void* DebugDraw::AllocateContext()