Skip to content

Commit ed9b980

Browse files
authored
Merge pull request #41 from Williscool13/synchronization-fix
Synchronization Fixes
2 parents 65eae16 + e2f56d4 commit ed9b980

16 files changed

Lines changed: 239 additions & 198 deletions

File tree

shaders/ambient_occlusion/ground_truth/gtao.comp

Lines changed: 0 additions & 92 deletions
This file was deleted.

shaders/deferredMrt.frag

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ layout (location = 6) in vec4 inPrevMvpPosition;
1717

1818
layout (location = 0) out vec4 normalTarget;// 10,10,10, (2 unused)
1919
layout (location = 1) out vec4 albedoTarget;// 10,10,10, (2 -> 0 = environment Map, 1 = renderObject)
20-
layout (location = 2) out vec4 pbrTarget;// 8 metallic, 8 roughness, 8 emissive (unused), 8 unused
21-
layout (location = 3) out vec2 velocityTarget;// 16 X, 16 Y
20+
layout (location = 2) out vec4 pbrTarget; // metal/roughness/unused/unused
21+
layout (location = 3) out vec2 velocityTarget;
2222

2323
// layout (std140, set = 0, binding = 0) uniform SceneData - scene.glsl
2424

shaders/deferredMrt.vert

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ void main() {
4949
outUV = uv;
5050
outMaterialIndex = materialIndex;
5151

52-
//outCurrMvpPosition = sceneData.viewProj * worldPos;
53-
//outPrevMvpPosition = sceneData.prevViewProj * models.previousModelMatrix * vec4(position, 1.0);
54-
5552
vec4 currClipPos = sceneData.viewProj * worldPos;
5653
vec4 prevClipPos = sceneData.prevViewProj * models.previousModelMatrix * vec4(position, 1.0);
5754
currClipPos.xy += currClipPos.w * sceneData.jitter.xy;

shaders/postProcess.comp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#version 460
22

3+
#include "scene.glsl"
4+
35
layout (local_size_x = 16, local_size_y = 16) in;
46

5-
layout (set = 0, binding = 0) uniform sampler2D inputImage;
6-
layout (rgba16f, set = 0, binding = 1) uniform image2D outputImage;
7+
layout (set = 1, binding = 0) uniform sampler2D inputImage;
8+
layout (rgba16f, set = 1, binding = 1) uniform image2D outputImage;
79

810

911
layout (push_constant) uniform PushConstants {
@@ -52,19 +54,16 @@ void main() {
5254
return;
5355
}
5456

55-
vec2 uv = (vec2(pixel.x, pixel.y) + 0.5) / vec2(push.width, push.height);
56-
57+
vec2 uv = (vec2(pixel.x, pixel.y) + 0.5) / sceneData.renderTargetSize;
5758
// Flip final image (cause vulkan images starts from top-left)
5859
uv.y = 1 - uv.y;
5960

61+
// Unjitter
62+
uv += sceneData.jitter.xy / 2.0f;
63+
6064
vec3 color = texture(inputImage, uv).rgb;
6165
vec2 texelSize = 1.0 / vec2(push.width, push.height);
6266

63-
if (push.flags == 0) {
64-
imageStore(outputImage, pixel, vec4(color, 1.0));
65-
return;
66-
}
67-
6867
if ((push.flags & 2) != 0) {
6968
color = sharpen(color, texelSize, uv);
7069
}

0 commit comments

Comments
 (0)