PageRenderTime 28ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/WindowsAPICodePack/DirectX/DirectX/Direct3D11/D3D11ComputeShaderPipelineStage.h

#
C Header | 143 lines | 31 code | 21 blank | 91 comment | 0 complexity | d8a24705a9a2e82235943f9dc7fca597 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. //Copyright (c) Microsoft Corporation. All rights reserved.
  2. #pragma once
  3. #include "D3D11PipelineStage.h"
  4. #include "D3D11ShaderAndClasses.h"
  5. namespace Microsoft { namespace WindowsAPICodePack { namespace DirectX { namespace Direct3D11 {
  6. /// <summary>
  7. /// Compute Shader pipeline stage.
  8. /// </summary>
  9. public ref class ComputeShaderPipelineStage : PipelineStage
  10. {
  11. public:
  12. /// <summary>
  13. /// Get the constant buffers used by the compute-shader stage.
  14. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSGetConstantBuffers)</para>
  15. /// </summary>
  16. /// <param name="startSlot">Index into the device's zero-based array to begin retrieving constant buffers from (ranges from 0 to D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1).</param>
  17. /// <param name="bufferCount">Number of buffers to retrieve (ranges from 0 to D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - startSlot).</param>
  18. /// <returns>A collection of constant buffer objects (see <see cref="D3DBuffer"/>)<seealso cref="D3DBuffer"/> to be returned by the method.</returns>
  19. ReadOnlyCollection<D3DBuffer^>^ GetConstantBuffers(UInt32 startSlot, UInt32 bufferCount);
  20. /// <summary>
  21. /// Get an array of sampler state objects from the compute-shader stage.
  22. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSGetSamplers)</para>
  23. /// </summary>
  24. /// <param name="startSlot">Index into a zero-based array to begin getting samplers from (ranges from 0 to D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1).</param>
  25. /// <param name="samplerCount">Number of samplers to get from a device context. Each pipeline stage has a total of 16 sampler slots available (ranges from 0 to D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - startSlot).</param>
  26. /// <returns>A collection of sampler-state objects (see <see cref="SamplerState"/>)<seealso cref="SamplerState"/>.</returns>
  27. ReadOnlyCollection<SamplerState^>^ GetSamplers(UInt32 startSlot, UInt32 samplerCount);
  28. // REVIEW: the native API declares the count argument as both in and out; if it turns out that
  29. // the CSGetShader() function can be called with NULL input to query the count of class instances,
  30. // then it would be feasible to turn this into a property. Likewise all the other shader-class
  31. // XXGet/SetShader() functions.
  32. /// <summary>
  33. /// Get the compute shader currently set on the device.
  34. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSGetShader)</para>
  35. /// </summary>
  36. /// <param name="classInstanceCount">The number of class-instances to retrieve.</param>
  37. /// <returns>
  38. /// A ComputeShader object and its classes (see <see cref="ComputeShader" />, <see cref="ShaderAndClasses" />)
  39. /// <seealso cref="ComputeShader" />, <seealso cref="ShaderAndClasses" />.
  40. /// </returns>
  41. ShaderAndClasses<ComputeShader^> GetShaderAndClasses(UInt32 classInstanceCount);
  42. /// <summary>
  43. /// Gets or sets the compute shader currently set on the device. (See <see cref="ComputeShader"/>)<seealso cref="ComputeShader"/>.
  44. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSGetShader, ID3D11DeviceContext::CSSetShader)</para>
  45. /// </summary>
  46. property ComputeShader^ Shader
  47. {
  48. ComputeShader^ get(void);
  49. void set(ComputeShader^ computeShader);
  50. }
  51. /// <summary>
  52. /// Get the compute-shader resources.
  53. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSGetShaderResources)</para>
  54. /// </summary>
  55. /// <param name="startSlot">Index into the device's zero-based array to begin getting shader resources from (ranges from 0 to D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1).</param>
  56. /// <param name="viewCount">The number of resources to get from the device. Up to a maximum of 128 slots are available for shader resources (ranges from 0 to D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - startSlot).</param>
  57. /// <returns>A collection of shader resource view objects to be returned by the device.</returns>
  58. ReadOnlyCollection<ShaderResourceView^>^ GetShaderResources(UInt32 startSlot, UInt32 viewCount);
  59. /// <summary>
  60. /// Gets an array of views for an unordered resource.
  61. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSGetUnorderedAccessViews)</para>
  62. /// </summary>
  63. /// <param name="startSlot">Index of the first element in the zero-based array to return (ranges from 0 to D3D11_PS_CS_UAV_REGISTER_COUNT - 1).</param>
  64. /// <param name="viewCount">Number of views to get (ranges from 0 to D3D11_PS_CS_UAV_REGISTER_COUNT - startSlot).</param>
  65. /// <returns>A collection of Unorderd Access Views (see <see cref="UnorderedAccessView"/>)<seealso cref="UnorderedAccessView"/> to get.</returns>
  66. ReadOnlyCollection<UnorderedAccessView^>^ GetUnorderedAccessViews(UInt32 startSlot, UInt32 viewCount);
  67. /// <summary>
  68. /// Set the constant buffers used by the compute-shader stage.
  69. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSSetConstantBuffers)</para>
  70. /// </summary>
  71. /// <param name="startSlot">Index into the zero-based array to begin setting constant buffers to (ranges from 0 to D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1).</param>
  72. /// <param name="constantBuffers">A collection of constant buffers (see <see cref="D3DBuffer"/>)<seealso cref="D3DBuffer"/> being given to the device.</param>
  73. void SetConstantBuffers(UInt32 startSlot, IEnumerable<D3DBuffer^>^ constantBuffers);
  74. /// <summary>
  75. /// Set an array of sampler states to the compute-shader stage.
  76. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSSetSamplers)</para>
  77. /// </summary>
  78. /// <param name="startSlot">Index into the device's zero-based array to begin setting samplers to (ranges from 0 to D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1).</param>
  79. /// <param name="samplers">A collection of sampler-state objects (see <see cref="SamplerState"/>)<seealso cref="SamplerState"/>.</param>
  80. void SetSamplers(UInt32 startSlot, IEnumerable<SamplerState^>^ samplers);
  81. /// <summary>
  82. /// Set a compute shader to the device.
  83. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSSetShader)</para>
  84. /// </summary>
  85. /// <param name="computeShader">A compute shader (see <see cref="ComputeShader"/>)<seealso cref="ComputeShader"/>. Passing in NULL disables the shader for this pipeline stage.</param>
  86. /// <param name="classInstances">A collection of class-instance objects (see <see cref="ClassInstance"/>)<seealso cref="ClassInstance"/>. Each interface used by a shader must have a corresponding class instance or the shader will get disabled.
  87. /// Set to null if the shader does not use any interfaces.</param>
  88. void SetShader(ComputeShader^ computeShader, IEnumerable<ClassInstance^>^ classInstances);
  89. /// <summary>
  90. /// Set a compute shader to the device.
  91. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSSetShader)</para>
  92. /// </summary>
  93. /// <param name="shaderAndClasses">
  94. /// A ComputeShader object and its classes (see <see cref="ComputeShader" />, <see cref="ShaderAndClasses" />)
  95. /// <seealso cref="ComputeShader" />, <seealso cref="ShaderAndClasses" />.
  96. /// Passing in null for the shader disables the shader for this pipeline stage.
  97. /// </param>
  98. void SetShader(ShaderAndClasses<ComputeShader^> shaderAndClasses);
  99. /// <summary>
  100. /// Bind an array of shader resources to the compute-shader stage.
  101. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSSetShaderResources)</para>
  102. /// </summary>
  103. /// <param name="startSlot">Index into the device's zero-based array to begin setting shader resources to (ranges from 0 to D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1).</param>
  104. /// <param name="shaderResourceViews">Collection of shader resource view objects to set to the device.</param>
  105. void SetShaderResources(UInt32 startSlot, IEnumerable<ShaderResourceView^>^ shaderResourceViews);
  106. /// <summary>
  107. /// Sets an array of views for an unordered resource.
  108. /// <para>(Also see DirectX SDK: ID3D11DeviceContext::CSSetUnorderedAccessViews)</para>
  109. /// </summary>
  110. /// <param name="startSlot">Index of the first element in the zero-based array to begin setting.</param>
  111. /// <param name="unorderedAccessViews">A collection of Unordered Access Views (see <see cref="UnorderedAccessView"/>)<seealso cref="UnorderedAccessView"/> to be set by the method.</param>
  112. /// <param name="initialCounts">Number of objects in the array.</param>
  113. void SetUnorderedAccessViews(UInt32 startSlot, IEnumerable<UnorderedAccessView^>^ unorderedAccessViews, array<UInt32>^ initialCounts);
  114. protected:
  115. // REVIEW: why 'protected' instead of 'internal'?
  116. ComputeShaderPipelineStage(void)
  117. { }
  118. internal:
  119. ComputeShaderPipelineStage(DeviceContext^ parent) : PipelineStage(parent)
  120. { }
  121. };
  122. } } } }