[Mesa-dev] [PATCH 03/15] i965: Make swizzle_to_scs non-static.

Chris Forbes chrisf at ijw.co.nz
Wed Nov 13 17:15:42 PST 2013


Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

Without any docs, I don't feel qualified enough to review beyond this
patch, but it looks generally sensible.

On Wed, Nov 13, 2013 at 2:50 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> We'll need this for Broadwell code as well.
>
> Normally, when we make things public, we add the "brw" prefix.  I'm not
> crazy about that in this case, since it deals with prog_instruction.h's
> SWIZZLE_XYZW values, rather than the BRW_SWIZZLE_XYZW enums.  However,
> I can't think of a better name, and at least the comments and code make
> it clear.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_state.h             |  1 +
>  src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 12 ++++++------
>  2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
> index 471f1da..2a4b23c 100644
> --- a/src/mesa/drivers/dri/i965/brw_state.h
> +++ b/src/mesa/drivers/dri/i965/brw_state.h
> @@ -200,6 +200,7 @@ int brw_get_texture_swizzle(const struct gl_context *ctx,
>                              const struct gl_texture_object *t);
>
>  /* gen7_wm_surface_state.c */
> +unsigned brw_swizzle_to_scs(GLenum swizzle, bool need_green_to_blue);
>  uint32_t gen7_surface_tiling_mode(uint32_t tiling);
>  uint32_t gen7_surface_msaa_bits(unsigned num_samples, enum intel_msaa_layout l);
>  void gen7_set_surface_mcs_info(struct brw_context *brw,
> diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> index 3f4817d..c3bd96d 100644
> --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> @@ -41,8 +41,8 @@
>   * Convert an swizzle enumeration (i.e. SWIZZLE_X) to one of the Gen7.5+
>   * "Shader Channel Select" enumerations (i.e. HSW_SCS_RED)
>   */
> -static unsigned
> -swizzle_to_scs(GLenum swizzle, bool need_green_to_blue)
> +unsigned
> +brw_swizzle_to_scs(GLenum swizzle, bool need_green_to_blue)
>  {
>     switch (swizzle) {
>     case SWIZZLE_X:
> @@ -343,10 +343,10 @@ gen7_update_texture_surface(struct gl_context *ctx,
>        const bool need_scs_green_to_blue = for_gather && tex_format == BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
>
>        surf[7] =
> -         SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 0), need_scs_green_to_blue), GEN7_SURFACE_SCS_R) |
> -         SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 1), need_scs_green_to_blue), GEN7_SURFACE_SCS_G) |
> -         SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 2), need_scs_green_to_blue), GEN7_SURFACE_SCS_B) |
> -         SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 3), need_scs_green_to_blue), GEN7_SURFACE_SCS_A);
> +         SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 0), need_scs_green_to_blue), GEN7_SURFACE_SCS_R) |
> +         SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 1), need_scs_green_to_blue), GEN7_SURFACE_SCS_G) |
> +         SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 2), need_scs_green_to_blue), GEN7_SURFACE_SCS_B) |
> +         SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 3), need_scs_green_to_blue), GEN7_SURFACE_SCS_A);
>     }
>
>     /* Emit relocation to surface contents */
> --
> 1.8.3.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list