Commit 8fa12ada authored by Lukas Tietze's avatar Lukas Tietze

Shaderkram

parent 1d9bf5cc
......@@ -3,9 +3,9 @@
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_nonuniform_qualifier : require
#include "raycommon.glsl"
#include "random.glsl"
#include "lighting.glsl"
#include "common/raycommon.glsl"
#include "common/random.glsl"
#include "common/lighting.glsl"
layout(push_constant) uniform Constants
{
......
#version 460
#extension GL_NV_ray_tracing : require
#extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl"
#include "common/raycommon.glsl"
layout(location = 0) rayPayloadInNV HitPayload payload;
......
#version 460
#extension GL_GOOGLE_include_directive : enable
layout(location = 0) in vec2 texCoord;
layout(location = 0) out vec4 color;
layout(binding = 0) uniform sampler2D texSampler;
void main() {
color = vec4(texture(texSampler, texCoord).rgb, 1.0);
}
\ No newline at end of file
#version 460
#extension GL_GOOGLE_include_directive : enable
layout(location = 0) out vec2 texCoord;
void main() {
texCoord = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
gl_Position = vec4(texCoord * 2.0 - 1.0, 0.0, 1.0);
}
\ No newline at end of file
......@@ -2,8 +2,8 @@
#extension GL_NV_ray_tracing : require
#extension GL_EXT_scalar_block_layout : enable
#extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl"
#include "random.glsl"
#include "common/raycommon.glsl"
#include "common/random.glsl"
layout(push_constant) uniform Constants
{
......
......@@ -21,8 +21,5 @@ namespace lib
std::unique_ptr<lib::Texture> raytracingTexture;
vk::Framebuffer raytracingTextureFbo;
std::unique_ptr<lib::Texture> imGuiTexture;
vk::Framebuffer imGuiTextureFbo;
};
} // namespace lib
......@@ -139,18 +139,61 @@ bool lib::CgContext::TryCreateRasterizerPipeline()
void lib::CgContext::CreateRasterizationDescriptorSets()
{
// TODO
const auto count = static_cast<uint32_t>(this->frames.size());
std::vector<vk::DescriptorSetLayout> layouts(count, this->rasterizationStep.descriptorSetLayout);
vk::DescriptorSetAllocateInfo allocateInfo;
allocateInfo.descriptorPool = this->rasterizationStep.descriptorPool;
allocateInfo.descriptorSetCount = count;
allocateInfo.pSetLayouts = layouts.data();
this->rasterizationStep.descriptorSets = this->logicalDevice.allocateDescriptorSets(allocateInfo);
for (uint32_t i = 0; i < count; i++)
{
vk::DescriptorImageInfo rtImageInfo;
rtImageInfo.imageLayout = vk::ImageLayout::eShaderReadOnlyOptimal;
rtImageInfo.imageView = this->frames[i].raytracingTexture->GetView();
rtImageInfo.sampler = this->frames[i].raytracingTexture->GetSampler();
vk::WriteDescriptorSet rtImageWrite;
rtImageWrite.descriptorCount = 1;
rtImageWrite.descriptorType = vk::DescriptorType::eCombinedImageSampler;
rtImageWrite.dstArrayElement = 0;
rtImageWrite.dstBinding = 0;
rtImageWrite.pImageInfo = &rtImageInfo;
rtImageWrite.dstSet = this->rasterizationStep.descriptorSets[i];
this->logicalDevice.updateDescriptorSets(rtImageWrite, {});
}
}
void lib::CgContext::CreateRasterizationDescriptorPool()
{
// TODO
const auto count = static_cast<uint32_t>(this->frames.size());
std::vector<vk::DescriptorPoolSize> poolSizes{
{vk::DescriptorType::eCombinedImageSampler, count * 2},
};
vk::DescriptorPoolCreateInfo createInfo;
createInfo.poolSizeCount = static_cast<uint32_t>(poolSizes.size());
createInfo.pPoolSizes = poolSizes.data();
createInfo.maxSets = count;
this->rasterizationStep.descriptorPool = this->logicalDevice.createDescriptorPool(createInfo);
}
void lib::CgContext::CreateRasterizationDescriptorSetLayout()
{
// TODO
std::vector<vk::DescriptorSetLayoutBinding> layoutBindings;
auto & item = layoutBindings.emplace_back();
item.binding = 0;
item.descriptorCount = 1;
item.descriptorType = vk::DescriptorType::eCombinedImageSampler;
// item.pImmutableSamplers = &this->
}
void lib::CgContext::CreateRasterizationRenderPass()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment