* vk报错修正

This commit is contained in:
2024-12-31 02:33:01 +08:00
parent 62426dd06c
commit d52e9bb2a3
15 changed files with 131 additions and 88 deletions
+21 -14
View File
@@ -29,7 +29,7 @@ else()
set(DL_DISABLE_AUDIO false)
set(DL_DISABLE_OPENSSL false)
set(DL_DISABLE_CURL false)
set(DL_DISABLE_CONSOLE false)
set(DL_DISABLE_CONSOLE false) # 仅控制是否有控制台
set(DL_USE_MT false)
endif()
@@ -144,23 +144,30 @@ add_subdirectory ("dl")
if(NOT DL_DISABLE_RENDER)
message("------------------解析dl_test-----------------------")
add_subdirectory ("project/dl_test")
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_editor/CMakeLists.txt)
message("------------------解析dl_editor-----------------------")
add_subdirectory ("project/dl_editor")
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_midi/CMakeLists.txt)
message("------------------解析dl_midi-----------------------")
add_subdirectory ("project/dl_midi")
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_chess/CMakeLists.txt)
message("------------------解析dl_chess-----------------------")
add_subdirectory ("project/dl_chess")
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_snake/CMakeLists.txt)
message("------------------解析dl_snake-----------------------")
add_subdirectory ("project/dl_snake")
endif()
endif()
message("------------------解析dl_console-----------------------")
add_subdirectory ("project/dl_console")
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_editor/CMakeLists.txt)
message("------------------解析dl_editor-----------------------")
add_subdirectory ("project/dl_editor")
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_midi/CMakeLists.txt)
message("------------------解析dl_midi-----------------------")
add_subdirectory ("project/dl_midi")
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_chess/CMakeLists.txt)
message("------------------解析dl_chess-----------------------")
add_subdirectory ("project/dl_chess")
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_config/CMakeLists.txt)
message("------------------解析dl_config-----------------------")
add_subdirectory ("project/dl_config")
endif()
+5
View File
@@ -84,6 +84,11 @@ public:
return Integer(min, max);
}
static unsigned Uint(unsigned min, unsigned max)
{
return Integer(min, max);
}
/**
* @brief 从容器随机选择一个
* @param[in] container 容器(不能为空)
+1
View File
@@ -151,6 +151,7 @@ public:
/**
* @brief 创建默认精灵
*/
[[nodiscard]]
gcSprite CreateSpriteDefault(const Color& col = ColorDef::WHITE);
/**
+7 -1
View File
@@ -54,7 +54,7 @@ namespace dl
// message[1] = 64;
// message[2] = 91;
// _out->sendMessage(&message);
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
// message[0] = 128;
// message[1] = 70;
// message[2] = 40;
@@ -98,4 +98,10 @@ namespace dl
_imp->_out->sendMessage((unsigned char*)buf.data(), buf.size());
}
void Midi::PlayC()
{
/*unsigned char
_imp->_out->sendMessage(,);*/
}
}
+1
View File
@@ -24,6 +24,7 @@ public:
~Midi();
void Play(BufferView buf);
void PlayC();
private:
MidiImp* _imp;
};
+42 -32
View File
@@ -22,8 +22,8 @@ namespace dl
struct Vertex
{
Position3 _pos;
Position3 _normal;
Position2 _uv;
Position3 _normal;
Position3 _tangent;
static VkVertexInputBindingDescription getBindingDescription()
{
@@ -36,22 +36,26 @@ struct Vertex
static std::array<VkVertexInputAttributeDescription, 4> getAttributeDescriptions()
{
std::array<VkVertexInputAttributeDescription, 4> 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 = 2;
attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[1].offset = offsetof(Vertex, _normal);
attributeDescriptions[2].binding = 0;
attributeDescriptions[2].location = 1;
attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
attributeDescriptions[2].offset = offsetof(Vertex, _uv);
attributeDescriptions[3].binding = 0;
attributeDescriptions[3].location = 3;
attributeDescriptions[3].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[3].offset = offsetof(Vertex, _tangent);
uint32_t i = 0;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[i].offset = offsetof(Vertex, _pos);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32_SFLOAT;
attributeDescriptions[i].offset = offsetof(Vertex, _uv);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[i].offset = offsetof(Vertex, _normal);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[i].offset = offsetof(Vertex, _tangent);
return attributeDescriptions;
}
};
@@ -61,11 +65,12 @@ constexpr size_t NUM_BONE = 4;
struct VertexBone
{
Position3 _pos;
Position3 _normal;
Position2 _uv0;
Position2 _uv1;
std::array<uint32_t, NUM_BONE> _joint0;
Position3 _normal;
Position3 _tangent;
Position4 _weight0;
std::array<uint32_t, NUM_BONE> _joint0;
Position4 _color;
static VkVertexInputBindingDescription getBindingDescription()
{
@@ -75,19 +80,14 @@ struct VertexBone
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
return bindingDescription;
}
static std::array<VkVertexInputAttributeDescription, 7> getAttributeDescriptions()
static std::array<VkVertexInputAttributeDescription, 8> getAttributeDescriptions()
{
std::array<VkVertexInputAttributeDescription, 7> attributeDescriptions{};
std::array<VkVertexInputAttributeDescription, 8> attributeDescriptions{};
uint32_t i = 0;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[i].offset = offsetof(VertexBone, _pos);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[i].offset = offsetof(VertexBone, _normal);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
@@ -98,6 +98,21 @@ struct VertexBone
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32_SFLOAT;
attributeDescriptions[i].offset = offsetof(VertexBone, _uv1);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[i].offset = offsetof(VertexBone, _normal);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[i].offset = offsetof(VertexBone, _tangent);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_SFLOAT;
attributeDescriptions[i].offset = offsetof(VertexBone, _weight0);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
@@ -106,12 +121,7 @@ struct VertexBone
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_UINT;
attributeDescriptions[i].offset = offsetof(VertexBone, _weight0);
++i;
attributeDescriptions[i].binding = 0;
attributeDescriptions[i].location = i;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_UINT;
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_SFLOAT;
attributeDescriptions[i].offset = offsetof(VertexBone, _color);
return attributeDescriptions;
+2 -2
View File
@@ -352,9 +352,9 @@ public:
void* pUserData)
{
if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
;// log_test0(pCallbackData->pMessage);
log_test0(pCallbackData->pMessage);
else if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
log_info0(pCallbackData->pMessage);//提高了一个等级,方便断点
log_info0(pCallbackData->pMessage);
return VK_FALSE;
}
+5 -1
View File
@@ -8,7 +8,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# 设置处理
if (DL_DISABLE_RENDER)
message(SEND_ERROR "dl_test必须启动绘图系统,将会编译失败(DL_DISABLE_RENDER)!")
message(SEND_ERROR ${PROJECT_NAME}"必须启动绘图系统,将会编译失败(DL_DISABLE_RENDER)!")
endif()
# dl目录
@@ -49,6 +49,10 @@ include_directories(${CMAKE_SOURCE_DIR}/third/tinyxml2)
include_directories(${CMAKE_SOURCE_DIR}/third/asio/include)
# angelscript
include_directories(${CMAKE_SOURCE_DIR}/third/angelscript/angelscript/include)
# lua
include_directories(${CMAKE_SOURCE_DIR}/third/lua)
# lua bridge
include_directories(${CMAKE_SOURCE_DIR}/third/LuaBridge3/Source)
# dl资源文件夹
set(DL_PATH_RES ${CMAKE_SOURCE_DIR}/res)
+18 -18
View File
@@ -154,24 +154,24 @@ void Init()
//g_factory->LoadModel("axis.glb", "axis");
// 脚本加载
{
g_as->SetPathRoot("as/");
std::vector<std::string> vec;
File::GetPathFileAll("as/", vec, {}, false);
for (auto& iter : vec)
{
g_as->LoadModule(iter);
}
}
// mod加载
{
std::vector<std::string> vec;
File::GetPathFileAll("mod/", vec, {}, false);
for (auto& iter : vec)
{
g_mod->LoadMod(iter);
}
}
//{
// g_as->SetPathRoot("as/");
// std::vector<std::string> vec;
// File::GetPathFileAll("as/", vec, {}, false);
// for (auto& iter : vec)
// {
// g_as->LoadModule(iter);
// }
//}
//// mod加载
//{
// std::vector<std::string> vec;
// File::GetPathFileAll("mod/", vec, {}, false);
// for (auto& iter : vec)
// {
// g_mod->LoadMod(iter);
// }
//}
g_ui->SetStandardSize({ 800, 600 });
g_ui->RegisterAll("ui/");
+2 -2
View File
@@ -49,8 +49,8 @@ UIMain::UIMain()
_ruler = Tool::Ruler::Create();
g_as->ExcuteFunction("mod管理器", "UI::Panel@ initUI(string)",
_panelMod, std::string{ "dddddddddd" });
/*g_as->ExcuteFunction("mod管理器", "UI::Panel@ initUI(string)",
_panelMod, std::string{ "dddddddddd" });*/
int x = 3;
}
Binary file not shown.
+12 -12
View File
@@ -1,30 +1,30 @@
::3d普通
glslc.exe shader.vert -o vert.spv
glslc.exe shader.frag -o frag.spv
copy vert.spv ..\res\shader\
copy frag.spv ..\res\shader\
glslc.exe shader_pbr.vert -o vert.spv
glslc.exe shader_pbr.frag -o frag.spv
copy vert.spv ..\res\dl\shader\
copy frag.spv ..\res\dl\shader\
del vert.spv
del frag.spv
::3d骨骼
glslc.exe shader.vert -D=BONE -o vert_bone.spv
glslc.exe shader.frag -D=BONE -o frag_bone.spv
copy vert_bone.spv ..\res\shader\
copy frag_bone.spv ..\res\shader\
glslc.exe shader_pbr.vert -D=BONE -o vert_bone.spv
glslc.exe shader_pbr.frag -D=BONE -o frag_bone.spv
copy vert_bone.spv ..\res\dl\shader\
copy frag_bone.spv ..\res\dl\shader\
del vert_bone.spv
del frag_bone.spv
glslc.exe shader_2d.vert -o vert_2d.spv
glslc.exe shader_2d.frag -o frag_2d.spv
copy vert_2d.spv ..\res\shader\
copy frag_2d.spv ..\res\shader\
copy vert_2d.spv ..\res\dl\shader\
copy frag_2d.spv ..\res\dl\shader\
del vert_2d.spv
del frag_2d.spv
glslc.exe shader_gfx.vert -o vert_gfx.spv
glslc.exe shader_gfx.frag -o frag_gfx.spv
copy vert_gfx.spv ..\res\shader\
copy frag_gfx.spv ..\res\shader\
copy vert_gfx.spv ..\res\dl\shader\
copy frag_gfx.spv ..\res\dl\shader\
del vert_gfx.spv
del frag_gfx.spv
+4 -2
View File
@@ -20,12 +20,14 @@ layout (set = 1, binding = 0) uniform UniformBufferBone
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec2 inTexCoord;
layout(location = 2) in vec3 inNormal;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inTexCoord;
layout(location = 3) in vec3 inTangent;
#ifdef BONE
layout(location = 4) in vec4 boneWeight;
layout(location = 5) in uvec4 boneIndex;
layout(location = 6) in vec2 inTexCoord1;
layout(location = 7) in vec4 inColor;
#endif
layout(location = 0) out vec3 fragColor;
+10 -3
View File
@@ -19,13 +19,20 @@ layout (set = 1, binding = 0) uniform UniformBufferBone
#endif
#ifdef BONE
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec2 inTexCoord;
layout(location = 2) in vec2 inTexCoord1;
layout(location = 3) in vec3 inNormal;
layout(location = 4) in vec3 inTangent;
layout(location = 5) in vec3 boneWeight;
layout(location = 6) in uvec4 boneIndex;
layout(location = 7) in vec4 inColor;
#else
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec2 inTexCoord;
layout(location = 2) in vec3 inNormal;
layout(location = 3) in vec3 inTangent;
#ifdef BONE
layout(location = 4) in vec3 boneWeight;
layout(location = 5) in uvec4 boneIndex;
#endif
layout(location = 0) out vec3 fragColor;