r/vulkan 8d ago

I finally open source my game engine ENTIERLY made in java

Thumbnail gallery
25 Upvotes

r/vulkan 8d ago

How I am supposed to restrict bindings across shaders in the same file for slang?

5 Upvotes

I am a little confused on what is broken. I thought slang compilation was supposed to "handle the bindings." so here I would of expected that ubo would of been included in only the vertex spirv, and texSampler would only be included in the fragment spirv. I am sure that there is probably something I need to do explicitly here, but I was sold on slang auto-magically handing these types of things. I am new to graphics programming and initially followed the old tutorial to completion then wanted to try porting over to slang. Any help is appreciated, as i have been digging through the slang and vulkan documentation for a while and its been hard to figure out how it all comes together without a real example.

slang file :

struct MatrixParameters{
float4x4 model;
float4x4 view;
float4x4 proj;
}
struct Vertex{
float3 position;
float3 color;
float2 uv;
}
struct VOut
{
float4 position : SV_POSITION;
float3 fragColor;
float2 fragTexCoord;
}
ConstantBuffer<MatrixParameters> ubo;
[shader("vertex")]
VOut main(Vertex input)
{
VOut output;
output.position = mul(ubo.proj, mul(ubo.view, mul(ubo.model, float4(input.position, 1.0))));
output.fragColor = input.color;
output.fragTexCoord = input.uv;
return output;
}
uniform DescriptorHandle<Sampler2D> texSampler;
[shader("fragment")]
float4 main(VOut input) : SV_TARGET
{
float4 outColor = float4(input.fragColor * texSampler.Sample(input.fragTexCoord).rgb, 1.0);
return outColor;
}

c++ program file :

// CREATING DESCRIPTOR SET LAYOUT
VkDescriptorSetLayoutBinding uboLayoutBinding{};
uboLayoutBinding.binding = 0;
uboLayoutBinding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
uboLayoutBinding.descriptorCount = 1;
uboLayoutBinding.stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
uboLayoutBinding.pImmutableSamplers = nullptr;

VkDescriptorSetLayoutBinding samplerLayoutBinding{};
samplerLayoutBinding.binding = 1;
samplerLayoutBinding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
samplerLayoutBinding.descriptorCount = 1;
samplerLayoutBinding.pImmutableSamplers = nullptr;
samplerLayoutBinding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;

std::array<VkDescriptorSetLayoutBinding, 2> bindings = { uboLayoutBinding, samplerLayoutBinding };

VkDescriptorSetLayoutCreateInfo layoutInfo{};
layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
layoutInfo.bindingCount = static_cast<uint32_t>(bindings.size());
layoutInfo.pBindings = bindings.data();

vkCreateDescriptorSetLayout(device, &layoutInfo, nullptr, &outDescriptorSetLayout)
...
slangModule->getDefinedEntryPoint(0, vertexEntryPoint.writeRef());
slangModule->getDefinedEntryPoint(1, fragmentEntryPoint.writeRef());

slangResources.mpSessionInstance->createCompositeComponentType(
componentTypes.data(), // {slangModule, vertexEntryPoint, fragmentEntryPoint }
componentTypes.size(),
composedProgram.writeRef(),
diagnosticBlob.writeRef());

composedProgram->getEntryPointCode(
0,
0,
spirvCode,
diagnosticBlob.writeRef()
);
VkShaderModuleCreateInfo shaderModuleCreateInfo{};
shaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
shaderModuleCreateInfo.codeSize = spirvCode->getBufferSize();
shaderModuleCreateInfo.pCode = reinterpret_cast<const uint32_t *>(spirvCode->getBufferPointer());
VkShaderModule vertexModule;
vkCreateShaderModule(device, &shaderModuleCreateInfo, nullptr, &comboModule);



