lib_global.hlsl 545 B

123456789101112131415161718192021222324
  1. // Make constructor for static global variable is called.
  2. Texture2D g_txDiffuse;
  3. SamplerState g_samLinear;
  4. cbuffer X {
  5. // Use min-precision type to force conversion of constant buffer type for legacy.
  6. // This has to happen at link time at the moment, so this will break unless type
  7. // annotations are retained for library.
  8. min16float f;
  9. }
  10. static float g[2] = { 1, f };
  11. [shader("pixel")]
  12. float4 test(float2 c : C) : SV_TARGET
  13. {
  14. float4 x = g_txDiffuse.Sample( g_samLinear, c );
  15. return x + g[1];
  16. }
  17. void update() {
  18. g[1]++;
  19. }