DepthViewerVS.hlsl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
  2. // CHECK: bufferLoad
  3. //
  4. // Copyright (c) Microsoft. All rights reserved.
  5. // This code is licensed under the MIT License (MIT).
  6. // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
  7. // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
  8. // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
  9. // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
  10. //
  11. // Developed by Minigraph
  12. //
  13. // Author(s): James Stanard
  14. // Alex Nankervis
  15. //
  16. #define USE_VERTEX_BUFFER 0
  17. #include "ModelViewerRS.hlsli"
  18. cbuffer VSConstants : register(b0)
  19. {
  20. float4x4 modelToProjection;
  21. };
  22. #if USE_VERTEX_BUFFER
  23. struct VSInput
  24. {
  25. float3 position : POSITION;
  26. float2 texcoord0 : TEXCOORD;
  27. float3 normal : NORMAL;
  28. float3 tangent : TANGENT;
  29. float3 bitangent : BITANGENT;
  30. };
  31. #else
  32. struct VSInput
  33. {
  34. float3 position;
  35. float2 texcoord0;
  36. float3 normal;
  37. float3 tangent;
  38. float3 bitangent;
  39. };
  40. StructuredBuffer<VSInput> vertexArray : register(t0);
  41. cbuffer StartVertex : register(b1)
  42. {
  43. uint baseVertex;
  44. };
  45. #endif
  46. struct VSOutput
  47. {
  48. float4 position : SV_Position;
  49. float2 texcoord0 : texcoord0;
  50. };
  51. [RootSignature(ModelViewer_RootSig)]
  52. #if USE_VERTEX_BUFFER
  53. VSOutput main(VSInput vsInput)
  54. {
  55. #else
  56. VSOutput main(uint vertexID : SV_VertexID)
  57. {
  58. // The baseVertex argument to DrawIndexed is not automatically added to SV_VertexID...
  59. VSInput vsInput = vertexArray[vertexID + baseVertex];
  60. #endif
  61. VSOutput vsOutput;
  62. vsOutput.position = mul(modelToProjection, float4(vsInput.position, 1.0));
  63. vsOutput.texcoord0 = vsInput.texcoord0;
  64. return vsOutput;
  65. }