hlsl.cbuffer-identifier.vert 663 B

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