preparing VKIndirectCommandBuffer.h
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user