Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does it make sense to turn off the rasterization step?

Tags:

c++

vulkan

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?

like image 712
Brotcrunsher Avatar asked Dec 10 '22 12:12

Brotcrunsher


2 Answers

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.

like image 64
Nicol Bolas Avatar answered Dec 13 '22 02:12

Nicol Bolas


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.

like image 39
Dreamer Avatar answered Dec 13 '22 01:12

Dreamer