[Mesa-dev] [PATCH] st/mesa: minor clean-ups in st_update_renderbuffer_surface()
Marek Olšák
maraeo at gmail.com
Wed Apr 26 16:01:49 UTC 2017
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Wed, Apr 26, 2017 at 5:28 PM, Brian Paul <brianp at vmware.com> wrote:
> Remove unneeded parens. Add const qualifiers. Move var decls closer
> to where they're used.
> ---
> src/mesa/state_tracker/st_cb_fbo.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
> index 7b9855f..f908225 100644
> --- a/src/mesa/state_tracker/st_cb_fbo.c
> +++ b/src/mesa/state_tracker/st_cb_fbo.c
> @@ -388,18 +388,19 @@ st_update_renderbuffer_surface(struct st_context *st,
> {
> struct pipe_context *pipe = st->pipe;
> struct pipe_resource *resource = strb->texture;
> - struct st_texture_object *stTexObj = NULL;
> + const struct st_texture_object *stTexObj = NULL;
> unsigned rtt_width = strb->Base.Width;
> unsigned rtt_height = strb->Base.Height;
> unsigned rtt_depth = strb->Base.Depth;
> +
> /*
> * For winsys fbo, it is possible that the renderbuffer is sRGB-capable but
> * the format of strb->texture is linear (because we have no control over
> * the format). Check strb->Base.Format instead of strb->texture->format
> * to determine if the rb is sRGB-capable.
> */
> - boolean enable_srgb = (st->ctx->Color.sRGBEnabled &&
> - _mesa_get_format_color_encoding(strb->Base.Format) == GL_SRGB);
> + boolean enable_srgb = st->ctx->Color.sRGBEnabled &&
> + _mesa_get_format_color_encoding(strb->Base.Format) == GL_SRGB;
> enum pipe_format format = resource->format;
>
> if (strb->is_rtt) {
> @@ -408,11 +409,7 @@ st_update_renderbuffer_surface(struct st_context *st,
> format = stTexObj->surface_format;
> }
>
> - format = (enable_srgb) ?
> - util_format_srgb(format) :
> - util_format_linear(format);
> -
> - unsigned first_layer, last_layer, level;
> + format = enable_srgb ? util_format_srgb(format) : util_format_linear(format);
>
> if (resource->target == PIPE_TEXTURE_1D_ARRAY) {
> rtt_depth = rtt_height;
> @@ -420,6 +417,7 @@ st_update_renderbuffer_surface(struct st_context *st,
> }
>
> /* find matching mipmap level size */
> + unsigned level;
> for (level = 0; level <= resource->last_level; level++) {
> if (u_minify(resource->width0, level) == rtt_width &&
> u_minify(resource->height0, level) == rtt_height &&
> @@ -431,6 +429,7 @@ st_update_renderbuffer_surface(struct st_context *st,
> assert(level <= resource->last_level);
>
> /* determine the layer bounds */
> + unsigned first_layer, last_layer;
> if (strb->rtt_layered) {
> first_layer = 0;
> last_layer = util_max_layer(strb->texture, level);
> @@ -443,7 +442,7 @@ st_update_renderbuffer_surface(struct st_context *st,
> /* Adjust for texture views */
> if (strb->is_rtt && resource->array_size > 1 &&
> stTexObj->base.Immutable) {
> - struct gl_texture_object *tex = &stTexObj->base;
> + const struct gl_texture_object *tex = &stTexObj->base;
> first_layer += tex->MinLayer;
> if (!strb->rtt_layered)
> last_layer += tex->MinLayer;
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list