Mercurial > mm7
comparison Engine/Graphics/Shaders/UI.shader @ 2523:c532d5242055
Hello from Direct3D 11 :)
author | a.parshin |
---|---|
date | Thu, 09 Oct 2014 23:33:36 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2522:b71d0e7837ac | 2523:c532d5242055 |
---|---|
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 } |