Note that "byte_count" is 4 for R10G10B10X2_UINT/R10G10B10X2_SNORM, while "attribute_size" is 6. I think 4 is correct.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/buffer.c | 2 +- dlls/wined3d/utils.c | 35 ----------------------------------- dlls/wined3d/vertexdeclaration.c | 2 +- dlls/wined3d/wined3d_private.h | 1 - 4 files changed, 2 insertions(+), 38 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index f381b2efb94..e20d66cc880 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -309,7 +309,7 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *buffer, }
data = ((DWORD_PTR)attrib->data.addr) % buffer->stride; - for (i = 0; i < format->attribute_size; ++i) + for (i = 0; i < format->byte_count; ++i) { DWORD_PTR idx = (data + i) % buffer->stride; if (buffer->conversion_map[idx] != conversion_type) diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 6f13f91353a..961e3fe7144 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3665,34 +3665,6 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_ format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE; }
-static unsigned int calculate_vertex_attribute_size(GLenum type, unsigned int component_count) -{ - switch (type) - { - case GL_HALF_FLOAT: - return component_count * sizeof(GLhalfNV); - case GL_FLOAT: - return component_count * sizeof(GLfloat); - case GL_BYTE: - return component_count * sizeof(GLbyte); - case GL_UNSIGNED_BYTE: - return component_count * sizeof(GLubyte); - case GL_SHORT: - return component_count * sizeof(GLshort); - case GL_UNSIGNED_SHORT: - return component_count * sizeof(GLushort); - case GL_INT: - return component_count * sizeof(GLint); - case GL_UNSIGNED_INT: - return component_count * sizeof(GLuint); - case GL_UNSIGNED_INT_2_10_10_10_REV: - return sizeof(GLuint); - default: - FIXME("Unhandled GL type %#x.\n", type); - return 0; - } -} - static BOOL init_format_vertex_info(const struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info) { @@ -3712,13 +3684,6 @@ static BOOL init_format_vertex_info(const struct wined3d_adapter *adapter, format->gl_vtx_type = format_vertex_info[i].gl_vtx_type; format->gl_vtx_format = format_vertex_info[i].component_count; format->gl_normalized = format_vertex_info[i].gl_normalized; - if (!(format->attribute_size = calculate_vertex_attribute_size(format->gl_vtx_type, - format->component_count))) - { - ERR("Invalid attribute size for vertex format %s (%#x).\n", - debug_d3dformat(format_vertex_info[i].id), format_vertex_info[i].id); - return FALSE; - } }
return TRUE; diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index c050a6dda9f..89329d42034 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -315,7 +315,7 @@ static void append_decl_element(struct wined3d_fvf_convert_state *state, elements[idx].usage_idx = usage_idx;
format = wined3d_get_format(state->adapter, format_id, 0); - state->offset += format->attribute_size; + state->offset += format->byte_count; ++state->idx; }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 70841683e5b..9dd3cd21499 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4346,7 +4346,6 @@ struct wined3d_format GLenum gl_vtx_type; GLint gl_vtx_format; GLboolean gl_normalized; - unsigned int attribute_size;
GLint glInternal; GLint glGammaInternal;