diff options
author | Brian Paul <[email protected]> | 2017-04-21 13:46:28 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2017-04-26 11:37:59 -0600 |
commit | 4bb19a15142a264af0072f3af49c6d2bdda93bd4 (patch) | |
tree | fa0c6f18e3cf666624fa9889791209d7f2b3883e /src/mesa/state_tracker | |
parent | 00b504474014663ff1b00d273d219cd9a02091de (diff) |
st/mesa: minor clean-ups in st_update_renderbuffer_surface()
Remove unneeded parens. Add const qualifiers. Move var decls closer
to where they're used.
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Neha Bhende<[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 17 |
1 files 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 7b9855f9631..f9082255a8b 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; |