[Mesa-dev] [PATCH 1/8] spirv: Import the latest 1.0.2 header from Khronos

Jason Ekstrand jason at jlekstrand.net
Fri Jul 14 01:57:47 UTC 2017


On Thu, Jul 13, 2017 at 6:38 PM, Ian Romanick <idr at freedesktop.org> wrote:

> Shouldn't this also update capability_to_string in spriv_info.c?


Yes, probably.


>   I'm
> also questioning that implementation... there are huge blocks in that
> array (e.g., all the elements from 61 to 4322) that are zeroed out by
> the initialization.


Ugh... I didn't realize we were packing it into an array. :(  We really
need to use a switch since it's sparse.

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.


>   This will cause spirv_capability_to_string() to
> happily return NULL pointers that none of the callers are prepared to
> handle.
>

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.

--Jason


>
> On 07/13/2017 12:41 PM, Jason Ekstrand wrote:
> > ---
> >  src/compiler/spirv/spirv.h | 41 ++++++++++++++++++++++++++++++
> +++++++----
> >  1 file changed, 37 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/compiler/spirv/spirv.h b/src/compiler/spirv/spirv.h
> > index 89354c0..61559a1 100644
> > --- a/src/compiler/spirv/spirv.h
> > +++ b/src/compiler/spirv/spirv.h
> > @@ -50,12 +50,12 @@
> >
> >  typedef unsigned int SpvId;
> >
> > -#define SPV_VERSION 0x10100
> > -#define SPV_REVISION 6
> > +#define SPV_VERSION 0x10200
> > +#define SPV_REVISION 1
> >
> >  static const unsigned int SpvMagicNumber = 0x07230203;
> > -static const unsigned int SpvVersion = 0x00010100;
> > -static const unsigned int SpvRevision = 6;
> > +static const unsigned int SpvVersion = 0x00010200;
> > +static const unsigned int SpvRevision = 1;
> >  static const unsigned int SpvOpCodeMask = 0xffff;
> >  static const unsigned int SpvWordCountShift = 16;
> >
> > @@ -65,6 +65,7 @@ typedef enum SpvSourceLanguage_ {
> >      SpvSourceLanguageGLSL = 2,
> >      SpvSourceLanguageOpenCL_C = 3,
> >      SpvSourceLanguageOpenCL_CPP = 4,
> > +    SpvSourceLanguageHLSL = 5,
> >      SpvSourceLanguageMax = 0x7fffffff,
> >  } SpvSourceLanguage;
> >
> > @@ -129,6 +130,10 @@ typedef enum SpvExecutionMode_ {
> >      SpvExecutionModeFinalizer = 34,
> >      SpvExecutionModeSubgroupSize = 35,
> >      SpvExecutionModeSubgroupsPerWorkgroup = 36,
> > +    SpvExecutionModeSubgroupsPerWorkgroupId = 37,
> > +    SpvExecutionModeLocalSizeId = 38,
> > +    SpvExecutionModeLocalSizeHintId = 39,
> > +    SpvExecutionModePostDepthCoverage = 4446,
> >      SpvExecutionModeMax = 0x7fffffff,
> >  } SpvExecutionMode;
> >
> > @@ -145,6 +150,7 @@ typedef enum SpvStorageClass_ {
> >      SpvStorageClassPushConstant = 9,
> >      SpvStorageClassAtomicCounter = 10,
> >      SpvStorageClassImage = 11,
> > +    SpvStorageClassStorageBuffer = 12,
> >      SpvStorageClassMax = 0x7fffffff,
> >  } SpvStorageClass;
> >
> > @@ -383,6 +389,9 @@ typedef enum SpvDecoration_ {
> >      SpvDecorationInputAttachmentIndex = 43,
> >      SpvDecorationAlignment = 44,
> >      SpvDecorationMaxByteOffset = 45,
> > +    SpvDecorationAlignmentId = 46,
> > +    SpvDecorationMaxByteOffsetId = 47,
> > +    SpvDecorationExplicitInterpAMD = 4999,
> >      SpvDecorationOverrideCoverageNV = 5248,
> >      SpvDecorationPassthroughNV = 5250,
> >      SpvDecorationViewportRelativeNV = 5252,
> > @@ -442,6 +451,13 @@ typedef enum SpvBuiltIn_ {
> >      SpvBuiltInDrawIndex = 4426,
> >      SpvBuiltInDeviceIndex = 4438,
> >      SpvBuiltInViewIndex = 4440,
> > +    SpvBuiltInBaryCoordNoPerspAMD = 4992,
> > +    SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993,
> > +    SpvBuiltInBaryCoordNoPerspSampleAMD = 4994,
> > +    SpvBuiltInBaryCoordSmoothAMD = 4995,
> > +    SpvBuiltInBaryCoordSmoothCentroidAMD = 4996,
> > +    SpvBuiltInBaryCoordSmoothSampleAMD = 4997,
> > +    SpvBuiltInBaryCoordPullModelAMD = 4998,
> >      SpvBuiltInViewportMaskNV = 5253,
> >      SpvBuiltInSecondaryPositionNV = 5257,
> >      SpvBuiltInSecondaryViewportMaskNV = 5258,
> > @@ -632,12 +648,19 @@ typedef enum SpvCapability_ {
> >      SpvCapabilitySubgroupBallotKHR = 4423,
> >      SpvCapabilityDrawParameters = 4427,
> >      SpvCapabilitySubgroupVoteKHR = 4431,
> > +    SpvCapabilityStorageBuffer16BitAccess = 4433,
> >      SpvCapabilityStorageUniformBufferBlock16 = 4433,
> >      SpvCapabilityStorageUniform16 = 4434,
> > +    SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434,
> >      SpvCapabilityStoragePushConstant16 = 4435,
> >      SpvCapabilityStorageInputOutput16 = 4436,
> >      SpvCapabilityDeviceGroup = 4437,
> >      SpvCapabilityMultiView = 4439,
> > +    SpvCapabilityVariablePointersStorageBuffer = 4441,
> > +    SpvCapabilityVariablePointers = 4442,
> > +    SpvCapabilityAtomicStorageOps = 4445,
> > +    SpvCapabilitySampleMaskPostDepthCoverage = 4447,
> > +    SpvCapabilityImageGatherBiasLodAMD = 5009,
> >      SpvCapabilitySampleMaskOverrideCoverageNV = 5249,
> >      SpvCapabilityGeometryShaderPassthroughNV = 5251,
> >      SpvCapabilityShaderViewportIndexLayerNV = 5254,
> > @@ -952,12 +975,22 @@ typedef enum SpvOp_ {
> >      SpvOpNamedBarrierInitialize = 328,
> >      SpvOpMemoryNamedBarrier = 329,
> >      SpvOpModuleProcessed = 330,
> > +    SpvOpExecutionModeId = 331,
> > +    SpvOpDecorateId = 332,
> >      SpvOpSubgroupBallotKHR = 4421,
> >      SpvOpSubgroupFirstInvocationKHR = 4422,
> >      SpvOpSubgroupAllKHR = 4428,
> >      SpvOpSubgroupAnyKHR = 4429,
> >      SpvOpSubgroupAllEqualKHR = 4430,
> >      SpvOpSubgroupReadInvocationKHR = 4432,
> > +    SpvOpGroupIAddNonUniformAMD = 5000,
> > +    SpvOpGroupFAddNonUniformAMD = 5001,
> > +    SpvOpGroupFMinNonUniformAMD = 5002,
> > +    SpvOpGroupUMinNonUniformAMD = 5003,
> > +    SpvOpGroupSMinNonUniformAMD = 5004,
> > +    SpvOpGroupFMaxNonUniformAMD = 5005,
> > +    SpvOpGroupUMaxNonUniformAMD = 5006,
> > +    SpvOpGroupSMaxNonUniformAMD = 5007,
> >      SpvOpMax = 0x7fffffff,
> >  } SpvOp;
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170713/037793cd/attachment-0001.html>


More information about the mesa-dev mailing list