[Mesa-dev] [PATCH 2/2] spirv: use subpass image type
Jason Ekstrand
jason at jlekstrand.net
Fri Sep 16 04:50:41 UTC 2016
On Thu, Sep 15, 2016 at 1:23 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This adds support for the input attachments subpass type
> to the SPIRV->NIR pass.
> ---
> src/compiler/spirv/spirv_to_nir.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/spirv/spirv_to_nir.c
> b/src/compiler/spirv/spirv_to_nir.c
> index 7e7a026..45dfe0b 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -828,6 +828,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
> case SpvDimCube: dim = GLSL_SAMPLER_DIM_CUBE; break;
> case SpvDimRect: dim = GLSL_SAMPLER_DIM_RECT; break;
> case SpvDimBuffer: dim = GLSL_SAMPLER_DIM_BUF; break;
> + case SpvDimSubpassData: dim = GLSL_SAMPLER_DIM_SUBPASS; break;
> default:
> unreachable("Invalid SPIR-V Sampler dimension");
> }
> @@ -854,7 +855,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
> val->type->type = glsl_sampler_type(dim, is_shadow, is_array,
> glsl_get_base_type(sampled_
> type));
> } else if (sampled == 2) {
> - assert(format);
> + assert((dim == GLSL_SAMPLER_DIM_SUBPASS) || format);
> assert(!is_shadow);
> val->type->type = glsl_image_type(dim, is_array,
> glsl_get_base_type(sampled_
> type));
> @@ -1419,6 +1420,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp
> opcode,
> case GLSL_SAMPLER_DIM_2D:
> case GLSL_SAMPLER_DIM_RECT:
> case GLSL_SAMPLER_DIM_MS:
> + case GLSL_SAMPLER_DIM_SUBPASS:
>
I don't think this is correct. Given that they're being handled as storage
images, you should never actually get here. Probably best to let it fall
through to the unreachable so we catch it if someone ever tries to texture
from a subpassInput.
I left one other comment on the first patch. With those two fixed,
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
This is a lot simpler than I expected and I think it probably is better to
just use storage images and convert to textures in a lowering pass. If
they ever let you combine a sampler with a subpassInput, we'll have to
rethink things a bit, but I like the way this looks.
> coord_components = 2;
> break;
> case GLSL_SAMPLER_DIM_3D:
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160915/4c0a59a5/attachment.html>
More information about the mesa-dev
mailing list