Draw calls API

namespace d3d

Functions

bool draw_base(int type, int start, int numprim, uint32_t num_instances, uint32_t start_instance)

Draw primitives.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • start – The starting index of the primitives.

  • numprim – The number of primitives to draw.

  • num_instances – The number of instances to draw.

  • start_instance – The starting instance index.

Returns:

True if the draw operation was successful, false otherwise.

inline bool draw(int type, int start, int numprim)

Draw primitives with a single instance.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • start – The starting index of the primitives.

  • numprim – The number of primitives to draw.

Returns:

True if the draw operation was successful, false otherwise.

inline bool draw_instanced(int type, int start, int numprim, uint32_t num_instances, uint32_t start_instance = 0)

Draw primitives with multiple instances.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • start – The starting index of the primitives.

  • numprim – The number of primitives to draw.

  • num_instances – The number of instances to draw.

  • start_instance – The starting instance index.

Returns:

True if the draw operation was successful, false otherwise.

bool drawind_base(int type, int startind, int numprim, int base_vertex, uint32_t num_instances, uint32_t start_instance)

Draw indexed primitives.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • startind – The starting index of the primitives.

  • numprim – The number of primitives to draw.

  • base_vertex – The base vertex index.

  • num_instances – The number of instances to draw.

  • start_instance – The starting instance index.

Returns:

True if the draw operation was successful, false otherwise.

inline bool drawind_instanced(int type, int startind, int numprim, int base_vertex, uint32_t num_instances, uint32_t start_instance = 0)

Draw indexed primitives with multiple instances.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • startind – The starting index of the primitives.

  • numprim – The number of primitives to draw.

  • base_vertex – The base vertex index.

  • num_instances – The number of instances to draw.

  • start_instance – The starting instance index.

Returns:

True if the draw operation was successful, false otherwise.

inline bool drawind(int type, int startind, int numprim, int base_vertex)

Draw indexed primitives with a single instance.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • startind – The starting index of the primitives.

  • numprim – The number of primitives to draw.

  • base_vertex – The base vertex index.

Returns:

True if the draw operation was successful, false otherwise.

bool draw_up(int type, int numprim, const void *ptr, int stride_bytes)

Draw primitives from a user pointer (rather slow).

Deprecated:

Remove this method. It uncontrollably allocates memory in driver.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • numprim – The number of primitives to draw.

  • ptr – The pointer to the vertex data.

  • stride_bytes – The stride between vertices in bytes.

Returns:

True if the draw operation was successful, false otherwise.

bool drawind_up(int type, int minvert, int numvert, int numprim, const uint16_t *ind, const void *ptr, int stride_bytes)

Draw indexed primitives from a user pointer (rather slow).

Deprecated:

Remove this method. It uncontrollably allocates memory in driver.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • minvert – The minimum vertex index.

  • numvert – The number of vertices.

  • numprim – The number of primitives to draw.

  • ind – The pointer to the index data.

  • ptr – The pointer to the vertex data.

  • stride_bytes – The stride between vertices in bytes.

Returns:

True if the draw operation was successful, false otherwise.

bool draw_indirect(int type, Sbuffer *args, uint32_t byte_offset = 0)

Draw primitives using indirect parameters.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • args – The buffer containing the draw parameters. The buffer must contain DrawIndirectArgs structure.

  • byte_offset – The byte offset into the buffer.

Returns:

True if the draw operation was successful, false otherwise.

bool draw_indexed_indirect(int type, Sbuffer *args, uint32_t byte_offset = 0)

Draw indexed primitives using indirect parameters.

Parameters:
  • type – The type of primitives to draw. One of PRIM_XXX enum.

  • args – The buffer containing the draw parameters. The buffer must contain DrawIndexedIndirectArgs structure.

  • byte_offset – The byte offset into the buffer.

Returns:

True if the draw operation was successful, false otherwise.

bool multi_draw_indirect(int prim_type, Sbuffer *args, uint32_t draw_count, uint32_t stride_bytes, uint32_t byte_offset = 0)

Draw multiple instances of primitives using indirect parameters.

Parameters:
  • prim_type – The type of primitives to draw. One of PRIM_XXX enum.

  • args – The buffer containing the draw parameters. The buffer must contain DrawIndirectArgs structures.

  • draw_count – The number of draw calls.

  • stride_bytes – The stride between draw parameters in bytes.

  • byte_offset – The byte offset into the buffer.

Returns:

True if the draw operation was successful, false otherwise.

bool multi_draw_indexed_indirect(int prim_type, Sbuffer *args, uint32_t draw_count, uint32_t stride_bytes, uint32_t byte_offset = 0)

Draw multiple instances of indexed primitives using indirect parameters.

Parameters:
  • prim_type – The type of primitives to draw. One of PRIM_XXX enum.

  • args – The buffer containing the draw parameters. The buffer must contain DrawIndexedIndirectArgs structures.

  • draw_count – The number of draw calls.

  • stride_bytes – The stride between draw parameters in bytes.

  • byte_offset – The byte offset into the buffer.

Returns:

True if the draw operation was successful, false otherwise.