Describe the bug
Drawing the same indexed vertices multiple times with some uniforms set only once per pipeline/frame and other uniforms set differently for each draw call, the resulting render looks strange (out of sync, appears to be drawn over the span of multiple frames).
using G4onG5 with Vulkan backend
rec-2023-12-03--15-17-42.mp4
using OpenGL backend
rec-2023-12-03--15-22-18.mp4
To Reproduce
A repro repo can be found here: weird-vulkan-behavior
Expected behavior
See the video where the OpenGL backend is being used.
Execution Environment:
Host system (where you compile your code): Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz - Linux 6.6.3-zen1-1-zen Update VertexBufferImpl.cpp #1 ZEN SMP PREEMPT_DYNAMIC Wed, 29 Nov 2023 00:40:39 +0000 x86_64 GNU/Linux
Target system (where you run your code): same as host
IDE and/or compiler used: vscode
Kinc revision: be46b46
Kinc build output:
Kinc/make --debug --compile -g vulkan
Using Kinc (be46b461) from /home/tc/code/weird-vulkan-behavior/Kinc
kfile found.
Creating Linux project files.
Compiling shader 1 of 4 (shader.frag).
Compiling shader 2 of 4 (shader.vert).
Compiling shader 3 of 4 (g1.frag).
Compiling shader 4 of 4 (g1.vert).
Compiling...
[1/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF posixunit.o.d -c ../../Kinc/Backends/System/POSIX/Sources/kinc/backend/posixunit.c -o posixunit.o
[2/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF shader.o.d -c ../../Sources/shader.c -o shader.o
[3/22] g++ -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF rootunit_.o.d -c ../../Kinc/Sources/kinc/rootunit.cpp -o rootunit_.o
[4/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF compute.o.d -c ../../Kinc/Backends/Graphics5/Vulkan/Sources/kinc/backend/compute.c -o compute.o
[5/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF audio.o.d -c ../../Kinc/Sources/kinc/audio2/audio.c -o audio.o
[6/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF g4ong5unit.o.d -c ../../Kinc/Backends/Graphics4/G4onG5/Sources/kinc/backend/graphics4/g4ong5unit.c -o g4ong5unit.o
[7/22] g++ -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF graphics_kore.o.d -c ../../Kinc/Sources/kinc/graphics2/graphics_kore.cpp -o graphics_kore.o
[8/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF graphics.o.d -c ../../Kinc/Sources/kinc/graphics1/graphics.c -o graphics.o
[9/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF a1unit.o.d -c ../../Kinc/Sources/kinc/audio1/a1unit.c -o a1unit.o
[10/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF graphics_soft.o.d -c ../../Kinc/Sources/kinc/graphics2/graphics_soft.c -o graphics_soft.o
[11/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF g4unit.o.d -c ../../Kinc/Sources/kinc/graphics4/g4unit.c -o g4unit.o
[12/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF g5unit.o.d -c ../../Kinc/Sources/kinc/graphics5/g5unit.c -o g5unit.o
[13/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF linuxunit.o.d -c ../../Kinc/Backends/System/Linux/Sources/kinc/backend/linuxunit.c -o linuxunit.o
[14/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF inputunit.o.d -c ../../Kinc/Sources/kinc/input/inputunit.c -o inputunit.o
[15/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF iounit.o.d -c ../../Kinc/Sources/kinc/io/iounit.c -o iounit.o
[16/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF mathunit.o.d -c ../../Kinc/Sources/kinc/math/mathunit.c -o mathunit.o
[17/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF rootunit.o.d -c ../../Kinc/Sources/kinc/rootunit.c -o rootunit.o
[18/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF networkunit.o.d -c ../../Kinc/Sources/kinc/network/networkunit.c -o networkunit.o
[19/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF waylandunit.o.d -c ../wayland/wayland-generated/waylandunit.c -o waylandunit.o
[20/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF vulkanunit.o.d -c ../../Kinc/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/vulkanunit.c -o vulkanunit.o
[21/22] gcc -g -I../../Kinc/Sources -I../../Kinc/Backends/System/Linux/Sources -I../../Kinc/Backends/System/POSIX/Sources -I../wayland -I../../Kinc/Backends/Graphics5/Vulkan/Sources -I../../Kinc/Backends/Graphics4/G4onG5/Sources -DKINC_NO_WAYLAND -DKORE_G1 -DKORE_G2 -DKORE_G3 -DKORE_A1 -DKORE_A2 -DKORE_LZ4X -DKORE_VULKAN -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -DKORE_G4 -DKORE_G5 -DKORE_G4ONG5 -MD -MF stb_vorbis.o.d -c ../../Kinc/Sources/kinc/libs/stb_vorbis.c -o stb_vorbis.o
[22/22] g++ -o ShaderTest -g shader.o g4ong5unit.o compute.o vulkanunit.o linuxunit.o posixunit.o rootunit.o rootunit_.o a1unit.o audio.o graphics.o graphics_kore.o graphics_soft.o g4unit.o g5unit.o inputunit.o iounit.o stb_vorbis.o mathunit.o networkunit.o waylandunit.o -static-libgcc -static-libstdc++ -pthread -lasound -ldl -ludev -lvulkan
Build time: 0m 2s
Done.
Application output (if it runs): Running with Vulkan validation layers enabled.
Describe the bug
Drawing the same indexed vertices multiple times with some uniforms set only once per pipeline/frame and other uniforms set differently for each draw call, the resulting render looks strange (out of sync, appears to be drawn over the span of multiple frames).
using G4onG5 with Vulkan backend
rec-2023-12-03--15-17-42.mp4
using OpenGL backend
rec-2023-12-03--15-22-18.mp4
To Reproduce
A repro repo can be found here: weird-vulkan-behavior
Expected behavior
See the video where the OpenGL backend is being used.
Execution Environment:
Running with Vulkan validation layers enabled.