@@ -424,6 +424,9 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
}
+ state->base_vertex_index = op->indexed ? op->base_vertex_idx : op->start_idx;
I don't think you can do this, the modified state would be visible to
the application through wined3d_stateblock_capture() and
wined3d_device_get_base_vertex_index().
+ device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
State invalidation isn't free, so it may be better to avoid doing this
unnecessarily. But if you do do this unconditionally, the invalidation
of STATE_BASEVERTEXINDEX a few lines above becomes redundant.
@@ -1793,7 +1800,8 @@ static void shader_glsl_declare_generic_vertex_attribute(struct wined3d_string_b
if (e->sysval_semantic == WINED3D_SV_VERTEX_ID)
{
- shader_addline(buffer, "vec4 vs_in%u = vec4(intBitsToFloat(gl_VertexID), 0.0, 0.0, 0.0);\n",
+ shader_addline(buffer, "uniform int base_vertex;\n");
+ shader_addline(buffer, "vec4 vs_in%u = vec4(intBitsToFloat(gl_VertexID - base_vertex), 0.0, 0.0, 0.0);\n",
index);
return;
}
Note that in principle this code would do the wrong thing when
ARB_draw_elements_base_vertex is not supported. The reason it works in
practice is that SV_VertexID is a SM4+ feature, and SM4 requires GL
3.2, which implies ARB_draw_elements_base_vertex. Th