<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 13, 2017 at 6:38 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Shouldn't this also update capability_to_string in spriv_info.c?</blockquote><div><br></div><div>Yes, probably.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  I'm<br>
also questioning that implementation... there are huge blocks in that<br>
array (e.g., all the elements from 61 to 4322) that are zeroed out by<br>
the initialization.</blockquote><div><br></div><div>Ugh... I didn't realize we were packing it into an array. :(  We really need to use a switch since it's sparse.<br><br></div><div>I think the correct answer here is a bit of python codegen.  There is a json file that provides all of these SPIR-V enums so it should be fairly easy to do.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  This will cause spirv_capability_to_string() to<br>
happily return NULL pointers that none of the callers are prepared to<br>
handle.<br></blockquote><div><br></div><div>I think you'll find that the SPIR-V parser does all sorts of "bad" things if you touch it wrong.  It was, after all, written for the Vulkan world where crashing is a valid response to *any* invalid input.  We probably want to make it a bit more robust for GL.  I've got something of a plan for doing so but haven't had the time to sit down and hack on it.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On 07/13/2017 12:41 PM, Jason Ekstrand wrote:<br>
> ---<br>
>  src/compiler/spirv/spirv.h | 41 ++++++++++++++++++++++++++++++<wbr>+++++++----<br>
>  1 file changed, 37 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/compiler/spirv/spirv.h b/src/compiler/spirv/spirv.h<br>
> index 89354c0..61559a1 100644<br>
> --- a/src/compiler/spirv/spirv.h<br>
> +++ b/src/compiler/spirv/spirv.h<br>
> @@ -50,12 +50,12 @@<br>
><br>
>  typedef unsigned int SpvId;<br>
><br>
> -#define SPV_VERSION 0x10100<br>
> -#define SPV_REVISION 6<br>
> +#define SPV_VERSION 0x10200<br>
> +#define SPV_REVISION 1<br>
><br>
>  static const unsigned int SpvMagicNumber = 0x07230203;<br>
> -static const unsigned int SpvVersion = 0x00010100;<br>
> -static const unsigned int SpvRevision = 6;<br>
> +static const unsigned int SpvVersion = 0x00010200;<br>
> +static const unsigned int SpvRevision = 1;<br>
>  static const unsigned int SpvOpCodeMask = 0xffff;<br>
>  static const unsigned int SpvWordCountShift = 16;<br>
><br>
> @@ -65,6 +65,7 @@ typedef enum SpvSourceLanguage_ {<br>
>      SpvSourceLanguageGLSL = 2,<br>
>      SpvSourceLanguageOpenCL_C = 3,<br>
>      SpvSourceLanguageOpenCL_CPP = 4,<br>
> +    SpvSourceLanguageHLSL = 5,<br>
>      SpvSourceLanguageMax = 0x7fffffff,<br>
>  } SpvSourceLanguage;<br>
><br>
> @@ -129,6 +130,10 @@ typedef enum SpvExecutionMode_ {<br>
>      SpvExecutionModeFinalizer = 34,<br>
>      SpvExecutionModeSubgroupSize = 35,<br>
>      SpvExecutionModeSubgroupsPerWo<wbr>rkgroup = 36,<br>
> +    SpvExecutionModeSubgroupsPerWo<wbr>rkgroupId = 37,<br>
> +    SpvExecutionModeLocalSizeId = 38,<br>
> +    SpvExecutionModeLocalSizeHintI<wbr>d = 39,<br>
> +    SpvExecutionModePostDepthCover<wbr>age = 4446,<br>
>      SpvExecutionModeMax = 0x7fffffff,<br>
>  } SpvExecutionMode;<br>
><br>
> @@ -145,6 +150,7 @@ typedef enum SpvStorageClass_ {<br>
>      SpvStorageClassPushConstant = 9,<br>
>      SpvStorageClassAtomicCounter = 10,<br>
>      SpvStorageClassImage = 11,<br>
> +    SpvStorageClassStorageBuffer = 12,<br>
>      SpvStorageClassMax = 0x7fffffff,<br>
>  } SpvStorageClass;<br>
><br>
> @@ -383,6 +389,9 @@ typedef enum SpvDecoration_ {<br>
>      SpvDecorationInputAttachmentIn<wbr>dex = 43,<br>
>      SpvDecorationAlignment = 44,<br>
>      SpvDecorationMaxByteOffset = 45,<br>
> +    SpvDecorationAlignmentId = 46,<br>
> +    SpvDecorationMaxByteOffsetId = 47,<br>
> +    SpvDecorationExplicitInterpAMD = 4999,<br>
>      SpvDecorationOverrideCoverageN<wbr>V = 5248,<br>
>      SpvDecorationPassthroughNV = 5250,<br>
>      SpvDecorationViewportRelativeN<wbr>V = 5252,<br>
> @@ -442,6 +451,13 @@ typedef enum SpvBuiltIn_ {<br>
>      SpvBuiltInDrawIndex = 4426,<br>
>      SpvBuiltInDeviceIndex = 4438,<br>
>      SpvBuiltInViewIndex = 4440,<br>
> +    SpvBuiltInBaryCoordNoPerspAMD = 4992,<br>
> +    SpvBuiltInBaryCoordNoPerspCent<wbr>roidAMD = 4993,<br>
> +    SpvBuiltInBaryCoordNoPerspSamp<wbr>leAMD = 4994,<br>
> +    SpvBuiltInBaryCoordSmoothAMD = 4995,<br>
> +    SpvBuiltInBaryCoordSmoothCentr<wbr>oidAMD = 4996,<br>
> +    SpvBuiltInBaryCoordSmoothSampl<wbr>eAMD = 4997,<br>
> +    SpvBuiltInBaryCoordPullModelAM<wbr>D = 4998,<br>
>      SpvBuiltInViewportMaskNV = 5253,<br>
>      SpvBuiltInSecondaryPositionNV = 5257,<br>
>      SpvBuiltInSecondaryViewportMas<wbr>kNV = 5258,<br>
> @@ -632,12 +648,19 @@ typedef enum SpvCapability_ {<br>
>      SpvCapabilitySubgroupBallotKHR = 4423,<br>
>      SpvCapabilityDrawParameters = 4427,<br>
>      SpvCapabilitySubgroupVoteKHR = 4431,<br>
> +    SpvCapabilityStorageBuffer16Bi<wbr>tAccess = 4433,<br>
>      SpvCapabilityStorageUniformBuf<wbr>ferBlock16 = 4433,<br>
>      SpvCapabilityStorageUniform16 = 4434,<br>
> +    SpvCapabilityUniformAndStorage<wbr>Buffer16BitAccess = 4434,<br>
>      SpvCapabilityStoragePushConsta<wbr>nt16 = 4435,<br>
>      SpvCapabilityStorageInputOutpu<wbr>t16 = 4436,<br>
>      SpvCapabilityDeviceGroup = 4437,<br>
>      SpvCapabilityMultiView = 4439,<br>
> +    SpvCapabilityVariablePointersS<wbr>torageBuffer = 4441,<br>
> +    SpvCapabilityVariablePointers = 4442,<br>
> +    SpvCapabilityAtomicStorageOps = 4445,<br>
> +    SpvCapabilitySampleMaskPostDep<wbr>thCoverage = 4447,<br>
> +    SpvCapabilityImageGatherBiasLo<wbr>dAMD = 5009,<br>
>      SpvCapabilitySampleMaskOverrid<wbr>eCoverageNV = 5249,<br>
>      SpvCapabilityGeometryShaderPas<wbr>sthroughNV = 5251,<br>
>      SpvCapabilityShaderViewportInd<wbr>exLayerNV = 5254,<br>
> @@ -952,12 +975,22 @@ typedef enum SpvOp_ {<br>
>      SpvOpNamedBarrierInitialize = 328,<br>
>      SpvOpMemoryNamedBarrier = 329,<br>
>      SpvOpModuleProcessed = 330,<br>
> +    SpvOpExecutionModeId = 331,<br>
> +    SpvOpDecorateId = 332,<br>
>      SpvOpSubgroupBallotKHR = 4421,<br>
>      SpvOpSubgroupFirstInvocationKH<wbr>R = 4422,<br>
>      SpvOpSubgroupAllKHR = 4428,<br>
>      SpvOpSubgroupAnyKHR = 4429,<br>
>      SpvOpSubgroupAllEqualKHR = 4430,<br>
>      SpvOpSubgroupReadInvocationKHR = 4432,<br>
> +    SpvOpGroupIAddNonUniformAMD = 5000,<br>
> +    SpvOpGroupFAddNonUniformAMD = 5001,<br>
> +    SpvOpGroupFMinNonUniformAMD = 5002,<br>
> +    SpvOpGroupUMinNonUniformAMD = 5003,<br>
> +    SpvOpGroupSMinNonUniformAMD = 5004,<br>
> +    SpvOpGroupFMaxNonUniformAMD = 5005,<br>
> +    SpvOpGroupUMaxNonUniformAMD = 5006,<br>
> +    SpvOpGroupSMaxNonUniformAMD = 5007,<br>
>      SpvOpMax = 0x7fffffff,<br>
>  } SpvOp;<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>