This saves us doing it at state validation time.
Reviewed-by: Matthew McClure <mcclurem@vmware.com>
SVGA3dDeclType decl_type[PIPE_MAX_ATTRIBS]; /**< vertex attrib formats */
unsigned adjust_attrib_range; /* bitmask of attrs needing range adjustment */
unsigned adjust_attrib_w_1; /* bitmask of attrs needing w = 1 */
+ boolean need_swvfetch;
};
/* Use to calculate differences between state emitted to hardware and
velems->count = count;
memcpy(velems->velem, attribs, sizeof(*attribs) * count);
+ velems->need_swvfetch = FALSE;
velems->adjust_attrib_range = 0x0;
velems->adjust_attrib_w_1 = 0x0;
for (i = 0; i < count; i++) {
enum pipe_format f = attribs[i].src_format;
velems->decl_type[i] = translate_vertex_format(f);
+ if (velems->decl_type[i] == SVGA3D_DECLTYPE_MAX) {
+ /* Unsupported format - use software fetch */
+ velems->need_swvfetch = TRUE;
+ break;
+ }
if (attrib_needs_range_adjustment(f)) {
velems->adjust_attrib_range |= (1 << i);
static enum pipe_error
update_need_swvfetch(struct svga_context *svga, unsigned dirty)
{
- unsigned i;
- boolean need_swvfetch = FALSE;
-
if (!svga->curr.velems) {
/* No vertex elements bound. */
return PIPE_OK;
}
- for (i = 0; i < svga->curr.velems->count; i++) {
- if (svga->curr.velems->decl_type[i] == SVGA3D_DECLTYPE_MAX) {
- /* Unsupported format - use software fetch */
- need_swvfetch = TRUE;
- break;
- }
- }
-
- if (need_swvfetch != svga->state.sw.need_swvfetch) {
- svga->state.sw.need_swvfetch = need_swvfetch;
+ if (svga->state.sw.need_swvfetch != svga->curr.velems->need_swvfetch) {
+ svga->state.sw.need_swvfetch = svga->curr.velems->need_swvfetch;
svga->dirty |= SVGA_NEW_NEED_SWVFETCH;
}