d3dut
annotate example/shader.hlsl @ 0:ecc040281dc9
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 22 Jun 2013 10:11:39 +0300 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 cbuffer RenderState : register(b0) { |
nuclear@0 | 2 matrix modelview_matrix : packoffset(c0); |
nuclear@0 | 3 matrix projection_matrix : packoffset(c4); |
nuclear@0 | 4 }; |
nuclear@0 | 5 |
nuclear@0 | 6 struct VSInput { |
nuclear@0 | 7 float4 pos : POSITION; |
nuclear@0 | 8 float4 color : COLOR; |
nuclear@0 | 9 }; |
nuclear@0 | 10 |
nuclear@0 | 11 struct VSOutput { |
nuclear@0 | 12 float4 pos : SV_POSITION; |
nuclear@0 | 13 float4 color : COLOR0; |
nuclear@0 | 14 }; |
nuclear@0 | 15 |
nuclear@0 | 16 VSOutput vertex_main(VSInput input) |
nuclear@0 | 17 { |
nuclear@0 | 18 VSOutput res; |
nuclear@0 | 19 |
nuclear@0 | 20 float4 vpos = mul(input.pos, modelview_matrix); |
nuclear@0 | 21 |
nuclear@0 | 22 res.pos = mul(vpos, projection_matrix); |
nuclear@0 | 23 res.color = input.color; |
nuclear@0 | 24 return res; |
nuclear@0 | 25 } |
nuclear@0 | 26 |
nuclear@0 | 27 |
nuclear@0 | 28 float4 pixel_main(VSOutput input) : SV_TARGET |
nuclear@0 | 29 { |
nuclear@0 | 30 return input.color; |
nuclear@0 | 31 } |