back  Return to list

GL_EXT_draw_instanced
homeprevnext Name
  
    EXT_draw_instanced  
  
homeprevnext Name Strings
  
    GL_EXT_draw_instanced  
  
homeprevnext Contact
  
    Michael Gold, NVIDIA Corporation (gold 'at' nvidia.com)  
  
homeprevnext Status
  
    Shipping for GeForce 8 Series (November 2006)  
  
homeprevnext Version
  
    Last Modified Date:  November 6, 2006  
    Author Revision: 1.4  
  
homeprevnext Number
  
    Unassigned  
  
homeprevnext Dependencies
  
    OpenGL 2.0 is required.  
  
    EXT_gpu_shader4 or NV_vertex_shader4 is required.  
  
homeprevnext Overview
  
    This extension provides the means to render multiple instances of  
    an object with a single draw call, and an "instance ID" variable  
    which can be used by the vertex program to compute per-instance  
    values, typically an object's transform.  
  
homeprevnext New Procedures and Functions
  
    void DrawArraysInstancedEXT(enum mode, int first, sizei count,  
            sizei primcount);  
    void DrawElementsInstancedEXT(enum mode, sizei count, enum type,  
            const void *indices, sizei primcount);  
  
homeprevnext Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
  
    Modify section 2.8 (Vertex Arrays), p. 23  
  
    (insert before the final paragraph, p. 30)  
  
    The internal counter <instanceID> is a 32-bit integer value which  
    may be read by a vertex program as <vertex.instance>, as described  
    in section 2.X.3.2, or vertex shader as <gl_InstanceID>, as  
    described in section 2.15.4.2.  The value of this counter is  
    always zero, except as noted below.  
  
    The command  
  
        void DrawArraysInstancedEXT(enum mode, int first, sizei count,  
                sizei primcount);  
  
    behaves identically to DrawArrays except that <primcount>  
    instances of the range of elements are executed and the value of  
    <instanceID> advances for each iteration.  It has the same effect  
    as:  
  
        if (mode or count is invalid)  
            generate appropriate error  
        else {  
            for (i = 0; i < primcount; i++) {  
                instanceID = i;  
                DrawArrays(mode, first, count, i);  
            }  
            instanceID = 0;  
        }  
  
    The command  
  
        void DrawElementsInstancedEXT(enum mode, sizei count, enum type,  
                const void *indices, sizei primcount);  
  
    behaves identically to DrawElements except that <primcount>  
    instances of the set of elements are executed, and the value of  
    <instanceID> advances for each iteration.  It has the same effect  
    as:  
  
        if (mode, count, or type is invalid )  
            generate appropriate error  
        else {  
            for (int i = 0; i < primcount; i++) {  
                instanceID = i;  
                DrawElements(mode, count, type, indices, i);  
            }  
            instanceID = 0;  
        }  
  
homeprevnext Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
  
    The error INVALID_OPERATION is generated if DrawArraysInstancedEXT  
    or DrawElementsInstancedEXT is called during display list  
    compilation.  
  
homeprevnext Dependencies on NV_vertex_program4
  
    If NV_vertex_program4 is not supported, all references to  
    vertex.instance are deleted.  
  
homeprevnext Dependencies on EXT_gpu_shader4
  
    If EXT_gpu_shader4 is not supported, all references to  
    gl_InstanceID are deleted.  
  
homeprevnext Errors
  
    INVALID_ENUM is generated by DrawElementsInstancedEXT if <type> is  
    not one of UNSIGNED_BYTE, UNSIGNED_SHORT or UNSIGNED_INT.  
  
    INVALID_VALUE is generated by DrawArraysInstancedEXT if <first> is  
    less than zero.  
  
homeprevnext Issues
  
  (1) Should instanceID be provided by this extension, or should it be  
      provided by EXT_gpu_shader4, thus creating a dependence on that  
      spec?  
  
        Resolved: While this extension could stand alone, its utility  
        would be limited without the additional functionality provided  
        by EXT_gpu_shader4; also, the spec language is cleaner if  
        EXT_gpu_shader4 assumes instanceID is always available, even  
        if its value is always zero without this extension.  
  
  (2) Should MultiDrawArrays and MultiDrawElements affect the value of  
      instanceID?  
  
        Resolved: No, this may cause implementation difficulties and  
        is considered unlikely to provide any real benefit.  
  
  (3) Should DrawArraysInstanced and DrawElementsInstanced be compiled  
      into display lists?  
  
        Resolved: No, calling these during display list compilation  
        generate INVALID_OPERATION.  
  
homeprevnext Revision History
  
    None  
    None  
Valid XHTML 1.1! Valid CSS! Last update: November 14, 2006.
Cette page doit être lue avec un navigateur récent respectant le standard XHTML 1.1.