-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[功能增强与构建系统优化]: 引入 Vulkan 支持并对 CMake 配置进行细化
- 细化了 GitHub Actions 工作流,区分了 macOS 和 Ubuntu 的构建条件。 - 在 `CMakeLists.txt` 中新增 `BUILD_VULKAN` 选项,允许用户选择是否编译 Vulkan 相关代码。 - 对示例项目和 GPU 图形模块的 CMake 配置进行了调整,根据 Vulkan 构建选项包含或排除源文件。 - 更新了 Qt 的 `.pro` 文件,为 Windows 平台添加了条件编译定义和源文件。 - 根据 Vulkan 支持更新了主窗口和其他相关类的实现。 - 新增了 `gpudata.hpp` 和 `gpudata.cc` 文件,为 GPU 渲染提供顶点和索引数据。 - 调整了 OpenGL 和 Vulkan 着色器代码,以适应新的数据结构和命名规范。 - 对 Vulkan 渲染器的代码进行了扩展,包括索引缓冲区的创建和管理。 - 更新了着色器文件,以确保它们与 Vulkan 渲染器兼容。
- Loading branch information
Showing
18 changed files
with
190 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include "gpudata.hpp" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
namespace GpuGraphics { | ||
|
||
static float vertices[] = { | ||
// positions // texture coords | ||
1.0F, 1.0F, 0.0F, 1.0F, 1.0F, // top right | ||
1.0F, -1.0F, 0.0F, 1.0F, 0.0F, // bottom right | ||
-1.0F, -1.0F, 0.0F, 0.0F, 0.0F, // bottom left | ||
-1.0F, 1.0F, 0.0F, 0.0F, 1.0F // top left | ||
}; | ||
static unsigned int indices[] = {0, 1, 3, 1, 2, 3}; | ||
|
||
} // namespace GpuGraphics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#version 450 | ||
#version 440 | ||
|
||
layout(binding = 1) uniform sampler2D texSampler; | ||
layout(binding = 1) uniform sampler2D tex; | ||
|
||
layout(location = 0) out vec4 outColor; | ||
layout(location = 0) out vec4 fragOutColor; | ||
layout(location = 0) in vec2 fragTexCoord; | ||
|
||
void main() | ||
{ | ||
outColor = texture(texSampler, fragTexCoord); | ||
fragOutColor = texture(tex, fragTexCoord); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
#version 450 | ||
#version 440 | ||
|
||
layout(binding = 0, std140) uniform UniformBufferObject | ||
{ | ||
mat4 transform; | ||
} ubo; | ||
}ubo; | ||
|
||
layout(location = 0) out vec2 fragTexCoord; | ||
layout(location = 0) in vec3 inPosition; | ||
layout(location = 1) in vec2 inTexCoord; | ||
layout(location = 0) in vec4 inPosition; | ||
|
||
void main() | ||
{ | ||
fragTexCoord = inTexCoord; | ||
gl_Position = ubo.transform * inPosition; | ||
fragTexCoord = vec2(inTexCoord.x, 1.0 - inTexCoord.y); | ||
gl_Position = ubo.transform * vec4(inPosition, 1.0); | ||
} |
Oops, something went wrong.