[Mesa-dev] [PATCH 06/25] i965: Hook up image state upload.
Paul Berry
stereotype441 at gmail.com
Mon Dec 30 18:07:53 PST 2013
On 2 December 2013 11:39, Francisco Jerez <currojerez at riseup.net> wrote:
> ---
> src/mesa/drivers/dri/i965/brw_context.h | 2 +
> src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 24 ++++++++++++
> src/mesa/drivers/dri/i965/brw_state.h | 3 ++
> src/mesa/drivers/dri/i965/brw_state_upload.c | 6 +++
> src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 24 ++++++++++++
> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 50
> ++++++++++++++++++++++++
> 6 files changed, 109 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h
> b/src/mesa/drivers/dri/i965/brw_context.h
> index dc606c0f..4586005 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -181,6 +181,7 @@ enum brw_state_id {
> BRW_STATE_STATS_WM,
> BRW_STATE_UNIFORM_BUFFER,
> BRW_STATE_ATOMIC_BUFFER,
> + BRW_STATE_IMAGE_UNITS,
> BRW_STATE_META_IN_PROGRESS,
> BRW_STATE_INTERPOLATION_MAP,
> BRW_STATE_PUSH_CONSTANT_ALLOCATION,
> @@ -220,6 +221,7 @@ enum brw_state_id {
> #define BRW_NEW_STATS_WM (1 << BRW_STATE_STATS_WM)
> #define BRW_NEW_UNIFORM_BUFFER (1 << BRW_STATE_UNIFORM_BUFFER)
> #define BRW_NEW_ATOMIC_BUFFER (1 << BRW_STATE_ATOMIC_BUFFER)
> +#define BRW_NEW_IMAGE_UNITS (1 << BRW_STATE_IMAGE_UNITS)
> #define BRW_NEW_META_IN_PROGRESS (1 << BRW_STATE_META_IN_PROGRESS)
> #define BRW_NEW_INTERPOLATION_MAP (1 << BRW_STATE_INTERPOLATION_MAP)
> #define BRW_NEW_PUSH_CONSTANT_ALLOCATION (1 <<
> BRW_STATE_PUSH_CONSTANT_ALLOCATION)
> diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
> b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
> index 5661941..6db061d 100644
> --- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
> @@ -110,3 +110,27 @@ const struct brw_tracked_state brw_gs_abo_surfaces = {
> },
> .emit = brw_upload_gs_abo_surfaces,
> };
> +
> +static void
> +brw_upload_gs_image_surfaces(struct brw_context *brw)
> +{
> + struct gl_context *ctx = &brw->ctx;
> + /* _NEW_PROGRAM */
> + struct gl_shader_program *prog = ctx->Shader.CurrentGeometryProgram;
>
Since you only need the geometry program here, you can depend on
BRW_NEW_GEOMETRY_PROGRAM instead of _NEW_PROGRAM, and avoid this function
getting called unnecessarily when the geometry shader doesn't change (e.g.
when switching between two programs that don't contain a geometry shader).
A similar improvement cound be made in the vs and fs cases, but the benefit
is less (since nearly all programs contain a vertex and a fragment shader).
It's not a huge deal, though. Either way, the patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131230/96c92489/attachment.html>
More information about the mesa-dev
mailing list