2524
|
1 cbuffer fast: register(b0)
|
|
2 {
|
|
3 float2 position : packoffset(c0.x);
|
|
4 float2 size : packoffset(c0.z);
|
|
5 };
|
|
6
|
|
7 cbuffer slow: register(b1)
|
|
8 {
|
|
9 };
|
|
10
|
|
11
|
|
12 struct VInput
|
|
13 {
|
|
14 float4 pos: POSITION0;
|
|
15 };
|
|
16
|
|
17 struct VOutput
|
|
18 {
|
|
19 float4 pos: SV_Position0;
|
|
20 float2 uv: TEXCOORD0;
|
|
21 };
|
|
22
|
|
23
|
|
24 VOutput vs(VInput vin)
|
|
25 {
|
|
26 VOutput vout;
|
|
27
|
|
28 float2 normalized_pos = vin.pos.xy * position.xy + vin.pos.zw * size.xy;
|
|
29 vout.pos.xy = float2(2, -2) * normalized_pos + float2(-1, 1);
|
|
30 vout.pos.zw = float2(0, 1);
|
|
31 vout.uv = vin.pos.zw;
|
|
32
|
|
33 return vout;
|
|
34 }
|
|
35
|
|
36
|
|
37
|
|
38
|
|
39 SamplerState basic_sampler: register(s0);
|
|
40 Texture2D<float4> image: register(t0);
|
|
41
|
|
42 float4 main(VOutput pin): SV_Target0
|
|
43 {
|
|
44 return image.Sample(basic_sampler, pin.uv);
|
|
45 } |