annotate Engine/Graphics/Shaders/UI.hlsl @ 2524:c7264ab7132f

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