summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-04-17 11:27:53 -0700
committerBrian Paul <[email protected]>2014-04-17 11:31:15 -0700
commitcb34575e19e10b94e90ffb730b962e6930b47a19 (patch)
tree56cc61c455a37d2d29da966324c798ccbc7d71a0 /src/gallium/drivers/svga
parent851645a3e7f06348d60180ec122b9ad0dc3cf432 (diff)
svga: compute need_swvfetch in svga_create_vertex_elements_state()
This saves us doing it at state validation time. Reviewed-by: Matthew McClure <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_context.h1
-rw-r--r--src/gallium/drivers/svga/svga_pipe_vertex.c6
-rw-r--r--src/gallium/drivers/svga/svga_state_need_swtnl.c15
3 files changed, 9 insertions, 13 deletions
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index 4ff0ed7e66f..a75f2a8b570 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -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
diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c
index f951c0da189..faf77f3ab63 100644
--- a/src/gallium/drivers/svga/svga_pipe_vertex.c
+++ b/src/gallium/drivers/svga/svga_pipe_vertex.c
@@ -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);
diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c
index c89e00336ba..cac39d62fd1 100644
--- a/src/gallium/drivers/svga/svga_state_need_swtnl.c
+++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
@@ -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;
}