preparing VKIndirectCommandBuffer.h
This commit is contained in:
parent
cc80fe7f39
commit
bf7c6bdeac
2
CMCore
2
CMCore
@ -1 +1 @@
|
||||
Subproject commit 3c382665efe376af10b231f603344cfd8a5758e8
|
||||
Subproject commit ee2bf2b9b854871b7af3c5e46007fe979119a338
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include<hgl/graph/RenderNode.h>
|
||||
#include<hgl/graph/VKVABList.h>
|
||||
#include<hgl/type/SortedSets.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
class RenderAssignBuffer;
|
||||
@ -37,6 +38,8 @@ private:
|
||||
void Set(Renderable *);
|
||||
};
|
||||
|
||||
SortedSets<const VDM *> vdm_set;
|
||||
|
||||
DataArray<RenderItem> ri_array;
|
||||
uint ri_count;
|
||||
|
||||
@ -48,7 +51,7 @@ protected:
|
||||
|
||||
Pipeline * last_pipeline;
|
||||
const PrimitiveDataBuffer * last_data_buffer;
|
||||
const VertexDataManager * last_vdm;
|
||||
const VDM * last_vdm;
|
||||
const PrimitiveRenderData * last_render_data;
|
||||
|
||||
bool BindVAB(const PrimitiveDataBuffer *,const uint);
|
||||
|
@ -104,6 +104,8 @@ class Primitive;
|
||||
class Renderable;
|
||||
|
||||
class VertexDataManager;
|
||||
using VDM=VertexDataManager;
|
||||
|
||||
class RenderResource;
|
||||
|
||||
enum class SharingMode
|
||||
|
37
inc/hgl/graph/VKIndirectCommandBuffer.h
Normal file
37
inc/hgl/graph/VKIndirectCommandBuffer.h
Normal file
@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VKBuffer.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class IndirectCommandBuffer:public DeviceBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
uint32_t max_count;
|
||||
uint32_t stride;
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
IndirectCommandBuffer(VkDevice d,const DeviceBufferData &vb,const uint32_t mc,const uint32_t s):DeviceBuffer(d,vb)
|
||||
{
|
||||
max_count=mc;
|
||||
stride=s;
|
||||
}
|
||||
|
||||
~IndirectCommandBuffer()=default;
|
||||
|
||||
const uint32_t GetMaxCount ()const { return max_count; }
|
||||
|
||||
const VkDeviceSize GetTotalBytes()const { return stride*max_count; }
|
||||
|
||||
void * Map (VkDeviceSize start,VkDeviceSize size) override {return DeviceBuffer::Map(start*stride,size*stride);}
|
||||
void Flush (VkDeviceSize start,VkDeviceSize size) override {return DeviceBuffer::Flush(start*stride,size*stride);}
|
||||
void Flush (VkDeviceSize size) override {return DeviceBuffer::Flush(size*stride);}
|
||||
|
||||
bool Write (const void *ptr,uint32_t start,uint32_t size) override {return DeviceBuffer::Write(ptr,start*stride,size*stride);}
|
||||
bool Write (const void *ptr,uint32_t size) override {return DeviceBuffer::Write(ptr,0,size*stride);}
|
||||
};//class IndirectCommandBuffer:public DeviceBuffer
|
||||
VK_NAMESPACE_END
|
@ -1,5 +1,4 @@
|
||||
#ifndef HGL_GRAPH_RENDERABLE_INCLUDE
|
||||
#define HGL_GRAPH_RENDERABLE_INCLUDE
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VKPrimitive.h>
|
||||
#include<hgl/graph/VKPipeline.h>
|
||||
@ -69,7 +68,7 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* 可渲染对象<br>
|
||||
* 原始可渲染对象(即仅一个模型一个材质)
|
||||
*/
|
||||
class Renderable ///可渲染对象实例
|
||||
{
|
||||
@ -111,4 +110,3 @@ public:
|
||||
|
||||
Renderable *CreateRenderable(Primitive *,MaterialInstance *,Pipeline *);
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_RENDERABLE_INCLUDE
|
||||
|
@ -32,12 +32,12 @@ namespace hgl
|
||||
const uint32_t GetStride()const { return stride; }
|
||||
const uint32_t GetCount ()const { return count; }
|
||||
|
||||
const VkDeviceSize GetBytes()const { return stride*count; }
|
||||
const VkDeviceSize GetTotalBytes()const { return stride*count; }
|
||||
|
||||
public:
|
||||
|
||||
void * Map (VkDeviceSize start,VkDeviceSize size) override {return DeviceBuffer::Map(start*stride,size*stride);}
|
||||
void Flush (VkDeviceSize start,VkDeviceSize size) override {return DeviceBuffer::Flush(start*stride,size*stride); }
|
||||
void Flush (VkDeviceSize start,VkDeviceSize size) override {return DeviceBuffer::Flush(start*stride,size*stride);}
|
||||
void Flush (VkDeviceSize size) override {return DeviceBuffer::Flush(size*stride);}
|
||||
|
||||
bool Write (const void *ptr,uint32_t start,uint32_t size) override {return DeviceBuffer::Write(ptr,start*stride,size*stride);}
|
||||
|
@ -57,4 +57,6 @@ public:
|
||||
IndexBuffer *GetIBO(){return ibo;}
|
||||
VAB *GetVAB(const uint index){return vab[index];}
|
||||
};//class VertexDataManager
|
||||
|
||||
using VDM=VertexDataManager;
|
||||
VK_NAMESPACE_END
|
||||
|
@ -236,6 +236,7 @@ SOURCE_GROUP("Vulkan\\Render Pass" FILES ${VK_RENDER_PASS_SOURCE})
|
||||
SOURCE_GROUP("Vulkan\\Render Context" FILES ${VK_RENDER_CONTEXT_SOURCE})
|
||||
|
||||
SET(VK_CMD_BUFFER_SOURCE ${SG_INCLUDE_PATH}/VKCommandBuffer.h
|
||||
${SG_INCLUDE_PATH}/VKIndirectCommandBuffer.h
|
||||
Vulkan/VKCommandBuffer.cpp
|
||||
Vulkan/VKCommandBufferRender.cpp)
|
||||
|
||||
|
@ -135,6 +135,9 @@ void MaterialRenderList::Stat()
|
||||
last_vdm =ri->pdb->vdm;
|
||||
last_render_data=ri->prd;
|
||||
|
||||
if(last_vdm)
|
||||
vdm_set.Add(last_vdm);
|
||||
|
||||
++rn;
|
||||
|
||||
for(uint i=1;i<count;i++)
|
||||
@ -174,8 +177,12 @@ void MaterialRenderList::Stat()
|
||||
last_vdm =ri->pdb->vdm;
|
||||
last_render_data=ri->prd;
|
||||
|
||||
if(last_vdm)
|
||||
vdm_set.Add(last_vdm);
|
||||
|
||||
++rn;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool MaterialRenderList::BindVAB(const PrimitiveDataBuffer *pdb,const uint ri_index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user