Mesa (gallium-index-bias): gallium: Add index bias parameter to draw_elements and friends.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Apr 19 07:32:33 UTC 2010


Module: Mesa
Branch: gallium-index-bias
Commit: c184da9505e04fdbdda1bb1ff6990d5defaa25d4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c184da9505e04fdbdda1bb1ff6990d5defaa25d4

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Apr 19 08:56:46 2010 +0200

gallium: Add index bias parameter to draw_elements and friends.

indexBias corresponds to:
- BaseVertexIndex parameter of D3D9's
  IDirect3DDevice9::DrawIndexedPrimitive method
- BaseVertexLocation parameter of ID3D10Device::DrawIndexed

Although a positive indexBias can be easily be implemented in Gallium by
adding indexBias*stride to each vertex buffer base offset, a negative
indexBias cannot, as the final vertex buffer offset could be negative.

I'm not aware of this functionality being exposed to GL drivers, so for
now all hardware drivers will just assert(indexBias == 0).

See also:
- http://msdn.microsoft.com/en-us/library/bb174369.aspx (D3D9)
- http://msdn.microsoft.com/en-us/library/ff556126.aspx (D3D10 DDI)

---

 src/gallium/include/pipe/p_context.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 1aa0cbe..6f47845 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -67,6 +67,7 @@ struct pipe_context {
    void (*draw_elements)( struct pipe_context *pipe,
                           struct pipe_resource *indexBuffer,
                           unsigned indexSize,
+                          int indexBias,
                           unsigned mode, unsigned start, unsigned count);
 
    void (*draw_arrays_instanced)(struct pipe_context *pipe,
@@ -79,6 +80,7 @@ struct pipe_context {
    void (*draw_elements_instanced)(struct pipe_context *pipe,
                                    struct pipe_resource *indexBuffer,
                                    unsigned indexSize,
+                                   int indexBias,
                                    unsigned mode,
                                    unsigned start,
                                    unsigned count,
@@ -93,6 +95,7 @@ struct pipe_context {
    void (*draw_range_elements)( struct pipe_context *pipe,
                                 struct pipe_resource *indexBuffer,
                                 unsigned indexSize,
+                                int indexBias,
                                 unsigned minIndex,
                                 unsigned maxIndex,
                                 unsigned mode, 




More information about the mesa-commit mailing list