Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

How To: Create a Hull Shader

A hull shader is the first of three stages that work together to implement tessellation. The hull-shader outputs drive the tessellator stage, as well as the domain-shader stage. This topic shows how to create a hull shader.

A hull shader transforms a set of input control points (from a vertex shader) into a set of output control points. The number of input and output points can vary in contents and number depending on the transform (a typical transformation would be a basis transformation).

A hull shader also outputs patch constant information, such as tessellation factors, for a domain shader and the tessellator. The fixed-function tessellator stage uses the tessellation factors as well as other state declared in a hull shader to determine how much to tessellate.

Ff476338.wedge(en-us,VS.85).gifTo create a hull shader

  1. Design a hull shader. See How To: Design a Hull Shader.
  2. Compile the shader code
  3. Create a hull-shader object using ID3D11Device::CreateHullShader.
    
    
    HRESULT CreateHullShader(
      const void *pShaderBytecode,  
      SIZE_T BytecodeLength,  
      ID3D11ClassLinkage *pClassLinkage,  
      ID3D11HullShader **ppHullShader
    );
    
    
    
  4. Initialize the pipeline stage using ID3D11DeviceContext::HSSetShader.
    
    
    void HSSetShader(
      ID3D11HullShader *pHullShader,  
      ID3D11ClassInstance *const *ppClassInstances,
      UINT NumClassInstances
    );
    
    
    

A domain shader must be bound to the pipeline if a hull shader is bound. In particular, it is not valid to directly stream out hull shader control points with the geometry shader.

Related topics

Tessellation Overview

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.