hlsl.scalar2matrix.frag 783 B

1234567891011121314151617181920212223242526272829
  1. void Fn1(float4x4 p) { }
  2. float4 main() : SV_TARGET
  3. {
  4. const float4x4 mat1c = 0.20;
  5. const float4x4 mat2c = {2, 2.1, 2.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  6. const float4x4 mat3c = (float4x4)float1(0.1);
  7. float4x4 mat1 = 0.25;
  8. float4x4 mat2 = {3, 3.1, 3.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  9. float4x4 mat3 = (float4x4)0.375;
  10. // float4x4 mat5 = (float4x4)Fn2(); // TODO: enable when compex rvalue handling is in place
  11. float4x4 mat4;
  12. mat4 = 0.75;
  13. mat4 = float4x4(4, 4.1, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  14. mat4 = (float4x4)0.5;
  15. mat4 *= 0.75;
  16. mat4 += 0.75;
  17. mat4 -= 0.5;
  18. mat4 /= 2.0;
  19. Fn1(5.0); // test calling fn accepting matrix with scalar type
  20. return mat1c[0] + mat3c[0] + mat1[1] + mat4[2];
  21. }