Browse Source

Update barycentric with new spec (#265)

1. Adding SV_Barycentric and removing barycentric intrinsics/dxilops
2. GetAttributeAtVertex only thakes no_interpolation attribute
3. SV_Barycentric can take any interpolation modifier except nointerpolation
4. SV_Barycentric can only have float3 type
Young Kim 8 years ago
parent
commit
13cf7d466c

+ 225 - 296
docs/DXIL.rst

@@ -595,38 +595,39 @@ Semantic Interpretations for each SemanticKind at each SigPointKind are as follo
 .. <py::lines('SEMINT-TABLE-RST')>hctdb_instrhelp.get_sem_interpretation_table_rst()</py>
 .. <py::lines('SEMINT-TABLE-RST')>hctdb_instrhelp.get_sem_interpretation_table_rst()</py>
 .. SEMINT-TABLE-RST:BEGIN
 .. SEMINT-TABLE-RST:BEGIN
 
 
-====================== ============ ===== ============ ============ ====== ======= ========== ============ ====== ===== ===== ============ ===== ============ ============= ========
-Semantic               VSIn         VSOut PCIn         HSIn         HSCPIn HSCPOut PCOut      DSIn         DSCPIn DSOut GSVIn GSIn         GSOut PSIn         PSOut         CSIn
-====================== ============ ===== ============ ============ ====== ======= ========== ============ ====== ===== ===== ============ ===== ============ ============= ========
-Arbitrary              Arb          Arb   NA           NA           Arb    Arb     Arb        Arb          Arb    Arb   Arb   NA           Arb   Arb          NA            NA
-VertexID               SV           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NA            NA
-InstanceID             SV           Arb   NA           NA           Arb    Arb     NA         NA           Arb    Arb   Arb   NA           Arb   Arb          NA            NA
-Position               Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV           NA            NA
-RenderTargetArrayIndex Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV           NA            NA
-ViewPortArrayIndex     Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV           NA            NA
-ClipDistance           Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV           NA            NA
-CullDistance           Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV           NA            NA
-OutputControlPointID   NA           NA    NA           NotInSig     NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NA            NA
-DomainLocation         NA           NA    NA           NA           NA     NA      NA         NotInSig     NA     NA    NA    NA           NA    NA           NA            NA
-PrimitiveID            NA           NA    NotInSig     NotInSig     NA     NA      NA         NotInSig     NA     NA    NA    Shadow       SGV   SGV          NA            NA
-GSInstanceID           NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NotInSig     NA    NA           NA            NA
-SampleIndex            NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    Shadow _41   NA            NA
-IsFrontFace            NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           SGV   SGV          NA            NA
-Coverage               NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NotInSig _50 NotPacked _41 NA
-InnerCoverage          NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NotInSig _50 NA            NA
-Target                 NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           Target        NA
-Depth                  NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NotPacked     NA
-DepthLessEqual         NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NotPacked _50 NA
-DepthGreaterEqual      NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NotPacked _50 NA
-StencilRef             NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NotPacked _50 NA
-DispatchThreadID       NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NA            NotInSig
-GroupID                NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NA            NotInSig
-GroupIndex             NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NA            NotInSig
-GroupThreadID          NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA           NA            NotInSig
-TessFactor             NA           NA    NA           NA           NA     NA      TessFactor TessFactor   NA     NA    NA    NA           NA    NA           NA            NA
-InsideTessFactor       NA           NA    NA           NA           NA     NA      TessFactor TessFactor   NA     NA    NA    NA           NA    NA           NA            NA
-ViewID                 NotInSig _61 NA    NotInSig _61 NotInSig _61 NA     NA      NA         NotInSig _61 NA     NA    NA    NotInSig _61 NA    NotInSig _61 NA            NA
-====================== ============ ===== ============ ============ ====== ======= ========== ============ ====== ===== ===== ============ ===== ============ ============= ========
+====================== ============ ===== ============ ============ ====== ======= ========== ============ ====== ===== ===== ============ ===== ============= ============= ========
+Semantic               VSIn         VSOut PCIn         HSIn         HSCPIn HSCPOut PCOut      DSIn         DSCPIn DSOut GSVIn GSIn         GSOut PSIn          PSOut         CSIn
+====================== ============ ===== ============ ============ ====== ======= ========== ============ ====== ===== ===== ============ ===== ============= ============= ========
+Arbitrary              Arb          Arb   NA           NA           Arb    Arb     Arb        Arb          Arb    Arb   Arb   NA           Arb   Arb           NA            NA
+VertexID               SV           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NA            NA
+InstanceID             SV           Arb   NA           NA           Arb    Arb     NA         NA           Arb    Arb   Arb   NA           Arb   Arb           NA            NA
+Position               Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV            NA            NA
+RenderTargetArrayIndex Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV            NA            NA
+ViewPortArrayIndex     Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV            NA            NA
+ClipDistance           Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV            NA            NA
+CullDistance           Arb          SV    NA           NA           SV     SV      Arb        Arb          SV     SV    SV    NA           SV    SV            NA            NA
+OutputControlPointID   NA           NA    NA           NotInSig     NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NA            NA
+DomainLocation         NA           NA    NA           NA           NA     NA      NA         NotInSig     NA     NA    NA    NA           NA    NA            NA            NA
+PrimitiveID            NA           NA    NotInSig     NotInSig     NA     NA      NA         NotInSig     NA     NA    NA    Shadow       SGV   SGV           NA            NA
+GSInstanceID           NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NotInSig     NA    NA            NA            NA
+SampleIndex            NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    Shadow _41    NA            NA
+IsFrontFace            NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           SGV   SGV           NA            NA
+Coverage               NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NotInSig _50  NotPacked _41 NA
+InnerCoverage          NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NotInSig _50  NA            NA
+Target                 NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            Target        NA
+Depth                  NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NotPacked     NA
+DepthLessEqual         NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NotPacked _50 NA
+DepthGreaterEqual      NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NotPacked _50 NA
+StencilRef             NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NotPacked _50 NA
+DispatchThreadID       NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NA            NotInSig
+GroupID                NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NA            NotInSig
+GroupIndex             NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NA            NotInSig
+GroupThreadID          NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NA            NA            NotInSig
+TessFactor             NA           NA    NA           NA           NA     NA      TessFactor TessFactor   NA     NA    NA    NA           NA    NA            NA            NA
+InsideTessFactor       NA           NA    NA           NA           NA     NA      TessFactor TessFactor   NA     NA    NA    NA           NA    NA            NA            NA
+ViewID                 NotInSig _61 NA    NotInSig _61 NotInSig _61 NA     NA      NA         NotInSig _61 NA     NA    NA    NotInSig _61 NA    NotInSig _61  NA            NA
+Barycentrics           NA           NA    NA           NA           NA     NA      NA         NA           NA     NA    NA    NA           NA    NotPacked _61 NA            NA
+====================== ============ ===== ============ ============ ====== ======= ========== ============ ====== ===== ===== ============ ===== ============= ============= ========
 
 
 .. SEMINT-TABLE-RST:END
 .. SEMINT-TABLE-RST:END
 
 
@@ -2040,12 +2041,8 @@ ID  Name                           Description
 134 LegacyDoubleToUInt32_          legacy fuction to convert double to uint32
 134 LegacyDoubleToUInt32_          legacy fuction to convert double to uint32
 135 WaveAllBitCount_               returns the count of bits set to 1 across the wave
 135 WaveAllBitCount_               returns the count of bits set to 1 across the wave
 136 WavePrefixBitCount_            returns the count of bits set to 1 on prior lanes
 136 WavePrefixBitCount_            returns the count of bits set to 1 on prior lanes
-137 Barycentrics_                  return weights at a current location.
-138 BarycentricsCentroid_          return weights at centroid location.
-139 BarycentricsSampleIndex_       return weights at the location of the sample specified by index
-140 BarycentricsSnapped_           return weights at the location specified in the pixel's 16x16 sample grid
-141 AttributeAtVertex_             returns the values of the attributes at the vertex.
-142 ViewID_                        returns the view index
+137 AttributeAtVertex_             returns the values of the attributes at the vertex.
+138 ViewID_                        returns the view index
 === ============================== =================================================================================================================
 === ============================== =================================================================================================================
 
 
 
 
@@ -2087,77 +2084,6 @@ AttributeAtVertex
 
 
 returns the values of the attributes at the vertex. VertexID ranges from 0 to 2.
 returns the values of the attributes at the vertex. VertexID ranges from 0 to 2.
 
 
-Barycentrics
-~~~~~~~~~~~~
-
-weight = Barycentrics(VertexID)
-
-Returns all 3 triangle Barycentrics weights even though two are strictly necessary.
-VertexID ranges from 0 to 2.
-
-The 3 values returned are NOT guaranteed to add up to floating-point 1.0 exactly.
-If it is desired for the pixel shader to receive weights with this property, it can reconstruct the third coordinate by subtracting the sum of the other two from 1.0.
-Also note, that individual barycentric weights may take on arbitrarily large or arbitrarily small values, and are not constrained to be within [0...1] range
-– this may happen for screen-space (non-perspective-correct) barycentric interpolants, screenspace quad primitives, or external triangles.
-For triangle primitives, all 3 weights will typically contain non-zero values, but for line primitives the third barycentric weight (myBaryWeights.z) is guaranteed to be exactly 0.0.
-
-BarycentricsCentroid
-~~~~~~~~~~~~~~~~~~~~
-
-weight = BarycentricsCentroid(VertexID)
-
-Equivalent to Barycentrics but returns barycentric weights at the centroid.
-
-BarycentricsSampleIndex
-~~~~~~~~~~~~~~~~~~~~~~~
-
-weight = BarycentricsSampleIndex(VertexID, sampleIndex)
-
-Equivalent to Barycentrics but returns barycentric weights at the sample.
-
-BarycentricsSnapped
-~~~~~~~~~~~~~~~~~~~
-
-weight = BarycentricsSnapped(VertexID, offsetX, offsetY)
-
-Equivalent to Barycentrics but returns barycentric weights of a position with 2D offset from the pixel center using a 16x16 grid. Only the last 4 bits of the two components of the pixel offsets are used.
-
-+----------+----------------+
-|  4 bits  |     offset     |
-+----------+----------------+
-|   1000   | -0.5f (-8/16)  |
-+----------+----------------+
-|   1001   | -0.4375f(-7/16)|
-+----------+----------------+
-|   1010   | -0.375f (-6/16)|
-+----------+----------------+
-|   1011   | -0.3125f(-5/16)|
-+----------+----------------+
-|   1100   | -0.25f (-4/16) |
-+----------+----------------+
-|   1101   | -0.1875f(-3/16)|
-+----------+----------------+
-|   1110   | -0.125f (-2/16)|
-+----------+----------------+
-|   1111   | -0.0625f(-1/16)|
-+----------+----------------+
-|   0000   | 0.0f (0/16)    |
-+----------+----------------+
-|   0001   | 0.0625f (1/16) |
-+----------+----------------+
-|   0010   | 0.125f (2/16)  |
-+----------+----------------+
-|   0011   | 0.1875f (3/16) |
-+----------+----------------+
-|   0100   | 0.25f (4/16)   |
-+----------+----------------+
-|   0101   | 0.3125f (5/16) |
-+----------+----------------+
-|   0110   | 0.375f (6/16)  |
-+----------+----------------+
-|   0111   | 0.4375f (7/16) |
-+----------+----------------+
-
 Bfi
 Bfi
 ~~~
 ~~~
 
 
@@ -2763,193 +2689,196 @@ The set of validation rules that are known to hold for a DXIL program is identif
 .. <py::lines('VALRULES-RST')>hctdb_instrhelp.get_valrules_rst()</py>
 .. <py::lines('VALRULES-RST')>hctdb_instrhelp.get_valrules_rst()</py>
 .. VALRULES-RST:BEGIN
 .. VALRULES-RST:BEGIN
 
 
-===================================== =======================================================================================================================================================================================================================================================================================================
-Rule Code                             Description
-===================================== =======================================================================================================================================================================================================================================================================================================
-BITCODE.VALID                         TODO - Module must be bitcode-valid
-CONTAINER.PARTINVALID                 DXIL Container must not contain unknown parts
-CONTAINER.PARTMATCHES                 DXIL Container Parts must match Module
-CONTAINER.PARTMISSING                 DXIL Container requires certain parts, corresponding to module
-CONTAINER.PARTREPEATED                DXIL Container must have only one of each part type
-CONTAINER.ROOTSIGNATUREINCOMPATIBLE   Root Signature in DXIL Container must be compatible with shader
-DECL.DXILFNEXTERN                     External function must be a DXIL function
-DECL.DXILNSRESERVED                   The DXIL reserved prefixes must only be used by built-in functions and types
-DECL.FNFLATTENPARAM                   Function parameters must not use struct types
-DECL.FNISCALLED                       Functions can only be used by call instructions
-DECL.NOTUSEDEXTERNAL                  External declaration should not be used
-DECL.USEDEXTERNALFUNCTION             External function must be used
-DECL.USEDINTERNAL                     Internal declaration must be used
-FLOW.DEADLOOP                         Loop must have break
-FLOW.FUNCTIONCALL                     Function with parameter is not permitted
-FLOW.NORECUSION                       Recursion is not permitted
-FLOW.REDUCIBLE                        Execution flow must be reducible
-INSTR.ALLOWED                         Instructions must be of an allowed type
-INSTR.BARRIERMODEFORNONCS             sync in a non-Compute Shader must only sync UAV (sync_uglobal)
-INSTR.BARRIERMODENOMEMORY             sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory).  Only _t (thread group sync) is optional.
-INSTR.BARRIERMODEUSELESSUGROUP        sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.
-INSTR.BUFFERUPDATECOUNTERONUAV        BufferUpdateCounter valid only on UAV
-INSTR.CALLOLOAD                       Call to DXIL intrinsic must match overload signature
-INSTR.CANNOTPULLPOSITION              pull-model evaluation of position disallowed
-INSTR.CBUFFERCLASSFORCBUFFERHANDLE    Expect Cbuffer for CBufferLoad handle
-INSTR.CBUFFEROUTOFBOUND               Cbuffer access out of bound
-INSTR.COORDINATECOUNTFORRAWTYPEDBUF   raw/typed buffer don't need 2 coordinates
-INSTR.COORDINATECOUNTFORSTRUCTBUF     structured buffer require 2 coordinates
-INSTR.DXILSTRUCTUSER                  Dxil struct types should only used by ExtractValue
-INSTR.DXILSTRUCTUSEROUTOFBOUND        Index out of bound when extract value from dxil struct types
-INSTR.EVALINTERPOLATIONMODE           Interpolation mode on %0 used with eval_* instruction must be linear, linear_centroid, linear_noperspective, linear_noperspective_centroid, linear_sample or linear_noperspective_sample
-INSTR.EXTRACTVALUE                    ExtractValue should only be used on dxil struct types and cmpxchg
-INSTR.FAILTORESLOVETGSMPOINTER        TGSM pointers must originate from an unambiguous TGSM global variable.
-INSTR.HANDLENOTFROMCREATEHANDLE       Resource handle should returned by createHandle
-INSTR.IMMBIASFORSAMPLEB               bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate
-INSTR.INBOUNDSACCESS                  Access to out-of-bounds memory is disallowed
-INSTR.MINPRECISIONNOTPRECISE          Instructions marked precise may not refer to minprecision values
-INSTR.MINPRECISONBITCAST              Bitcast on minprecison types is not allowed
-INSTR.MIPLEVELFORGETDIMENSION         Use mip level on buffer when GetDimensions
-INSTR.MIPONUAVLOAD                    uav load don't support mipLevel/sampleIndex
-INSTR.NOGENERICPTRADDRSPACECAST       Address space cast between pointer types must have one part to be generic address space
-INSTR.NOIDIVBYZERO                    No signed integer division by zero
-INSTR.NOINDEFINITEACOS                No indefinite arccosine
-INSTR.NOINDEFINITEASIN                No indefinite arcsine
-INSTR.NOINDEFINITEDSXY                No indefinite derivative calculation
-INSTR.NOINDEFINITELOG                 No indefinite logarithm
-INSTR.NOREADINGUNINITIALIZED          Instructions should not read uninitialized value
-INSTR.NOUDIVBYZERO                    No unsigned integer division by zero
-INSTR.OFFSETONUAVLOAD                 uav load don't support offset
-INSTR.OLOAD                           DXIL intrinsic overload must be valid
-INSTR.ONLYONEALLOCCONSUME             RWStructuredBuffers may increment or decrement their counters, but not both.
-INSTR.OPCODERESERVED                  Instructions must not reference reserved opcodes
-INSTR.OPCONST                         DXIL intrinsic requires an immediate constant operand
-INSTR.OPCONSTRANGE                    Constant values must be in-range for operation
-INSTR.OPERANDRANGE                    DXIL intrinsic operand must be within defined range
-INSTR.PTRBITCAST                      Pointer type bitcast must be have same size
-INSTR.RESOURCECLASSFORLOAD            load can only run on UAV/SRV resource
-INSTR.RESOURCECLASSFORSAMPLERGATHER   sample, lod and gather should on srv resource.
-INSTR.RESOURCECLASSFORUAVSTORE        store should on uav resource.
-INSTR.RESOURCECOORDINATEMISS          coord uninitialized
-INSTR.RESOURCECOORDINATETOOMANY       out of bound coord must be undef
-INSTR.RESOURCEKINDFORBUFFERLOADSTORE  buffer load/store only works on Raw/Typed/StructuredBuffer
-INSTR.RESOURCEKINDFORCALCLOD          lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray
-INSTR.RESOURCEKINDFORGATHER           gather requires resource declared as texture/2D/Cube/2DArray/CubeArray
-INSTR.RESOURCEKINDFORGETDIM           Invalid resource kind on GetDimensions
-INSTR.RESOURCEKINDFORSAMPLE           sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray
-INSTR.RESOURCEKINDFORSAMPLEC          samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray
-INSTR.RESOURCEKINDFORTEXTURELOAD      texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray
-INSTR.RESOURCEKINDFORTEXTURESTORE     texture store only works on Texture1D/1DArray/2D/2DArray/3D
-INSTR.RESOURCEOFFSETMISS              offset uninitialized
-INSTR.RESOURCEOFFSETTOOMANY           out of bound offset must be undef
-INSTR.SAMPLECOMPTYPE                  sample_* instructions require resource to be declared to return UNORM, SNORM or FLOAT.
-INSTR.SAMPLEINDEXFORLOAD2DMS          load on Texture2DMS/2DMSArray require sampleIndex
-INSTR.SAMPLERMODEFORLOD               lod instruction requires sampler declared in default mode
-INSTR.SAMPLERMODEFORSAMPLE            sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode
-INSTR.SAMPLERMODEFORSAMPLEC           sample_c_*/gather_c instructions require sampler declared in comparison mode
-INSTR.STRUCTBITCAST                   Bitcast on struct types is not allowed
-INSTR.TEXTUREOFFSET                   offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7
-INSTR.TGSMRACECOND                    Race condition writing to shared memory detected, consider making this write conditional
-INSTR.UNDEFRESULTFORGETDIMENSION      GetDimensions used undef dimension %0 on %1
-INSTR.WRITEMASKFORTYPEDUAVSTORE       store on typed uav must write to all four components of the UAV
-INSTR.WRITEMASKMATCHVALUEFORUAVSTORE  uav store write mask must match store value mask, write mask is %0 and store value mask is %1
-META.BRANCHFLATTEN                    Can't use branch and flatten attributes together
-META.CLIPCULLMAXCOMPONENTS            Combined elements of SV_ClipDistance and SV_CullDistance must fit in 8 components
-META.CLIPCULLMAXROWS                  Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows.
-META.CONTROLFLOWHINTNOTONCONTROLFLOW  Control flow hint only works on control flow inst
-META.DENSERESIDS                      Resource identifiers must be zero-based and dense
-META.DUPLICATESYSVALUE                System value may only appear once in signature
-META.ENTRYFUNCTION                    entrypoint not found
-META.FLAGSUSAGE                       Flags must match usage
-META.FORCECASEONSWITCH                Attribute forcecase only works for switch
-META.FUNCTIONANNOTATION               Cannot find function annotation for %0
-META.GLCNOTONAPPENDCONSUME            globallycoherent cannot be used with append/consume buffers
-META.INTEGERINTERPMODE                Interpolation mode on integer must be Constant
-META.INTERPMODEINONEROW               Interpolation mode must be identical for all elements packed into the same row.
-META.INTERPMODEVALID                  Interpolation mode must be valid
-META.INVALIDCONTROLFLOWHINT           Invalid control flow hint
-META.KNOWN                            Named metadata should be known
-META.MAXTESSFACTOR                    Hull Shader MaxTessFactor must be [%0..%1].  %2 specified
-META.NOSEMANTICOVERLAP                Semantics must not overlap
-META.REQUIRED                         TODO - Required metadata missing
-META.SEMAKINDMATCHESNAME              Semantic name must match system value, when defined.
-META.SEMAKINDVALID                    Semantic kind must be valid
-META.SEMANTICCOMPTYPE                 %0 must be %1
-META.SEMANTICINDEXMAX                 System value semantics have a maximum valid semantic index
-META.SEMANTICLEN                      Semantic length must be at least 1 and at most 64
-META.SEMANTICSHOULDBEALLOCATED        Semantic should have a valid packing location
-META.SEMANTICSHOULDNOTBEALLOCATED     Semantic should have a packing location of -1
-META.SIGNATURECOMPTYPE                signature %0 specifies unrecognized or invalid component type
-META.SIGNATUREILLEGALCOMPONENTORDER   Component ordering for packed elements must be: arbitrary < system value < system generated value
-META.SIGNATUREINDEXCONFLICT           Only elements with compatible indexing rules may be packed together
-META.SIGNATUREOUTOFRANGE              Signature elements must fit within maximum signature size
-META.SIGNATUREOVERLAP                 Signature elements may not overlap in packing location.
-META.STRUCTBUFALIGNMENT               StructuredBuffer stride not aligned
-META.STRUCTBUFALIGNMENTOUTOFBOUND     StructuredBuffer stride out of bounds
-META.SYSTEMVALUEROWS                  System value may only have 1 row
-META.TARGET                           Target triple must be 'dxil-ms-dx'
-META.TESSELLATOROUTPUTPRIMITIVE       Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW.
-META.TESSELLATORPARTITION             Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even.
-META.TEXTURETYPE                      elements of typed buffers and textures must fit in four 32-bit quantities
-META.USED                             All metadata must be used by dxil
-META.VALIDSAMPLERMODE                 Invalid sampler mode on sampler
-META.VALUERANGE                       Metadata value must be within range
-META.WELLFORMED                       TODO - Metadata must be well-formed in operand count and types
-SM.APPENDANDCONSUMEONSAMEUAV          BufferUpdateCounter inc and dec on a given UAV (%d) cannot both be in the same shader for shader model less than 5.1.
-SM.CBUFFERELEMENTOVERFLOW             CBuffer elements must not overflow
-SM.CBUFFEROFFSETOVERLAP               CBuffer offsets must not overlap
-SM.CBUFFERTEMPLATETYPEMUSTBESTRUCT    D3D12 constant/texture buffer template element can only be a struct
-SM.COMPLETEPOSITION                   Not all elements of SV_Position were written
-SM.COUNTERONLYONSTRUCTBUF             BufferUpdateCounter valid only on structured buffers
-SM.CSNORETURN                         Compute shaders can't return values, outputs must be written in writable resources (UAVs).
-SM.DOMAINLOCATIONIDXOOB               DomainLocation component index out of bounds for the domain.
-SM.DSINPUTCONTROLPOINTCOUNTRANGE      DS input control point count must be [0..%0].  %1 specified
-SM.DXILVERSION                        Target shader model requires specific Dxil Version
-SM.GSINSTANCECOUNTRANGE               GS instance count must be [1..%0].  %1 specified
-SM.GSOUTPUTVERTEXCOUNTRANGE           GS output vertex count must be [0..%0].  %1 specified
-SM.GSTOTALOUTPUTVERTEXDATARANGE       Declared output vertex count (%0) multiplied by the total number of declared scalar components of output data (%1) equals %2.  This value cannot be greater than %3
-SM.GSVALIDINPUTPRIMITIVE              GS input primitive unrecognized
-SM.GSVALIDOUTPUTPRIMITIVETOPOLOGY     GS output primitive topology unrecognized
-SM.HSINPUTCONTROLPOINTCOUNTRANGE      HS input control point count must be [0..%0].  %1 specified
-SM.HULLPASSTHRUCONTROLPOINTCOUNTMATCH For pass thru hull shader, input control point count must match output control point count
-SM.INSIDETESSFACTORSIZEMATCHDOMAIN    InsideTessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.
-SM.INVALIDRESOURCECOMPTYPE            Invalid resource return type
-SM.INVALIDRESOURCEKIND                Invalid resources kind
-SM.INVALIDTEXTUREKINDONUAV            Texture2DMS[Array] or TextureCube[Array] resources are not supported with UAVs
-SM.ISOLINEOUTPUTPRIMITIVEMISMATCH     Hull Shader declared with IsoLine Domain must specify output primitive point or line. Triangle_cw or triangle_ccw output are not compatible with the IsoLine Domain.
-SM.MAXTGSMSIZE                        Total Thread Group Shared Memory storage is %0, exceeded %1
-SM.MAXTHEADGROUP                      Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1
-SM.MULTISTREAMMUSTBEPOINT             When multiple GS output streams are used they must be pointlists
-SM.NAME                               Target shader model name must be known
-SM.NOINTERPMODE                       Interpolation mode must be undefined for VS input/PS output/patch constant.
-SM.NOPSOUTPUTIDX                      Pixel shader output registers are not indexable.
-SM.OPCODE                             Opcode must be defined in target shader model
-SM.OPCODEININVALIDFUNCTION            Invalid DXIL opcode usage like StorePatchConstant in patch constant function
-SM.OPERAND                            Operand must be defined in target shader model
-SM.OUTPUTCONTROLPOINTCOUNTRANGE       output control point count must be [0..%0].  %1 specified
-SM.OUTPUTCONTROLPOINTSTOTALSCALARS    Total number of scalars across all HS output control points must not exceed
-SM.PATCHCONSTANTONLYFORHSDS           patch constant signature only valid in HS and DS
-SM.PSCONSISTENTINTERP                 Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE and not running at sample frequency (which is forced by inputting SV_SampleIndex or declaring an input linear_sample or linear_noperspective_sample)
-SM.PSCOVERAGEANDINNERCOVERAGE         InnerCoverage and Coverage are mutually exclusive.
-SM.PSMULTIPLEDEPTHSEMANTIC            Pixel Shader only allows one type of depth semantic to be declared
-SM.PSOUTPUTSEMANTIC                   Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found
-SM.PSTARGETCOL0                       SV_Target packed location must start at column 0
-SM.PSTARGETINDEXMATCHESROW            SV_Target semantic index must match packed row location
-SM.RESOURCERANGEOVERLAP               Resource ranges must not overlap
-SM.ROVONLYINPS                        RasterizerOrdered objects are only allowed in 5.0+ pixel shaders
-SM.SAMPLECOUNTONLYON2DMS              Only Texture2DMS/2DMSArray could has sample count
-SM.SEMANTIC                           Semantic must be defined in target shader model
-SM.STREAMINDEXRANGE                   Stream index (%0) must between 0 and %1
-SM.TESSFACTORFORDOMAIN                Required TessFactor for domain not found declared anywhere in Patch Constant data
-SM.TESSFACTORSIZEMATCHDOMAIN          TessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.
-SM.THREADGROUPCHANNELRANGE            Declared Thread Group %0 size %1 outside valid range [%2..%3]
-SM.TRIOUTPUTPRIMITIVEMISMATCH         Hull Shader declared with Tri Domain must specify output primitive point, triangle_cw or triangle_ccw. Line output is not compatible with the Tri domain
-SM.UNDEFINEDOUTPUT                    Not all elements of output %0 were written
-SM.VALIDDOMAIN                        Invalid Tessellator Domain specified. Must be isoline, tri or quad
-SM.VIEWIDNEEDSSLOT                    ViewID requires compatible space in pixel shader input signature
-SM.ZEROHSINPUTCONTROLPOINTWITHINPUT   When HS input control point count is 0, no input signature should exist
-TYPES.DEFINED                         Type must be defined based on DXIL primitives
-TYPES.I8                              I8 can only used as immediate value for intrinsic
-TYPES.INTWIDTH                        Int type must be of valid width
-TYPES.NOMULTIDIM                      Only one dimension allowed for array type
-TYPES.NOVECTOR                        Vector types must not be present
-UNI.NOWAVESENSITIVEGRADIENT           Gradient operations are not affected by wave-sensitive data or control flow.
-===================================== =======================================================================================================================================================================================================================================================================================================
+====================================== =======================================================================================================================================================================================================================================================================================================
+Rule Code                              Description
+====================================== =======================================================================================================================================================================================================================================================================================================
+BITCODE.VALID                          TODO - Module must be bitcode-valid
+CONTAINER.PARTINVALID                  DXIL Container must not contain unknown parts
+CONTAINER.PARTMATCHES                  DXIL Container Parts must match Module
+CONTAINER.PARTMISSING                  DXIL Container requires certain parts, corresponding to module
+CONTAINER.PARTREPEATED                 DXIL Container must have only one of each part type
+CONTAINER.ROOTSIGNATUREINCOMPATIBLE    Root Signature in DXIL Container must be compatible with shader
+DECL.DXILFNEXTERN                      External function must be a DXIL function
+DECL.DXILNSRESERVED                    The DXIL reserved prefixes must only be used by built-in functions and types
+DECL.FNFLATTENPARAM                    Function parameters must not use struct types
+DECL.FNISCALLED                        Functions can only be used by call instructions
+DECL.NOTUSEDEXTERNAL                   External declaration should not be used
+DECL.USEDEXTERNALFUNCTION              External function must be used
+DECL.USEDINTERNAL                      Internal declaration must be used
+FLOW.DEADLOOP                          Loop must have break
+FLOW.FUNCTIONCALL                      Function with parameter is not permitted
+FLOW.NORECUSION                        Recursion is not permitted
+FLOW.REDUCIBLE                         Execution flow must be reducible
+INSTR.ALLOWED                          Instructions must be of an allowed type
+INSTR.ATTRIBUTEATVERTEXNOINTERPOLATION Attribute %0 must have nointerpolation mode in order to use GetAttributeAtVertex function.
+INSTR.BARRIERMODEFORNONCS              sync in a non-Compute Shader must only sync UAV (sync_uglobal)
+INSTR.BARRIERMODENOMEMORY              sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory).  Only _t (thread group sync) is optional.
+INSTR.BARRIERMODEUSELESSUGROUP         sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.
+INSTR.BUFFERUPDATECOUNTERONUAV         BufferUpdateCounter valid only on UAV
+INSTR.CALLOLOAD                        Call to DXIL intrinsic must match overload signature
+INSTR.CANNOTPULLPOSITION               pull-model evaluation of position disallowed
+INSTR.CBUFFERCLASSFORCBUFFERHANDLE     Expect Cbuffer for CBufferLoad handle
+INSTR.CBUFFEROUTOFBOUND                Cbuffer access out of bound
+INSTR.COORDINATECOUNTFORRAWTYPEDBUF    raw/typed buffer don't need 2 coordinates
+INSTR.COORDINATECOUNTFORSTRUCTBUF      structured buffer require 2 coordinates
+INSTR.DXILSTRUCTUSER                   Dxil struct types should only used by ExtractValue
+INSTR.DXILSTRUCTUSEROUTOFBOUND         Index out of bound when extract value from dxil struct types
+INSTR.EVALINTERPOLATIONMODE            Interpolation mode on %0 used with eval_* instruction must be linear, linear_centroid, linear_noperspective, linear_noperspective_centroid, linear_sample or linear_noperspective_sample
+INSTR.EXTRACTVALUE                     ExtractValue should only be used on dxil struct types and cmpxchg
+INSTR.FAILTORESLOVETGSMPOINTER         TGSM pointers must originate from an unambiguous TGSM global variable.
+INSTR.HANDLENOTFROMCREATEHANDLE        Resource handle should returned by createHandle
+INSTR.IMMBIASFORSAMPLEB                bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate
+INSTR.INBOUNDSACCESS                   Access to out-of-bounds memory is disallowed
+INSTR.MINPRECISIONNOTPRECISE           Instructions marked precise may not refer to minprecision values
+INSTR.MINPRECISONBITCAST               Bitcast on minprecison types is not allowed
+INSTR.MIPLEVELFORGETDIMENSION          Use mip level on buffer when GetDimensions
+INSTR.MIPONUAVLOAD                     uav load don't support mipLevel/sampleIndex
+INSTR.NOGENERICPTRADDRSPACECAST        Address space cast between pointer types must have one part to be generic address space
+INSTR.NOIDIVBYZERO                     No signed integer division by zero
+INSTR.NOINDEFINITEACOS                 No indefinite arccosine
+INSTR.NOINDEFINITEASIN                 No indefinite arcsine
+INSTR.NOINDEFINITEDSXY                 No indefinite derivative calculation
+INSTR.NOINDEFINITELOG                  No indefinite logarithm
+INSTR.NOREADINGUNINITIALIZED           Instructions should not read uninitialized value
+INSTR.NOUDIVBYZERO                     No unsigned integer division by zero
+INSTR.OFFSETONUAVLOAD                  uav load don't support offset
+INSTR.OLOAD                            DXIL intrinsic overload must be valid
+INSTR.ONLYONEALLOCCONSUME              RWStructuredBuffers may increment or decrement their counters, but not both.
+INSTR.OPCODERESERVED                   Instructions must not reference reserved opcodes
+INSTR.OPCONST                          DXIL intrinsic requires an immediate constant operand
+INSTR.OPCONSTRANGE                     Constant values must be in-range for operation
+INSTR.OPERANDRANGE                     DXIL intrinsic operand must be within defined range
+INSTR.PTRBITCAST                       Pointer type bitcast must be have same size
+INSTR.RESOURCECLASSFORLOAD             load can only run on UAV/SRV resource
+INSTR.RESOURCECLASSFORSAMPLERGATHER    sample, lod and gather should on srv resource.
+INSTR.RESOURCECLASSFORUAVSTORE         store should on uav resource.
+INSTR.RESOURCECOORDINATEMISS           coord uninitialized
+INSTR.RESOURCECOORDINATETOOMANY        out of bound coord must be undef
+INSTR.RESOURCEKINDFORBUFFERLOADSTORE   buffer load/store only works on Raw/Typed/StructuredBuffer
+INSTR.RESOURCEKINDFORCALCLOD           lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray
+INSTR.RESOURCEKINDFORGATHER            gather requires resource declared as texture/2D/Cube/2DArray/CubeArray
+INSTR.RESOURCEKINDFORGETDIM            Invalid resource kind on GetDimensions
+INSTR.RESOURCEKINDFORSAMPLE            sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray
+INSTR.RESOURCEKINDFORSAMPLEC           samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray
+INSTR.RESOURCEKINDFORTEXTURELOAD       texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray
+INSTR.RESOURCEKINDFORTEXTURESTORE      texture store only works on Texture1D/1DArray/2D/2DArray/3D
+INSTR.RESOURCEOFFSETMISS               offset uninitialized
+INSTR.RESOURCEOFFSETTOOMANY            out of bound offset must be undef
+INSTR.SAMPLECOMPTYPE                   sample_* instructions require resource to be declared to return UNORM, SNORM or FLOAT.
+INSTR.SAMPLEINDEXFORLOAD2DMS           load on Texture2DMS/2DMSArray require sampleIndex
+INSTR.SAMPLERMODEFORLOD                lod instruction requires sampler declared in default mode
+INSTR.SAMPLERMODEFORSAMPLE             sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode
+INSTR.SAMPLERMODEFORSAMPLEC            sample_c_*/gather_c instructions require sampler declared in comparison mode
+INSTR.STRUCTBITCAST                    Bitcast on struct types is not allowed
+INSTR.TEXTUREOFFSET                    offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7
+INSTR.TGSMRACECOND                     Race condition writing to shared memory detected, consider making this write conditional
+INSTR.UNDEFRESULTFORGETDIMENSION       GetDimensions used undef dimension %0 on %1
+INSTR.WRITEMASKFORTYPEDUAVSTORE        store on typed uav must write to all four components of the UAV
+INSTR.WRITEMASKMATCHVALUEFORUAVSTORE   uav store write mask must match store value mask, write mask is %0 and store value mask is %1
+META.BARYCENTRICSFLOAT3                only 'float3' type is allowed for SV_Barycentrics.
+META.BARYCENTRICSINTERPOLATION         SV_Barycentrics cannot be used with 'nointerpolation' type
+META.BRANCHFLATTEN                     Can't use branch and flatten attributes together
+META.CLIPCULLMAXCOMPONENTS             Combined elements of SV_ClipDistance and SV_CullDistance must fit in 8 components
+META.CLIPCULLMAXROWS                   Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows.
+META.CONTROLFLOWHINTNOTONCONTROLFLOW   Control flow hint only works on control flow inst
+META.DENSERESIDS                       Resource identifiers must be zero-based and dense
+META.DUPLICATESYSVALUE                 System value may only appear once in signature
+META.ENTRYFUNCTION                     entrypoint not found
+META.FLAGSUSAGE                        Flags must match usage
+META.FORCECASEONSWITCH                 Attribute forcecase only works for switch
+META.FUNCTIONANNOTATION                Cannot find function annotation for %0
+META.GLCNOTONAPPENDCONSUME             globallycoherent cannot be used with append/consume buffers
+META.INTEGERINTERPMODE                 Interpolation mode on integer must be Constant
+META.INTERPMODEINONEROW                Interpolation mode must be identical for all elements packed into the same row.
+META.INTERPMODEVALID                   Interpolation mode must be valid
+META.INVALIDCONTROLFLOWHINT            Invalid control flow hint
+META.KNOWN                             Named metadata should be known
+META.MAXTESSFACTOR                     Hull Shader MaxTessFactor must be [%0..%1].  %2 specified
+META.NOSEMANTICOVERLAP                 Semantics must not overlap
+META.REQUIRED                          TODO - Required metadata missing
+META.SEMAKINDMATCHESNAME               Semantic name must match system value, when defined.
+META.SEMAKINDVALID                     Semantic kind must be valid
+META.SEMANTICCOMPTYPE                  %0 must be %1
+META.SEMANTICINDEXMAX                  System value semantics have a maximum valid semantic index
+META.SEMANTICLEN                       Semantic length must be at least 1 and at most 64
+META.SEMANTICSHOULDBEALLOCATED         Semantic should have a valid packing location
+META.SEMANTICSHOULDNOTBEALLOCATED      Semantic should have a packing location of -1
+META.SIGNATURECOMPTYPE                 signature %0 specifies unrecognized or invalid component type
+META.SIGNATUREILLEGALCOMPONENTORDER    Component ordering for packed elements must be: arbitrary < system value < system generated value
+META.SIGNATUREINDEXCONFLICT            Only elements with compatible indexing rules may be packed together
+META.SIGNATUREOUTOFRANGE               Signature elements must fit within maximum signature size
+META.SIGNATUREOVERLAP                  Signature elements may not overlap in packing location.
+META.STRUCTBUFALIGNMENT                StructuredBuffer stride not aligned
+META.STRUCTBUFALIGNMENTOUTOFBOUND      StructuredBuffer stride out of bounds
+META.SYSTEMVALUEROWS                   System value may only have 1 row
+META.TARGET                            Target triple must be 'dxil-ms-dx'
+META.TESSELLATOROUTPUTPRIMITIVE        Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW.
+META.TESSELLATORPARTITION              Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even.
+META.TEXTURETYPE                       elements of typed buffers and textures must fit in four 32-bit quantities
+META.USED                              All metadata must be used by dxil
+META.VALIDSAMPLERMODE                  Invalid sampler mode on sampler
+META.VALUERANGE                        Metadata value must be within range
+META.WELLFORMED                        TODO - Metadata must be well-formed in operand count and types
+SM.APPENDANDCONSUMEONSAMEUAV           BufferUpdateCounter inc and dec on a given UAV (%d) cannot both be in the same shader for shader model less than 5.1.
+SM.CBUFFERELEMENTOVERFLOW              CBuffer elements must not overflow
+SM.CBUFFEROFFSETOVERLAP                CBuffer offsets must not overlap
+SM.CBUFFERTEMPLATETYPEMUSTBESTRUCT     D3D12 constant/texture buffer template element can only be a struct
+SM.COMPLETEPOSITION                    Not all elements of SV_Position were written
+SM.COUNTERONLYONSTRUCTBUF              BufferUpdateCounter valid only on structured buffers
+SM.CSNORETURN                          Compute shaders can't return values, outputs must be written in writable resources (UAVs).
+SM.DOMAINLOCATIONIDXOOB                DomainLocation component index out of bounds for the domain.
+SM.DSINPUTCONTROLPOINTCOUNTRANGE       DS input control point count must be [0..%0].  %1 specified
+SM.DXILVERSION                         Target shader model requires specific Dxil Version
+SM.GSINSTANCECOUNTRANGE                GS instance count must be [1..%0].  %1 specified
+SM.GSOUTPUTVERTEXCOUNTRANGE            GS output vertex count must be [0..%0].  %1 specified
+SM.GSTOTALOUTPUTVERTEXDATARANGE        Declared output vertex count (%0) multiplied by the total number of declared scalar components of output data (%1) equals %2.  This value cannot be greater than %3
+SM.GSVALIDINPUTPRIMITIVE               GS input primitive unrecognized
+SM.GSVALIDOUTPUTPRIMITIVETOPOLOGY      GS output primitive topology unrecognized
+SM.HSINPUTCONTROLPOINTCOUNTRANGE       HS input control point count must be [0..%0].  %1 specified
+SM.HULLPASSTHRUCONTROLPOINTCOUNTMATCH  For pass thru hull shader, input control point count must match output control point count
+SM.INSIDETESSFACTORSIZEMATCHDOMAIN     InsideTessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.
+SM.INVALIDRESOURCECOMPTYPE             Invalid resource return type
+SM.INVALIDRESOURCEKIND                 Invalid resources kind
+SM.INVALIDTEXTUREKINDONUAV             Texture2DMS[Array] or TextureCube[Array] resources are not supported with UAVs
+SM.ISOLINEOUTPUTPRIMITIVEMISMATCH      Hull Shader declared with IsoLine Domain must specify output primitive point or line. Triangle_cw or triangle_ccw output are not compatible with the IsoLine Domain.
+SM.MAXTGSMSIZE                         Total Thread Group Shared Memory storage is %0, exceeded %1
+SM.MAXTHEADGROUP                       Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1
+SM.MULTISTREAMMUSTBEPOINT              When multiple GS output streams are used they must be pointlists
+SM.NAME                                Target shader model name must be known
+SM.NOINTERPMODE                        Interpolation mode must be undefined for VS input/PS output/patch constant.
+SM.NOPSOUTPUTIDX                       Pixel shader output registers are not indexable.
+SM.OPCODE                              Opcode must be defined in target shader model
+SM.OPCODEININVALIDFUNCTION             Invalid DXIL opcode usage like StorePatchConstant in patch constant function
+SM.OPERAND                             Operand must be defined in target shader model
+SM.OUTPUTCONTROLPOINTCOUNTRANGE        output control point count must be [0..%0].  %1 specified
+SM.OUTPUTCONTROLPOINTSTOTALSCALARS     Total number of scalars across all HS output control points must not exceed
+SM.PATCHCONSTANTONLYFORHSDS            patch constant signature only valid in HS and DS
+SM.PSCONSISTENTINTERP                  Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE and not running at sample frequency (which is forced by inputting SV_SampleIndex or declaring an input linear_sample or linear_noperspective_sample)
+SM.PSCOVERAGEANDINNERCOVERAGE          InnerCoverage and Coverage are mutually exclusive.
+SM.PSMULTIPLEDEPTHSEMANTIC             Pixel Shader only allows one type of depth semantic to be declared
+SM.PSOUTPUTSEMANTIC                    Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found
+SM.PSTARGETCOL0                        SV_Target packed location must start at column 0
+SM.PSTARGETINDEXMATCHESROW             SV_Target semantic index must match packed row location
+SM.RESOURCERANGEOVERLAP                Resource ranges must not overlap
+SM.ROVONLYINPS                         RasterizerOrdered objects are only allowed in 5.0+ pixel shaders
+SM.SAMPLECOUNTONLYON2DMS               Only Texture2DMS/2DMSArray could has sample count
+SM.SEMANTIC                            Semantic must be defined in target shader model
+SM.STREAMINDEXRANGE                    Stream index (%0) must between 0 and %1
+SM.TESSFACTORFORDOMAIN                 Required TessFactor for domain not found declared anywhere in Patch Constant data
+SM.TESSFACTORSIZEMATCHDOMAIN           TessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.
+SM.THREADGROUPCHANNELRANGE             Declared Thread Group %0 size %1 outside valid range [%2..%3]
+SM.TRIOUTPUTPRIMITIVEMISMATCH          Hull Shader declared with Tri Domain must specify output primitive point, triangle_cw or triangle_ccw. Line output is not compatible with the Tri domain
+SM.UNDEFINEDOUTPUT                     Not all elements of output %0 were written
+SM.VALIDDOMAIN                         Invalid Tessellator Domain specified. Must be isoline, tri or quad
+SM.VIEWIDNEEDSSLOT                     ViewID requires compatible space in pixel shader input signature
+SM.ZEROHSINPUTCONTROLPOINTWITHINPUT    When HS input control point count is 0, no input signature should exist
+TYPES.DEFINED                          Type must be defined based on DXIL primitives
+TYPES.I8                               I8 can only used as immediate value for intrinsic
+TYPES.INTWIDTH                         Int type must be of valid width
+TYPES.NOMULTIDIM                       Only one dimension allowed for array type
+TYPES.NOVECTOR                         Vector types must not be present
+UNI.NOWAVESENSITIVEGRADIENT            Gradient operations are not affected by wave-sensitive data or control flow.
+====================================== =======================================================================================================================================================================================================================================================================================================
 
 
 .. VALRULES-RST:END
 .. VALRULES-RST:END
 
 

