gallivm: clean-up in lp_bld_sample.c

Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16937>
This commit is contained in:
Brian Paul
2022-05-24 15:13:23 -06:00
committed by Marge Bot
parent dee76459ca
commit f18a23d87c
+30 -26
View File
@@ -98,26 +98,28 @@ void
lp_sampler_static_texture_state(struct lp_static_texture_state *state,
const struct pipe_sampler_view *view)
{
const struct pipe_resource *texture;
memset(state, 0, sizeof *state);
if (!view || !view->texture)
return;
texture = view->texture;
const struct pipe_resource *texture = view->texture;
state->format = view->format;
state->swizzle_r = view->swizzle_r;
state->swizzle_g = view->swizzle_g;
state->swizzle_b = view->swizzle_b;
state->swizzle_a = view->swizzle_a;
state->format = view->format;
state->swizzle_r = view->swizzle_r;
state->swizzle_g = view->swizzle_g;
state->swizzle_b = view->swizzle_b;
state->swizzle_a = view->swizzle_a;
assert(state->swizzle_r < PIPE_SWIZZLE_NONE);
assert(state->swizzle_g < PIPE_SWIZZLE_NONE);
assert(state->swizzle_b < PIPE_SWIZZLE_NONE);
assert(state->swizzle_a < PIPE_SWIZZLE_NONE);
state->target = view->target;
state->pot_width = util_is_power_of_two_or_zero(texture->width0);
state->pot_height = util_is_power_of_two_or_zero(texture->height0);
state->pot_depth = util_is_power_of_two_or_zero(texture->depth0);
state->level_zero_only = !view->u.tex.last_level;
state->target = view->target;
state->pot_width = util_is_power_of_two_or_zero(texture->width0);
state->pot_height = util_is_power_of_two_or_zero(texture->height0);
state->pot_depth = util_is_power_of_two_or_zero(texture->depth0);
state->level_zero_only = !view->u.tex.last_level;
/*
* the layer / element / level parameters are all either dynamic
@@ -134,26 +136,28 @@ void
lp_sampler_static_texture_state_image(struct lp_static_texture_state *state,
const struct pipe_image_view *view)
{
const struct pipe_resource *resource;
memset(state, 0, sizeof *state);
if (!view || !view->resource)
return;
resource = view->resource;
const struct pipe_resource *resource = view->resource;
state->format = view->format;
state->swizzle_r = PIPE_SWIZZLE_X;
state->swizzle_g = PIPE_SWIZZLE_Y;
state->swizzle_b = PIPE_SWIZZLE_Z;
state->swizzle_a = PIPE_SWIZZLE_W;
state->format = view->format;
state->swizzle_r = PIPE_SWIZZLE_X;
state->swizzle_g = PIPE_SWIZZLE_Y;
state->swizzle_b = PIPE_SWIZZLE_Z;
state->swizzle_a = PIPE_SWIZZLE_W;
assert(state->swizzle_r < PIPE_SWIZZLE_NONE);
assert(state->swizzle_g < PIPE_SWIZZLE_NONE);
assert(state->swizzle_b < PIPE_SWIZZLE_NONE);
assert(state->swizzle_a < PIPE_SWIZZLE_NONE);
state->target = view->resource->target;
state->pot_width = util_is_power_of_two_or_zero(resource->width0);
state->pot_height = util_is_power_of_two_or_zero(resource->height0);
state->pot_depth = util_is_power_of_two_or_zero(resource->depth0);
state->level_zero_only = 0;
state->target = view->resource->target;
state->pot_width = util_is_power_of_two_or_zero(resource->width0);
state->pot_height = util_is_power_of_two_or_zero(resource->height0);
state->pot_depth = util_is_power_of_two_or_zero(resource->depth0);
state->level_zero_only = 0;
/*
* the layer / element / level parameters are all either dynamic