mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
zink: force stencil format for stencil-only samplers and swizzle the right component
packed buffers will still return the full format when we're using only the
stencil aspect, so we need to explicitly set the format here
also due to 7ca72f1726 we can't use the provided
swizzle for this case and have to force y -> x component swizzle
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7491>
This commit is contained in:
parent
ad0037fcfe
commit
c768c5297a
1 changed files with 9 additions and 3 deletions
|
|
@ -330,14 +330,20 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres,
|
|||
ivci.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ivci.image = res->image;
|
||||
ivci.viewType = image_view_type(state->target);
|
||||
ivci.format = zink_get_format(screen, state->format);
|
||||
assert(ivci.format);
|
||||
|
||||
ivci.components.r = component_mapping(state->swizzle_r);
|
||||
ivci.components.g = component_mapping(state->swizzle_g);
|
||||
ivci.components.b = component_mapping(state->swizzle_b);
|
||||
ivci.components.a = component_mapping(state->swizzle_a);
|
||||
|
||||
ivci.subresourceRange.aspectMask = sampler_aspect_from_format(state->format);
|
||||
/* samplers for stencil aspects of packed formats need to always use stencil type */
|
||||
if (ivci.subresourceRange.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
ivci.format = VK_FORMAT_S8_UINT;
|
||||
ivci.components.g = VK_COMPONENT_SWIZZLE_R;
|
||||
} else
|
||||
ivci.format = zink_get_format(screen, state->format);
|
||||
assert(ivci.format);
|
||||
|
||||
ivci.subresourceRange.baseMipLevel = state->u.tex.first_level;
|
||||
ivci.subresourceRange.baseArrayLayer = state->u.tex.first_layer;
|
||||
ivci.subresourceRange.levelCount = state->u.tex.last_level - state->u.tex.first_level + 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue