• Józef Kucia's avatar
    wined3d: Fix mapping of SV_VertexID to gl_VertexID. · 60d9211f
    Józef Kucia authored
    Based on a patch by Andrew Wesie.
    
    In Direct3D, SV_VertexID generally starts from zero. In OpenGL,
    gl_VertexID starts from "first" parameter passed to glDrawArrays(), or
    from "baseVertex" parameter for indexed draw calls.  The
    GL_ARB_shader_draw_parameters extension doesn't help us much because
    gl_BaseVertexARB is zero for non-indexed draw calls [1]. If
    gl_BaseVertexARB would be equal to "first" for non-indexed draw calls,
    we could simply use gl_VertexID - gl_BaseVertexARB.
    
    After this commit, SV_VertexID is still wrong for indirect draw calls
    because we cannot easily access the "first" field from struct
    DrawArraysIndirectCommand in a vertex shader.
    
    [1] - The ARB_shader_draw_parameters spec says that "In the case where
    the command has no <baseVertex> parameter, the value of
    <gl_BaseVertexARB> is zero."
    Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com>
    Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    60d9211f
cs.c 96.6 KB