On 13 November 2016 at 19:35, Andrew Wesie <awesie(a)gmail.com> wrote:
@@ -481,7 +481,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_DRAW; - op->base_vertex_idx = base_vertex_idx; + op->base_vertex_idx = indexed ? base_vertex_idx : 0; This change seems questionable. Why is it needed?
@@ -1988,7 +1988,11 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I { TRACE("device %p, base_index %d.\n", device, base_index);
- device->update_state->base_vertex_index = base_index; + if (device->update_state->base_vertex_index != base_index) + { + device->update_state->base_vertex_index = base_index; + device_invalidate_state(device, STATE_BASEVERTEXINDEX); + } } This should happen in wined3d_cs_exec_draw(). (The background is that we're working on executing that on a different thread, and state invalidation should generally happen in that same thread.)
@@ -1424,6 +1425,12 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context checkGLcall("glUniform4fv"); }
+ if (update_mask & WINED3D_SHADER_CONST_BASE_VERTEX) + { + GL_EXTCALL(glUniform1i(prog->vs.base_vertex_location, state->base_vertex_index)); + checkGLcall("glUniform1i"); + } @@ -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; } Does this do the right thing when ARB_draw_elements_base_vertex is not supported?