This commit is contained in:
Jorijn van der Graaf 2026-01-28 23:37:12 +01:00
commit 9f62233a07
20 changed files with 298 additions and 322 deletions

View file

View file

@ -4,13 +4,18 @@ import Crafter.Graphics;
using namespace Crafter;
import std;
typedef VulkanShader<"raygen.spv", "main", VK_SHADER_STAGE_RAYGEN_BIT_KHR, 2, {{{VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 0}, {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1}}}> Raygenspv;
int main() {
/*
This sets up all necessary things and creates the vulkan device.
This must be called before any vulkan related things.
Things like VkDevice are static members of the VulkanDevice class.
*/
VulkanDevice::CreateDevice();
Raygenspv::CreateShader();
WindowVulkan window(1280, 720, "HelloVulkan");
/*

View file

View file

@ -9,6 +9,13 @@
"path":"../../project.json",
"configuration":"lib-vulkan"
}
],
"shaders": [
{
"path":"raygen.glsl",
"type":6,
"entrypoint":"main"
}
]
}
]

View file

@ -0,0 +1,12 @@
#version 460
#extension GL_EXT_ray_tracing : enable
#extension GL_EXT_shader_image_load_formatted : enable
layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS;
layout(binding = 1, set = 0) uniform image2D image;
layout(location = 0) rayPayloadEXT vec3 hitValue;
void main() {
imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(1,1,1, 0.0));
}