Particle_PS.hlsl 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
  2. // CHECK: sample
  3. // CHECK: discard
  4. //--------------------------------------------------------------------------------------
  5. // File: Particle.hlsl
  6. //
  7. // HLSL file containing shader function to render front-facing particles.
  8. //
  9. // Copyright (c) Microsoft Corporation. All rights reserved.
  10. //--------------------------------------------------------------------------------------
  11. #include "shader_include.hlsli"
  12. //--------------------------------------------------------------------------------------
  13. // Internal defines
  14. //--------------------------------------------------------------------------------------
  15. #define FIXED_VERTEX_RADIUS 5.0
  16. //--------------------------------------------------------------------------------------
  17. // Structures
  18. //--------------------------------------------------------------------------------------
  19. struct VS_PARTICLE_INPUT
  20. {
  21. float3 WSPos : POSITION;
  22. };
  23. struct GS_PARTICLE_INPUT
  24. {
  25. float4 WSPos : POSITION;
  26. };
  27. struct PS_PARTICLE_INPUT
  28. {
  29. float4 Pos : SV_POSITION;
  30. float2 Tex : TEXCOORD0;
  31. };
  32. //--------------------------------------------------------------------------------------
  33. // Pixel Shader to display constant single color
  34. //--------------------------------------------------------------------------------------
  35. float4 main( PS_PARTICLE_INPUT input ) : SV_TARGET
  36. {
  37. // Sample particle texture
  38. float4 vColor = g_baseTexture.Sample( g_samLinear, input.Tex ).wwww;
  39. // Clip fully transparent pixels
  40. clip( vColor.a - 1.0/255.0 );
  41. // Return color
  42. return vColor;
  43. }