wined3d: Get rid of the "attribute_size" field in struct wined3d_format.

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>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-09-10 01:02:45 +04:30 committed by Alexandre Julliard
parent 69b7e09fa7
commit ccbee769a4
4 changed files with 2 additions and 38 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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;
}

View file

@ -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;