2009/7/9 Stefan Dösinger <[email protected]>: > - > GL_EXTCALL(glSecondaryColorPointerEXT)(e->format_desc->gl_vtx_format, > e->format_desc->gl_vtx_type, > - e->stride, e->data + stateblock->loadBaseVertexIndex * > e->stride + offset[e->stream_idx]); > + > + if(GLINFO_LOCATION.quirks & WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA) > + { > + /* The spec disallows 4 component specular colors, but most > GL drivers accept it. Try to use it, > + * since the 4th value can be passed through to pixel shaders > + */ > + > GL_EXTCALL(glSecondaryColorPointerEXT)(e->format_desc->gl_vtx_format, > e->format_desc->gl_vtx_type, > + e->stride, e->data + > stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]); > + } > + else > + { > + GLenum type = e->format_desc->gl_vtx_type; > + GLint format = e->format_desc->gl_vtx_format; > + if(format == 4 && type == GL_UNSIGNED_BYTE) > + { > + GL_EXTCALL(glSecondaryColorPointerEXT)(3, > GL_UNSIGNED_BYTE, > + e->stride, > e->data + stateblock->loadBaseVertexIndex * e->stride + > offset[e->stream_idx]); > + } > + else > + { > + FIXME("Add specular color code for type %x, fmt %u\n", > type, format); > + GL_EXTCALL(glSecondaryColorPointerEXT)(format, type, > + e->stride, > e->data + stateblock->loadBaseVertexIndex * e->stride + > offset[e->stream_idx]); > + } > + }
I think you should test for the specific case the quirk addresses. For example, 3 component specular color will trigger the FIXME with this code. Also, EXT_vertex_array_bgra adds GL_BGRA as a valid type/size parameter for glSecondaryColorPointer(). Just test for "type == 4" and handle it according to the quirk being present or not. Combinations that are always invalid, like e.g. 1 or 2 component data should already have been filtered by declaration_element_valid_ffp().
