RenderSurface::CreateBuffer增加错误检测和报警
This commit is contained in:
parent
e55896059f
commit
b7fe7626b8
@ -55,11 +55,18 @@ namespace
|
||||
|
||||
VertexBuffer *RenderSurface::CreateBuffer(VkBufferUsageFlags buf_usage,VkFormat format,uint32_t count,VkSharingMode sharing_mode)
|
||||
{
|
||||
VulkanBuffer vb;
|
||||
|
||||
const uint32_t stride=GetStrideByFormat(format);
|
||||
|
||||
if(stride==0)
|
||||
{
|
||||
std::cerr<<"format["<<format<<"] stride length is 0,please use \"RenderSurface::CreateBuffer(VkBufferUsageFlags,VkDeviceSize,VkSharingMode)\" function.";
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
const VkDeviceSize size=stride*count;
|
||||
|
||||
VulkanBuffer vb;
|
||||
|
||||
if(!CreateVulkanBuffer(vb,rsa,buf_usage,size,sharing_mode))
|
||||
return(nullptr);
|
||||
|
||||
|
@ -12,10 +12,10 @@ VK_NAMESPACE_BEGIN
|
||||
using CharPointerList=hgl::List<const char *>;
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool CheckStrideBytesByFormat();
|
||||
bool CheckStrideBytesByFormat(); ///<检验所有数据类型长度数组是否符合规则
|
||||
#endif//_DEBUG
|
||||
|
||||
uint32_t GetStrideByFormat(const VkFormat &);
|
||||
uint32_t GetStrideByFormat(const VkFormat &); ///<根据数据类型获取访类型单个数据长度字节数
|
||||
|
||||
inline void debug_out(const hgl::List<VkLayerProperties> &layer_properties)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user