Commit 5ea0b370 authored by Lukas Tietze's avatar Lukas Tietze

Shaderspilereien

parent 7618de36
......@@ -27,28 +27,29 @@ void main() {
vec2 relativePixelSize = vec2(1.0) / textureSize(texSampler, 0);
vec3 samples[9];
vec4 samples[9];
for(int i = 0; i < 9; i++) {
samples[i] = texture(texSampler, texCoord + offsets[i] * relativePixelSize).rgb;
samples[i] = texture(texSampler, texCoord + offsets[i] * relativePixelSize);
}
vec3 edge = vec3(0);
for(int i = 0; i < 9; i++) {
edge += samples[i] * edgeDetectKernel[i];
edge += samples[i].rgb * edgeDetectKernel[i];
}
vec3 blur = vec3(0);
for(int i = 0; i < 9; i++) {
blur += samples[i] * blurKernel[i];
blur += samples[i].rgb * blurKernel[i];
}
float l = length(edge);
vec3 res = vec3(0);
res = l * blur + (1 - l) * samples[5];
res = l * blur + (1 - l) * samples[5].rgb;
color = vec4(res, 1.0);
color = vec4(vec3(samples[5].a * 0.5), 1.0);
// color = vec4(res, 1.0);
}
\ No newline at end of file
......@@ -39,5 +39,5 @@ void main()
vec3 res = payload.value;
imageStore(image, ivec2(gl_LaunchIDNV.xy), vec4(res, 0));
imageStore(image, ivec2(gl_LaunchIDNV.xy), vec4(res, length(res)));
}
\ No newline at end of file
......@@ -770,11 +770,6 @@ void lib::CgContext::UpdateCommandBuffer(uint32_t imageIndex)
this->swapChainExtent.width, this->swapChainExtent.height, 1);
}
// TransitionImageLayout(frame.commandBuffer,
// frame.raytracingTexture->GetHandle(), this->swapChainImageFormat,
// vk::ImageLayout::eGeneral, vk::ImageLayout::eShaderReadOnlyOptimal,
// vk::PipelineStageFlagBits::eRayTracingShaderNV, vk::PipelineStageFlagBits::eAllGraphics);
if (this->IsOk())
{
vk::RenderPassBeginInfo ppBeginInfo;
......@@ -791,6 +786,14 @@ void lib::CgContext::UpdateCommandBuffer(uint32_t imageIndex)
frame.commandBuffer.draw(3, 1, 0, 0);
frame.commandBuffer.endRenderPass();
}
else
{
TransitionImageLayout(frame.commandBuffer,
frame.swapChainImage, this->swapChainImageFormat,
vk::ImageLayout::eUndefined, vk::ImageLayout::eColorAttachmentOptimal,
vk::PipelineStageFlagBits::eTopOfPipe,
vk::PipelineStageFlagBits::eFragmentShader);
}
if (this->imGui.show)
{
......
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