-
Notifications
You must be signed in to change notification settings - Fork 25
/
test_output_resource.rpsl
39 lines (31 loc) · 1.71 KB
/
test_output_resource.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
// 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.
node DrawTriangle(rtv dst : SV_Target0);
node Blt(float3 tint, ps_srv src, rtv dst : SV_Target0, RpsViewport viewport : SV_Viewport);
export void render_colored([readonly(present)] texture backBuffer, [readonly(ps)] out texture offscreenRT)
{
ResourceDesc backbufferDesc = backBuffer.desc();
uint32_t width = (uint32_t)backbufferDesc.Width / 2;
uint32_t height = (uint32_t)backbufferDesc.Height / 2;
RPS_FORMAT backbufferFormat = backbufferDesc.Format;
clear(backBuffer, float4(0.1, 0.1, 0.1, 1.0));
// Create offscreen buffer and assign to the out parameter
offscreenRT = create_tex2d(backbufferFormat, width, height);
clear(offscreenRT, float4(0.1, 0.2, 0.4, 1.0));
DrawTriangle(offscreenRT);
copy_texture(backBuffer, uint3(0, 0, 0), offscreenRT, uint3(0, 0, 0), uint3(width, height, 1));
}
export void render_tinted([readonly(present)] texture backBuffer, [readonly(ps)] texture offscreenBuffer)
{
ResourceDesc backbufferDesc = backBuffer.desc();
uint32_t width = (uint32_t)backbufferDesc.Width / 2;
uint32_t height = (uint32_t)backbufferDesc.Height / 2;
Blt(float3(1, 1, 1), offscreenBuffer, backBuffer, viewport(0, 0, width, height));
Blt(float3(1, 0, 0), offscreenBuffer, backBuffer, viewport(width, 0, width, height));
Blt(float3(0, 1, 0), offscreenBuffer, backBuffer, viewport(0, height, width, height));
Blt(float3(0, 0, 1), offscreenBuffer, backBuffer, viewport(width, height, width, height));
}