Mesa (master): gallium/docs: Document draw_vbo and set_index_buffer.

Chia-I Wu olv at kemper.freedesktop.org
Thu Jul 29 05:45:45 UTC 2010


Module: Mesa
Branch: master
Commit: e7f69c459af3274b9d1435c06a15b14eb40e4cc5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7f69c459af3274b9d1435c06a15b14eb40e4cc5

Author: Chia-I Wu <olv at lunarg.com>
Date:   Sat Jul 17 22:00:04 2010 +0800

gallium/docs: Document draw_vbo and set_index_buffer.

Document the new unified drawing method and remove references to old
ones.

---

 src/gallium/docs/d3d11ddi.txt       |   30 +++++++------------
 src/gallium/docs/source/context.rst |   55 ++++++++++------------------------
 2 files changed, 27 insertions(+), 58 deletions(-)

diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt
index 0954c29..f8155c8 100644
--- a/src/gallium/docs/d3d11ddi.txt
+++ b/src/gallium/docs/d3d11ddi.txt
@@ -66,9 +66,6 @@ Unordered access view: view supporting random read/write access (usually from co
 clear
 	+ Gallium supports clearing both render targets and depth/stencil with a single call
 
-draw_range_elements
-	+ Gallium supports indexed draw with explicit range
-
 fence_signalled
 fence_finish
 	+ D3D10/D3D11 don't appear to support explicit fencing; queries can often substitute though, and flushing is supported
@@ -271,31 +268,27 @@ Dispatch (D3D11 only)
 DispatchIndirect (D3D11 only)
 	- Gallium does not support compute shaders
 
-Draw -> draw_arrays
+Draw -> draw_vbo
 	! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
 
 DrawAuto -> draw_auto
 
-DrawIndexed -> draw_elements
+DrawIndexed -> draw_vbo
 	! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
-	* may want to add a separate set_index_buffer
-	- Gallium lacks base vertex for indexed draw calls
-	+ D3D11 lacks draw_range_elements functionality, which is required for OpenGL
+	+ D3D11 lacks explicit range, which is required for OpenGL
 
-DrawIndexedInstanced -> draw_elements_instanced
+DrawIndexedInstanced -> draw_vbo
 	! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
-	* may want to add a separate set_index_buffer
-	- Gallium lacks base vertex for indexed draw calls
 
-DrawIndexedInstancedIndirect (D3D11 only) -> call draw_elements_instanced multiple times in software
-	# this allows to use an hardware buffer to specify the parameters for multiple draw_elements_instanced calls
+DrawIndexedInstancedIndirect (D3D11 only)
+	# this allows to use an hardware buffer to specify the parameters for multiple draw_vbo calls
 	- Gallium does not support draw call parameter buffers and indirect draw
 
-DrawInstanced -> draw_arrays_instanced
+DrawInstanced -> draw_vbo
 	! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
 
-DrawInstancedIndirect (D3D11 only) -> call draw_arrays_instanced multiple times in software
-	# this allows to use an hardware buffer to specify the parameters for multiple draw_arrays_instanced calls
+DrawInstancedIndirect (D3D11 only)
+	# this allows to use an hardware buffer to specify the parameters for multiple draw_vbo calls
 	- Gallium does not support draw call parameter buffers and indirect draws
 
 DsSetConstantBuffers (D3D11 only)
@@ -332,10 +325,9 @@ HsSetShaderResources (D3D11 only)
 HsSetShaderWithIfaces (D3D11 only)
 	- Gallium does not support hull shaders
 
-IaSetIndexBuffer
-	! Gallium passes this to the draw_elements or draw_elements_instanced calls
+IaSetIndexBuffer -> set_index_buffer
 	+ Gallium supports 8-bit indices
-	! the D3D11 interface allows index-size-unaligned byte offsets into index buffers; it's not clear whether they actually work
+	# the D3D11 interface allows index-size-unaligned byte offsets into the index buffer; most drivers will abort with an assertion
 
 IaSetInputLayout -> bind_vertex_elements_state
 
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index 4e35a4c..f241411 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -45,6 +45,7 @@ buffers, surfaces) are bound to the driver.
 
 * ``set_vertex_buffers``
 
+* ``set_index_buffer``
 
 Non-CSO State
 ^^^^^^^^^^^^^
@@ -132,50 +133,26 @@ this surface need not be bound to the framebuffer.
 Drawing
 ^^^^^^^
 
-``draw_arrays`` draws a specified primitive.
+``draw_vbo`` draws a specified primitive.  The primitive mode and other
+properties are described by ``pipe_draw_info``.
 
-This command is equivalent to calling ``draw_arrays_instanced``
-with ``startInstance`` set to 0 and ``instanceCount`` set to 1.
+The ``mode``, ``start``, and ``count`` fields of ``pipe_draw_info`` specify the
+the mode of the primitive and the vertices to be fetched, in the range between
+``start`` to ``start``+``count``-1, inclusive.
 
-``draw_elements`` draws a specified primitive using an optional
-index buffer.
+Every instance with instanceID in the range between ``start_instance`` and
+``start_instance``+``instance_count``-1, inclusive, will be drawn.
 
-This command is equivalent to calling ``draw_elements_instanced``
-with ``startInstance`` set to 0 and ``instanceCount`` set to 1.
+All vertex indices must fall inside the range given by ``min_index`` and
+``max_index``.  In case non-indexed draw, ``min_index`` should be set to
+``start`` and ``max_index`` should be set to ``start``+``count``-1.
 
-``draw_range_elements``
+``index_bias`` is a value added to every vertex index before fetching vertex
+attributes.  It does not affect ``min_index`` and ``max_index``.
 
-XXX: this is (probably) a temporary entrypoint, as the range
-information should be available from the vertex_buffer state.
-Using this to quickly evaluate a specialized path in the draw
-module.
-
-``draw_arrays_instanced`` draws multiple instances of the same primitive.
-
-This command is equivalent to calling ``draw_elements_instanced``
-with ``indexBuffer`` set to NULL and ``indexSize`` set to 0.
-
-``draw_elements_instanced`` draws multiple instances of the same primitive
-using an optional index buffer.
-
-For instanceID in the range between ``startInstance``
-and ``startInstance``+``instanceCount``-1, inclusive, draw a primitive
-specified by ``mode`` and sequential numbers in the range between ``start``
-and ``start``+``count``-1, inclusive.
-
-If ``indexBuffer`` is not NULL, it specifies an index buffer with index
-byte size of ``indexSize``. The sequential numbers are used to lookup
-the index buffer and the resulting indices in turn are used to fetch
-vertex attributes.
-
-If ``indexBuffer`` is NULL, the sequential numbers are used directly
-as indices to fetch vertex attributes.
-
-``indexBias`` is a value which is added to every index read from the index 
-buffer before fetching vertex attributes.
-
-``minIndex`` and ``maxIndex`` describe minimum and maximum index contained in
-the index buffer.
+If there is an index buffer bound, and ``indexed`` field is true, all vertex
+indices will be looked up in the index buffer.  ``min_index``, ``max_index``,
+and ``index_bias`` apply after index lookup.
 
 If a given vertex element has ``instance_divisor`` set to 0, it is said
 it contains per-vertex data and effective vertex attribute address needs




More information about the mesa-commit mailing list