Loading...
Searching...
No Matches
score::gfx::IndirectCountClamp Class Reference

The draw-count rung, emulated with compute for backends without it. More...

Detailed Description

The draw-count rung, emulated with compute for backends without it.

A producer that writes its draw count on the GPU may leave anything in the command slots past that count: syn-pop-draw writes poison commands there. The count rung (drawIndexedIndirectCount) never reads them, but it is not always there: Metal implements it with indirect command buffers, which a pipeline that binds textures cannot use, and some drivers lack it outright. The full-capacity multi-draw rung would then draw the dead slots.

run() copies the commands to a buffer of its own with every slot at or past the count zeroed, so a multi-draw of the copy paints what the count draw would. Nothing is read back. It needs compute and a storage-usable command and count buffer, and returns nullptr otherwise.

Call it outside a pass, before the render pass that draws.

Classes

struct  Input
 

Public Member Functions

QRhiBuffer * run (RenderState &state, QRhiCommandBuffer &cb, QRhiResourceUpdateBatch *&res, const Input &in)
 
void release ()
 
const char * refusal () const noexcept
 Why the last run() returned nullptr, or nullptr when it did not.
 
quint64 bindingsId () const noexcept
 
quint64 pipelineBindingsId () const noexcept
 

Static Public Attributes

static constexpr int LocalSize = 64
 

Member Function Documentation

◆ bindingsId()

quint64 score::gfx::IndirectCountClamp::bindingsId ( ) const
noexcept

For tests: the resource ids of the bindings the dispatch uses and of the ones the pipeline was last given (ids, not addresses: a new object can take a deleted one's address).

◆ run()

QRhiBuffer * score::gfx::IndirectCountClamp::run ( RenderState &  state,
QRhiCommandBuffer &  cb,
QRhiResourceUpdateBatch *&  res,
const Input &  in 
)

The clamped copy of the commands, at offset 0 with the same stride, or nullptr when the clamp cannot run (the caller keeps its plain rungs).


The documentation for this class was generated from the following files: