diff --git a/inc/hgl/graph/VKBuffer.h b/inc/hgl/graph/VKBuffer.h index b76efbf1..7fe19a5d 100644 --- a/inc/hgl/graph/VKBuffer.h +++ b/inc/hgl/graph/VKBuffer.h @@ -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 diff --git a/inc/hgl/graph/VKIndexBuffer.h b/inc/hgl/graph/VKIndexBuffer.h new file mode 100644 index 00000000..9dc375a4 --- /dev/null +++ b/inc/hgl/graph/VKIndexBuffer.h @@ -0,0 +1,34 @@ +#ifndef HGL_GRAPH_VULKAN_INDEX_BUFFER_INCLUDE +#define HGL_GRAPH_VULKAN_INDEX_BUFFER_INCLUDE + +#include + +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 diff --git a/inc/hgl/graph/VKVertexAttribBuffer.h b/inc/hgl/graph/VKVertexAttribBuffer.h new file mode 100644 index 00000000..7c497051 --- /dev/null +++ b/inc/hgl/graph/VKVertexAttribBuffer.h @@ -0,0 +1,44 @@ +#ifndef HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE +#define HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE + +#include + +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