From 4a6c6c49a7236b1471df143a697195f0c11eb23c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Feb 2015 13:53:31 -0800 Subject: i965: Perform program state upload outside of atom handling Across the board of the various generations, the intial few atoms in all of the atom lists are basically the same, (performing uploads for the various programs). The only difference is that prior to gen6 there's an ff_gs upload in place of the later gs upload. In this commit, instead of using the atom lists for this program state upload, we add a new function brw_upload_programs that calls into the per-stage upload functions which in turn check dirty bits and return immediately if nothing needs to be done. This commit is intended to have no functional change. The motivation is that future code, (such as the shader cache), wants to have a single function within which to perform various operations before and after program upload, (with some local variables holding state across the upload). It may be worth looking at whether some of the other functionality currently handled via atoms might also be more cleanly handled in a similar fashion. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_vs.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'src/mesa/drivers/dri/i965/brw_vs.c') diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 2d56b74..2aefd35 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -409,8 +409,8 @@ brw_setup_vue_key_clip_info(struct brw_context *brw, } } - -static void brw_upload_vs_prog(struct brw_context *brw) +void +brw_upload_vs_prog(struct brw_context *brw) { struct gl_context *ctx = &brw->ctx; struct brw_vs_prog_key key; @@ -420,6 +420,17 @@ static void brw_upload_vs_prog(struct brw_context *brw) struct gl_program *prog = (struct gl_program *) brw->vertex_program; int i; + if (!brw_state_dirty(brw, + _NEW_BUFFERS | + _NEW_LIGHT | + _NEW_POINT | + _NEW_POLYGON | + _NEW_TEXTURE | + _NEW_TRANSFORM, + BRW_NEW_VERTEX_PROGRAM | + BRW_NEW_VS_ATTRIB_WORKAROUNDS)) + return; + memset(&key, 0, sizeof(key)); /* Just upload the program verbatim for now. Always send it all @@ -482,22 +493,6 @@ static void brw_upload_vs_prog(struct brw_context *brw) } } -/* See brw_vs.c: - */ -const struct brw_tracked_state brw_vs_prog = { - .dirty = { - .mesa = _NEW_BUFFERS | - _NEW_LIGHT | - _NEW_POINT | - _NEW_POLYGON | - _NEW_TEXTURE | - _NEW_TRANSFORM, - .brw = BRW_NEW_VERTEX_PROGRAM | - BRW_NEW_VS_ATTRIB_WORKAROUNDS, - }, - .emit = brw_upload_vs_prog -}; - bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *shader_prog, -- cgit v1.1