spirv: Handle the SpvDecorationStream decoration

From SPIR-V 1.0 spec, section 3.20, "Decoration":

   "Stream
    Apply to an object or a member of a structure type. Indicates the
    stream number to put an output on."

Note the "or", so that means that it is allowed for both a full struct
or a membef or a struct (although the wording is not really ideal, and
somewhat error-prone, imho).

We found this with some Geometry Streams tests for ARB_gl_spirv, where
the full gl_PerVertex is assigned Stream 0 (default value on OpenGL
for gl_PerVertex).

So this commit allows structs to have this Decoration, and sets the
stream at the nir variable if needed.

Signed-off-by: Neil Roberts <nroberts@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>

v2: squash two Decoration Stream patches (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Neil Roberts
2018-01-17 16:35:56 +01:00
committed by Alejandro Piñeiro
parent d480623bef
commit 13b8857fcf
2 changed files with 12 additions and 2 deletions

View File

@@ -1298,7 +1298,6 @@ apply_var_decoration(struct vtn_builder *b,
case SpvDecorationMatrixStride:
case SpvDecorationAliased:
case SpvDecorationUniform:
case SpvDecorationStream:
case SpvDecorationLinkageAttributes:
break; /* Do nothing with these here */
@@ -1337,6 +1336,10 @@ apply_var_decoration(struct vtn_builder *b,
var_data->offset = dec->literals[0];
break;
case SpvDecorationStream:
var_data->stream = dec->literals[0];
break;
case SpvDecorationCPacked:
case SpvDecorationSaturatedConversion:
case SpvDecorationFuncParamAttr: