Add support for creating Vulkan window surfaces.
This commit is contained in:
parent
8886134156
commit
6272f853c1
36 changed files with 16176 additions and 0 deletions
|
@ -25,6 +25,7 @@ if(SFML_BUILD_GRAPHICS)
|
|||
add_subdirectory(joystick)
|
||||
add_subdirectory(shader)
|
||||
add_subdirectory(island)
|
||||
add_subdirectory(vulkan)
|
||||
endif()
|
||||
|
||||
if(SFML_OS_WINDOWS)
|
||||
|
|
11
examples/vulkan/CMakeLists.txt
Normal file
11
examples/vulkan/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/vulkan)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Vulkan.cpp)
|
||||
|
||||
# define the window target
|
||||
sfml_add_example(vulkan GUI_APP
|
||||
SOURCES ${SRC}
|
||||
DEPENDS sfml-graphics
|
||||
RESOURCES_DIR resources)
|
2557
examples/vulkan/Vulkan.cpp
Normal file
2557
examples/vulkan/Vulkan.cpp
Normal file
File diff suppressed because it is too large
Load diff
BIN
examples/vulkan/resources/logo.png
Normal file
BIN
examples/vulkan/resources/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
16
examples/vulkan/resources/shader.frag
Normal file
16
examples/vulkan/resources/shader.frag
Normal file
|
@ -0,0 +1,16 @@
|
|||
#version 450
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
layout(binding = 1) uniform sampler2D texSampler;
|
||||
|
||||
layout(location = 0) in vec4 fragColor;
|
||||
layout(location = 1) in vec2 fragTexCoord;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
outColor = fragColor * texture(texSampler, fragTexCoord);
|
||||
|
||||
if (outColor.a < 0.5)
|
||||
discard;
|
||||
}
|
BIN
examples/vulkan/resources/shader.frag.spv
Normal file
BIN
examples/vulkan/resources/shader.frag.spv
Normal file
Binary file not shown.
25
examples/vulkan/resources/shader.vert
Normal file
25
examples/vulkan/resources/shader.vert
Normal file
|
@ -0,0 +1,25 @@
|
|||
#version 450
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
layout(binding = 0) uniform UniformBufferObject {
|
||||
mat4 model;
|
||||
mat4 view;
|
||||
mat4 proj;
|
||||
} ubo;
|
||||
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec4 inColor;
|
||||
layout(location = 2) in vec2 inTexCoord;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 1) out vec2 fragTexCoord;
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main() {
|
||||
gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0);
|
||||
fragColor = inColor;
|
||||
fragTexCoord = inTexCoord;
|
||||
}
|
BIN
examples/vulkan/resources/shader.vert.spv
Normal file
BIN
examples/vulkan/resources/shader.vert.spv
Normal file
Binary file not shown.
3341
examples/vulkan/vulkan.h
Normal file
3341
examples/vulkan/vulkan.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue