Prepare FFlatVertexBuffer for removal
This commit is contained in:
parent
1fe5b8e26f
commit
154cb2e967
13 changed files with 102 additions and 73 deletions
|
|
@ -128,10 +128,3 @@ void FFlatVertexBuffer::Copy(int start, int count)
|
|||
|
||||
mVertexBuffer = old;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
||||
std::pair<FFlatVertex*, unsigned int> FRenderState::AllocVertices(unsigned int count)
|
||||
{
|
||||
return screen->mVertexData->AllocVertices(count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ MeshBuilder::MeshBuilder()
|
|||
mVertices = screen->mVertexData->vbo_shadowdata;
|
||||
}
|
||||
|
||||
void MeshBuilder::SetShadowData(const TArray<FFlatVertex>& vertices, const TArray<uint32_t>& indexes)
|
||||
{
|
||||
mVertices = vertices;
|
||||
mIndexes = indexes;
|
||||
}
|
||||
|
||||
void MeshBuilder::Draw(int dt, int index, int count, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ public:
|
|||
|
||||
// Vertices
|
||||
std::pair<FFlatVertex*, unsigned int> AllocVertices(unsigned int count) override;
|
||||
void SetShadowData(const TArray<FFlatVertex>& vertices, const TArray<uint32_t>& indexes) override;
|
||||
void UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count) { }
|
||||
|
||||
// Buffers
|
||||
int SetViewpoint(const HWViewpointUniforms& vp) override { return 0; }
|
||||
|
|
@ -115,6 +117,7 @@ private:
|
|||
DrawLists* mDrawLists = nullptr;
|
||||
|
||||
TArray<FFlatVertex> mVertices;
|
||||
TArray<uint32_t> mIndexes;
|
||||
int mDepthFunc = 0;
|
||||
|
||||
VSMatrix mTextureMatrix = VSMatrix::identity();
|
||||
|
|
|
|||
|
|
@ -734,7 +734,9 @@ public:
|
|||
// API-dependent render interface
|
||||
|
||||
// Vertices
|
||||
virtual std::pair<FFlatVertex*, unsigned int> AllocVertices(unsigned int count);
|
||||
virtual std::pair<FFlatVertex*, unsigned int> AllocVertices(unsigned int count) = 0;
|
||||
virtual void SetShadowData(const TArray<FFlatVertex>& vertices, const TArray<uint32_t>& indexes) = 0;
|
||||
virtual void UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count) = 0;
|
||||
|
||||
// Buffers
|
||||
virtual int SetViewpoint(const HWViewpointUniforms& vp) = 0;
|
||||
|
|
|
|||
|
|
@ -620,6 +620,30 @@ int VkRenderState::UploadBones(const TArray<VSMatrix>& bones)
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<FFlatVertex*, unsigned int> VkRenderState::AllocVertices(unsigned int count)
|
||||
{
|
||||
return fb->mVertexData->AllocVertices(count);
|
||||
}
|
||||
|
||||
void VkRenderState::SetShadowData(const TArray<FFlatVertex>& vertices, const TArray<uint32_t>& indexes)
|
||||
{
|
||||
FFlatVertexBuffer* fvb = fb->mVertexData;
|
||||
fvb->vbo_shadowdata = vertices;
|
||||
fvb->ibo_data = indexes;
|
||||
fvb->mCurIndex = fvb->vbo_shadowdata.Size();
|
||||
fvb->mIndex = fvb->vbo_shadowdata.Size();
|
||||
fvb->Copy(0, fvb->mIndex);
|
||||
fvb->mIndexBuffer->SetData(fvb->ibo_data.Size() * sizeof(uint32_t), &fvb->ibo_data[0], BufferUsageType::Static);
|
||||
}
|
||||
|
||||
void VkRenderState::UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count)
|
||||
{
|
||||
FFlatVertexBuffer* fvb = fb->mVertexData;
|
||||
FFlatVertex* mapvt = fvb->GetBuffer(index);
|
||||
memcpy(mapvt, vertices, count * sizeof(FFlatVertex));
|
||||
fvb->mVertexBuffer->Upload(index * sizeof(FFlatVertex), count * sizeof(FFlatVertex));
|
||||
}
|
||||
|
||||
void VkRenderState::BeginFrame()
|
||||
{
|
||||
mMaterial.Reset();
|
||||
|
|
|
|||
|
|
@ -55,6 +55,11 @@ public:
|
|||
int UploadLights(const FDynLightData& lightdata) override;
|
||||
int UploadBones(const TArray<VSMatrix>& bones) override;
|
||||
|
||||
// Vertices
|
||||
std::pair<FFlatVertex*, unsigned int> AllocVertices(unsigned int count) override;
|
||||
void SetShadowData(const TArray<FFlatVertex>& vertices, const TArray<uint32_t>& indexes) override;
|
||||
void UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count) override;
|
||||
|
||||
protected:
|
||||
void Apply(int dt);
|
||||
void ApplyRenderPass(int dt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue