diff --git a/dl/base/dl_type_user.h b/dl/base/dl_type_user.h index efec359e..98d127df 100644 --- a/dl/base/dl_type_user.h +++ b/dl/base/dl_type_user.h @@ -54,4 +54,7 @@ struct DeviceInfo std::string _name; }_monitor; //!< 显示器 }; + + + } \ No newline at end of file diff --git a/dl/base/dl_vector2.h b/dl/base/dl_vector2.h new file mode 100644 index 00000000..ff78cc36 --- /dev/null +++ b/dl/base/dl_vector2.h @@ -0,0 +1,30 @@ +/** +* @file dl_vector2.h +* @brief 2άvector +* +* +* @version 1.0 +* @author lveyou +* @date 23-07-09 +* +* @note ÌṩÐÐָÕ룬±ÜÃâ³˷¨¼ÆËã +* @note Éè¼ÆΪÉ±´£¬Óëstd::vectorһÖ +*/ +#pragma once + + +namespace dl { + +template +class Vector2 +{ +public: + Vector2() : + _w{ 0 } + {} +private: + std::vector _data; + std::size_t _w;// ¿í + std::vector _ptrLine; // ÐÐָÕë +}; +} \ No newline at end of file diff --git a/dl/io/dl_log.cpp b/dl/io/dl_log.cpp index 8c3cc292..2c6883c9 100644 --- a/dl/io/dl_log.cpp +++ b/dl/io/dl_log.cpp @@ -20,6 +20,8 @@ void log(std::string_view str, const std::source_location location /*= std::sour s += fmt::format("{}({}): ", location.file_name(), location.line()); } + s += LogSystem::Level2String(setting._level); + s += ": "; s += str; if (setting._bStackTrace) { diff --git a/dl/io/dl_log.h b/dl/io/dl_log.h index 2fb8a41d..66283f19 100644 --- a/dl/io/dl_log.h +++ b/dl/io/dl_log.h @@ -27,11 +27,28 @@ namespace dl { +constexpr std::array DL_LOG_SYSTEM_LEVLE_NAME = { + "pause", "test", "info", "msg", "notice", "warn", "err", "damage" +}; + + class LogSystem { public: + enum class Level + { + PAUSE, + TEST, + INFO, + MSG, + NOTICE, + WARN, + ERR, + DAMAGE + }; struct Setting { + Level _level = Level::INFO; bool _bSourceLocation = true; bool _bStackTrace = false; }; @@ -39,14 +56,49 @@ public: { _stackSetting.push({}); } + + //! 返回当前设置 Setting& GetSetting() { return _stackSetting.top(); } + + //! 入栈设置 + void Push(const Setting& setting) + { + _stackSetting.push(setting); + } + + //! 入栈设置 + void PushLevel(Level level) + { + Setting setting = GetSetting(); + setting._level = level; + _stackSetting.push(setting); + } + + //! 出栈设置 + void Pop() + { + _stackSetting.pop(); + } + + /** + * @brief 日志等级转字符串 + */ + static std::string_view Level2String(Level level) + { + size_t index = (size_t)level; + if (index >= DL_LOG_SYSTEM_LEVLE_NAME.size()) + return "NONE"; + return DL_LOG_SYSTEM_LEVLE_NAME[index]; + } private: std::stack _stackSetting; }; extern LogSystem* g_log; + + /** * @brief 输出日志 */ @@ -59,4 +111,60 @@ void log(std::string_view str, void log(std::string_view str); #endif +void log_pause(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::PAUSE); + log(str); + g_log->Pop(); +} + +void log_test(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::TEST); + log(str); + g_log->Pop(); +} + +void log_info(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::INFO); + log(str); + g_log->Pop(); +} + +void log_msg(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::MSG); + log(str); + g_log->Pop(); +} + +void log_notice(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::NOTICE); + log(str); + g_log->Pop(); +} + +void log_warn(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::WARN); + log(str); + g_log->Pop(); +} + +void log_err(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::ERR); + log(str); + g_log->Pop(); +} + +void log_damage(std::string_view str) +{ + g_log->PushLevel(LogSystem::Level::DAMAGE); + log(str); + g_log->Pop(); +} + } \ No newline at end of file diff --git a/dl/memory/dl_buffer.cpp b/dl/memory/dl_buffer.cpp index d33ebaa5..ebf8c48c 100644 --- a/dl/memory/dl_buffer.cpp +++ b/dl/memory/dl_buffer.cpp @@ -1,63 +1,61 @@ -#include -#include "MKBuffer.h" +#include "memory/dl_buffer.h" -#ifndef MK_OTHER_PROJECT #include "fmt/format.h" -#endif -namespace mk +namespace dl { -std::string toString(const Buffer& buf, bool add_tag /*= false*/) -{ - if (buf.empty()) - return ""; - std::string ret; - if (add_tag) - ret += "0x"; - for (size_t i = 0; i < buf.size(); ++i) - { -#ifndef MK_OTHER_PROJECT - ret += fmt::format("{:0<2x}", buf.data()[i]); -#else - ret += format("{:0<2x}", buf.data()[i]); -#endif - } - return ret; -} - -mk::Buffer createBuffer(unsigned char* p, size_t size) -{ - Buffer ret; - ret.resize(size); - memcpy(ret.data(), p, size); - return ret; -} - -mk::Buffer createBuffer(std::vector& vec) -{ - Buffer ret; - ret.resize(vec.size()); - memcpy(ret.data(), vec.data(), vec.size()); - return ret; -} - -Buffer createBuffer(const std::string& path_name) -{ - std::ifstream ifs{ path_name, std::ios::binary }; - if (!ifs.is_open()) - return {}; - - Buffer ret; - - ifs.seekg(0, std::ios::end); - ret.resize((size_t)ifs.tellg()); - - - ifs.seekg(0); - ifs.read((char*)ret.data(), ret.size()); - return ret; -} +//std::string toString(const Buffer& buf, bool add_tag /*= false*/) +//{ +// if (buf.empty()) +// return ""; +// std::string ret; +// if (add_tag) +// ret += "0x"; +// +// for (size_t i = 0; i < buf.size(); ++i) +// { +//#ifndef MK_OTHER_PROJECT +// ret += fmt::format("{:0<2x}", buf.data()[i]); +//#else +// ret += format("{:0<2x}", buf.data()[i]); +//#endif +// } +// return ret; +//} +// +//mk::Buffer createBuffer(unsigned char* p, size_t size) +//{ +// Buffer ret; +// ret.resize(size); +// memcpy(ret.data(), p, size); +// return ret; +//} +// +//mk::Buffer createBuffer(std::vector& vec) +//{ +// Buffer ret; +// ret.resize(vec.size()); +// memcpy(ret.data(), vec.data(), vec.size()); +// return ret; +//} +// +//Buffer createBuffer(const std::string& path_name) +//{ +// std::ifstream ifs{ path_name, std::ios::binary }; +// if (!ifs.is_open()) +// return {}; +// +// Buffer ret; +// +// ifs.seekg(0, std::ios::end); +// ret.resize((size_t)ifs.tellg()); +// +// +// ifs.seekg(0); +// ifs.read((char*)ret.data(), ret.size()); +// return ret; +//} } diff --git a/dl/memory/dl_buffer.h b/dl/memory/dl_buffer.h index e747a98f..7e082d17 100644 --- a/dl/memory/dl_buffer.h +++ b/dl/memory/dl_buffer.h @@ -14,6 +14,7 @@ #include #include +#include namespace dl { diff --git a/dl/render/dl_image.cpp b/dl/render/dl_image.cpp new file mode 100644 index 00000000..6acb9261 --- /dev/null +++ b/dl/render/dl_image.cpp @@ -0,0 +1,11 @@ +#include "render/dl_image.h" + +namespace dl +{ + +dl::Image* CreateImage(std::string_view str_path) +{ + +} + +} \ No newline at end of file diff --git a/dl/render/dl_image.h b/dl/render/dl_image.h new file mode 100644 index 00000000..2049dae9 --- /dev/null +++ b/dl/render/dl_image.h @@ -0,0 +1,140 @@ +/** +* @file dl_image.h +* @brief 图像对象 +* +* +* @version 1.1 +* @author lveyou +* @date 21-08-09 +* +* @note 基本的图像对象,使用stb_image库加载 +* @note 基于4字节的n32颜色,内部通道为ABGR,接口使用Color.h规定的 +* @note 注意转为char访问时,需要考虑字节序 +*/ +#pragma once + +#include "base/dl_vector2.h" + +namespace dl { + +using Image = Vector2; + + +Image* CreateImage(std::string_view str_path); +// +//class Image +//{ +//public: +// /** +// * @brief 创建图像 +// * @param[in] path_name 路径 +// * @retval 用户需要使用delete释放获得的指针,除非失败返回了nullptr。 +// */ +// static Image* Create(string_view path_name); +// +// /** +// * @brief 创建图像 +// * @param[in] size 大小 +// * @param[in] color 颜色 +// */ +// static Image* Create(const Size& size, const Color& color); +// +// /** +// * @brief 是否支持的格式 +// * @param[in] str 格式,例如png +// * @param[in] read 为真时检查可读取,反之为可保存 +// * @note 依赖stb_image库,注意必须全小写 +// */ +// static bool IsSupportFormat(string_view str, bool read) +// { +// constexpr array ARRAY_READ = { +// "jpg", "png", "tga", "bmp", "psd", "gif", "hdr", "pic" +// }; +// constexpr array ARRAY_WRITE = { +// "png", "tag", "bmp" +// }; +// return read ? Any::Equal(ARRAY_READ, str) : Any::Equal(ARRAY_WRITE, str); +// } +// +// /** +// * @brief 返回图像大小 +// */ +// Size GetSize() const +// { +// return _size; +// } +// /** +// * @brief 返回字节大小 +// */ +// size_t GetSizeByte() +// { +// return _size[0] * _size[1] * 4; +// } +// /** +// * @brief 返回数据指针 +// */ +// byte* GetBuffer() +// { +// return (byte*)_data; +// } +// /** +// * @brief 返回数据指针 +// */ +// uint32_t* GetData() +// { +// return _data; +// } +// +// /** +// * @brief 计算返回最小包围盒(去除边缘的全透明像素) +// * @param[in] rect 传入包围盒 +// */ +// void CalcLeastRect(RectU& rect); +// /** +// * @brief 返回是否包含非透明颜色 +// * @note 只判断alpha通道 +// */ +// bool IsHaveTranslucent(const RectU& rect) const; +// /** +// * @brief 添加另一个图像的部分到自己的位置上 +// * @param[in] img 另一个图像 +// * @param[in] rect 另一图像选择的区域 +// * @param[in] tar_xy 自己的位置 +// * +// * @note 如果有超出源图像区域,或者超出目标图像区域,则什么都不做,只发出一条警告 +// */ +// void AddImageRect(const Image* img, const RectU& rect, const PointU& tar_xy); +// /** +// * @brief 设置透明色颜色为0,针对于某些颜色透明,但是其他通道非0 +// */ +// void SetAlphaZero() +// { +// size_t length = size_t(Accumulate::Mul(_size)); +// for (size_t i = 0; i != length; ++i) +// { +// if (ABGR::GetA(_data[i]) == 0) +// { +// _data[i] = 0; +// } +// } +// } +// +// +// /** +// * @brief 保存到图像 +// */ +// bool SaveToFile(string_view path_name); +// ~Image(); +//private: +// Image(): +// _data{nullptr}, +// _size{} +// {} +// uint32_t* _data; +// Size _size; +// +// bool _is_out_range(const PointU& xy) const; +//}; + + +} diff --git a/dl/vk/dl_vertex.h b/dl/vk/dl_vertex.h new file mode 100644 index 00000000..f755e88d --- /dev/null +++ b/dl/vk/dl_vertex.h @@ -0,0 +1,157 @@ +/** +* @file dl_vertex.h +* @brief 顶点 +* +* +* @version 1.0 +* @author lveyou +* @date 23-07-09 +* +* @note +*/ +#pragma once + +#include + +namespace dl +{ + +//! 3d顶点 +struct Vertex +{ + Position3 _pos; + Position3 _uv; + Position3 _normal; + Position3 _tangent; + static VkVertexInputBindingDescription getBindingDescription() + { + VkVertexInputBindingDescription bindingDescription{}; + bindingDescription.binding = 0; + bindingDescription.stride = sizeof(Vertex); + bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; + return bindingDescription; + } + static array getAttributeDescriptions() + { + array attributeDescriptions{}; + attributeDescriptions[0].binding = 0; + attributeDescriptions[0].location = 0; + attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[0].offset = offsetof(Vertex, _pos); + attributeDescriptions[1].binding = 0; + attributeDescriptions[1].location = 1; + attributeDescriptions[1].format = VK_FORMAT_R32G32_SFLOAT; + attributeDescriptions[1].offset = offsetof(Vertex, _uv); + attributeDescriptions[2].binding = 0; + attributeDescriptions[2].location = 2; + attributeDescriptions[2].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[2].offset = offsetof(Vertex, _normal); + attributeDescriptions[3].binding = 0; + attributeDescriptions[3].location = 3; + attributeDescriptions[3].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[3].offset = offsetof(Vertex, _tangent); + return attributeDescriptions; + } +}; + +constexpr size_t NUM_BONE = 4; +//! 3d顶点(带骨骼) +struct VertexBone +{ + Position3 _pos; + Position2 _uv; + Position3 _normal; + Position3 _tangent; + Position3 _boneWeight; + uint8_t _boneID[NUM_BONE]; + static VkVertexInputBindingDescription getBindingDescription() + { + VkVertexInputBindingDescription bindingDescription{}; + bindingDescription.binding = 0; + bindingDescription.stride = sizeof(VertexBone); + bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; + return bindingDescription; + } + static array getAttributeDescriptions() + { + array attributeDescriptions{}; + attributeDescriptions[0].binding = 0; + attributeDescriptions[0].location = 0; + attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[0].offset = offsetof(VertexBone, _pos); + attributeDescriptions[1].binding = 0; + attributeDescriptions[1].location = 1; + attributeDescriptions[1].format = VK_FORMAT_R32G32_SFLOAT; + attributeDescriptions[1].offset = offsetof(VertexBone, _uv); + attributeDescriptions[2].binding = 0; + attributeDescriptions[2].location = 2; + attributeDescriptions[2].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[2].offset = offsetof(VertexBone, _normal); + attributeDescriptions[3].binding = 0; + attributeDescriptions[3].location = 3; + attributeDescriptions[3].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[3].offset = offsetof(VertexBone, _tangent); + attributeDescriptions[4].binding = 0; + attributeDescriptions[4].location = 4; + attributeDescriptions[4].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[4].offset = offsetof(VertexBone, _boneWeight); + attributeDescriptions[5].binding = 0; + attributeDescriptions[5].location = 5; + attributeDescriptions[5].format = VK_FORMAT_R8G8B8A8_UINT; + attributeDescriptions[5].offset = offsetof(VertexBone, _boneID); + + return attributeDescriptions; + } +}; + +//! 材质 +struct Material +{ + Position4 _diffuseAlbedo;//漫反射率 + Position3 _fresnelR0; //菲涅耳系数 + float _roughness; //粗糙度 + + bool operator==(const Material& b) const + { + return _roughness == b._roughness + && _fresnelR0 == b._fresnelR0 + && _diffuseAlbedo == b._diffuseAlbedo; + } +}; + + +//! 2d顶点 +struct Vertex2D +{ + Position3 _pos; + Color _color; + Position2 _uv; + static VkVertexInputBindingDescription getBindingDescription() + { + VkVertexInputBindingDescription bindingDescription{}; + bindingDescription.binding = 0; + bindingDescription.stride = sizeof(Vertex2D); + bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; + return bindingDescription; + } + static array getAttributeDescriptions() + { + array attributeDescriptions{}; + attributeDescriptions[0].binding = 0; + attributeDescriptions[0].location = 0; + attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[0].offset = offsetof(Vertex2D, _pos); + attributeDescriptions[1].binding = 0; + attributeDescriptions[1].location = 1; + attributeDescriptions[1].format = VK_FORMAT_R32G32B32A32_SFLOAT; + attributeDescriptions[1].offset = offsetof(Vertex2D, _color); + attributeDescriptions[2].binding = 0; + attributeDescriptions[2].location = 2; + attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT; + attributeDescriptions[2].offset = offsetof(Vertex2D, _uv); + return attributeDescriptions; + } +}; + +} + diff --git a/dl/vk/dl_vk.h b/dl/vk/dl_vk.h index bc5d0b2e..6b00afd2 100644 --- a/dl/vk/dl_vk.h +++ b/dl/vk/dl_vk.h @@ -13,14 +13,18 @@ #include #include +#include #define GLFW_INCLUDE_VULKAN #include +#include "io/dl_log.h" #include "math/dl_matrix.h" #include "render/dl_sprite.h" #include "base/dl_type_user.h" #include "memory/dl_buffer.h" +#include "vk/dl_vertex.h" +#include "render/dl_image.h" namespace dl { @@ -500,16 +504,16 @@ public: { if (id >= _allPushConstant.size()) { - debug_err(format("超过 推送常量区上限:{}", _allPushConstant.size())); + log(fmt::format("超过 推送常量区上限:{}", _allPushConstant.size())); return nullptr; } return &_allPushConstant[id]; } //! 更新骨骼ubo(实例id) - void UpdateUboBone(size_t id, vector& trans) + void UpdateUboBone(size_t id, std::vector& trans) { - dnd_assert(trans.size() <= NUM_MAX_BONE_TRANS); + assert(trans.size() <= NUM_MAX_BONE_TRANS); size_t size = sizeof(Matrix4) * trans.size(); size_t index = id * NUM_MAX_FRAME_IN_FLIGHT + _currentFrame; @@ -528,19 +532,19 @@ public: if (!_mapBoneUse[i]) return i; } - debug_err("无可用骨骼ub!"); + log("无可用骨骼ub!"); return -1; } //! 设置蒙皮id可用 void SetUboBoneFree(size_t id) { - dnd_assert(_mapBoneUse[id]); + assert(_mapBoneUse[id]); _mapBoneUse[id] = false; } //! 设置蒙皮id占用(描述符创建时就已经映射) void SetUboBoneUse(size_t id) { - dnd_assert(!_mapBoneUse[id]); + assert(!_mapBoneUse[id]); _mapBoneUse[id] = true; } @@ -686,7 +690,7 @@ public: VkImage dst_image; if (vkCreateImage(_device, &create_info, nullptr, &dst_image) != VK_SUCCESS) { - debug_err("创建dst_image失败!"); + log_error("创建dst_image失败!"); return; } //创建内存内存 @@ -1073,60 +1077,60 @@ public: } private: VkInstance _instance; //vk实例 - vector _allExtension; //所有扩展,返回获得 - vector _allLayer; //所有层,返回获得 - vector _allValidationLayer; //验证层,手动设置 + std::vector _allExtension; //所有扩展,返回获得 + std::vector _allLayer; //所有层,返回获得 + std::vector _allValidationLayer; //验证层,手动设置 VkPhysicalDevice _physicalDevice; //所选物理设备 - vector _allPhysicalDevice; //所有物理设备 + std::vector _allPhysicalDevice; //所有物理设备 VkDevice _device; //逻辑设备 VkQueue _graphicsQueue; //图形队列 VkSurfaceKHR _surface; //窗口表面 VkQueue _presentQueue; //呈现队列 - vector _allDeviceExtension; //物理设备所需扩展,手动设置 + std::vector _allDeviceExtension; //物理设备所需扩展,手动设置 VkSwapchainKHR _swapChain; //交换链 - vector _allImageSwapChain; //交换链图像 + std::vector _allImageSwapChain; //交换链图像 VkFormat _formatSwapChainImage; //交换链图像格式 VkExtent2D _extentSwapChain; //交换链范围 - vector _allImageViewSwapChain; //交换链图像视图 + std::vector _allImageViewSwapChain; //交换链图像视图 VkRenderPass _renderPass; //渲染流程 VkPipelineLayout _pipelineLayout; //管线布局 VkPipelineLayout _pipelineLayoutBone; //管线布局(骨骼动画) VkPipeline _graphicsPipeline; //图形管线 VkPipeline _graphicsPipelineBone; //图形管线(骨骼动画) - vector _allFrameBufferSwapChain; //交换链帧缓冲区 + std::vector _allFrameBufferSwapChain; //交换链帧缓冲区 VkCommandPool _commandPool; //命令池 - vector _allCommandBuffer; //命令缓冲区(依赖于命令池,自动释放) - vector _allSemaphoreImageAvailable;//同步对象(交换链图像可用) - vector _allSemaphoreRenderFinished;//同步对象(绘制完成) - vector _allFenceInFlight; //同步对象(绘制过程) + std::vector _allCommandBuffer; //命令缓冲区(依赖于命令池,自动释放) + std::vector _allSemaphoreImageAvailable;//同步对象(交换链图像可用) + std::vector _allSemaphoreRenderFinished;//同步对象(绘制完成) + std::vector _allFenceInFlight; //同步对象(绘制过程) uint32_t _currentFrame; //当前帧 bool _bFrameBufferResize; //帧缓冲大小发生变化 VkDebugUtilsMessengerEXT _debugMessenger; //调试信使 VkDescriptorSetLayout _descriptorSetLayout; //描述符集合布局 VkDescriptorSetLayout _descriptorSetLayoutBone; //描述符集合布局(骨骼动画) - vector _uniformBuffers; //统一缓冲 - vector _uniformBuffersMemory; //统一缓冲内存 + std::vector _uniformBuffers; //统一缓冲 + std::vector _uniformBuffersMemory; //统一缓冲内存 VkDescriptorPool _descriptorPool; //描述符池 VkDescriptorPool _descriptorPoolBone; //描述符池(带骨骼动画) - vector _descriptorSets; //所有描述符集 - vector _descriptorSetsBone; //所有描述符集(带骨骼动画) + std::vector _descriptorSets; //所有描述符集 + std::vector _descriptorSetsBone; //所有描述符集(带骨骼动画) VkSampler _textureSampler; //纹理采样器 VkImage _depthImage; //深度图像 VkDeviceMemory _depthImageMemory; //深度图像内存 VkImageView _depthImageView; //深度图像视图 - array _allPushConstant;//常量缓冲 + std::array _allPushConstant;//常量缓冲 size_t _curPushConstant; //当前使用 常量缓冲 下标 Camera* _camera; //当前摄像机(设置vp矩阵) Camera _cameraDefault; //默认相机 - vector _allTexture3D; //3d使用的所有贴图 - unordered_map _mapPath2Texture; //文件路径 -> 纹理下标 - vector _ubMaterial; //材质缓冲 - vector _ubMaterialMemory; //材质缓冲内存 - vector _allMaterial; //所有已添加材质(计数和避免重复) - vector _ubBone; //骨骼ub - vector _ubBoneMemory; //骨骼ub内存 - vector _mapBoneUse; //骨骼ub使用表 - vector _allPrimitive; //所有图元 + std::vector _allTexture3D; //3d使用的所有贴图 + std::unordered_map _mapPath2Texture; //文件路径 -> 纹理下标 + std::vector _ubMaterial; //材质缓冲 + std::vector _ubMaterialMemory; //材质缓冲内存 + std::vector _allMaterial; //所有已添加材质(计数和避免重复) + std::vector _ubBone; //骨骼ub + std::vector _ubBoneMemory; //骨骼ub内存 + std::vector _mapBoneUse; //骨骼ub使用表 + std::vector _allPrimitive; //所有图元 VkSampleCountFlagBits _msaaSamples; //msaa采样数 VkImage _colorImage; //离屏图像 VkDeviceMemory _colorImageMemory; //离屏图像内存 @@ -1203,7 +1207,7 @@ private: //检查拓展支持数 void _check_extension(); //返回需要的扩展(根据验证层) - vector _get_required_extensions(); + std::vector _get_required_extensions(); //创建实例 void _create_instance(); //创建验证层 @@ -1222,7 +1226,7 @@ private: if (CreateDebugUtilsMessengerEXT(_instance, &createInfo, nullptr, &_debugMessenger) != VK_SUCCESS) { - debug_err("开启调试信使失败!"); + log_err("开启调试信使失败!"); return; } } @@ -1284,7 +1288,7 @@ private: //记录命令 void _record_command_buffer(VkCommandBuffer command_buffer, uint32_t index_image, - const vector& list_dc, const vector& list_dc_translucent); + const std::vector& list_dc, const std::vector& list_dc_translucent); //重建交换链 void _rebuild_swap_chain(GLFWwindow* window);