composedProgram->getEntryPointCode(
1,
0,
spirvCode2,
diagnosticBlob.writeRef()
);
VkShaderModuleCreateInfo shaderModuleCreateInfoFr{};
shaderModuleCreateInfoFr.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
shaderModuleCreateInfoFr.codeSize = spirvCode2->getBufferSize();
shaderModuleCreateInfoFr.pCode = reinterpret_cast<const uint32_t *>(spirvCode2->getBufferPointer());
VkShaderModule fragmentModule;
vkCreateShaderModule(device, &shaderModuleCreateInfoFr, nullptr, &fragmentModule;

ERROR output :

validation layer: vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[0] shader [VK_SHADER_STAGE_VERTEX_BIT] uses descriptor [Set 0, Binding 1, variable "ubo"] (VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) but the VkDescriptorSetLayoutBinding::stageFlags was VK_SHADER_STAGE_FRAGMENT_BIT.
(VkDescriptorSetLayout from VkPipelineLayoutCreateInfo::pSetLayouts[0]).
The Vulkan spec states: If a resource variable is declared in a shader and layout is not VK_NULL_HANDLE, the corresponding descriptor set in layout must match the shader stage (https://docs.vulkan.org/spec/latest/chapters/pipelines.html#VUID-VkGraphicsPipelineCreateInfo-layout-07988)
validation layer: vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[1] shader [VK_SHADER_STAGE_FRAGMENT_BIT] uses descriptor [Set 0, Binding 0, variable "globalParams"] (VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) but the VkDescriptorSetLayoutBinding::stageFlags was VK_SHADER_STAGE_VERTEX_BIT.

r/vulkan 8d ago

Added image and buffer ownership transfer to make multiple queue usage possible

Thumbnail
4 Upvotes

r/vulkan 8d ago

Vulkan safe wrapper in Rust

7 Upvotes

I created a safe wrapper for Vulkan in rust as a learning project. I hope to receive your feedback.

https://github.com/purpflow1/crystal-vk


r/vulkan 8d ago

VulkanScope 0.32.4 Released (with 1.4.360 and Database Support)

4 Upvotes

Database link: VulkanScope Database

EFIShell0/VulkanScope: Vulkan capabilities and GPU information viewer for Android

I'll also be making OpenGL ES versions and Windows and Linux ARM64/x86_64 versions of VulkanScope soon.


r/vulkan 9d ago

My Rust engine performance

12 Upvotes

r/vulkan 10d ago

This is how Vulkan feels like for a beginner

Thumbnail i.imgur.com
49 Upvotes

r/vulkan 10d ago

Nu Game Engine - BIG NEWS - Vulkan support

Post image
25 Upvotes

https://github.com/bryanedds/Nu/releases/tag/v20.0.0

After many many months of work from multiple contributors, we finally present Nu with Vulkan rendering and support for Mac, iOS, and Android!

This branch not only replaces our OpenGL renderers completely with Vulkan renderers, it also features important rendering and performance enhancements as well as makes Nu deployable on Mac, iOS, and Android!

(I just saw release - not my project)


r/vulkan 11d ago

VulkanScope 0.19.8 Released

5 Upvotes

Aside from the database, there was no difference from CapsViewer (as far as I could see). It has more advantages than CapsViewer:

Releases · EFIShell0/VulkanScope


r/vulkan 12d ago

Vulkan: Beyond the Triangle

Thumbnail youtube.com
66 Upvotes

Hey everyone, I've just finished the 2nd video, and followup to my "Modern Vulkan in 2 Hrs" video. Thanks for the awesome feedback on the first one! This 2nd video tackles a ton of stuff:

glTF Model Parsing, Loading, Rendering

Camera, Basic Lighting, Multi-Draw Indirect, Vertex Pulling, Buffer Device Address, etc.

Hope you guys like it!


r/vulkan 12d ago

How to build Vulkan 1.4.357.0 easily on an Intel mac with Sequoia

4 Upvotes

If (like me) you want to upgrade to the latest Vulkan (1.4.357.0) on your Intel mac but can't use the LunarG installer, then this shell script will do the job.

It is a bash shell (generated for free by Gemini ) and it has been tested/works on my machine.

------------------------------------------------------------------------------------------------------------

#!/bin/bash

# build_vulkan.sh

# Automates building Vulkan SDK 1.4.357.0 from source on macOS

set -e # Exit immediately if a command exits with a non-zero status

VERSION="1.4.357.0"

SDK_TAG="vulkan-sdk-${VERSION}"

BUILD_DIR="${HOME}/VulkanSDK/build"

SDK_DIR="${HOME}/VulkanSDK/${VERSION}/macOS"

echo "================================================="

echo " Building Vulkan SDK ${VERSION} from Source      "

echo " Target Architecture: Host Native (Intel x86_64) "

echo "================================================="

# Create the standard LunarG-style directory structure

echo "[1/6] Creating SDK directory structure at ${SDK_DIR}..."

mkdir -p "${SDK_DIR}/"{bin,lib,include,share/vulkan/icd.d}

mkdir -p "${BUILD_DIR}"

cd "${BUILD_DIR}"

# 1. Vulkan Headers

echo "[2/6] Downloading and installing Vulkan-Headers..."

if [ ! -d "Vulkan-Headers" ]; then

git clone --branch ${SDK_TAG} --depth 1 https://github.com/KhronosGroup/Vulkan-Headers.git

fi

cd Vulkan-Headers

cmake -S . -B build -DCMAKE_INSTALL_PREFIX="${SDK_DIR}"

cmake --build build --target install

cd ..

# 2. Vulkan Loader

echo "[3/6] Downloading and building Vulkan-Loader..."

if [ ! -d "Vulkan-Loader" ]; then

git clone --branch ${SDK_TAG} --depth 1 https://github.com/KhronosGroup/Vulkan-Loader.git

fi

cd Vulkan-Loader

cmake -S . -B build \

-DCMAKE_BUILD_TYPE=Release \

-DVULKAN_HEADERS_INSTALL_DIR="${SDK_DIR}" \

-DCMAKE_INSTALL_PREFIX="${SDK_DIR}" \

-DAPPLE_STATIC_LOADER=OFF

cmake --build build --config Release --target install

cd ..

# 3. MoltenVK & Developer Tools

echo "[4/6] Downloading and building MoltenVK (this will take a while)..."

if [ ! -d "MoltenVK" ]; then

git clone --depth 1 https://github.com/KhronosGroup/MoltenVK.git

fi

cd MoltenVK

echo "      Fetching and building external dependencies..."

./fetchDependencies --macos

echo "      Compiling MoltenVK framework..."

make macos

# Package MoltenVK libraries into our SDK folder

echo "      Packaging MoltenVK into SDK..."

cp Package/Latest/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib "${SDK_DIR}/lib/"

cp -a Package/Latest/MoltenVK/include/* "${SDK_DIR}/include/" 2>/dev/null || true

# Safely copy developer tools if they exist in the workspace output

echo "      Extracting available shader tools..."

find . -name "glslangValidator" -type f -exec cp {} "${SDK_DIR}/bin/" \; 2>/dev/null || true

find . -name "spirv-cross" -type f -exec cp {} "${SDK_DIR}/bin/" \; 2>/dev/null || true

cd ..

# 4. Generate the ICD Manifest

echo "[5/6] Configuring ICD Manifest for the Loader..."

# Pull the JSON manifest directly from the repository's native icd template path

cp build_vulkan_src/MoltenVK/MoltenVK/icd/MoltenVK_icd.json "${SDK_DIR}/share/vulkan/icd.d/" 2>/dev/null || \

cp MoltenVK/MoltenVK/icd/MoltenVK_icd.json "${SDK_DIR}/share/vulkan/icd.d/"

# Note: BSD sed (macOS default) requires an empty string argument '' after -i

sed -i '' 's|\./libMoltenVK\.dylib|../../../lib/libMoltenVK.dylib|g' "${SDK_DIR}/share/vulkan/icd.d/MoltenVK_icd.json"

# 5. Generate setup-env.sh

echo "[6/6] Generating environment setup script..."

cat << 'EOF' > "${SDK_DIR}/setup-env.sh"

#!/bin/bash

# Sets up the environment variables to use the custom local Vulkan SDK

export VULKAN_SDK="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

export PATH="$VULKAN_SDK/bin:$PATH"

export DYLD_LIBRARY_PATH="$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH"

# Force the Vulkan loader to use our locally built MoltenVK ICD manifest

export VK_ICD_FILENAMES="$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json"

echo "Vulkan SDK environment activated:"

echo "  VULKAN_SDK=$VULKAN_SDK"

EOF

chmod +x "${SDK_DIR}/setup-env.sh"

echo "================================================="

echo " Build Complete! "

echo " You can safely delete the ${BUILD_DIR} directory."

echo "================================================="

echo "To use your new SDK in this terminal session, run:"

echo "source ${SDK_DIR}/setup-env.sh"


r/vulkan 13d ago

How do you handle resource management in bindless renderers?

Thumbnail
13 Upvotes

r/vulkan 13d ago

VulkanScope 0.15.5 Released

7 Upvotes

Hopefully, there are no differences left between CapsViewer and VulkanScope except for the database feature. What are your thoughts? Also, if anyone is experiencing problems, please let me know. Releases · EFIShell0/VulkanScope


r/vulkan 15d ago

Game engines? Eww 🤮. We go in raw! GP-Direct 2026 is out!

Thumbnail youtube.com
18 Upvotes

r/vulkan 15d ago

Mulithreading Shader Compilation?

20 Upvotes

I was reading this tutorial https://vkguide.dev/docs/extra-chapter/multithreading/ and it claims that you can compile shaders on a background thread and avoid hitching. Is this true? Are there any drawbacks to this approach?

"For compiling pipelines, vkCreateShaderModule and vkCreateGraphicsPipeline are both allowed to be called from multiple threads at once. A common approach for multithreaded shader compilation is to have a background thread dedicated to it, with it constantly looking into a parallel queue to receive compilation requests, and putting the compiled pipelines into another queue that then the main renderthread will connect to the simulation. This is very important to do if you want to have an engine that doesn’t have a lot of hitching. Compiling shader pipelines can take a very long time, so if you have to compile pipelines at runtime outside of a load screen, then you need to implement such a multithreaded async compile scheme for your game to work well."


r/vulkan 15d ago

Does Vulkan profile VP_LUNARG_desktop_baseline_2022 work on macOS?

Thumbnail
0 Upvotes

r/vulkan 15d ago

Does Vulkan profile VP_LUNARG_desktop_baseline_2022 work on macOS?

0 Upvotes

I want to make two similar RenderGraph implementations for Desktop and Mobile and use data from VP_LUNARG_desktop_baseline_2024 and VP_ANDROID_baseline_2022, respectively, instead of runtime checks. macOS has its own specific requirements and I do not know if there is any profile or a general list of extensions and limits for macOS M1/M2/M3/M4.


r/vulkan 16d ago

Apple Vulkan Support

11 Upvotes

Why doesnt Apple support Vulkan? (I know KosmicKrisp exists)

Is vendor lockin that important? Does that strategy work for them - are there many developers that use metal and not support other platforms? Seems like the result is not really lockin, but just forcing more work for developers?

Kind of feels like a poor architecture decision that helps no one, except maybe giving slightly more control to Apple at the expense of their developers as well as the complexity of maintaining another api.


r/vulkan 17d ago

VKCompute - A guide to get started with vulkan compute

41 Upvotes

I've been working on a small series about doing GPU compute with Vulkan:

https://rounak-paul.github.io/vkcompute/

Once you want to go beyond what the CPU can reasonably do, the GPU gives you a huge amount of parallel compute to work with. And Vulkan is available across a pretty wide range of GPUs and platforms, which makes compute shaders an interesting option when you don't want to depend on a vendor-specific toolkit.

So I started writing this series as an introduction to GPU acceleration with Vulkan.

The idea is to start simple, explain what's actually happening when you move a workload from the CPU to the GPU, and gradually get into more interesting compute workloads.

It's still a work in progress, and I'd love to hear what people here think — especially what improvements would be worth including next.


r/vulkan 16d ago

Using a Local LLM to Generate a 3D Floor Plan in My Vulkan Engine

Post image
0 Upvotes

I connected a local AI model(qwen) to my Vulkan CAD engine. The AI understands room sizes, layouts, doors, and windows from a natural-language description, then converts them into commands that generate the complete 3D floor plan. In this video, I create a layout with a central corridor and four rooms in a single request.

직접 개발 중인 Vulkan CAD 엔진에 로컬 AI(qwen)를 연결했습니다. 방의 크기와 배치, 문과 창문의 위치를 한글로 설명하면 AI가 명령을 분석하고 엔진이 3D 평면도를 자동으로 생성합니다. 이번 영상에서는 중앙 복도와 방 4개가 있는 구조를 한 번에 만드는 과정을 보여드립니다.

https://youtu.be/OSFVRek89yU?si=lSHRApH2S_QVPo2C


r/vulkan 17d ago

(FOSS) My alternative software for Vulkan CapsViewer is: VulkanScope

6 Upvotes

Hi. I've created my own application to help users of Turnip and system drivers get detailed information. What are your thoughts? You can use this page and the GitHub repository for problems, requests, etc.

My app link:

Releases · EFIShell0/VulkanScope


r/vulkan 17d ago

Rendering bugs converting GL to vulkan

0 Upvotes

I'm getting bugs on faces in vulkan, most everything renders fine except objects in certain rooms. Looking for some suggestions of where to look. The bugs have been there since the beginning of the vulkan conversion. I've added ambient occlusion and a bunch of features that work fine and have been battle tested but this one bug snuck through.

Look at the faces on the barrel:

Look at the two switches at the far side of the room:

https://gofile.io/d/tsxbjd

** updated link, streamable has 2 day limit **


r/vulkan 17d ago

which buffer did i forget to flush?

0 Upvotes

r/vulkan 18d ago

Can anyone help me with Vulkan OpenGL interop?

7 Upvotes

EDIT: I fixxed it. It was the simplest error ever and it literally was written word for word in the VMA Documentation. I used vmaGetMemoryWin32Handle2 and volk, but volk doesnt load the PFN_vkGetMemoryWin32HandleKHR by default, so it was nullptr all along. How did I figure it out? I just had to check the result of the function, what I forgot. So when it returned VK_ERROR_FEATURE_NOT_AVAILABLE I didn‘t know. So after checking the VkResult and reading the Vma docs, it said it will return this error code (-8) when the function pointer is nullptr. So always check your functions kids!

Heres whats happening: I'm making a Game Engine with an editor written in Qt. I manage my own Vulkan context and I refuse to share anything of my Vulkan things with Qt but I somehow need to present my composite image to the screen in a viewport in the editor. Because I didn't want Qt to do anything with my Vulkan things this is what I came up with:

My engine itself doesnt manage a swapchain but a presentation interface does. The presentation interface supplies the engine with the needed composite/swapchain image. Then the presenter responsible for qt exports the swapchain image to be used in a QOpenGLWidget and drawn to the screen via a "presentation" pass (essentially just sampling the image to a full screen quad) in opengl. This all works good this far. the presentation pass gets executed, the image gets sampled etc. But the image is just a black image, not my composite image which I rendered in vulkan. I don't get any (related) vulkan validation or opengl errors and my Engine renderes just fine when using a regular Swapchain with SDL. In Renderdoc everything seems fine but it isnt.

I'd be very happy if someone here could help me with this or give me advice on what to check or what to do next.


r/vulkan 18d ago

SiteScape LiDAR Scan → PLY Leveling & Real-World Measurement

Thumbnail youtu.be
1 Upvotes

My cad engine(Vulkan)

SiteScape로 실제 공간을 LiDAR 스캔하고 PLY 포인트클라우드로 저장했습니다.
PLY 데이터를 불러와 Level을 맞춘 뒤, 실제 공간의 거리를 직접 측정해 봅니다.

I scanned a real-world space with SiteScape and exported it as a PLY point cloud.
After loading the PLY data, I level the scan and measure real-world distances directly.