+ 5 - 12
include/dxc/HLSL/DxilConstants.h

@@ -149,6 +149,7 @@ namespace DXIL {
     TessFactor,
     TessFactor,
     InsideTessFactor,
     InsideTessFactor,
     ViewID,
     ViewID,
+    Barycentrics,
     Invalid,
     Invalid,
   };
   };
   // SemanticKind-ENUM:END
   // SemanticKind-ENUM:END
@@ -313,7 +314,7 @@ namespace DXIL {
     GSInstanceID = 100, // GSInstanceID
     GSInstanceID = 100, // GSInstanceID
   
   
     // Graphics shader
     // Graphics shader
-    ViewID = 142, // returns the view index
+    ViewID = 138, // returns the view index
   
   
     // Hull shader
     // Hull shader
     OutputControlPointID = 107, // OutputControlPointID
     OutputControlPointID = 107, // OutputControlPointID
@@ -328,11 +329,7 @@ namespace DXIL {
     CycleCounterLegacy = 109, // CycleCounterLegacy
     CycleCounterLegacy = 109, // CycleCounterLegacy
   
   
     // Pixel shader
     // Pixel shader
-    AttributeAtVertex = 141, // returns the values of the attributes at the vertex.
-    Barycentrics = 137, // return weights at a current location.
-    BarycentricsCentroid = 138, // return weights at centroid location.
-    BarycentricsSampleIndex = 139, // return weights at the location of the sample specified by index
-    BarycentricsSnapped = 140, // return weights at the location specified in the pixel's 16x16 sample grid
+    AttributeAtVertex = 137, // returns the values of the attributes at the vertex.
     CalculateLOD = 81, // calculates the level of detail
     CalculateLOD = 81, // calculates the level of detail
     Coverage = 91, // returns the coverage mask input in a pixel shader
     Coverage = 91, // returns the coverage mask input in a pixel shader
     DerivCoarseX = 83, // computes the rate of change per stamp in x direction.
     DerivCoarseX = 83, // computes the rate of change per stamp in x direction.
@@ -455,7 +452,7 @@ namespace DXIL {
   
   
     NumOpCodes_Dxil_1_0 = 137,
     NumOpCodes_Dxil_1_0 = 137,
   
   
-    NumOpCodes = 143 // exclusive last value of enumeration
+    NumOpCodes = 139 // exclusive last value of enumeration
   };
   };
   // OPCODE-ENUM:END
   // OPCODE-ENUM:END
 
 
@@ -531,10 +528,6 @@ namespace DXIL {
   
   
     // Pixel shader
     // Pixel shader
     AttributeAtVertex,
     AttributeAtVertex,
-    Barycentrics,
-    BarycentricsCentroid,
-    BarycentricsSampleIndex,
-    BarycentricsSnapped,
     CalculateLOD,
     CalculateLOD,
     Coverage,
     Coverage,
     Discard,
     Discard,
@@ -616,7 +609,7 @@ namespace DXIL {
   
   
     NumOpClasses_Dxil_1_0 = 93,
     NumOpClasses_Dxil_1_0 = 93,
   
   
-    NumOpClasses = 99 // exclusive last value of enumeration
+    NumOpClasses = 95 // exclusive last value of enumeration
   };
   };
   // OPCODECLASS-ENUM:END
   // OPCODECLASS-ENUM:END
 
 

+ 2 - 1
include/dxc/HLSL/DxilContainer.h

@@ -166,7 +166,8 @@ enum class DxilProgramSigSemantic : uint32_t {
   DepthGE = 67,
   DepthGE = 67,
   DepthLE = 68,
   DepthLE = 68,
   StencilRef = 69,
   StencilRef = 69,
-  InnerCoverage = 70
+  InnerCoverage = 70,
+  Barycentrics = 71
 };
 };
 
 
 enum class DxilProgramSigCompType : uint32_t {
 enum class DxilProgramSigCompType : uint32_t {

+ 0 - 75
include/dxc/HLSL/DxilInstructions.h

@@ -3348,81 +3348,6 @@ struct DxilInst_WavePrefixBitCount {
   llvm::Value *get_value() const { return Instr->getOperand(1); }
   llvm::Value *get_value() const { return Instr->getOperand(1); }
 };
 };
 
 
-/// This instruction return weights at a current location.
-struct DxilInst_Barycentrics {
-  const llvm::Instruction *Instr;
-  // Construction and identification
-  DxilInst_Barycentrics(llvm::Instruction *pInstr) : Instr(pInstr) {}
-  operator bool() const {
-    return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Barycentrics);
-  }
-  // Validation support
-  bool isAllowed() const { return true; }
-  bool isArgumentListValid() const {
-    if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
-    return true;
-  }
-  // Accessors
-  llvm::Value *get_VertexID() const { return Instr->getOperand(1); }
-};
-
-/// This instruction return weights at centroid location.
-struct DxilInst_BarycentricsCentroid {
-  const llvm::Instruction *Instr;
-  // Construction and identification
-  DxilInst_BarycentricsCentroid(llvm::Instruction *pInstr) : Instr(pInstr) {}
-  operator bool() const {
-    return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BarycentricsCentroid);
-  }
-  // Validation support
-  bool isAllowed() const { return true; }
-  bool isArgumentListValid() const {
-    if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
-    return true;
-  }
-  // Accessors
-  llvm::Value *get_VertexID() const { return Instr->getOperand(1); }
-};
-
-/// This instruction return weights at the location of the sample specified by index
-struct DxilInst_BarycentricsSampleIndex {
-  const llvm::Instruction *Instr;
-  // Construction and identification
-  DxilInst_BarycentricsSampleIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
-  operator bool() const {
-    return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BarycentricsSampleIndex);
-  }
-  // Validation support
-  bool isAllowed() const { return true; }
-  bool isArgumentListValid() const {
-    if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
-    return true;
-  }
-  // Accessors
-  llvm::Value *get_VertexID() const { return Instr->getOperand(1); }
-  llvm::Value *get_sampleIndex() const { return Instr->getOperand(2); }
-};
-
-/// This instruction return weights at the location specified in the pixel's 16x16 sample grid
-struct DxilInst_BarycentricsSnapped {
-  const llvm::Instruction *Instr;
-  // Construction and identification
-  DxilInst_BarycentricsSnapped(llvm::Instruction *pInstr) : Instr(pInstr) {}
-  operator bool() const {
-    return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BarycentricsSnapped);
-  }
-  // Validation support
-  bool isAllowed() const { return true; }
-  bool isArgumentListValid() const {
-    if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
-    return true;
-  }
-  // Accessors
-  llvm::Value *get_VertexID() const { return Instr->getOperand(1); }
-  llvm::Value *get_offsetX() const { return Instr->getOperand(2); }
-  llvm::Value *get_offsetY() const { return Instr->getOperand(3); }
-};
-
 /// This instruction returns the values of the attributes at the vertex.
 /// This instruction returns the values of the attributes at the vertex.
 struct DxilInst_AttributeAtVertex {
 struct DxilInst_AttributeAtVertex {
   const llvm::Instruction *Instr;
   const llvm::Instruction *Instr;

+ 3 - 0
include/dxc/HLSL/DxilValidation.h

@@ -48,6 +48,7 @@ enum class ValidationRule : unsigned {
 
 
   // Instruction
   // Instruction
   InstrAllowed, // Instructions must be of an allowed type
   InstrAllowed, // Instructions must be of an allowed type
+  InstrAttributeAtVertexNoInterpolation, // Attribute %0 must have nointerpolation mode in order to use GetAttributeAtVertex function.
   InstrBarrierModeForNonCS, // sync in a non-Compute Shader must only sync UAV (sync_uglobal)
   InstrBarrierModeForNonCS, // sync in a non-Compute Shader must only sync UAV (sync_uglobal)
   InstrBarrierModeNoMemory, // sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory).  Only _t (thread group sync) is optional. 
   InstrBarrierModeNoMemory, // sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory).  Only _t (thread group sync) is optional. 
   InstrBarrierModeUselessUGroup, // sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.
   InstrBarrierModeUselessUGroup, // sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.
@@ -114,6 +115,8 @@ enum class ValidationRule : unsigned {
   InstrWriteMaskMatchValueForUAVStore, // uav store write mask must match store value mask, write mask is %0 and store value mask is %1
   InstrWriteMaskMatchValueForUAVStore, // uav store write mask must match store value mask, write mask is %0 and store value mask is %1
 
 
   // Metadata
   // Metadata
+  MetaBarycentricsFloat3, // only 'float3' type is allowed for SV_Barycentrics.
+  MetaBarycentricsInterpolation, // SV_Barycentrics cannot be used with 'nointerpolation' type
   MetaBranchFlatten, // Can't use branch and flatten attributes together
   MetaBranchFlatten, // Can't use branch and flatten attributes together
   MetaClipCullMaxComponents, // Combined elements of SV_ClipDistance and SV_CullDistance must fit in 8 components
   MetaClipCullMaxComponents, // Combined elements of SV_ClipDistance and SV_CullDistance must fit in 8 components
   MetaClipCullMaxRows, // Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows.
   MetaClipCullMaxRows, // Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows.

+ 0 - 4
include/dxc/HlslIntrinsicOp.h

@@ -32,10 +32,6 @@ import hctdb_instrhelp
   IOP_EvaluateAttributeCentroid,
   IOP_EvaluateAttributeCentroid,
   IOP_EvaluateAttributeSnapped,
   IOP_EvaluateAttributeSnapped,
   IOP_GetAttributeAtVertex,
   IOP_GetAttributeAtVertex,
-  IOP_GetBarycentrics,
-  IOP_GetBarycentricsAtSample,
-  IOP_GetBarycentricsCentroid,
-  IOP_GetBarycentricsSnapped,
   IOP_GetRenderTargetSampleCount,
   IOP_GetRenderTargetSampleCount,
   IOP_GetRenderTargetSamplePosition,
   IOP_GetRenderTargetSamplePosition,
   IOP_GroupMemoryBarrier,
   IOP_GroupMemoryBarrier,

+ 1 - 0
lib/HLSL/DxilContainerAssembler.cpp

@@ -44,6 +44,7 @@ static DxilProgramSigSemantic KindToSystemValue(Semantic::Kind kind, DXIL::Tesse
   case Semantic::Kind::ViewPortArrayIndex: return DxilProgramSigSemantic::ViewPortArrayIndex;
   case Semantic::Kind::ViewPortArrayIndex: return DxilProgramSigSemantic::ViewPortArrayIndex;
   case Semantic::Kind::ClipDistance: return DxilProgramSigSemantic::ClipDistance;
   case Semantic::Kind::ClipDistance: return DxilProgramSigSemantic::ClipDistance;
   case Semantic::Kind::CullDistance: return DxilProgramSigSemantic::CullDistance;
   case Semantic::Kind::CullDistance: return DxilProgramSigSemantic::CullDistance;
+  case Semantic::Kind::Barycentrics: return DxilProgramSigSemantic::Barycentrics;
   case Semantic::Kind::TessFactor: {
   case Semantic::Kind::TessFactor: {
     switch (domain) {
     switch (domain) {
     case DXIL::TessellatorDomain::IsoLine:
     case DXIL::TessellatorDomain::IsoLine:

+ 0 - 12
lib/HLSL/DxilOperations.cpp

@@ -240,10 +240,6 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = {
   {  OC::WavePrefixBitCount,      "WavePrefixBitCount",       OCC::WavePrefixOp,             "wavePrefixOp",                true, false, false, false, false, false, false, false, false, Attribute::None,     },
   {  OC::WavePrefixBitCount,      "WavePrefixBitCount",       OCC::WavePrefixOp,             "wavePrefixOp",                true, false, false, false, false, false, false, false, false, Attribute::None,     },
 
 
   // Pixel shader                                                                                                           void,     h,     f,     d,    i1,    i8,   i16,   i32,   i64  function attribute
   // Pixel shader                                                                                                           void,     h,     f,     d,    i1,    i8,   i16,   i32,   i64  function attribute
-  {  OC::Barycentrics,            "Barycentrics",             OCC::Barycentrics,             "barycentrics",               false, false,  true, false, false, false, false, false, false, Attribute::ReadNone, },
-  {  OC::BarycentricsCentroid,    "BarycentricsCentroid",     OCC::BarycentricsCentroid,     "barycentricsCentroid",       false, false,  true, false, false, false, false, false, false, Attribute::ReadNone, },
-  {  OC::BarycentricsSampleIndex, "BarycentricsSampleIndex",  OCC::BarycentricsSampleIndex,  "barycentricsSampleIndex",    false, false,  true, false, false, false, false, false, false, Attribute::ReadNone, },
-  {  OC::BarycentricsSnapped,     "BarycentricsSnapped",      OCC::BarycentricsSnapped,      "barycentricsSnapped",        false, false,  true, false, false, false, false, false, false, Attribute::ReadNone, },
   {  OC::AttributeAtVertex,       "AttributeAtVertex",        OCC::AttributeAtVertex,        "attributeAtVertex",          false,  true,  true, false, false, false, false, false, false, Attribute::ReadNone, },
   {  OC::AttributeAtVertex,       "AttributeAtVertex",        OCC::AttributeAtVertex,        "attributeAtVertex",          false,  true,  true, false, false, false, false, false, false, Attribute::ReadNone, },
 
 
   // Graphics shader                                                                                                        void,     h,     f,     d,    i1,    i8,   i16,   i32,   i64  function attribute
   // Graphics shader                                                                                                        void,     h,     f,     d,    i1,    i8,   i16,   i32,   i64  function attribute
@@ -699,10 +695,6 @@ Function *OP::GetOpFunc(OpCode OpCode, Type *pOverloadType) {
   case OpCode::WavePrefixBitCount:     A(pI32);     A(pI32); A(pI1);  break;
   case OpCode::WavePrefixBitCount:     A(pI32);     A(pI32); A(pI1);  break;
 
 
     // Pixel shader
     // Pixel shader
-  case OpCode::Barycentrics:           A(pF32);     A(pI32); A(pI8);  break;
-  case OpCode::BarycentricsCentroid:   A(pF32);     A(pI32); A(pI8);  break;
-  case OpCode::BarycentricsSampleIndex:A(pF32);     A(pI32); A(pI8);  A(pI32); break;
-  case OpCode::BarycentricsSnapped:    A(pF32);     A(pI32); A(pI8);  A(pI32); A(pI32); break;
   case OpCode::AttributeAtVertex:      A(pETy);     A(pI32); A(pI32); A(pI32); A(pI8);  A(pI8);  break;
   case OpCode::AttributeAtVertex:      A(pETy);     A(pI32); A(pI32); A(pI32); A(pI8);  A(pI8);  break;
 
 
     // Graphics shader
     // Graphics shader
@@ -841,10 +833,6 @@ llvm::Type *OP::GetOverloadType(OpCode OpCode, llvm::Function *F) {
     return IntegerType::get(m_Ctx, 32);
     return IntegerType::get(m_Ctx, 32);
   case OpCode::CalculateLOD:
   case OpCode::CalculateLOD:
   case OpCode::DomainLocation:
   case OpCode::DomainLocation:
-  case OpCode::Barycentrics:
-  case OpCode::BarycentricsCentroid:
-  case OpCode::BarycentricsSampleIndex:
-  case OpCode::BarycentricsSnapped:
     return Type::getFloatTy(m_Ctx);
     return Type::getFloatTy(m_Ctx);
   case OpCode::MakeDouble:
   case OpCode::MakeDouble:
   case OpCode::SplitDouble:
   case OpCode::SplitDouble:

+ 1 - 0
lib/HLSL/DxilSemantic.cpp

@@ -149,6 +149,7 @@ const Semantic Semantic::ms_SemanticTable[kNumSemanticRecords] = {
   SP(Kind::TessFactor,            "SV_TessFactor"),
   SP(Kind::TessFactor,            "SV_TessFactor"),
   SP(Kind::InsideTessFactor,      "SV_InsideTessFactor"),
   SP(Kind::InsideTessFactor,      "SV_InsideTessFactor"),
   SP(Kind::ViewID,                "SV_ViewID"),
   SP(Kind::ViewID,                "SV_ViewID"),
+  SP(Kind::Barycentrics,          "SV_Barycentrics"),
   SP(Kind::Invalid,               nullptr),
   SP(Kind::Invalid,               nullptr),
 };
 };
 
 

+ 30 - 29
lib/HLSL/DxilSigPoint.cpp

@@ -56,36 +56,37 @@ const SigPoint SigPoint::ms_SigPoints[kNumSigPointRecords] = {
 
 
 // <py::lines('INTERPRETATION-TABLE')>hctdb_instrhelp.get_interpretation_table()</py>
 // <py::lines('INTERPRETATION-TABLE')>hctdb_instrhelp.get_interpretation_table()</py>
 // INTERPRETATION-TABLE:BEGIN
 // INTERPRETATION-TABLE:BEGIN
-//   Semantic,               VSIn,         VSOut, PCIn,         HSIn,         HSCPIn, HSCPOut, PCOut,      DSIn,         DSCPIn, DSOut, GSVIn, GSIn,         GSOut, PSIn,         PSOut,         CSIn
+//   Semantic,               VSIn,         VSOut, PCIn,         HSIn,         HSCPIn, HSCPOut, PCOut,      DSIn,         DSCPIn, DSOut, GSVIn, GSIn,         GSOut, PSIn,          PSOut,         CSIn
 #define DO_INTERPRETATION_TABLE(DO) \
 #define DO_INTERPRETATION_TABLE(DO) \
-  DO(Arbitrary,              Arb,          Arb,   NA,           NA,           Arb,    Arb,     Arb,        Arb,          Arb,    Arb,   Arb,   NA,           Arb,   Arb,          NA,            NA) \
-  DO(VertexID,               SV,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NA,            NA) \
-  DO(InstanceID,             SV,           Arb,   NA,           NA,           Arb,    Arb,     NA,         NA,           Arb,    Arb,   Arb,   NA,           Arb,   Arb,          NA,            NA) \
-  DO(Position,               Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,           NA,            NA) \
-  DO(RenderTargetArrayIndex, Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,           NA,            NA) \
-  DO(ViewPortArrayIndex,     Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,           NA,            NA) \
-  DO(ClipDistance,           Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,           NA,            NA) \
-  DO(CullDistance,           Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,           NA,            NA) \
-  DO(OutputControlPointID,   NA,           NA,    NA,           NotInSig,     NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NA,            NA) \
-  DO(DomainLocation,         NA,           NA,    NA,           NA,           NA,     NA,      NA,         NotInSig,     NA,     NA,    NA,    NA,           NA,    NA,           NA,            NA) \
-  DO(PrimitiveID,            NA,           NA,    NotInSig,     NotInSig,     NA,     NA,      NA,         NotInSig,     NA,     NA,    NA,    Shadow,       SGV,   SGV,          NA,            NA) \
-  DO(GSInstanceID,           NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NotInSig,     NA,    NA,           NA,            NA) \
-  DO(SampleIndex,            NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    Shadow _41,   NA,            NA) \
-  DO(IsFrontFace,            NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           SGV,   SGV,          NA,            NA) \
-  DO(Coverage,               NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NotInSig _50, NotPacked _41, NA) \
-  DO(InnerCoverage,          NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NotInSig _50, NA,            NA) \
-  DO(Target,                 NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           Target,        NA) \
-  DO(Depth,                  NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NotPacked,     NA) \
-  DO(DepthLessEqual,         NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NotPacked _50, NA) \
-  DO(DepthGreaterEqual,      NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NotPacked _50, NA) \
-  DO(StencilRef,             NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NotPacked _50, NA) \
-  DO(DispatchThreadID,       NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NA,            NotInSig) \
-  DO(GroupID,                NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NA,            NotInSig) \
-  DO(GroupIndex,             NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NA,            NotInSig) \
-  DO(GroupThreadID,          NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,           NA,            NotInSig) \
-  DO(TessFactor,             NA,           NA,    NA,           NA,           NA,     NA,      TessFactor, TessFactor,   NA,     NA,    NA,    NA,           NA,    NA,           NA,            NA) \
-  DO(InsideTessFactor,       NA,           NA,    NA,           NA,           NA,     NA,      TessFactor, TessFactor,   NA,     NA,    NA,    NA,           NA,    NA,           NA,            NA) \
-  DO(ViewID,                 NotInSig _61, NA,    NotInSig _61, NotInSig _61, NA,     NA,      NA,         NotInSig _61, NA,     NA,    NA,    NotInSig _61, NA,    NotInSig _61, NA,            NA)
+  DO(Arbitrary,              Arb,          Arb,   NA,           NA,           Arb,    Arb,     Arb,        Arb,          Arb,    Arb,   Arb,   NA,           Arb,   Arb,           NA,            NA) \
+  DO(VertexID,               SV,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NA,            NA) \
+  DO(InstanceID,             SV,           Arb,   NA,           NA,           Arb,    Arb,     NA,         NA,           Arb,    Arb,   Arb,   NA,           Arb,   Arb,           NA,            NA) \
+  DO(Position,               Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,            NA,            NA) \
+  DO(RenderTargetArrayIndex, Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,            NA,            NA) \
+  DO(ViewPortArrayIndex,     Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,            NA,            NA) \
+  DO(ClipDistance,           Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,            NA,            NA) \
+  DO(CullDistance,           Arb,          SV,    NA,           NA,           SV,     SV,      Arb,        Arb,          SV,     SV,    SV,    NA,           SV,    SV,            NA,            NA) \
+  DO(OutputControlPointID,   NA,           NA,    NA,           NotInSig,     NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NA,            NA) \
+  DO(DomainLocation,         NA,           NA,    NA,           NA,           NA,     NA,      NA,         NotInSig,     NA,     NA,    NA,    NA,           NA,    NA,            NA,            NA) \
+  DO(PrimitiveID,            NA,           NA,    NotInSig,     NotInSig,     NA,     NA,      NA,         NotInSig,     NA,     NA,    NA,    Shadow,       SGV,   SGV,           NA,            NA) \
+  DO(GSInstanceID,           NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NotInSig,     NA,    NA,            NA,            NA) \
+  DO(SampleIndex,            NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    Shadow _41,    NA,            NA) \
+  DO(IsFrontFace,            NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           SGV,   SGV,           NA,            NA) \
+  DO(Coverage,               NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NotInSig _50,  NotPacked _41, NA) \
+  DO(InnerCoverage,          NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NotInSig _50,  NA,            NA) \
+  DO(Target,                 NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            Target,        NA) \
+  DO(Depth,                  NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NotPacked,     NA) \
+  DO(DepthLessEqual,         NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NotPacked _50, NA) \
+  DO(DepthGreaterEqual,      NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NotPacked _50, NA) \
+  DO(StencilRef,             NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NotPacked _50, NA) \
+  DO(DispatchThreadID,       NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NA,            NotInSig) \
+  DO(GroupID,                NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NA,            NotInSig) \
+  DO(GroupIndex,             NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NA,            NotInSig) \
+  DO(GroupThreadID,          NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NA,            NA,            NotInSig) \
+  DO(TessFactor,             NA,           NA,    NA,           NA,           NA,     NA,      TessFactor, TessFactor,   NA,     NA,    NA,    NA,           NA,    NA,            NA,            NA) \
+  DO(InsideTessFactor,       NA,           NA,    NA,           NA,           NA,     NA,      TessFactor, TessFactor,   NA,     NA,    NA,    NA,           NA,    NA,            NA,            NA) \
+  DO(ViewID,                 NotInSig _61, NA,    NotInSig _61, NotInSig _61, NA,     NA,      NA,         NotInSig _61, NA,     NA,    NA,    NotInSig _61, NA,    NotInSig _61,  NA,            NA) \
+  DO(Barycentrics,           NA,           NA,    NA,           NA,           NA,     NA,      NA,         NA,           NA,     NA,    NA,    NA,           NA,    NotPacked _61, NA,            NA)
 // INTERPRETATION-TABLE:END
 // INTERPRETATION-TABLE:END
 
 
 const VersionedSemanticInterpretation SigPoint::ms_SemanticInterpretationTable[(unsigned)DXIL::SemanticKind::Invalid][(unsigned)SigPoint::Kind::Invalid] = {
 const VersionedSemanticInterpretation SigPoint::ms_SemanticInterpretationTable[(unsigned)DXIL::SemanticKind::Invalid][(unsigned)SigPoint::Kind::Invalid] = {

+ 37 - 5
lib/HLSL/DxilValidation.cpp

@@ -105,6 +105,8 @@ const char *hlsl::GetValidationRuleText(ValidationRule value) {
     case hlsl::ValidationRule::MetaForceCaseOnSwitch: return "Attribute forcecase only works for switch";
     case hlsl::ValidationRule::MetaForceCaseOnSwitch: return "Attribute forcecase only works for switch";
     case hlsl::ValidationRule::MetaControlFlowHintNotOnControlFlow: return "Control flow hint only works on control flow inst";
     case hlsl::ValidationRule::MetaControlFlowHintNotOnControlFlow: return "Control flow hint only works on control flow inst";
     case hlsl::ValidationRule::MetaTextureType: return "elements of typed buffers and textures must fit in four 32-bit quantities";
     case hlsl::ValidationRule::MetaTextureType: return "elements of typed buffers and textures must fit in four 32-bit quantities";
+    case hlsl::ValidationRule::MetaBarycentricsInterpolation: return "SV_Barycentrics cannot be used with 'nointerpolation' type";
+    case hlsl::ValidationRule::MetaBarycentricsFloat3: return "only 'float3' type is allowed for SV_Barycentrics.";
     case hlsl::ValidationRule::InstrOload: return "DXIL intrinsic overload must be valid";
     case hlsl::ValidationRule::InstrOload: return "DXIL intrinsic overload must be valid";
     case hlsl::ValidationRule::InstrCallOload: return "Call to DXIL intrinsic '%0' does not match an allowed overload signature";
     case hlsl::ValidationRule::InstrCallOload: return "Call to DXIL intrinsic '%0' does not match an allowed overload signature";
     case hlsl::ValidationRule::InstrPtrBitCast: return "Pointer type bitcast must be have same size";
     case hlsl::ValidationRule::InstrPtrBitCast: return "Pointer type bitcast must be have same size";
@@ -170,6 +172,7 @@ const char *hlsl::GetValidationRuleText(ValidationRule value) {
     case hlsl::ValidationRule::InstrFailToResloveTGSMPointer: return "TGSM pointers must originate from an unambiguous TGSM global variable.";
     case hlsl::ValidationRule::InstrFailToResloveTGSMPointer: return "TGSM pointers must originate from an unambiguous TGSM global variable.";
     case hlsl::ValidationRule::InstrExtractValue: return "ExtractValue should only be used on dxil struct types and cmpxchg";
     case hlsl::ValidationRule::InstrExtractValue: return "ExtractValue should only be used on dxil struct types and cmpxchg";
     case hlsl::ValidationRule::InstrTGSMRaceCond: return "Race condition writing to shared memory detected, consider making this write conditional";
     case hlsl::ValidationRule::InstrTGSMRaceCond: return "Race condition writing to shared memory detected, consider making this write conditional";
+    case hlsl::ValidationRule::InstrAttributeAtVertexNoInterpolation: return "Attribute %0 must have nointerpolation mode in order to use GetAttributeAtVertex function.";
     case hlsl::ValidationRule::TypesNoVector: return "Vector type '%0' is not allowed";
     case hlsl::ValidationRule::TypesNoVector: return "Vector type '%0' is not allowed";
     case hlsl::ValidationRule::TypesDefined: return "Type '%0' is not defined on DXIL primitives";
     case hlsl::ValidationRule::TypesDefined: return "Type '%0' is not defined on DXIL primitives";
     case hlsl::ValidationRule::TypesIntWidth: return "Int type '%0' has an invalid width";
     case hlsl::ValidationRule::TypesIntWidth: return "Int type '%0' has an invalid width";
@@ -586,13 +589,12 @@ static bool ValidateOpcodeInProfile(DXIL::OpCode opcode,
   // EvalCentroid=89, SampleIndex=90, Coverage=91, InnerCoverage=92
   // EvalCentroid=89, SampleIndex=90, Coverage=91, InnerCoverage=92
   if (60 <= op && op <= 61 || op == 64 || 76 <= op && op <= 77 || 81 <= op && op <= 92)
   if (60 <= op && op <= 61 || op == 64 || 76 <= op && op <= 77 || 81 <= op && op <= 92)
     return (pSM->IsPS());
     return (pSM->IsPS());
-  // Instructions: Barycentrics=137, BarycentricsCentroid=138,
-  // BarycentricsSampleIndex=139, BarycentricsSnapped=140, AttributeAtVertex=141
-  if (137 <= op && op <= 141)
+  // Instructions: AttributeAtVertex=137
+  if (op == 137)
     return (pSM->GetMajor() > 6 || (pSM->GetMajor() == 6 && pSM->GetMinor() >= 1))
     return (pSM->GetMajor() > 6 || (pSM->GetMajor() == 6 && pSM->GetMinor() >= 1))
         && (pSM->IsPS());
         && (pSM->IsPS());
-  // Instructions: ViewID=142
-  if (op == 142)
+  // Instructions: ViewID=138
+  if (op == 138)
     return (pSM->GetMajor() > 6 || (pSM->GetMajor() == 6 && pSM->GetMinor() >= 1))
     return (pSM->GetMajor() > 6 || (pSM->GetMajor() == 6 && pSM->GetMinor() >= 1))
         && (pSM->IsVS() || pSM->IsHS() || pSM->IsDS() || pSM->IsGS() || pSM->IsPS());
         && (pSM->IsVS() || pSM->IsHS() || pSM->IsDS() || pSM->IsGS() || pSM->IsPS());
   return true;
   return true;
@@ -1292,6 +1294,20 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
       }
       }
     }
     }
   } break;
   } break;
+  case DXIL::OpCode::AttributeAtVertex: {
+    Value *Attribute = CI->getArgOperand(DXIL::OperandIndex::kBinarySrc0OpIdx);
+    DxilSignature &inputSig = ValCtx.DxilMod.GetInputSignature();
+    Value *row = CI->getArgOperand(DXIL::OperandIndex::kLoadInputRowOpIdx);
+    Value *col = CI->getArgOperand(DXIL::OperandIndex::kLoadInputColOpIdx);
+    DxilSignatureElement *pSE =
+        ValidateSignatureAccess(CI, inputSig, Attribute, row, col, ValCtx);
+    if (pSE && pSE->GetInterpolationMode()->GetKind() !=
+                   hlsl::InterpolationMode::Kind::Constant) {
+      ValCtx.EmitInstrFormatError(
+          CI, ValidationRule::InstrAttributeAtVertexNoInterpolation,
+          {pSE->GetName()});
+    }
+  } break;
   case DXIL::OpCode::GetDimensions: {
   case DXIL::OpCode::GetDimensions: {
     DxilInst_GetDimensions getDim(CI);
     DxilInst_GetDimensions getDim(CI);
     Value *handle = getDim.get_handle();
     Value *handle = getDim.get_handle();
@@ -3259,6 +3275,22 @@ static void ValidateSignatureElement(DxilSignatureElement &SE,
   case DXIL::SemanticKind::Invalid:
   case DXIL::SemanticKind::Invalid:
     DXASSERT(!bAllowedInSig, "else internal inconsistency between semantic interpretation table and validation code");
     DXASSERT(!bAllowedInSig, "else internal inconsistency between semantic interpretation table and validation code");
     break;
     break;
+  case DXIL::SemanticKind::Barycentrics:
+    if (compKind != DXIL::ComponentType::F32) {
+      ValCtx.EmitFormatError(ValidationRule::MetaSemanticCompType, {SE.GetSemantic()->GetName(), "float"});
+    }
+    if (Mode != InterpolationMode::Kind::Linear &&
+        Mode != InterpolationMode::Kind::LinearCentroid &&
+        Mode != InterpolationMode::Kind::LinearNoperspective &&
+        Mode != InterpolationMode::Kind::LinearNoperspectiveCentroid &&
+        Mode != InterpolationMode::Kind::LinearNoperspectiveSample &&
+        Mode != InterpolationMode::Kind::LinearSample) {
+      ValCtx.EmitSignatureError(&SE, ValidationRule::MetaBarycentricsInterpolation);
+    }
+    if (SE.GetCols() != 3) {
+      ValCtx.EmitSignatureError(&SE, ValidationRule::MetaBarycentricsFloat3);
+    }
+    break;
   default:
   default:
     ValCtx.EmitSignatureError(&SE, ValidationRule::MetaSemaKindValid);
     ValCtx.EmitSignatureError(&SE, ValidationRule::MetaSemaKindValid);
     break;
     break;

+ 0 - 65
lib/HLSL/HLOperationLower.cpp

@@ -742,67 +742,6 @@ Value *TranslateEvalCentroid(CallInst *CI, IntrinsicOp IOP, OP::OpCode op,
   return result;
   return result;
 }
 }
 
 
-// Barycentrics intrinsics
-Value *TranslateBarycentrics(CallInst *CI, IntrinsicOp IOP, OP::OpCode op,
-                             HLOperationLowerHelper &helper,
-                             HLObjectOperationLowerHelper *pObjHelper,
-                             bool &Translated) {
-  DXASSERT(op == OP::OpCode::Barycentrics ||
-           op == OP::OpCode::BarycentricsCentroid,
-           "Wrong opcode to translate");
-  hlsl::OP *hlslOP = &helper.hlslOP;
-  Function *evalFunc = hlslOP->GetOpFunc(op, Type::getFloatTy(CI->getContext()));
-  Value *opArg = hlslOP->GetU32Const((unsigned)op);
-
-  Value *result = UndefValue::get(CI->getType());
-  IRBuilder<> Builder(CI);
-  for (unsigned i = 0; i < 3; ++i) {
-    Value *Elt = Builder.CreateCall(evalFunc, { opArg, hlslOP->GetI8Const(i) });
-    result = Builder.CreateInsertElement(result, Elt, i);
-  }
-  return result;
-}
-
-Value *TranslateBarycentricsSample(CallInst *CI, IntrinsicOp IOP, OP::OpCode op,
-  HLOperationLowerHelper &helper,
-  HLObjectOperationLowerHelper *pObjHelper,
-  bool &Translated) {
-  DXASSERT(op == OP::OpCode::BarycentricsSampleIndex, "Wrong opcode to translate");
-  hlsl::OP *hlslOP = &helper.hlslOP;
-  Function *evalFunc = hlslOP->GetOpFunc(op, Type::getFloatTy(CI->getContext()));
-  Value *opArg = hlslOP->GetU32Const((unsigned)op);
-  Value *sampleIndex = CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx);
-
-  Value *result = UndefValue::get(CI->getType());
-  IRBuilder<> Builder(CI);
-  for (unsigned i = 0; i < 3; ++i) {
-    Value *Elt = Builder.CreateCall(evalFunc, { opArg, hlslOP->GetI8Const(i), sampleIndex });
-    result = Builder.CreateInsertElement(result, Elt, i);
-  }
-  return result;
-}
-
-Value *TranslateBarycentricsSnapped(CallInst *CI, IntrinsicOp IOP, OP::OpCode op,
-  HLOperationLowerHelper &helper,
-  HLObjectOperationLowerHelper *pObjHelper,
-  bool &Translated) {
-  DXASSERT(op == OP::OpCode::BarycentricsSnapped, "Wrong opcode to translate");
-  hlsl::OP *hlslOP = &helper.hlslOP;
-  Function *evalFunc = hlslOP->GetOpFunc(op, Type::getFloatTy(CI->getContext()));
-  Value *opArg = hlslOP->GetU32Const((unsigned)op);
-  Value *offsets = CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx);
-
-  Value *result = UndefValue::get(CI->getType());
-  IRBuilder<> Builder(CI);
-  Value *offsetX = Builder.CreateExtractElement(offsets, (uint64_t)0);
-  Value *offsetY = Builder.CreateExtractElement(offsets, 1);
-  for (unsigned i = 0; i < 3; ++i) {
-    Value *Elt = Builder.CreateCall(evalFunc, { opArg, hlslOP->GetI8Const(i), offsetX, offsetY });
-    result = Builder.CreateInsertElement(result, Elt, i);
-  }
-  return result;
-}
-
 Value *TranslateGetAttributeAtVertex(CallInst *CI, IntrinsicOp IOP, OP::OpCode op,
 Value *TranslateGetAttributeAtVertex(CallInst *CI, IntrinsicOp IOP, OP::OpCode op,
   HLOperationLowerHelper &helper,
   HLOperationLowerHelper &helper,
   HLObjectOperationLowerHelper *pObjHelper,
   HLObjectOperationLowerHelper *pObjHelper,
@@ -4125,10 +4064,6 @@ IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] =
     {IntrinsicOp::IOP_EvaluateAttributeCentroid, TranslateEvalCentroid, DXIL::OpCode::EvalCentroid},
     {IntrinsicOp::IOP_EvaluateAttributeCentroid, TranslateEvalCentroid, DXIL::OpCode::EvalCentroid},
     {IntrinsicOp::IOP_EvaluateAttributeSnapped, TranslateEvalSnapped, DXIL::OpCode::NumOpCodes},
     {IntrinsicOp::IOP_EvaluateAttributeSnapped, TranslateEvalSnapped, DXIL::OpCode::NumOpCodes},
     {IntrinsicOp::IOP_GetAttributeAtVertex, TranslateGetAttributeAtVertex, DXIL::OpCode::AttributeAtVertex},
     {IntrinsicOp::IOP_GetAttributeAtVertex, TranslateGetAttributeAtVertex, DXIL::OpCode::AttributeAtVertex},
-    {IntrinsicOp::IOP_GetBarycentrics, TranslateBarycentrics, DXIL::OpCode::Barycentrics},
-    {IntrinsicOp::IOP_GetBarycentricsAtSample, TranslateBarycentricsSample, DXIL::OpCode::BarycentricsSampleIndex},
-    {IntrinsicOp::IOP_GetBarycentricsCentroid, TranslateBarycentrics, DXIL::OpCode::BarycentricsCentroid},
-    {IntrinsicOp::IOP_GetBarycentricsSnapped, TranslateBarycentricsSnapped, DXIL::OpCode::BarycentricsSnapped},
     {IntrinsicOp::IOP_GetRenderTargetSampleCount, TrivialNoArgOperation, DXIL::OpCode::RenderTargetGetSampleCount},
     {IntrinsicOp::IOP_GetRenderTargetSampleCount, TrivialNoArgOperation, DXIL::OpCode::RenderTargetGetSampleCount},
     {IntrinsicOp::IOP_GetRenderTargetSamplePosition, TranslateGetRTSamplePos, DXIL::OpCode::NumOpCodes},
     {IntrinsicOp::IOP_GetRenderTargetSamplePosition, TranslateGetRTSamplePos, DXIL::OpCode::NumOpCodes},
     {IntrinsicOp::IOP_GroupMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier},
     {IntrinsicOp::IOP_GroupMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier},

+ 3 - 2
tools/clang/lib/CodeGen/CGHLSLMS.cpp

@@ -403,9 +403,10 @@ void CGMSHLSLRuntime::CheckParameterAnnotation(
       Semantic::GetByName(semName, sigPoint, SM->GetMajor(), SM->GetMinor());
       Semantic::GetByName(semName, sigPoint, SM->GetMajor(), SM->GetMinor());
   if (pSemantic->IsInvalid()) {
   if (pSemantic->IsInvalid()) {
     DiagnosticsEngine &Diags = CGM.getDiags();
     DiagnosticsEngine &Diags = CGM.getDiags();
+    const ShaderModel *shader = m_pHLModule->GetShaderModel();
     unsigned DiagID =
     unsigned DiagID =
-        Diags.getCustomDiagID(DiagnosticsEngine::Error, "invalid semantic '%0' for %1");
-    Diags.Report(SLoc, DiagID) << semName << m_pHLModule->GetShaderModel()->GetKindName();
+        Diags.getCustomDiagID(DiagnosticsEngine::Error, "invalid semantic '%0' for %1 %2.%3");
+    Diags.Report(SLoc, DiagID) << semName << shader->GetKindName() << shader->GetMajor() << shader->GetMinor();
   }
   }
 }
 }
 
 

File diff suppressed because it is too large
+ 128 - 150
tools/clang/lib/Sema/gen_intrin_main_tables_15.h


+ 1 - 1
tools/clang/test/CodeGenHLSL/abs1.hlsl

@@ -2,7 +2,7 @@
 
 
 // CHECK: main
 // CHECK: main
 // After lowering, these would turn into multiple abs calls rather than a 4 x float
 // After lowering, these would turn into multiple abs calls rather than a 4 x float
-// CHECK: call <4 x float> @"dx.hl.op..<4 x float> (i32, <4 x float>)"(i32 64,
+// CHECK: call <4 x float> @"dx.hl.op..<4 x float> (i32, <4 x float>)"(i32 60,
 
 
 float4 main(float4 a : A) : SV_TARGET {
 float4 main(float4 a : A) : SV_TARGET {
   return abs(a*a.yxxx);
   return abs(a*a.yxxx);

+ 13 - 13
tools/clang/test/CodeGenHLSL/attributeAtVertex.hlsl

@@ -1,19 +1,19 @@
 // RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
 // RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 0, i32 0, i8 0, i8 0)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 0, i32 0, i8 1, i8 0)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 0, i32 0, i8 2, i8 0)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 0, i32 0, i8 3, i8 0)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 1, i32 0, i8 0, i8 1)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 1, i32 0, i8 1, i8 1)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 1, i32 0, i8 2, i8 1)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 1, i32 0, i8 3, i8 1)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 2, i32 0, i8 0, i8 2)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 2, i32 0, i8 1, i8 2)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 2, i32 0, i8 2, i8 2)
-// CHECK: call float @dx.op.attributeAtVertex.f32(i32 141, i32 2, i32 0, i8 3, i8 2)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 0, i8 0)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 1, i8 0)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 2, i8 0)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 3, i8 0)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 0, i8 1)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 1, i8 1)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 2, i8 1)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 3, i8 1)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 2, i32 0, i8 0, i8 2)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 2, i32 0, i8 1, i8 2)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 2, i32 0, i8 2, i8 2)
+// CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 2, i32 0, i8 3, i8 2)
 
 
-float4 main(float4 a : A, float4 b : B, float4 c : C) : SV_Target
+float4 main(nointerpolation float4 a : A, nointerpolation float4 b : B, nointerpolation float4 c : C) : SV_Target
 {
 {
   float4 a0 = GetAttributeAtVertex(a, 0);
   float4 a0 = GetAttributeAtVertex(a, 0);
   float4 b1 = GetAttributeAtVertex(b, 1);
   float4 b1 = GetAttributeAtVertex(b, 1);

+ 3 - 17
tools/clang/test/CodeGenHLSL/barycentrics.hlsl

@@ -1,25 +1,11 @@
 // RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
 // RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
-// CHECK: call float @dx.op.barycentrics.f32
-// CHECK: call float @dx.op.barycentricsSampleIndex.f32
-// CHECK: call float @dx.op.barycentricsCentroid.f32
-// CHECK: call float @dx.op.barycentricsSnapped.f32
+// CHECK: SV_Barycentric
 
 
-float4 main(float4 a : A) : SV_Target
+float4 main(float3 bary : SV_Barycentric) : SV_Target
 {
 {
   float4 vcolor0 = float4(1,0,0,1);
   float4 vcolor0 = float4(1,0,0,1);
   float4 vcolor1 = float4(0,1,0,1);
   float4 vcolor1 = float4(0,1,0,1);
   float4 vcolor2 = float4(0,0,0,1);
   float4 vcolor2 = float4(0,0,0,1);
-
-  float3 bary = GetBarycentrics();
-  float3 barySample = GetBarycentricsAtSample(0);
-  float3 baryCentroid = GetBarycentricsCentroid();
-  float3 barySnapped = GetBarycentricsSnapped(uint2(4,10));
-
-  float4 baryColor = bary.x * vcolor0 + bary.y * vcolor1 + bary.z * vcolor2;
-  float4 barySampleColor = barySample.x * vcolor0 + barySample.y * vcolor1 + barySample.z * vcolor2;
-  float4 baryCentroidColor = baryCentroid.x * vcolor0 + baryCentroid.y * vcolor1 + baryCentroid.z * vcolor2;
-  float4 barySnappedColor = barySnapped.x * vcolor0 + barySnapped.y * vcolor1 + barySnapped.z * vcolor2;
-
-  return (baryColor + barySampleColor + baryCentroidColor + barySnappedColor) / 4;
+  return bary.x * vcolor0 + bary.y * vcolor1 + bary.z * vcolor2;
 }
 }

+ 1 - 0
tools/clang/test/HLSL/system-values.hlsl

@@ -37,6 +37,7 @@
 #define Def_OutputControlPointID DECLARE(uint ocpid : SV_OutputControlPointID) USE(uint, ocpid)
 #define Def_OutputControlPointID DECLARE(uint ocpid : SV_OutputControlPointID) USE(uint, ocpid)
 #define Def_GSInstanceID DECLARE(uint gsiid : SV_GSInstanceID) USE(uint, gsiid)
 #define Def_GSInstanceID DECLARE(uint gsiid : SV_GSInstanceID) USE(uint, gsiid)
 #define Def_ViewID DECLARE(uint viewID : SV_ViewID) USE(uint, viewID)
 #define Def_ViewID DECLARE(uint viewID : SV_ViewID) USE(uint, viewID)
+#define Def_Barycentrics DECLARE(float3 BaryWeights : SV_Barycentrics) USE(float, BaryWeights.x) USE(float, BaryWeights.y) USE(float, BaryWeights.z)
 
 
 #define Domain_Quad 0
 #define Domain_Quad 0
 #define Domain_Tri 1
 #define Domain_Tri 1

+ 0 - 4
tools/clang/tools/dxcompiler/dxcompilerobj.cpp

@@ -1590,10 +1590,6 @@ static const char *OpCodeSignatures[] = {
   "(value)",  // LegacyDoubleToUInt32
   "(value)",  // LegacyDoubleToUInt32
   "(value)",  // WaveAllBitCount
   "(value)",  // WaveAllBitCount
   "(value)",  // WavePrefixBitCount
   "(value)",  // WavePrefixBitCount
-  "(VertexID)",  // Barycentrics
-  "(VertexID)",  // BarycentricsCentroid
-  "(VertexID,sampleIndex)",  // BarycentricsSampleIndex
-  "(VertexID,offsetX,offsetY)",  // BarycentricsSnapped
   "(inputSigId,inputRowIndex,inputColIndex,VertexID)",  // AttributeAtVertex
   "(inputSigId,inputRowIndex,inputColIndex,VertexID)",  // AttributeAtVertex
   "()"  // ViewID
   "()"  // ViewID
 };
 };

+ 2 - 2
tools/clang/unittests/HLSL/ExtensionTest.cpp

@@ -731,11 +731,11 @@ TEST_F(ExtensionTest, UnsignedOpcodeIsUnchanged) {
 
 
   // - opcode is unchanged when it matches an hlsl intrinsic with
   // - opcode is unchanged when it matches an hlsl intrinsic with
   //   an unsigned version.
   //   an unsigned version.
-  // Note that 118 is the current opcode for IOP_min. If that opcode
+  // Note that 114 is the current opcode for IOP_min. If that opcode
   // changes the test will need to be updated to reflect the new opcode.
   // changes the test will need to be updated to reflect the new opcode.
   VERIFY_IS_TRUE(
   VERIFY_IS_TRUE(
     disassembly.npos !=
     disassembly.npos !=
-    disassembly.find("call i32 @test_unsigned(i32 118, "));
+    disassembly.find("call i32 @test_unsigned(i32 114, "));
 }
 }
 
 
 TEST_F(ExtensionTest, ResourceExtensionIntrinsic) {
 TEST_F(ExtensionTest, ResourceExtensionIntrinsic) {

+ 58 - 2
tools/clang/unittests/HLSL/ValidationTest.cpp

@@ -201,9 +201,14 @@ public:
   //TEST_METHOD(TGSMRaceCond2)
   //TEST_METHOD(TGSMRaceCond2)
   TEST_METHOD(AddUint64Odd)
   TEST_METHOD(AddUint64Odd)
 
 
+  TEST_METHOD(BarycentricFloat4Fail)
+  TEST_METHOD(BarycentricNoInterpolationFail)
   TEST_METHOD(ClipCullMaxComponents)
   TEST_METHOD(ClipCullMaxComponents)
   TEST_METHOD(ClipCullMaxRows)
   TEST_METHOD(ClipCullMaxRows)
   TEST_METHOD(DuplicateSysValue)
   TEST_METHOD(DuplicateSysValue)
+  TEST_METHOD(GetAttributeAtVertexInVSFail)
+  TEST_METHOD(GetAttributeAtVertexIn60Fail)
+  TEST_METHOD(GetAttributeAtVertexInterpFail)
   TEST_METHOD(SemTargetMax)
   TEST_METHOD(SemTargetMax)
   TEST_METHOD(SemTargetIndexMatchesRow)
   TEST_METHOD(SemTargetIndexMatchesRow)
   TEST_METHOD(SemTargetCol0)
   TEST_METHOD(SemTargetCol0)
@@ -2902,7 +2907,7 @@ void main(uint id : SV_GroupIndex) \
     "cs_6_1",
     "cs_6_1",
     {"dx.op.flattenedThreadIdInGroup.i32(i32 96",
     {"dx.op.flattenedThreadIdInGroup.i32(i32 96",
      "declare i32 @dx.op.flattenedThreadIdInGroup.i32(i32)"},
      "declare i32 @dx.op.flattenedThreadIdInGroup.i32(i32)"},
-    {"dx.op.viewID.i32(i32 142",
+    {"dx.op.viewID.i32(i32 138",
      "declare i32 @dx.op.viewID.i32(i32)"},
      "declare i32 @dx.op.viewID.i32(i32)"},
     "Opcode ViewID not valid in shader model cs_6_1",
     "Opcode ViewID not valid in shader model cs_6_1",
     /*bRegex*/false);
     /*bRegex*/false);
@@ -2917,7 +2922,7 @@ float4 main(float3 pos : Position, uint id : SV_PrimitiveID) : SV_Position \
     "ds_6_0",
     "ds_6_0",
     {"dx.op.primitiveID.i32(i32 108",
     {"dx.op.primitiveID.i32(i32 108",
      "declare i32 @dx.op.primitiveID.i32(i32)"},
      "declare i32 @dx.op.primitiveID.i32(i32)"},
-    {"dx.op.viewID.i32(i32 142",
+    {"dx.op.viewID.i32(i32 138",
      "declare i32 @dx.op.viewID.i32(i32)"},
      "declare i32 @dx.op.viewID.i32(i32)"},
     "Opcode ViewID not valid in shader model ds_6_0",
     "Opcode ViewID not valid in shader model ds_6_0",
     /*bRegex*/false);
     /*bRegex*/false);
@@ -2937,6 +2942,57 @@ float4 main(uint vid : SV_ViewID, float3 In[31] : INPUT) : SV_Target \
     /*bRegex*/true);
     /*bRegex*/true);
 }
 }
 
 
+TEST_F(ValidationTest, GetAttributeAtVertexInVSFail) {
+  RewriteAssemblyCheckMsg(
+    "float4 main(float4 pos: POSITION) : SV_POSITION { return pos.x; }",
+    "vs_6_1",
+    { "call float @dx.op.loadInput.f32(i32 4, i32 0, i32 0, i8 0, i32 undef)",
+    "declare float @dx.op.loadInput.f32(i32, i32, i32, i8, i32)" },
+    { "call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 0, i8 0)",
+    "declare float @dx.op.attributeAtVertex.f32(i32, i32, i32, i8, i8)" },
+    "Opcode AttributeAtVertex not valid in shader model vs_6_1",
+    /*bRegex*/ false);
+}
 
 
+TEST_F(ValidationTest, GetAttributeAtVertexIn60Fail) {
+  RewriteAssemblyCheckMsg(
+    "float4 main(float4 col : COLOR) : "
+    "SV_Target { return EvaluateAttributeCentroid(col).x; }",
+    "ps_6_0",
+    { "call float @dx.op.evalCentroid.f32(i32 89, i32 0, i32 0, i8 0)",
+    "declare float @dx.op.evalCentroid.f32(i32, i32, i32, i8)"
+    },
+    { "call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 0, i8 0)",
+    "declare float @dx.op.attributeAtVertex.f32(i32, i32, i32, i8, i8)" },
+    "Opcode AttributeAtVertex not valid in shader model ps_6_0", /*bRegex*/ false);
+}
+
+TEST_F(ValidationTest, GetAttributeAtVertexInterpFail) {
+  RewriteAssemblyCheckMsg("float4 main(nointerpolation float4 col : COLOR) : "
+                          "SV_Target { return GetAttributeAtVertex(col, 0); }",
+                          "ps_6_1", {"!\"COLOR\", i8 9, i8 0, (![0-9]+), i8 1"},
+                          {"!\"COLOR\", i8 9, i8 0, \\1, i8 2"},
+                          "Attribute COLOR must have nointerpolation mode in "
+                          "order to use GetAttributeAtVertex function.",
+                          /*bRegex*/ true);
+}
+
+TEST_F(ValidationTest, BarycentricNoInterpolationFail) {
+  RewriteAssemblyCheckMsg(
+      "float4 main(float3 bary : SV_Barycentrics) : "
+      "SV_Target { return bary.x * float4(1,0,0,0) + bary.y * float4(0,1,0,0) "
+      "+ bary.z * float4(0,0,1,0); }",
+      "ps_6_1", {"!\"SV_Barycentrics\", i8 9, i8 28, (![0-9]+), i8 2"},
+      {"!\"SV_Barycentrics\", i8 9, i8 28, \\1, i8 1"},
+      "SV_Barycentrics cannot be used with 'nointerpolation' type",
+      /*bRegex*/ true);
+}
+
+TEST_F(ValidationTest, BarycentricFloat4Fail) {
+  RewriteAssemblyCheckMsg(
+      "float4 main(float4 col : COLOR) : SV_Target { return col; }", "ps_6_1",
+      {"!\"COLOR\", i8 9, i8 0"}, {"!\"SV_Barycentrics\", i8 9, i8 28"},
+      "only 'float3' type is allowed for SV_Barycentrics.", false);
+}
 
 
 // TODO: reject non-zero padding
 // TODO: reject non-zero padding

+ 0 - 4
utils/hct/gen_intrin_main.txt

@@ -122,10 +122,6 @@ $type1 [[rn]] EvaluateAttributeAtSample(in numeric<> value, in uint index);
 $type1 [[rn]] EvaluateAttributeCentroid(in numeric<> value);
 $type1 [[rn]] EvaluateAttributeCentroid(in numeric<> value);
 $type1 [[rn]] EvaluateAttributeSnapped(in numeric<> value, in int<2> offset);
 $type1 [[rn]] EvaluateAttributeSnapped(in numeric<> value, in int<2> offset);
 $type1 [[rn]] GetAttributeAtVertex(in numeric<> value, in uint VertexID);
 $type1 [[rn]] GetAttributeAtVertex(in numeric<> value, in uint VertexID);
-float<3> [[rn]] GetBarycentrics();
-float<3> [[rn]] GetBarycentricsCentroid();
-float<3> [[rn]] GetBarycentricsAtSample(in uint index);
-float<3> [[rn]] GetBarycentricsSnapped(in int<2> offset);
 $type1 [[rn]] exp(in float_like<> x);
 $type1 [[rn]] exp(in float_like<> x);
 $type1 [[rn]] exp2(in float_like<> x);
 $type1 [[rn]] exp2(in float_like<> x);
 float<> [[rn]] f16tof32(in uint<> x);
 float<> [[rn]] f16tof32(in uint<> x);

+ 9 - 23
utils/hct/hctdb.py

@@ -248,7 +248,7 @@ class db_dxil(object):
             self.name_idx[i].category = "Resources - gather"
             self.name_idx[i].category = "Resources - gather"
         for i in "AtomicBinOp,AtomicCompareExchange,Barrier".split(","):
         for i in "AtomicBinOp,AtomicCompareExchange,Barrier".split(","):
             self.name_idx[i].category = "Synchronization"
             self.name_idx[i].category = "Synchronization"
-        for i in "CalculateLOD,Discard,DerivCoarseX,DerivCoarseY,DerivFineX,DerivFineY,EvalSnapped,EvalSampleIndex,EvalCentroid,SampleIndex,Coverage,InnerCoverage,Barycentrics,BarycentricsCentroid,BarycentricsSampleIndex,BarycentricsSnapped,AttributeAtVertex".split(","):
+        for i in "CalculateLOD,Discard,DerivCoarseX,DerivCoarseY,DerivFineX,DerivFineY,EvalSnapped,EvalSampleIndex,EvalCentroid,SampleIndex,Coverage,InnerCoverage,AttributeAtVertex".split(","):
             self.name_idx[i].category = "Pixel shader"
             self.name_idx[i].category = "Pixel shader"
             self.name_idx[i].shader_stages = "p"
             self.name_idx[i].shader_stages = "p"
         for i in "ThreadId,GroupId,ThreadIdInGroup,FlattenedThreadIdInGroup".split(","):
         for i in "ThreadId,GroupId,ThreadIdInGroup,FlattenedThreadIdInGroup".split(","):
@@ -281,7 +281,7 @@ class db_dxil(object):
                 i.is_wave = True
                 i.is_wave = True
             elif i.name.startswith("Bitcast"):
             elif i.name.startswith("Bitcast"):
                 i.category = "Bitcasts with different sizes"
                 i.category = "Bitcasts with different sizes"
-        for i in "ViewID,Barycentrics,BarycentricsCentroid,BarycentricsSampleIndex,BarycentricsSnapped,AttributeAtVertex".split(","):
+        for i in "ViewID,AttributeAtVertex".split(","):
             self.name_idx[i].shader_model = 6,1
             self.name_idx[i].shader_model = 6,1
 
 
     def populate_llvm_instructions(self):
     def populate_llvm_instructions(self):
@@ -1053,25 +1053,6 @@ class db_dxil(object):
         # End of DXIL 1.0 opcodes.
         # End of DXIL 1.0 opcodes.
         self.set_op_count_for_version(1, 0, next_op_idx)
         self.set_op_count_for_version(1, 0, next_op_idx)
 
 
-        self.add_dxil_op("Barycentrics", next_op_idx, "Barycentrics", "return weights at a current location.", "f", "rn", [
-            db_dxil_param(0, "f", "", "result"),
-            db_dxil_param(2, "i8", "VertexID", "Vertex Index")])
-        next_op_idx += 1
-        self.add_dxil_op("BarycentricsCentroid", next_op_idx, "BarycentricsCentroid", "return weights at centroid location.", "f", "rn", [
-            db_dxil_param(0, "f", "", "result"),
-            db_dxil_param(2, "i8", "VertexID", "Vertex Index")])
-        next_op_idx += 1
-        self.add_dxil_op("BarycentricsSampleIndex", next_op_idx, "BarycentricsSampleIndex", "return weights at the location of the sample specified by index", "f", "rn", [
-            db_dxil_param(0, "f", "", "result"),
-            db_dxil_param(2, "i8", "VertexID", "Vertex Index"),
-            db_dxil_param(3, "i32", "sampleIndex", "sample index")])
-        next_op_idx += 1
-        self.add_dxil_op("BarycentricsSnapped", next_op_idx, "BarycentricsSnapped", "return weights at the location specified in the pixel's 16x16 sample grid", "f", "rn", [
-            db_dxil_param(0, "f", "", "result"),
-            db_dxil_param(2, "i8", "VertexID", "Vertex Index"),
-            db_dxil_param(3, "i32", "offsetX", "2D offset from the pixel center using a 16x16 grid"),
-            db_dxil_param(4, "i32", "offsetY", "2D offset from the pixel center using a 16x16 grid")])
-        next_op_idx += 1
         self.add_dxil_op("AttributeAtVertex", next_op_idx, "AttributeAtVertex", "returns the values of the attributes at the vertex.", "hf", "rn", [
         self.add_dxil_op("AttributeAtVertex", next_op_idx, "AttributeAtVertex", "returns the values of the attributes at the vertex.", "hf", "rn", [
             db_dxil_param(0, "$o", "", "result"),
             db_dxil_param(0, "$o", "", "result"),
             db_dxil_param(2, "i32", "inputSigId", "input signature element ID"),
             db_dxil_param(2, "i32", "inputSigId", "input signature element ID"),
@@ -1088,7 +1069,7 @@ class db_dxil(object):
         # Uncomment this when 1.1 is final.
         # Uncomment this when 1.1 is final.
         #self.set_op_count_for_version(1, 1, next_op_idx)
         #self.set_op_count_for_version(1, 1, next_op_idx)
 
 
-        assert next_op_idx == 143, "next operation index is %d rather than 143 and thus opcodes are broken" % next_op_idx
+        assert next_op_idx == 139, "next operation index is %d rather than 139 and thus opcodes are broken" % next_op_idx
 
 
         # Set interesting properties.
         # Set interesting properties.
         self.build_indices()
         self.build_indices()
@@ -1394,7 +1375,8 @@ class db_dxil(object):
             (25, "TessFactor", ""),
             (25, "TessFactor", ""),
             (26, "InsideTessFactor", ""),
             (26, "InsideTessFactor", ""),
             (27, "ViewID", ""),
             (27, "ViewID", ""),
-            (28, "Invalid", ""),
+            (28, "Barycentrics", ""),
+            (29, "Invalid", ""),
             ])
             ])
         self.enums.append(SemanticKind)
         self.enums.append(SemanticKind)
         SigPointKind = db_dxil_enum("SigPointKind", "Signature Point is more specific than shader stage or signature as it is unique in both stage and item dimensionality or frequency.", [
         SigPointKind = db_dxil_enum("SigPointKind", "Signature Point is more specific than shader stage or signature as it is unique in both stage and item dimensionality or frequency.", [
@@ -1499,6 +1481,7 @@ class db_dxil(object):
             TessFactor,NA,NA,NA,NA,NA,NA,TessFactor,TessFactor,NA,NA,NA,NA,NA,NA,NA,NA
             TessFactor,NA,NA,NA,NA,NA,NA,TessFactor,TessFactor,NA,NA,NA,NA,NA,NA,NA,NA
             InsideTessFactor,NA,NA,NA,NA,NA,NA,TessFactor,TessFactor,NA,NA,NA,NA,NA,NA,NA,NA
             InsideTessFactor,NA,NA,NA,NA,NA,NA,TessFactor,TessFactor,NA,NA,NA,NA,NA,NA,NA,NA
             ViewID,NotInSig _61,NA,NotInSig _61,NotInSig _61,NA,NA,NA,NotInSig _61,NA,NA,NA,NotInSig _61,NA,NotInSig _61,NA,NA
             ViewID,NotInSig _61,NA,NotInSig _61,NotInSig _61,NA,NA,NA,NotInSig _61,NA,NA,NA,NotInSig _61,NA,NotInSig _61,NA,NA
+            Barycentrics,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NotPacked _61,NA,NA
         """
         """
         table = [list(map(str.strip, line.split(','))) for line in SemanticInterpretationCSV.splitlines() if line.strip()]
         table = [list(map(str.strip, line.split(','))) for line in SemanticInterpretationCSV.splitlines() if line.strip()]
         for row in table[1:]: assert(len(row) == len(table[0])) # Ensure table is rectangular
         for row in table[1:]: assert(len(row) == len(table[0])) # Ensure table is rectangular
@@ -1559,6 +1542,8 @@ class db_dxil(object):
         self.add_valrule("Meta.ForceCaseOnSwitch", "Attribute forcecase only works for switch")
         self.add_valrule("Meta.ForceCaseOnSwitch", "Attribute forcecase only works for switch")
         self.add_valrule("Meta.ControlFlowHintNotOnControlFlow", "Control flow hint only works on control flow inst")
         self.add_valrule("Meta.ControlFlowHintNotOnControlFlow", "Control flow hint only works on control flow inst")
         self.add_valrule("Meta.TextureType", "elements of typed buffers and textures must fit in four 32-bit quantities")
         self.add_valrule("Meta.TextureType", "elements of typed buffers and textures must fit in four 32-bit quantities")
+        self.add_valrule("Meta.BarycentricsInterpolation", "SV_Barycentrics cannot be used with 'nointerpolation' type")
+        self.add_valrule("Meta.BarycentricsFloat3", "only 'float3' type is allowed for SV_Barycentrics.")
 
 
         self.add_valrule("Instr.Oload", "DXIL intrinsic overload must be valid")
         self.add_valrule("Instr.Oload", "DXIL intrinsic overload must be valid")
         self.add_valrule_msg("Instr.CallOload", "Call to DXIL intrinsic must match overload signature", "Call to DXIL intrinsic '%0' does not match an allowed overload signature")
         self.add_valrule_msg("Instr.CallOload", "Call to DXIL intrinsic must match overload signature", "Call to DXIL intrinsic '%0' does not match an allowed overload signature")
@@ -1637,6 +1622,7 @@ class db_dxil(object):
         self.add_valrule("Instr.FailToResloveTGSMPointer", "TGSM pointers must originate from an unambiguous TGSM global variable.")
         self.add_valrule("Instr.FailToResloveTGSMPointer", "TGSM pointers must originate from an unambiguous TGSM global variable.")
         self.add_valrule("Instr.ExtractValue", "ExtractValue should only be used on dxil struct types and cmpxchg")
         self.add_valrule("Instr.ExtractValue", "ExtractValue should only be used on dxil struct types and cmpxchg")
         self.add_valrule("Instr.TGSMRaceCond", "Race condition writing to shared memory detected, consider making this write conditional")
         self.add_valrule("Instr.TGSMRaceCond", "Race condition writing to shared memory detected, consider making this write conditional")
+        self.add_valrule("Instr.AttributeAtVertexNoInterpolation", "Attribute %0 must have nointerpolation mode in order to use GetAttributeAtVertex function.")
 
 
         # Some legacy rules:
         # Some legacy rules:
         # - space is only supported for shader targets 5.1 and higher
         # - space is only supported for shader targets 5.1 and higher

+ 0 - 67
utils/hct/hctdb_inst_docs.txt

@@ -585,73 +585,6 @@ Either of destHI or destLO may be specified as NULL instead of specifying a regi
 
 
 dest0, dest1 = USubb(src0, src1)
 dest0, dest1 = USubb(src0, src1)
 
 
-* Inst: Barycentrics - return weights at a current location.
-
-weight = Barycentrics(VertexID)
-
-Returns all 3 triangle Barycentrics weights even though two are strictly necessary.
-VertexID ranges from 0 to 2.
-
-The 3 values returned are NOT guaranteed to add up to floating-point 1.0 exactly.
-If it is desired for the pixel shader to receive weights with this property, it can reconstruct the third coordinate by subtracting the sum of the other two from 1.0.
-Also note, that individual barycentric weights may take on arbitrarily large or arbitrarily small values, and are not constrained to be within [0...1] range
-– this may happen for screen-space (non-perspective-correct) barycentric interpolants, screenspace quad primitives, or external triangles.
-For triangle primitives, all 3 weights will typically contain non-zero values, but for line primitives the third barycentric weight (myBaryWeights.z) is guaranteed to be exactly 0.0.
-
-* Inst: BarycentricsCentroid - return weights at centroid location.
-
-weight = BarycentricsCentroid(VertexID)
-
-Equivalent to Barycentrics but returns barycentric weights at the centroid.
-
-* Inst: BarycentricsSampleIndex - return weights at the location of the sample specified by index
-
-weight = BarycentricsSampleIndex(VertexID, sampleIndex)
-
-Equivalent to Barycentrics but returns barycentric weights at the sample.
-
-* Inst: BarycentricsSnapped - return weights at the location specified in the pixel's 16x16 sample grid
-
-weight = BarycentricsSnapped(VertexID, offsetX, offsetY)
-
-Equivalent to Barycentrics but returns barycentric weights of a position with 2D offset from the pixel center using a 16x16 grid. Only the last 4 bits of the two components of the pixel offsets are used.
-
-+----------+----------------+
-|  4 bits  |     offset     |
-+----------+----------------+
-|   1000   | -0.5f (-8/16)  |
-+----------+----------------+
-|   1001   | -0.4375f(-7/16)|
-+----------+----------------+
-|   1010   | -0.375f (-6/16)|
-+----------+----------------+
-|   1011   | -0.3125f(-5/16)|
-+----------+----------------+
-|   1100   | -0.25f (-4/16) |
-+----------+----------------+
-|   1101   | -0.1875f(-3/16)|
-+----------+----------------+
-|   1110   | -0.125f (-2/16)|
-+----------+----------------+
-|   1111   | -0.0625f(-1/16)|
-+----------+----------------+
-|   0000   | 0.0f (0/16)    |
-+----------+----------------+
-|   0001   | 0.0625f (1/16) |
-+----------+----------------+
-|   0010   | 0.125f (2/16)  |
-+----------+----------------+
-|   0011   | 0.1875f (3/16) |
-+----------+----------------+
-|   0100   | 0.25f (4/16)   |
-+----------+----------------+
-|   0101   | 0.3125f (5/16) |
-+----------+----------------+
-|   0110   | 0.375f (6/16)  |
-+----------+----------------+
-|   0111   | 0.4375f (7/16) |
-+----------+----------------+
-
 * Inst: AttributeAtVertex - returns the values of the attributes at the vertex.
 * Inst: AttributeAtVertex - returns the values of the attributes at the vertex.
 
 
 returns the values of the attributes at the vertex. VertexID ranges from 0 to 2.
 returns the values of the attributes at the vertex. VertexID ranges from 0 to 2.

Some files were not shown because too many files changed in this diff