I have a few short question regarding operations happening in the rendering pipeline (OpenGL, Vulkan, I'd expect for all questions to have similar answers for these two frameworks while DirectX might work a bit different).

Is the division of the coordinates x/w,y/w,z/w the last operation that happens on the GPU? Or are there other operations that happen afterwards? I wasn't really able to find any information on that, could anyone point me into the right direction?

Furthermore, concerning the depth of fragments, as far as I understand a quantization takes place to discrete units of depth, but I couldn't find anything detailed if these operations follow some kind of IEEE standard or if they have their own standards, maybe even depending on the manufacturer. Does anyone know more detail about this or could point me into the right direction?

In general are there some, more or less, complete information about the possible operations (besides of course programmable operations during the programmable shader stages), the error bounds, etc. for operations on the GPU?

Kind regards and thank you in advance.


1 Answer 1


Is the division of the coordinates x/w,y/w,z/w the last operation that happens on the GPU?

The division you are referring to is generally called "The Perspective Divide". You can google it and get information overload on helpful documentation. The division itself happens after the geometry shader before the fragment shader as part of rasterization. And is part of the process that creates the fragments that the pixel shader is run on. It is also an important part of vertex attribute interpolation. All of OpenGL, Vulkan, DirectX perform the perspective divide in the same place which is done by the GPU's hardware.

The most adopted floating point standard is IEEE 754 and yes virtually all vendors implement and follow these standards. I highly recommend (slowly) wrapping your mind around this standard to get a deeper understanding of how floats are processed. Here is a good first factoid to memorize (if you want): The standard put the sign bit for floating point numbers in the same place as the sign bit for integers to make conversion between and understanding both easier.

Quantization in this context refers to the accuracy of floating point numbers. There are many numbers that can not be fully represented in floating point math on the GPU, such as 1/3. Quantization is the process of representing that number as closely as possible within the limitations of the hardware. But minor difference in hardware implementations that are still standards compliant can and often will produce slightly different results.

Rather then focus on the limits of floating point numbers or attempting to write code that operates at the edge of these limits, coders generally use techniques that avoid the issue altogether like utilizing hardware offset capabilities to side step the issue completely is one method. (but is situation specific, like when applying decals)

  • $\begingroup$ Hello, thank you for your exhaustive answer this will very much help me forward! Just a short part on the quantization, this means the fragments are not quantized on lets say a pixel cube with 1024x1024x1024 but still use the full precision of loat? $\endgroup$
    – Anima
    Nov 16, 2020 at 15:38
  • $\begingroup$ Its better to think of floats as either can be fully represented or can't be fully represented. Any multiple of 2 can be fully represented by a floating point number exactly. Issues with quantization occur when 2 numbers that can not be fully represented are the multiplied together and the error which was minor previously begins to multiply. When generating fragments, the exact positions can always be calculated since texels are computed on boundaries that can be exactly represented inside the values stored on the GPU. $\endgroup$
    – pmw1234
    Nov 17, 2020 at 0:27
  • $\begingroup$ I recommend writing a small test program that adds a very small amount to a floating point number in a loop allowing it to accumulate, say 0.0001f it will slowly accumulate until the number becomes to large to fully represent. Along the way it will begin to skip certain numbers, before stopping to accumulate all together. There is a really great website that explains really well but I can seem to find a link to it...sorry. $\endgroup$
    – pmw1234
    Nov 17, 2020 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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