From a929a69b627bc4bd34a5d56959d40bfa167fe86f Mon Sep 17 00:00:00 2001 From: espes Date: Sat, 22 Aug 2015 13:51:04 +1000 Subject: [PATCH] avoid trivial redundant buffering of converted attributes --- hw/xbox/nv2a.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/xbox/nv2a.c b/hw/xbox/nv2a.c index 6263c42fd0..520507cb59 100644 --- a/hw/xbox/nv2a.c +++ b/hw/xbox/nv2a.c @@ -1971,13 +1971,17 @@ static void pgraph_bind_vertex_attributes(NV2AState *d, } } - attribute->converted_elements = num_elements; glBindBuffer(GL_ARRAY_BUFFER, attribute->gl_converted_buffer); - glBufferData(GL_ARRAY_BUFFER, - num_elements * out_stride, - attribute->converted_buffer, - GL_DYNAMIC_DRAW); + if (num_elements != attribute->converted_elements) { + glBufferData(GL_ARRAY_BUFFER, + num_elements * out_stride, + attribute->converted_buffer, + GL_DYNAMIC_DRAW); + } + + attribute->converted_elements = num_elements; + glVertexAttribPointer(i, attribute->converted_count, @@ -4613,7 +4617,9 @@ static void pgraph_method(NV2AState *d, vertex_attribute->needs_conversion = false; break; case NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE_CMP: - /* "3 signed, normalized components packed in 32-bits. (11,11,10)" */ + /* "3 signed, normalized components packed in 32-bits. (11,11,10)" + * TODO: This could use ARB_vertex_type_10f_11f_11f_rev where + * available. */ vertex_attribute->size = 4; vertex_attribute->gl_type = GL_FLOAT; vertex_attribute->gl_normalize = GL_FALSE;