shader
This commit is contained in:
parent
e08d5f104a
commit
9f62233a07
20 changed files with 298 additions and 322 deletions
0
examples/VulkanTriangle/closesthit.glsl
Normal file
0
examples/VulkanTriangle/closesthit.glsl
Normal 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");
|
||||
|
||||
/*
|
||||
|
|
|
|||
0
examples/VulkanTriangle/miss.glsl
Normal file
0
examples/VulkanTriangle/miss.glsl
Normal file
|
|
@ -9,6 +9,13 @@
|
|||
"path":"../../project.json",
|
||||
"configuration":"lib-vulkan"
|
||||
}
|
||||
],
|
||||
"shaders": [
|
||||
{
|
||||
"path":"raygen.glsl",
|
||||
"type":6,
|
||||
"entrypoint":"main"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
12
examples/VulkanTriangle/raygen.glsl
Normal file
12
examples/VulkanTriangle/raygen.glsl
Normal 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));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue