Search

A technology, a device or an article

Who fills in the GPU’s next draw command?

Indirect drawing lets a GPU consume parameters from a buffer. A separate count can keep visibility decisions on the device while preserving state and synchronization requirements.

Glass stage with geometric figures and tiles in the foreground
ITNWS AI-generated conceptual illustration. Tiles evoke draw parameters near their consumer, not an actual rendered frame or measurement.ITNWS · image_gen · Original ITNWS AI-generated conceptual editorial illustration

The CPU asks how many objects survived visibility testing. The GPU already knows, but answering means sending a small result back across a boundary and arranging for the CPU to use it. The number may occupy only a few bytes; the awkward part is the dependency. A renderer that needs that number before recording its draws can wait for information that is sitting beside the work it will eventually control. Indirect drawing changes this conversation. The GPU can read drawing parameters from memory when it executes the recorded command.

To see what that changes, imagine a scene containing many instances of a few meshes. Some objects are outside the view, while others remain visible. This is a hypothetical scene, not a frame captured or timed by ITNWS. Geometry and material data already exist in buffers, and a compute pass can inspect object bounds. The design question is who turns that decision into the parameters of subsequent drawing. It concerns the organization of work, rather than a promise that drawing the same pixels will suddenly require less arithmetic.

The Khronos multi-draw indirect sample demonstrates different placements of that responsibility. In its GPU path, visibility controls the instance count in an indirect record. The official sample is evidence of the mechanism, not an editorial benchmark and not a universal result for all scene structures. The documents cited here were checked on October 29, 2026. Indirect drawing is an established capability; this article does not announce a new graphics card or a newly released Vulkan version.

A command with a blank to fill

With a direct indexed draw, values such as the number of indices and instances are supplied while the command is recorded. With an indirect indexed draw, the device obtains the corresponding values from a designated buffer during execution. A record contains indexCount, instanceCount, firstIndex, vertexOffset and firstInstance. These describe geometry and instance selection. They are not miniature command buffers containing arbitrary graphics API calls. Their deliberately limited vocabulary is what lets a recorded draw consume changing data without requiring the CPU to rewrite each individual draw instruction.

That vocabulary matters when interpreting the phrase GPU-driven. A compute shader can write a record that disables an object by setting its instance count to zero. It can populate a compacted list containing only surviving objects. It can choose which section of already available geometry a draw references. But an ordinary indirect record does not, merely by existing, bind an entirely different pipeline or create a missing texture. The CPU and renderer architecture still establish the resources and state under which those records will be interpreted.

Consider the fixed-list approach first. Every candidate object retains a record in a buffer. Visibility determines whether its instance count is zero or nonzero, while the recorded draw operation addresses the candidate list. The advantage is simple identity: record position can remain associated with the same object. The cost includes processing the list structure and retaining space for candidates that contribute no geometry. A zero instance count prevents the corresponding instance work; it does not prove that the entire command-processing cost of an unused record disappears on every device.

Compaction changes the arrangement. Surviving objects occupy consecutive records, and a separate counter records how many were written. Now the result is both a list and its length. The counter is not merely a convenient display statistic: it determines which entries are valid for consumption. If a renderer accidentally reuses the previous frame’s count, stale records can become visible work. If it publishes a new count before the associated records are ready, the consumer can reach unfinished data. Correctness joins the fields, even though they live in different buffers.

The Vulkan guide to indirect counts identifies an important boundary. In the ordinary indirect form, drawCount is still provided when recording. The count variant reads the number of draws from a buffer during execution. The relevant functionality was promoted to Vulkan 1.2, with feature requirements that must still be checked for the intended call. Reading the parameters indirectly and reading the list length indirectly are related capabilities, not two names for the same operation. A renderer can use the first without having eliminated every need to know a count on the CPU.

Turquoise pastel rectangles gather into a row beside an ochre mark
ITNWS AI-generated conceptual illustration. The row and separate mark evoke a command list and its length, not a performance plot. — ITNWS · image_gen · Original ITNWS AI-generated conceptual editorial illustration

The number has a ceiling

In vkCmdDrawIndexedIndirectCount, the stored count is bounded by maxDrawCount. This upper limit belongs to the recorded command and must respect device limits and the supplied buffers. Suppose, purely for explanation, the renderer reserves room for 1,000 records and produces 240 visible records. The count operation can consume those 240 within the bound. The example is about valid capacity, not a recommended batch size or a measured saving. The available space must be valid even when visibility differs next frame.

The bound does not excuse a compute shader that writes past its allocation. Clamping the number of records later consumed by drawing cannot undo an earlier out-of-range write. The producer needs its own bounded allocation or overflow strategy. Similarly, the count buffer must be initialized for each intended production interval. An atomic increment applied to yesterday’s surviving total is not today’s count. These are ordinary data-structure obligations that become easy to overlook when the word indirect makes the command sound more autonomous than its producer actually is.

