1 2cbuffer ConstantBuffer : register( b0 ) 3{ 4 matrix World; 5 matrix View; 6 matrix Projection; 7}; 8 9struct VS_INPUT 10{ 11 float4 Pos : POSITION; 12 float3 Norm : NORMAL; 13}; 14 15struct PS_INPUT 16{ 17 float4 Pos : SV_POSITION; 18 float3 Norm : TEXCOORD0; 19}; 20 21PS_INPUT main( VS_INPUT input ) 22{ 23 int ConstantBuffer = 42; // test ConstantBuffer as an identifier 24 25 PS_INPUT output = (PS_INPUT)0; 26 output.Pos = mul( input.Pos, World ); 27 output.Pos = mul( output.Pos, View ); 28 output.Pos = mul( output.Pos, Projection ); 29 output.Norm = mul( input.Norm, World ); // Work when output.Norm = mul( input.Norm, (float3x3)World ); 30 31 return output; 32} 33