moved codes to stalone files, they're VKIndexBuffer.h and VKVertexAttribBuffer.h
This commit is contained in:
parent
46f006f470
commit
cc014e9b31
@ -48,61 +48,5 @@ public:
|
||||
bool Write (const void *ptr,uint32_t size) {return buf.memory->Write(ptr,0,size);}
|
||||
bool Write (const void *ptr) {return buf.memory->Write(ptr);}
|
||||
};//class GPUBuffer
|
||||
|
||||
class VertexAttribBuffer:public GPUBuffer
|
||||
{
|
||||
VkFormat format; ///<数据格式
|
||||
uint32_t stride; ///<单个数据字节数
|
||||
uint32_t count; ///<数据数量
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
VertexAttribBuffer(VkDevice d,const GPUBufferData &vb,VkFormat fmt,uint32_t _stride,uint32_t _count):GPUBuffer(d,vb)
|
||||
{
|
||||
format=fmt;
|
||||
stride=_stride;
|
||||
count=_count;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
~VertexAttribBuffer()=default;
|
||||
|
||||
const VkFormat GetFormat()const { return format; }
|
||||
const uint32_t GetStride()const { return stride; }
|
||||
const uint32_t GetCount ()const { return count; }
|
||||
|
||||
void *Map(VkDeviceSize start=0,VkDeviceSize size=0) override
|
||||
{
|
||||
return GPUBuffer::Map(start*stride,size*stride);
|
||||
}
|
||||
};//class VertexAttribBuffer:public GPUBuffer
|
||||
|
||||
using VAB=VertexAttribBuffer;
|
||||
|
||||
class IndexBuffer:public GPUBuffer
|
||||
{
|
||||
IndexType index_type;
|
||||
uint32_t count;
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
IndexBuffer(VkDevice d,const GPUBufferData &vb,IndexType it,uint32_t _count):GPUBuffer(d,vb)
|
||||
{
|
||||
index_type=it;
|
||||
count=_count;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
~IndexBuffer()=default;
|
||||
|
||||
const IndexType GetType ()const{return index_type;}
|
||||
const uint32 GetCount()const{return count;}
|
||||
};//class IndexBuffer:public GPUBuffer
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_BUFFER_INCLUDE
|
||||
|
34
inc/hgl/graph/VKIndexBuffer.h
Normal file
34
inc/hgl/graph/VKIndexBuffer.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_INDEX_BUFFER_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_INDEX_BUFFER_INCLUDE
|
||||
|
||||
#include<hgl/graph/VKBuffer.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
class IndexBuffer:public GPUBuffer
|
||||
{
|
||||
IndexType index_type;
|
||||
uint32_t count;
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
IndexBuffer(VkDevice d,const GPUBufferData &vb,IndexType it,uint32_t _count):GPUBuffer(d,vb)
|
||||
{
|
||||
index_type=it;
|
||||
count=_count;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
~IndexBuffer()=default;
|
||||
|
||||
const IndexType GetType ()const{return index_type;}
|
||||
const uint32 GetCount()const{return count;}
|
||||
};//class IndexBuffer:public GPUBuffer
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_VULKAN_INDEX_BUFFER_INCLUDE
|
44
inc/hgl/graph/VKVertexAttribBuffer.h
Normal file
44
inc/hgl/graph/VKVertexAttribBuffer.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE
|
||||
|
||||
#include<hgl/graph/VKBuffer.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
class VertexAttribBuffer:public GPUBuffer
|
||||
{
|
||||
VkFormat format; ///<数据格式
|
||||
uint32_t stride; ///<单个数据字节数
|
||||
uint32_t count; ///<数据数量
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
VertexAttribBuffer(VkDevice d,const GPUBufferData &vb,VkFormat fmt,uint32_t _stride,uint32_t _count):GPUBuffer(d,vb)
|
||||
{
|
||||
format=fmt;
|
||||
stride=_stride;
|
||||
count=_count;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
~VertexAttribBuffer()=default;
|
||||
|
||||
const VkFormat GetFormat()const { return format; }
|
||||
const uint32_t GetStride()const { return stride; }
|
||||
const uint32_t GetCount ()const { return count; }
|
||||
|
||||
void *Map(VkDeviceSize start=0,VkDeviceSize size=0) override
|
||||
{
|
||||
return GPUBuffer::Map(start*stride,size*stride);
|
||||
}
|
||||
};//class VertexAttribBuffer:public GPUBuffer
|
||||
|
||||
using VAB=VertexAttribBuffer;
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE
|
Loading…
x
Reference in New Issue
Block a user