The bytes also have a defined layout. Buffer offsets, strides and field types must agree with the API and shader representation. An integer with the right apparent value at the wrong offset is not a valid command parameter. vertexOffset is signed in the indexed structure; treating every field as an interchangeable unsigned object can change addressing. firstInstance has feature-related constraints that should be checked instead of inferred from the fact that another field works. The reference page provides the detailed validity requirements for the particular function rather than leaving them to a visual resemblance between C and shader structs.

A useful design often groups objects under compatible rendering state. If the next record requires a different graphics pipeline, ordinary multi-draw indirect does not supply a hidden state change between records. The renderer may divide the workload into separate batches, use suitable data-driven resource selection, or choose another supported command mechanism. Those choices carry their own limits and costs. Consequently, counting the maximum possible draws combined into one call is a poor standalone measure of an engine’s quality. A coherent batch must still represent the right resources and preserve the rendering result.

What no longer travels back

The CPU no longer needs the current visible count solely to spell out every draw when a count-buffer design handles that decision. It still records commands that establish the compute and drawing work, manages resource lifetimes, and supplies changing scene input. The removed round trip is specific. GPU-driven rendering should not be read as a claim that the CPU disappears from the frame or that the graphics card schedules the entire application independently. The useful change is where a decision can remain after it has been computed.

This is why the size of the returned number can be misleading. Transferring four bytes may be cheap in bandwidth and expensive as a synchronization dependency. If the CPU blocks until those bytes describe the current frame, subsequent command preparation may wait. An implementation could instead read an older result and accept different visibility behavior, but that changes the algorithm. Keeping the current result on the GPU avoids that particular readback dependency while preserving the chosen current-frame decision. Whether the overall frame finishes sooner depends on the rest of its work.

The command data must become visible to the intended consumer. A compute shader’s storage writes and the later indirect-command reads need the appropriate execution and memory dependency. The Khronos synchronization examples show compute-produced indirect buffers with a dependency from shader writes to indirect reads. If the same compute pass also creates data read by vertex shaders, that data introduces its own required access scope. Naming only the indirect consumer would leave part of the actual dependency unexpressed.

Separate queue families add ownership and inter-queue coordination where applicable. Sharing one buffer between compute and graphics is not permission for either queue to overwrite it whenever convenient. Reusing the buffer next frame must also wait until the preceding draw no longer needs it. Distinct per-frame regions can change how that lifetime is managed, but do not remove the responsibility. These details are essential because an intermittent stale draw can look like a visibility-test error when the test was correct and only its result’s handover was wrong.

The official Direct3D 12 indirect drawing sample demonstrates the same broader idea in a different API: compute manipulates commands that an indirect execution mechanism later consumes. Its command-signature and resource-state model must be read on its own terms. Vulkan field names are not a portable binary interface for ExecuteIndirect. The comparison establishes that moving draw decisions near their consumer is a useful architectural pattern; it does not license copying one API’s barriers or record definitions into another.

Visibility itself still needs a defensible test. A conservative bound can keep an object that ultimately produces no pixels, wasting some work while preserving correctness. An incorrect rejection removes geometry that should have appeared. A fast command-generation pass cannot compensate for that error. Occlusion methods introduce further dependence on depth information and its age. Therefore, replacing CPU submission is only one part of GPU-driven design. The renderer must maintain a valid relationship between its scene representation, its visibility decisions and the commands that finally use them.

Ordering can matter too. A compacted list built through atomic allocation need not preserve the original object order. For opaque geometry, a changed order can alter efficiency even when the final image remains acceptable under the intended rules. For transparency and other order-dependent operations, arbitrary reordering may change the visible result itself. The ability to produce commands dynamically is not permission to discard semantic ordering. A real engine needs an order policy consistent with the pass rather than assuming that all surviving objects are freely interchangeable.

Performance evaluation would separate command recording, visibility work, command consumption and the completion of the required frame. Reducing CPU API calls can be valuable when submission limits progress, while adding compute compaction may hurt a scene already limited elsewhere. The official sample demonstrates selectable approaches precisely so their behavior can be studied. Here no timing figures are borrowed as forecasts for a reader’s GPU. A comparison must use equivalent visible results and explain which removed dependency or changed work accounts for a difference.

Indirect drawing changes where a GPU can use a decision: information produced on the device can remain there and govern later drawing. Its buffer is neither a photograph of the frame nor a general-purpose replacement for a command stream. It is a small agreed vocabulary that lets changing scene decisions meet an already recorded operation. The CPU’s original question can remain unanswered on the CPU because the answer has reached the place that needs to act on it.

Sources & documentation

  1. Khronos GPU rendering and multi-draw indirect sample ↗
  2. Vulkan vkCmdDrawIndexedIndirectCount ↗
  3. Vulkan indirect count guide ↗
  4. Vulkan synchronization examples ↗
  5. Microsoft indirect drawing and GPU culling ↗