1
$\begingroup$

what exactly does the rasterizer outputs as per my knowlage it outputs primitives rasterized as fragments which seems correct as the next step in vulkan/opengl is fragment shader but dx confuses me here because there the step after rasterization is pixel shader.Is it just a convention for dx to call it pixel shader even though it runs per fragment or is my understanding incorrect that rasterizer outputs fragments.Also what is the size of a fragment?

$\endgroup$

2 Answers 2

1
$\begingroup$

You are correct in your understanding that the rasterizer produces fragments. Each fragment can be thought of as a quasi-pixel, in that geometry may generate more than one fragment for the same pixel (such as in multisampling). The pixel shader's job is to take those fragments and compute lighting, color, etc., to produce the final pixel that gets written to the target buffer.

In essence: Vertex Shader -> Rasterizer -> Fragment -> Pixel Shader -> Pixel

You might also find the DX11 documentation here, and this question about the difference between fragments, samples, and pixels to be useful.

$\endgroup$
2
  • $\begingroup$ and the size of the fragment is sample sized correct,which is hardware defined(cannot be changed by developer),correct? $\endgroup$
    – VersesDev
    Apr 24 at 12:42
  • $\begingroup$ I believe so? Though seeing as its implementation defined, there's not much you could do about it anyway. In the end, I know of know way that you can query for it, so I'm honestly not sure it's something that application developers really need to concern themselves with. $\endgroup$
    – Straivers
    Apr 24 at 20:31
0
$\begingroup$

In general, a rasterizer converts a vector description of an image to a raster description, like converting (centerx centery radius color) to a bitmap of a shaded circle. Literally, the rasters are the rakes (unrelated implement named from the same Latin root) or scanlines of the image, so they might be interally represented as rows of a bitmap or a run-length encoding or a set of cooefficients for a fourier transform or something.

The process can be considered as projecting the scanlines backwards into the model space and detecting where these lines intersect with the boundaries of objects. A distributed shader might produce a small bitmap or a few scanlines which must be reintegrated to produce the full image.

In a finer-grained setting, the rasterizer could be isolated to just detecting the edges of objects and then call the pixel shader for the smaller range of the scanline where it's actually inside of the object.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.