From 7461b7edf33bde6a9b34b4dd132b608938b5de67 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 12 Apr 2019 01:04:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0glsl=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=92=8C=E7=BC=96=E8=AF=91=E6=89=B9=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅增加glsl文件,代码中未使用 --- example/Vulkan/CMakeLists.txt | 7 ++++++- example/Vulkan/FlatColor.frag | 9 +++++++++ example/Vulkan/FlatColor.vert | 13 +++++++++++++ example/Vulkan/shader_compile.bat | 2 ++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 example/Vulkan/FlatColor.frag create mode 100644 example/Vulkan/FlatColor.vert create mode 100644 example/Vulkan/shader_compile.bat diff --git a/example/Vulkan/CMakeLists.txt b/example/Vulkan/CMakeLists.txt index 3e6a2aa0..e404c90b 100644 --- a/example/Vulkan/CMakeLists.txt +++ b/example/Vulkan/CMakeLists.txt @@ -22,9 +22,14 @@ SET(VULKAN_TEST_HEADER_FILES VK.h VKBuffer.h Window.h) +SET(SHADER_FILES shader_compile.bat + FlatColor.vert + FlatColor.frag) + SOURCE_GROUP("Header Files" FILES ${VULKAN_TEST_HEADER_FILES}) SOURCE_GROUP("Source Files" FILES ${VULKAN_TEST_SOURCE_FILES}) +SOURCE_GROUP("Shader Files" FILES ${SHADER_FILES}) -add_executable(VulkanTest ${VULKAN_TEST_HEADER_FILES} ${VULKAN_TEST_SOURCE_FILES}) +add_executable(VulkanTest ${VULKAN_TEST_HEADER_FILES} ${VULKAN_TEST_SOURCE_FILES} ${SHADER_FILES}) target_link_libraries(VulkanTest PRIVATE ${ULRE} ${VULKAN_LIB} ${RENDER_WINDOW_LIBRARY}) diff --git a/example/Vulkan/FlatColor.frag b/example/Vulkan/FlatColor.frag new file mode 100644 index 00000000..cf5dd17b --- /dev/null +++ b/example/Vulkan/FlatColor.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) in vec4 FragmentColor; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor=vec4(FragmentColor.rgb,1); +} diff --git a/example/Vulkan/FlatColor.vert b/example/Vulkan/FlatColor.vert new file mode 100644 index 00000000..cfd3dea4 --- /dev/null +++ b/example/Vulkan/FlatColor.vert @@ -0,0 +1,13 @@ +#version 450 + +layout(location = 0) in vec2 Vertex; +layout(location = 1) in vec3 Color; + +layout(location = 0) out vec4 FragmentColor; + +void main() +{ + FragmentColor=vec4(Color,1.0); + + gl_Position=vec4(Vertex,0.0,1.0); +} diff --git a/example/Vulkan/shader_compile.bat b/example/Vulkan/shader_compile.bat new file mode 100644 index 00000000..56dd4144 --- /dev/null +++ b/example/Vulkan/shader_compile.bat @@ -0,0 +1,2 @@ +glslangValidator -V -o FlatColor.vert.spv FlatColor.vert +glslangValidator -V -o FlatColor.frag.spv FlatColor.frag