diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Engine/Graphics/Shaders/UI.shader	Thu Oct 09 23:33:36 2014 +0300
@@ -0,0 +1,45 @@
+cbuffer fast: register(b0)
+{
+    float2 position : packoffset(c0.x);
+    float2 size     : packoffset(c0.z);
+};
+
+cbuffer slow: register(b1)
+{
+};
+
+
+struct VInput
+{
+    float4 pos: POSITION0;
+};
+
+struct VOutput
+{
+    float4 pos: SV_Position0;
+    float2 uv:  TEXCOORD0;
+};
+
+
+VOutput vs(VInput vin)
+{
+    VOutput vout;
+
+    float2 normalized_pos = vin.pos.xy * position.xy + vin.pos.zw * size.xy;
+    vout.pos.xy = float2(2, -2) * normalized_pos + float2(-1, 1);
+    vout.pos.zw = float2(0, 1);
+    vout.uv = vin.pos.zw;
+
+    return vout;
+}
+
+
+
+
+SamplerState      basic_sampler: register(s0);
+Texture2D<float4> image: register(t0);
+
+float4 main(VOutput pin): SV_Target0
+{
+    return image.Sample(basic_sampler, pin.uv);
+}
\ No newline at end of file