Skip to content

Commit

Permalink
fixed tdao on dx
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Jul 13, 2024
1 parent 83b8fe7 commit 7a4f7c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/pipelines/tdao.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ return {
env.tdao_rb = nil
env.tdao_rb_desc = nil
end
env.tdao_rb_desc = env.tdao_rb_desc or env.createRenderbufferDesc { size = {w, h}, format = "depth32", debug_name = "tdao", compute_write = true }
env.tdao_rb_desc = env.tdao_rb_desc or env.createRenderbufferDesc { size = {w, h}, format = "depth32", debug_name = "tdao" }
if env.tdao_rb == nil then
env.tdao_rb = env.createRenderbuffer(env.tdao_rb_desc)
end
Expand Down
5 changes: 4 additions & 1 deletion data/pipelines/tdao.shd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ compute_shader [[
vec2 screen_uv = gl_GlobalInvocationID.xy / vec2(u_width, u_height);
vec3 wpos = getViewPosition(u_depth_buffer, Global.inv_view_projection, screen_uv);

vec2 uv = (wpos.xz + vec2(u_offset0, u_offset2)) / u_range * vec2(1, -1);
vec2 uv = (wpos.xz + vec2(u_offset0, u_offset2)) / u_range;
#ifdef _ORIGIN_BOTTOM_LEFT
uv = uv * vec2(1, -1);
#endif
if (any(greaterThan(uv, vec2(1, 1)))) return;
if (any(lessThan(uv, vec2(-1, -1)))) return;
uv = saturate(uv * 0.5 + 0.5);
Expand Down

0 comments on commit 7a4f7c2

Please sign in to comment.