svga: compute need_swvfetch in svga_create_vertex_elements_state()
This saves us doing it at state validation time. Reviewed-by: Matthew McClure <mcclurem@vmware.com>
This commit is contained in:
@@ -203,6 +203,7 @@ struct svga_velems_state {
|
||||
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
|
||||
|
||||
@@ -161,6 +161,7 @@ svga_create_vertex_elements_state(struct pipe_context *pipe,
|
||||
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;
|
||||
|
||||
@@ -168,6 +169,11 @@ svga_create_vertex_elements_state(struct pipe_context *pipe,
|
||||
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);
|
||||
|
||||
@@ -34,24 +34,13 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user