forked from overdesigned/RenderPipelineShaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_temporal.rpsl
44 lines (34 loc) · 1.43 KB
/
test_temporal.rpsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2024 Advanced Micro Devices, Inc.
//
// This file is part of the AMD Render Pipeline Shaders SDK which is
// released under the MIT LICENSE.
//
// See file LICENSE.txt for full license details.
graphics node Triangle(rtv renderTarget : SV_Target0, uint triangleId);
node CopySrcDummy([readonly(copy)] texture temporal);
export void main([readonly(present)] texture backbuffer, uint frameIndex)
{
ResourceDesc backbufferDesc = backbuffer.desc();
uint32_t width = (uint32_t)backbufferDesc.Width;
uint32_t height = backbufferDesc.Height;
RPS_FORMAT format = backbufferDesc.Format;
uint tempLayers = 3;
texture history = create_tex2d(format, width, height, 1, 1, tempLayers);
if (frameIndex < tempLayers){
// clear and then render geometry to back buffer
clear(backbuffer, float4(0.0, 0.2, 0.4, 1.0));
clear(history, float4(0.0, 0.2, 0.4, 1.0));
Triangle(backbuffer, 0);
Triangle(history, 0);
// Add an empty node call with a dummy access, so this slice can be accessed as a copy source
// already. Note: This is a temporary solution and will be changed in the future.
CopySrcDummy(history);
}
else
{
// Copy from previous to current slice.
copy_texture(history.temporal(0), history.temporal(1));
// Copy to backbuffer from 2 frames ago.
copy_texture(backbuffer, history.temporal(2));
}
}