Module: Mesa Branch: master Commit: 13b8857fcf575c5b786e055ad4594d8bf6a5c4b6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=13b8857fcf575c5b786e055ad4594d8bf6a5c4b6
Author: Neil Roberts <[email protected]> Date: Wed Jan 17 16:35:56 2018 +0100 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 <[email protected]> Signed-off-by: Alejandro PiƱeiro <[email protected]> v2: squash two Decoration Stream patches (Jason) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> --- src/compiler/spirv/spirv_to_nir.c | 9 ++++++++- src/compiler/spirv/vtn_variables.c | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 4013d2ddd0..7e3a6d6e88 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -847,7 +847,6 @@ type_decoration_cb(struct vtn_builder *b, case SpvDecorationNonWritable: case SpvDecorationNonReadable: case SpvDecorationUniform: - case SpvDecorationStream: case SpvDecorationLocation: case SpvDecorationComponent: case SpvDecorationOffset: @@ -857,6 +856,14 @@ type_decoration_cb(struct vtn_builder *b, spirv_decoration_to_string(dec->decoration)); break; + case SpvDecorationStream: + /* We don't need to do anything here, as stream is filled up when + * aplying the decoration to a variable, just check that if it is not a + * struct member, it should be a struct. + */ + vtn_assert(type->base_type == vtn_base_type_struct); + break; + case SpvDecorationRelaxedPrecision: case SpvDecorationSpecId: case SpvDecorationInvariant: diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 6ff2e83515..8dab86abd7 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -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: _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
