Sample questions
Gfx Gpu Pipeline StagesDifficulty 1
In the graphics pipeline, what is the primary job of the input assembly stage?
- aIt samples textures and filters color values for each fragment
- bIt blends the fragment shader output with the existing color buffer
- cIt reads vertex/index buffer data and assembles primitives such as triangles✓
- dIt converts normalized device coordinates into pixel coordinates on screen
Explanation:Input assembly is the stage that reads vertex/index buffer data and groups vertices into primitives (points, lines, triangles) according to the draw call's topology, before any vertex shader work happens. Texture filtering, blending, and the NDC-to-pixel conversion belong to later stages.
Gfx Gpu Pipeline StagesDifficulty 1
How does a vertex shader execute relative to the mesh being drawn?
- aIt runs once per vertex, independently transforming each vertex's attributes✓
- bIt runs once per pixel, computing the final color for each covered fragment
- cIt runs once per draw call, transforming the whole mesh in a single invocation
- dIt runs once per triangle, after the triangle's three vertices are already assembled
Explanation:A vertex shader is invoked once for every vertex fed into the pipeline, typically transforming position (usually into clip space) and other per-vertex attributes independently of its neighbors. Per-pixel color computation is the fragment shader's job, not the vertex shader's.
Gfx Gpu Pipeline StagesDifficulty 2
Where do the optional tessellation and geometry shader stages sit in the pipeline order, when present?
- aBoth run after rasterization, operating on the already-generated fragments
- bBoth run after the vertex shader and before rasterization, on vertex/primitive data✓
- cTessellation runs before input assembly, geometry runs after the output merger
- dBoth run inside the fragment shader as callable sub-programs invoked per pixel
Explanation:When enabled, tessellation and geometry stages are positioned after the vertex shader and before rasterization: they still operate on vertex/primitive-level data (subdividing patches or emitting new primitives), not on per-pixel fragments. Fragment-stage work only begins once rasterization has produced fragments.
Gfx Gpu Pipeline StagesDifficulty 1
What operation is the perspective divide, and when does it happen in the pipeline?
- aMultiplying screen-space x and y by the depth value, performed inside the fragment shader
- bAdding the camera's near and far plane distances, performed during input assembly
- cSubtracting the viewport origin from window coordinates, performed during the output merger
- dDividing clip-space x, y and z by clip-space w to produce normalized device coordinates✓
Explanation:The perspective divide takes clip-space coordinates and divides x, y and z by the w component, producing normalized device coordinates (NDC). This happens after clipping and before the viewport transform converts NDC into window/pixel coordinates.
Gfx Gpu Pipeline StagesDifficulty 2
What does the viewport transform convert, and into what space?
- aIt converts world-space positions directly into clip-space positions
- bIt converts normalized device coordinates into window/pixel coordinates✓
- cIt converts fragment shader color output into the framebuffer's storage format
- dIt converts vertex attributes into the varyings passed to the fragment shader
Explanation:The viewport transform maps normalized device coordinates (the −1..1 range after the perspective divide) into the actual window/pixel coordinates of the configured viewport rectangle, which rasterization then uses to generate fragments at specific pixel locations.
Gfx Gpu Pipeline StagesDifficulty 2
Relative to the perspective divide, in which space does primitive clipping against the view volume happen?
- aIn clip space, before the perspective divide, using bounds expressed in terms of w✓
- bIn window space, after the viewport transform has produced pixel coordinates
- cIn normalized device coordinate space, strictly after the perspective divide
- dIn tangent space, computed alongside normal mapping in the fragment shader
Explanation:Clipping is defined against the clip-space view volume, where the bounds are expressed relative to w (for example −w ≤ x ≤ w), and this happens before the perspective divide converts coordinates into NDC. Clipping in window space or after the divide would need a different, non-clip-space formulation.