7

In vulkan there is a struct which is required for pipeline creation, named VkPipelineRasterizationStateCreateInfo. In this struct there is a member named rasterizerDiscardEnable. If this member is set to VK_TRUE then all primitives are discarded before the rasterization step. This disables any output to the framebuffer.

I cannot think of a scenario where this might make any sense. In which cases could it be useful?

Brotcrunsher
  • 1,964
  • 10
  • 32

2 Answers2

12

It would be for any case where you're executing the rendering pipeline solely for the side effects of the vertex processing stage(s). For example, you could use a GS to feed data into a buffer, which you later render from.

Now in many cases you could use a compute shader to do something similar. But you can't use a CS to efficiently implement tessellation; that's best done by the hardware tessellator. So if you want to capture data generated by tessellation (presumably because you'll be rendering with it multiple times), you have to use a rendering process.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 4
    To extend this a little with a real-world example: Point tessellation voxelization (www.cs.columbia.edu/~fyun/gi12/paper100.pdf) is something I recently implemented and I use a graphics pass up to the tessellator and then use a geometry shader to write out to a 3D buffer. From there you move to the compute shader to actually create the voxels. – David Sauter Mar 21 '17 at 13:36
7

A useful side-effect (though not necessarily the intended use case) of this parameter is for benchmarking / determining the bottle-neck of your Vulkan application: If discarding all primitives before the rasterization stage (and thus before any fragment shaders are ever executed) does not improve your frame-rate then you can rule out that your application performance is fragment stage-bound.

Dreamer
  • 1,139
  • 9
  • 18