Forráskód Böngészése

Improve location reporting for validation errors (#2938)

This strips the previous method of error reporting from DxilValidation
in favor of the DxilUtil methods. With these comes a new way to find
location information for those associated with functions or globals.
Instruction reporting is slightly changed in that the asm informtion
including the instruction and its block is added as a note so as to not
clutter up the line with the error and hlsl location.

For the most part, the existing EmitError* functions were retained, but
their implementation was changed to largely format inputs for the
dxilutil:: function and call it.

Errors that had clear associations with instructions, functions, or
globals had their emitting functions changed to variants that had this
information. The result is error message with as much location
information as is available.

In some cases, functions that implicitly added format arguments where
removed in favor of explicit formatted error calls that are clearer.

* Avoid directory duplication in DIFile MD

Change #2030 prevented the duplication of the directory for filenames
with full paths. However the same problem exists for relative paths that
include directories. This results in duplicate DIFile entries and
confusing error message outputs for Global Variables.

This skips the original code which was meant to prepend the directory
name since our filenames always have that information already.

* Validation error message text changes

This includes a number of different changes to validation error
messages. Some correct grammar. Some add a format argument to the
message for better information. Many of them just add a period to the
end of the error message for consistency and to allow the "Use /Zi"
message to be tagged on the end without jumbling the output.

* Enhancements for Dxil DiagnosticInfo and DxilUtil

Introduce *OnContext diagnostic reporting for messages that don't
clearly adhere to any instruction, global, or function. Also includes
the ability to add a note to supplement an earlier diagnostic.

Add function to DiagnosticInfo. This provides a fallback option for
printing location information when debug info isn't available. At least
we can print the function where the issue occurs.

For GV errors, we can't depend on the module having a dxil module in it.
Debug modules don't get the dxil part cloned. The only use of it was the
potentially cached debuginfofinder. Lacking it, we can just create it on
the fly.

Corrected the format of the output for DiagnosticInfoDxil::print. In
addition to minor fixups, when the diagnostic is a remark or note, it
doesn't need the "Use /Zi" prompt.

DxilLoopUnroll has its own diagnostics reporting. This adds the
associated function for the messages.

* Add function location information for interp mode error

This is to satisfy a specific request for line information for this
specific error. It got left out of the original batch, but it's
important enough for a followon.
Greg Roth 5 éve
szülő
commit
ce645d1c11

+ 138 - 138
docs/DXIL.rst

@@ -2959,9 +2959,9 @@ 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>
 .. 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
@@ -2983,120 +2983,120 @@ DECL.SHADERMISSINGARG                     payload/params/attributes parameter is
 DECL.SHADERRETURNVOID                     Shader functions must return void
 DECL.USEDEXTERNALFUNCTION                 External function must be used
 DECL.USEDINTERNAL                         Internal declaration must be used
-FLOW.DEADLOOP                             Loop must have break
+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
+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/Amplification/Mesh Shader must only sync UAV (sync_uglobal)
+INSTR.BARRIERMODEFORNONCS                 sync in a non-Compute/Amplification/Mesh 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.BUFFERUPDATECOUNTERONRESHASCOUNTER  BufferUpdateCounter valid only when HasCounter is true
-INSTR.BUFFERUPDATECOUNTERONUAV            BufferUpdateCounter valid only on UAV
+INSTR.BUFFERUPDATECOUNTERONRESHASCOUNTER  BufferUpdateCounter valid only when HasCounter is true.
+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.CHECKACCESSFULLYMAPPED              CheckAccessFullyMapped should only used on resource status
-INSTR.COORDINATECOUNTFORRAWTYPEDBUF       raw/typed buffer don't need 2 coordinates
-INSTR.COORDINATECOUNTFORSTRUCTBUF         structured buffer require 2 coordinates
+INSTR.CBUFFERCLASSFORCBUFFERHANDLE        Expect Cbuffer for CBufferLoad handle.
+INSTR.CBUFFEROUTOFBOUND                   Cbuffer access out of bound.
+INSTR.CHECKACCESSFULLYMAPPED              CheckAccessFullyMapped should only be used on resource status.
+INSTR.COORDINATECOUNTFORRAWTYPEDBUF       raw/typed buffer don't need 2 coordinates.
+INSTR.COORDINATECOUNTFORSTRUCTBUF         structured buffer require 2 coordinates.
 INSTR.CREATEHANDLEIMMRANGEID              Local resource must map to global resource.
-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.DXILSTRUCTUSER                      Dxil struct types should only be 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.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.MISSINGSETMESHOUTPUTCOUNTS          Missing SetMeshOutputCounts call.
 INSTR.MULTIPLEGETMESHPAYLOAD              GetMeshPayload cannot be called multiple times.
 INSTR.MULTIPLESETMESHOUTPUTCOUNTS         SetMeshOUtputCounts cannot be called multiple times.
-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.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.NONDOMINATINGDISPATCHMESH           Non-Dominating DispatchMesh call.
 INSTR.NONDOMINATINGSETMESHOUTPUTCOUNTS    Non-Dominating SetMeshOutputCounts call.
-INSTR.NOREADINGUNINITIALIZED              Instructions should not read uninitialized value
+INSTR.NOREADINGUNINITIALIZED              Instructions should not read uninitialized value.
 INSTR.NOTONCEDISPATCHMESH                 DispatchMesh must be called exactly once in an Amplification shader.
-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.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.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.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.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 be on srv resource.
 INSTR.RESOURCECLASSFORUAVSTORE            store should be 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.RESOURCEKINDFORTRACERAY             TraceRay should only use RTAccelerationStructure
-INSTR.RESOURCEMAPTOSINGLEENTRY            Fail to map resource to resource table
-INSTR.RESOURCEOFFSETMISS                  offset uninitialized
-INSTR.RESOURCEOFFSETTOOMANY               out of bound offset must be undef
-INSTR.RESOURCEUSER                        Resource should only used by Load/GEP/Call
+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.RESOURCEKINDFORTRACERAY             TraceRay should only use RTAccelerationStructure.
+INSTR.RESOURCEMAPTOSINGLEENTRY            Fail to map resource to resource table.
+INSTR.RESOURCEOFFSETMISS                  offset uninitialized.
+INSTR.RESOURCEOFFSETTOOMANY               out of bound offset must be undef.
+INSTR.RESOURCEUSER                        Resource should only be used by Load/GEP/Call.
 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.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.SIGNATUREOPERATIONNOTINENTRY        Dxil operation for input output signature must be in entryPoints.
-INSTR.STATUS                              Resource status should only used by CheckAccessFullyMapped
-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
+INSTR.STATUS                              Resource status should only be used by CheckAccessFullyMapped.
+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.BARYCENTRICSINTERPOLATION            SV_Barycentrics cannot be used with 'nointerpolation' type.
 META.BARYCENTRICSTWOPERSPECTIVES          There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode.
-META.BRANCHFLATTEN                        Can't use branch and flatten attributes together
+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.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.GLCNOTONAPPENDCONSUME                globallycoherent cannot be used with append/consume buffers
+META.ENTRYFUNCTION                        entrypoint not found.
+META.FLAGSUSAGE                           Flags must match usage.
+META.FORCECASEONSWITCH                    Attribute forcecase only works for switch.
+META.GLCNOTONAPPENDCONSUME                globallycoherent cannot be used with append/consume buffers: '%0'.
 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.INVALIDCONTROLFLOWHINT               Invalid control flow hint.
 META.KNOWN                                Named metadata should be known
-META.MAXTESSFACTOR                        Hull Shader MaxTessFactor must be [%0..%1].  %2 specified
-META.NOENTRYPROPSFORENTRY                 EntryPoints must have entry properties.
+META.MAXTESSFACTOR                        Hull Shader MaxTessFactor must be [%0..%1].  %2 specified.
+META.NOENTRYPROPSFORENTRY                 Entry point %0 must have entry properties.
 META.NOSEMANTICOVERLAP                    Semantics must not overlap
-META.REQUIRED                             TODO - Required metadata missing
+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.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.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.SIGNATURECOMPTYPE                    signature %0 specifies unrecognized or invalid component type.
 META.SIGNATUREDATAWIDTH                   Data width must be identical for all elements packed into the same row.
 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
@@ -3108,89 +3108,89 @@ 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.64BITRAWBUFFERLOADSTORE                i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3
-SM.AMPLIFICATIONSHADERPAYLOADSIZE         For shader '%0', payload size is greater than %1
-SM.AMPLIFICATIONSHADERPAYLOADSIZEDECLARED For shader '%0', payload size %1 is greater than declared size of %2 bytes
+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.64BITRAWBUFFERLOADSTORE                i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3.
+SM.AMPLIFICATIONSHADERPAYLOADSIZE         For amplification shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes.
+SM.AMPLIFICATIONSHADERPAYLOADSIZEDECLARED For amplification shader with entry '%0', payload size %1 is greater than declared size of %2 bytes.
 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.CBUFFERARRAYOFFSETALIGNMENT            CBuffer array offset must be aligned to 16-bytes
 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.CBUFFERTEMPLATETYPEMUSTBESTRUCT        D3D12 constant/texture buffer template element can only be a struct.
+SM.COMPLETEPOSITION                       Not all elements of SV_Position were written.
 SM.CONSTANTINTERPMODE                     Interpolation mode must be constant for MS primitive output.
-SM.COUNTERONLYONSTRUCTBUF                 BufferUpdateCounter valid only on structured buffers
+SM.COUNTERONLYONSTRUCTBUF                 BufferUpdateCounter valid only on structured buffers.
 SM.CSNOSIGNATURES                         Compute shaders must not have shader signatures.
 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.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.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.INVALIDSAMPLERFEEDBACKTYPE             Invalid sampler feedback type
-SM.INVALIDTEXTUREKINDONUAV                Texture2DMS[Array] or TextureCube[Array] resources are not supported with UAVs
+SM.INVALIDRESOURCECOMPTYPE                Invalid resource return type.
+SM.INVALIDRESOURCEKIND                    Invalid resources kind.
+SM.INVALIDSAMPLERFEEDBACKTYPE             Invalid sampler feedback type.
+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.MAXMSSMSIZE                            Total Thread Group Shared Memory storage is %0, exceeded %1
-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.MESHPSIGROWCOUNT                       For shader '%0', primitive output signatures are taking up more than %1 rows
-SM.MESHSHADERINOUTSIZE                    For shader '%0', payload plus output size is greater than %1
-SM.MESHSHADERMAXPRIMITIVECOUNT            MS max primitive output count must be [0..%0].  %1 specified
-SM.MESHSHADERMAXVERTEXCOUNT               MS max vertex output count must be [0..%0].  %1 specified
-SM.MESHSHADEROUTPUTSIZE                   For shader '%0', vertex plus primitive output size is greater than %1
-SM.MESHSHADERPAYLOADSIZE                  For shader '%0', payload size is greater than %1
-SM.MESHSHADERPAYLOADSIZEDECLARED          For shader '%0', payload size %1 is greater than declared size of %2 bytes
-SM.MESHTOTALSIGROWCOUNT                   For shader '%0', vertex and primitive output signatures are taking up more than %1 rows
-SM.MESHVSIGROWCOUNT                       For shader '%0', vertex output signatures are taking up more than %1 rows
+SM.MAXMSSMSIZE                            Total Thread Group Shared Memory storage is %0, exceeded %1.
+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.MESHPSIGROWCOUNT                       For shader '%0', primitive output signatures are taking up more than %1 rows.
+SM.MESHSHADERINOUTSIZE                    For shader '%0', payload plus output size is greater than %1.
+SM.MESHSHADERMAXPRIMITIVECOUNT            MS max primitive output count must be [0..%0].  %1 specified.
+SM.MESHSHADERMAXVERTEXCOUNT               MS max vertex output count must be [0..%0].  %1 specified.
+SM.MESHSHADEROUTPUTSIZE                   For shader '%0', vertex plus primitive output size is greater than %1.
+SM.MESHSHADERPAYLOADSIZE                  For mesh shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes.
+SM.MESHSHADERPAYLOADSIZEDECLARED          For mesh shader with entry '%0', payload size %1 is greater than declared size of %2 bytes.
+SM.MESHTOTALSIGROWCOUNT                   For shader '%0', vertex and primitive output signatures are taking up more than %1 rows.
+SM.MESHVSIGROWCOUNT                       For shader '%0', vertex output signatures are taking up more than %1 rows.
 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.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.RAYSHADERPAYLOADSIZE                   For shader '%0', %1 size is smaller than argument's allocation size
-SM.RAYSHADERSIGNATURES                    Ray tracing shader '%0' should not have any shader signatures
+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.RAYSHADERPAYLOADSIZE                   For shader '%0', %1 size is smaller than argument's allocation size.
+SM.RAYSHADERSIGNATURES                    Ray tracing shader '%0' should not have any shader signatures.
 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.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.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.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
+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.I8                                  I8 can only be 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.NOPTRTOPTR                          Pointers to pointers, or pointers in structures are not allowed
+TYPES.NOMULTIDIM                          Only one dimension allowed for array type.
+TYPES.NOPTRTOPTR                          Pointers to pointers, or pointers in structures are not allowed.
 TYPES.NOVECTOR                            Vector types must not be present
-========================================= =======================================================================================================================================================================================================================================================================================================
+========================================= ========================================================================================================================================================================================================================================================================================================
 
 .. VALRULES-RST:END
 

+ 3 - 0
include/dxc/DXIL/DxilUtil.h

@@ -82,6 +82,9 @@ namespace dxilutil {
   void EmitWarningOnFunction(llvm::Function *F, llvm::Twine Msg);
   void EmitErrorOnGlobalVariable(llvm::GlobalVariable *GV, llvm::Twine Msg);
   void EmitWarningOnGlobalVariable(llvm::GlobalVariable *GV, llvm::Twine Msg);
+  void EmitErrorOnContext(llvm::LLVMContext &Ctx, llvm::Twine Msg);
+  void EmitWarningOnContext(llvm::LLVMContext &Ctx, llvm::Twine Msg);
+  void EmitNoteOnContext(llvm::LLVMContext &Ctx, llvm::Twine Msg);
 
   void EmitResMappingError(llvm::Instruction *Res);
   // Simple demangle just support case "\01?name@" pattern.

+ 136 - 136
include/dxc/HLSL/DxilValidation.h

@@ -58,118 +58,118 @@ enum class ValidationRule : unsigned {
   DeclUsedInternal, // Internal declaration must be used
 
   // 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/Amplification/Mesh 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. 
+  InstrBarrierModeForNonCS, // sync in a non-Compute/Amplification/Mesh 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.
   InstrBarrierModeUselessUGroup, // sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.
-  InstrBufferUpdateCounterOnResHasCounter, // BufferUpdateCounter valid only when HasCounter is true
-  InstrBufferUpdateCounterOnUAV, // BufferUpdateCounter valid only on UAV
-  InstrCBufferClassForCBufferHandle, // Expect Cbuffer for CBufferLoad handle
-  InstrCBufferOutOfBound, // Cbuffer access out of bound
+  InstrBufferUpdateCounterOnResHasCounter, // BufferUpdateCounter valid only when HasCounter is true.
+  InstrBufferUpdateCounterOnUAV, // BufferUpdateCounter valid only on UAV.
+  InstrCBufferClassForCBufferHandle, // Expect Cbuffer for CBufferLoad handle.
+  InstrCBufferOutOfBound, // Cbuffer access out of bound.
   InstrCallOload, // Call to DXIL intrinsic must match overload signature
   InstrCannotPullPosition, // pull-model evaluation of position disallowed
-  InstrCheckAccessFullyMapped, // CheckAccessFullyMapped should only used on resource status
-  InstrCoordinateCountForRawTypedBuf, // raw/typed buffer don't need 2 coordinates
-  InstrCoordinateCountForStructBuf, // structured buffer require 2 coordinates
+  InstrCheckAccessFullyMapped, // CheckAccessFullyMapped should only be used on resource status.
+  InstrCoordinateCountForRawTypedBuf, // raw/typed buffer don't need 2 coordinates.
+  InstrCoordinateCountForStructBuf, // structured buffer require 2 coordinates.
   InstrCreateHandleImmRangeID, // Local resource must map to global resource.
-  InstrDxilStructUser, // Dxil struct types should only used by ExtractValue
-  InstrDxilStructUserOutOfBound, // Index out of bound when extract value from dxil struct types
-  InstrEvalInterpolationMode, // Interpolation mode on %0 used with eval_* instruction must be linear, linear_centroid, linear_noperspective, linear_noperspective_centroid, linear_sample or linear_noperspective_sample
-  InstrExtractValue, // ExtractValue should only be used on dxil struct types and cmpxchg
+  InstrDxilStructUser, // Dxil struct types should only be used by ExtractValue.
+  InstrDxilStructUserOutOfBound, // Index out of bound when extract value from dxil struct types.
+  InstrEvalInterpolationMode, // Interpolation mode on %0 used with eval_* instruction must be linear, linear_centroid, linear_noperspective, linear_noperspective_centroid, linear_sample or linear_noperspective_sample.
+  InstrExtractValue, // ExtractValue should only be used on dxil struct types and cmpxchg.
   InstrFailToResloveTGSMPointer, // TGSM pointers must originate from an unambiguous TGSM global variable.
-  InstrHandleNotFromCreateHandle, // Resource handle should returned by createHandle
-  InstrImmBiasForSampleB, // bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate
-  InstrInBoundsAccess, // Access to out-of-bounds memory is disallowed
-  InstrMinPrecisionNotPrecise, // Instructions marked precise may not refer to minprecision values
-  InstrMinPrecisonBitCast, // Bitcast on minprecison types is not allowed
-  InstrMipLevelForGetDimension, // Use mip level on buffer when GetDimensions
-  InstrMipOnUAVLoad, // uav load don't support mipLevel/sampleIndex
+  InstrHandleNotFromCreateHandle, // Resource handle should returned by createHandle.
+  InstrImmBiasForSampleB, // bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate.
+  InstrInBoundsAccess, // Access to out-of-bounds memory is disallowed.
+  InstrMinPrecisionNotPrecise, // Instructions marked precise may not refer to minprecision values.
+  InstrMinPrecisonBitCast, // Bitcast on minprecison types is not allowed.
+  InstrMipLevelForGetDimension, // Use mip level on buffer when GetDimensions.
+  InstrMipOnUAVLoad, // uav load don't support mipLevel/sampleIndex.
   InstrMissingSetMeshOutputCounts, // Missing SetMeshOutputCounts call.
   InstrMultipleGetMeshPayload, // GetMeshPayload cannot be called multiple times.
   InstrMultipleSetMeshOutputCounts, // SetMeshOUtputCounts cannot be called multiple times.
-  InstrNoGenericPtrAddrSpaceCast, // Address space cast between pointer types must have one part to be generic address space
-  InstrNoIDivByZero, // No signed integer division by zero
-  InstrNoIndefiniteAcos, // No indefinite arccosine
-  InstrNoIndefiniteAsin, // No indefinite arcsine
-  InstrNoIndefiniteDsxy, // No indefinite derivative calculation
-  InstrNoIndefiniteLog, // No indefinite logarithm
-  InstrNoReadingUninitialized, // Instructions should not read uninitialized value
-  InstrNoUDivByZero, // No unsigned integer division by zero
+  InstrNoGenericPtrAddrSpaceCast, // Address space cast between pointer types must have one part to be generic address space.
+  InstrNoIDivByZero, // No signed integer division by zero.
+  InstrNoIndefiniteAcos, // No indefinite arccosine.
+  InstrNoIndefiniteAsin, // No indefinite arcsine.
+  InstrNoIndefiniteDsxy, // No indefinite derivative calculation.
+  InstrNoIndefiniteLog, // No indefinite logarithm.
+  InstrNoReadingUninitialized, // Instructions should not read uninitialized value.
+  InstrNoUDivByZero, // No unsigned integer division by zero.
   InstrNonDominatingDispatchMesh, // Non-Dominating DispatchMesh call.
   InstrNonDominatingSetMeshOutputCounts, // Non-Dominating SetMeshOutputCounts call.
   InstrNotOnceDispatchMesh, // DispatchMesh must be called exactly once in an Amplification shader.
-  InstrOffsetOnUAVLoad, // uav load don't support offset
-  InstrOload, // DXIL intrinsic overload must be valid
+  InstrOffsetOnUAVLoad, // uav load don't support offset.
+  InstrOload, // DXIL intrinsic overload must be valid.
   InstrOnlyOneAllocConsume, // RWStructuredBuffers may increment or decrement their counters, but not both.
-  InstrOpCodeReserved, // Instructions must not reference reserved opcodes
+  InstrOpCodeReserved, // Instructions must not reference reserved opcodes.
   InstrOpConst, // DXIL intrinsic requires an immediate constant operand
-  InstrOpConstRange, // Constant values must be in-range for operation
+  InstrOpConstRange, // Constant values must be in-range for operation.
   InstrOperandRange, // DXIL intrinsic operand must be within defined range
-  InstrPtrBitCast, // Pointer type bitcast must be have same size
-  InstrResourceClassForLoad, // load can only run on UAV/SRV resource
+  InstrPtrBitCast, // Pointer type bitcast must be have same size.
+  InstrResourceClassForLoad, // load can only run on UAV/SRV resource.
   InstrResourceClassForSamplerGather, // sample, lod and gather should be on srv resource.
   InstrResourceClassForUAVStore, // store should be on uav resource.
-  InstrResourceCoordinateMiss, // coord uninitialized
-  InstrResourceCoordinateTooMany, // out of bound coord must be undef
-  InstrResourceKindForBufferLoadStore, // buffer load/store only works on Raw/Typed/StructuredBuffer
-  InstrResourceKindForCalcLOD, // lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray
-  InstrResourceKindForGather, // gather requires resource declared as texture/2D/Cube/2DArray/CubeArray
-  InstrResourceKindForGetDim, // Invalid resource kind on GetDimensions
-  InstrResourceKindForSample, // sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray
-  InstrResourceKindForSampleC, // samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray
-  InstrResourceKindForTextureLoad, // texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray
-  InstrResourceKindForTextureStore, // texture store only works on Texture1D/1DArray/2D/2DArray/3D
-  InstrResourceKindForTraceRay, // TraceRay should only use RTAccelerationStructure
-  InstrResourceMapToSingleEntry, // Fail to map resource to resource table
-  InstrResourceOffsetMiss, // offset uninitialized
-  InstrResourceOffsetTooMany, // out of bound offset must be undef
-  InstrResourceUser, // Resource should only used by Load/GEP/Call
+  InstrResourceCoordinateMiss, // coord uninitialized.
+  InstrResourceCoordinateTooMany, // out of bound coord must be undef.
+  InstrResourceKindForBufferLoadStore, // buffer load/store only works on Raw/Typed/StructuredBuffer.
+  InstrResourceKindForCalcLOD, // lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray.
+  InstrResourceKindForGather, // gather requires resource declared as texture/2D/Cube/2DArray/CubeArray.
+  InstrResourceKindForGetDim, // Invalid resource kind on GetDimensions.
+  InstrResourceKindForSample, // sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray.
+  InstrResourceKindForSampleC, // samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray.
+  InstrResourceKindForTextureLoad, // texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray.
+  InstrResourceKindForTextureStore, // texture store only works on Texture1D/1DArray/2D/2DArray/3D.
+  InstrResourceKindForTraceRay, // TraceRay should only use RTAccelerationStructure.
+  InstrResourceMapToSingleEntry, // Fail to map resource to resource table.
+  InstrResourceOffsetMiss, // offset uninitialized.
+  InstrResourceOffsetTooMany, // out of bound offset must be undef.
+  InstrResourceUser, // Resource should only be used by Load/GEP/Call.
   InstrSampleCompType, // sample_* instructions require resource to be declared to return UNORM, SNORM or FLOAT.
-  InstrSampleIndexForLoad2DMS, // load on Texture2DMS/2DMSArray require sampleIndex
-  InstrSamplerModeForLOD, // lod instruction requires sampler declared in default mode
-  InstrSamplerModeForSample, // sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode
-  InstrSamplerModeForSampleC, // sample_c_*/gather_c instructions require sampler declared in comparison mode
+  InstrSampleIndexForLoad2DMS, // load on Texture2DMS/2DMSArray require sampleIndex.
+  InstrSamplerModeForLOD, // lod instruction requires sampler declared in default mode.
+  InstrSamplerModeForSample, // sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode.
+  InstrSamplerModeForSampleC, // sample_c_*/gather_c instructions require sampler declared in comparison mode.
   InstrSignatureOperationNotInEntry, // Dxil operation for input output signature must be in entryPoints.
-  InstrStatus, // Resource status should only used by CheckAccessFullyMapped
-  InstrStructBitCast, // Bitcast on struct types is not allowed
-  InstrTGSMRaceCond, // Race condition writing to shared memory detected, consider making this write conditional
-  InstrTextureOffset, // offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7
-  InstrUndefResultForGetDimension, // GetDimensions used undef dimension %0 on %1
-  InstrWriteMaskForTypedUAVStore, // store on typed uav must write to all four components of the UAV
-  InstrWriteMaskMatchValueForUAVStore, // uav store write mask must match store value mask, write mask is %0 and store value mask is %1
+  InstrStatus, // Resource status should only be used by CheckAccessFullyMapped.
+  InstrStructBitCast, // Bitcast on struct types is not allowed.
+  InstrTGSMRaceCond, // Race condition writing to shared memory detected, consider making this write conditional.
+  InstrTextureOffset, // offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7.
+  InstrUndefResultForGetDimension, // GetDimensions used undef dimension %0 on %1.
+  InstrWriteMaskForTypedUAVStore, // store on typed uav must write to all four components of the UAV.
+  InstrWriteMaskMatchValueForUAVStore, // uav store write mask must match store value mask, write mask is %0 and store value mask is %1.
 
   // Metadata
   MetaBarycentricsFloat3, // only 'float3' type is allowed for SV_Barycentrics.
-  MetaBarycentricsInterpolation, // SV_Barycentrics cannot be used with 'nointerpolation' type
+  MetaBarycentricsInterpolation, // SV_Barycentrics cannot be used with 'nointerpolation' type.
   MetaBarycentricsTwoPerspectives, // There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode.
-  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
   MetaClipCullMaxRows, // Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows.
-  MetaControlFlowHintNotOnControlFlow, // Control flow hint only works on control flow inst
-  MetaDenseResIDs, // Resource identifiers must be zero-based and dense
+  MetaControlFlowHintNotOnControlFlow, // Control flow hint only works on control flow inst.
+  MetaDenseResIDs, // Resource identifiers must be zero-based and dense.
   MetaDuplicateSysValue, // System value may only appear once in signature
-  MetaEntryFunction, // entrypoint not found
-  MetaFlagsUsage, // Flags must match usage
-  MetaForceCaseOnSwitch, // Attribute forcecase only works for switch
-  MetaGlcNotOnAppendConsume, // globallycoherent cannot be used with append/consume buffers
+  MetaEntryFunction, // entrypoint not found.
+  MetaFlagsUsage, // Flags must match usage.
+  MetaForceCaseOnSwitch, // Attribute forcecase only works for switch.
+  MetaGlcNotOnAppendConsume, // globallycoherent cannot be used with append/consume buffers: '%0'.
   MetaIntegerInterpMode, // Interpolation mode on integer must be Constant
   MetaInterpModeInOneRow, // Interpolation mode must be identical for all elements packed into the same row.
   MetaInterpModeValid, // Interpolation mode must be valid
-  MetaInvalidControlFlowHint, // Invalid control flow hint
+  MetaInvalidControlFlowHint, // Invalid control flow hint.
   MetaKnown, // Named metadata should be known
-  MetaMaxTessFactor, // Hull Shader MaxTessFactor must be [%0..%1].  %2 specified
-  MetaNoEntryPropsForEntry, // EntryPoints must have entry properties.
+  MetaMaxTessFactor, // Hull Shader MaxTessFactor must be [%0..%1].  %2 specified.
+  MetaNoEntryPropsForEntry, // Entry point %0 must have entry properties.
   MetaNoSemanticOverlap, // Semantics must not overlap
-  MetaRequired, // TODO - Required metadata missing
+  MetaRequired, // TODO - Required metadata missing.
   MetaSemaKindMatchesName, // Semantic name must match system value, when defined.
   MetaSemaKindValid, // Semantic kind must be valid
-  MetaSemanticCompType, // %0 must be %1
+  MetaSemanticCompType, // %0 must be %1.
   MetaSemanticIndexMax, // System value semantics have a maximum valid semantic index
-  MetaSemanticLen, // Semantic length must be at least 1 and at most 64
+  MetaSemanticLen, // Semantic length must be at least 1 and at most 64.
   MetaSemanticShouldBeAllocated, // Semantic should have a valid packing location
   MetaSemanticShouldNotBeAllocated, // Semantic should have a packing location of -1
-  MetaSignatureCompType, // signature %0 specifies unrecognized or invalid component type
+  MetaSignatureCompType, // signature %0 specifies unrecognized or invalid component type.
   MetaSignatureDataWidth, // Data width must be identical for all elements packed into the same row.
   MetaSignatureIllegalComponentOrder, // Component ordering for packed elements must be: arbitrary < system value < system generated value
   MetaSignatureIndexConflict, // Only elements with compatible indexing rules may be packed together
@@ -181,97 +181,97 @@ enum class ValidationRule : unsigned {
   MetaTarget, // Target triple must be 'dxil-ms-dx'
   MetaTessellatorOutputPrimitive, // Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW.
   MetaTessellatorPartition, // Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even.
-  MetaTextureType, // elements of typed buffers and textures must fit in four 32-bit quantities
-  MetaUsed, // All metadata must be used by dxil
-  MetaValidSamplerMode, // Invalid sampler mode on sampler 
-  MetaValueRange, // Metadata value must be within range
-  MetaWellFormed, // TODO - Metadata must be well-formed in operand count and types
+  MetaTextureType, // elements of typed buffers and textures must fit in four 32-bit quantities.
+  MetaUsed, // All metadata must be used by dxil.
+  MetaValidSamplerMode, // Invalid sampler mode on sampler .
+  MetaValueRange, // Metadata value must be within range.
+  MetaWellFormed, // TODO - Metadata must be well-formed in operand count and types.
 
   // Program flow
-  FlowDeadLoop, // Loop must have break
+  FlowDeadLoop, // Loop must have break.
   FlowFunctionCall, // Function with parameter is not permitted
-  FlowNoRecusion, // Recursion is not permitted
-  FlowReducible, // Execution flow must be reducible
+  FlowNoRecusion, // Recursion is not permitted.
+  FlowReducible, // Execution flow must be reducible.
 
   // Shader model
-  Sm64bitRawBufferLoadStore, // i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3
-  SmAmplificationShaderPayloadSize, // For shader '%0', payload size is greater than %1
-  SmAmplificationShaderPayloadSizeDeclared, // For shader '%0', payload size %1 is greater than declared size of %2 bytes
+  Sm64bitRawBufferLoadStore, // i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3.
+  SmAmplificationShaderPayloadSize, // For amplification shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes.
+  SmAmplificationShaderPayloadSizeDeclared, // For amplification shader with entry '%0', payload size %1 is greater than declared size of %2 bytes.
   SmAppendAndConsumeOnSameUAV, // BufferUpdateCounter inc and dec on a given UAV (%d) cannot both be in the same shader for shader model less than 5.1.
   SmCBufferArrayOffsetAlignment, // CBuffer array offset must be aligned to 16-bytes
   SmCBufferElementOverflow, // CBuffer elements must not overflow
   SmCBufferOffsetOverlap, // CBuffer offsets must not overlap
-  SmCBufferTemplateTypeMustBeStruct, // D3D12 constant/texture buffer template element can only be a struct
+  SmCBufferTemplateTypeMustBeStruct, // D3D12 constant/texture buffer template element can only be a struct.
   SmCSNoSignatures, // Compute shaders must not have shader signatures.
-  SmCompletePosition, // Not all elements of SV_Position were written
+  SmCompletePosition, // Not all elements of SV_Position were written.
   SmConstantInterpMode, // Interpolation mode must be constant for MS primitive output.
-  SmCounterOnlyOnStructBuf, // BufferUpdateCounter valid only on structured buffers
-  SmDSInputControlPointCountRange, // DS input control point count must be [0..%0].  %1 specified
+  SmCounterOnlyOnStructBuf, // BufferUpdateCounter valid only on structured buffers.
+  SmDSInputControlPointCountRange, // DS input control point count must be [0..%0].  %1 specified.
   SmDomainLocationIdxOOB, // DomainLocation component index out of bounds for the domain.
   SmDxilVersion, // Target shader model requires specific Dxil Version
-  SmGSInstanceCountRange, // GS instance count must be [1..%0].  %1 specified
-  SmGSOutputVertexCountRange, // GS output vertex count must be [0..%0].  %1 specified
-  SmGSTotalOutputVertexDataRange, // 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
-  SmGSValidInputPrimitive, // GS input primitive unrecognized
-  SmGSValidOutputPrimitiveTopology, // GS output primitive topology unrecognized
-  SmHSInputControlPointCountRange, // HS input control point count must be [0..%0].  %1 specified
+  SmGSInstanceCountRange, // GS instance count must be [1..%0].  %1 specified.
+  SmGSOutputVertexCountRange, // GS output vertex count must be [0..%0].  %1 specified.
+  SmGSTotalOutputVertexDataRange, // 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.
+  SmGSValidInputPrimitive, // GS input primitive unrecognized.
+  SmGSValidOutputPrimitiveTopology, // GS output primitive topology unrecognized.
+  SmHSInputControlPointCountRange, // HS input control point count must be [0..%0].  %1 specified.
   SmHullPassThruControlPointCountMatch, // For pass thru hull shader, input control point count must match output control point count
   SmInsideTessFactorSizeMatchDomain, // InsideTessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.
-  SmInvalidResourceCompType, // Invalid resource return type
-  SmInvalidResourceKind, // Invalid resources kind
-  SmInvalidSamplerFeedbackType, // Invalid sampler feedback type
-  SmInvalidTextureKindOnUAV, // Texture2DMS[Array] or TextureCube[Array] resources are not supported with UAVs
+  SmInvalidResourceCompType, // Invalid resource return type.
+  SmInvalidResourceKind, // Invalid resources kind.
+  SmInvalidSamplerFeedbackType, // Invalid sampler feedback type.
+  SmInvalidTextureKindOnUAV, // Texture2DMS[Array] or TextureCube[Array] resources are not supported with UAVs.
   SmIsoLineOutputPrimitiveMismatch, // 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.
-  SmMaxMSSMSize, // Total Thread Group Shared Memory storage is %0, exceeded %1
-  SmMaxTGSMSize, // Total Thread Group Shared Memory storage is %0, exceeded %1
-  SmMaxTheadGroup, // Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1
-  SmMeshPSigRowCount, // For shader '%0', primitive output signatures are taking up more than %1 rows
-  SmMeshShaderInOutSize, // For shader '%0', payload plus output size is greater than %1
-  SmMeshShaderMaxPrimitiveCount, // MS max primitive output count must be [0..%0].  %1 specified
-  SmMeshShaderMaxVertexCount, // MS max vertex output count must be [0..%0].  %1 specified
-  SmMeshShaderOutputSize, // For shader '%0', vertex plus primitive output size is greater than %1
-  SmMeshShaderPayloadSize, // For shader '%0', payload size is greater than %1
-  SmMeshShaderPayloadSizeDeclared, // For shader '%0', payload size %1 is greater than declared size of %2 bytes
-  SmMeshTotalSigRowCount, // For shader '%0', vertex and primitive output signatures are taking up more than %1 rows
-  SmMeshVSigRowCount, // For shader '%0', vertex output signatures are taking up more than %1 rows
+  SmMaxMSSMSize, // Total Thread Group Shared Memory storage is %0, exceeded %1.
+  SmMaxTGSMSize, // Total Thread Group Shared Memory storage is %0, exceeded %1.
+  SmMaxTheadGroup, // Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1.
+  SmMeshPSigRowCount, // For shader '%0', primitive output signatures are taking up more than %1 rows.
+  SmMeshShaderInOutSize, // For shader '%0', payload plus output size is greater than %1.
+  SmMeshShaderMaxPrimitiveCount, // MS max primitive output count must be [0..%0].  %1 specified.
+  SmMeshShaderMaxVertexCount, // MS max vertex output count must be [0..%0].  %1 specified.
+  SmMeshShaderOutputSize, // For shader '%0', vertex plus primitive output size is greater than %1.
+  SmMeshShaderPayloadSize, // For mesh shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes.
+  SmMeshShaderPayloadSizeDeclared, // For mesh shader with entry '%0', payload size %1 is greater than declared size of %2 bytes.
+  SmMeshTotalSigRowCount, // For shader '%0', vertex and primitive output signatures are taking up more than %1 rows.
+  SmMeshVSigRowCount, // For shader '%0', vertex output signatures are taking up more than %1 rows.
   SmMultiStreamMustBePoint, // When multiple GS output streams are used they must be pointlists
   SmName, // Target shader model name must be known
   SmNoInterpMode, // Interpolation mode must be undefined for VS input/PS output/patch constant.
   SmNoPSOutputIdx, // Pixel shader output registers are not indexable.
   SmOpcode, // Opcode must be defined in target shader model
   SmOpcodeInInvalidFunction, // Invalid DXIL opcode usage like StorePatchConstant in patch constant function
-  SmOperand, // Operand must be defined in target shader model
-  SmOutputControlPointCountRange, // output control point count must be [0..%0].  %1 specified
-  SmOutputControlPointsTotalScalars, // Total number of scalars across all HS output control points must not exceed 
-  SmPSConsistentInterp, // 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)
+  SmOperand, // Operand must be defined in target shader model.
+  SmOutputControlPointCountRange, // output control point count must be [0..%0].  %1 specified.
+  SmOutputControlPointsTotalScalars, // Total number of scalars across all HS output control points must not exceed .
+  SmPSConsistentInterp, // 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).
   SmPSCoverageAndInnerCoverage, // InnerCoverage and Coverage are mutually exclusive.
-  SmPSMultipleDepthSemantic, // Pixel Shader only allows one type of depth semantic to be declared
-  SmPSOutputSemantic, // Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found
-  SmPSTargetCol0, // SV_Target packed location must start at column 0
-  SmPSTargetIndexMatchesRow, // SV_Target semantic index must match packed row location
-  SmPatchConstantOnlyForHSDS, // patch constant signature only valid in HS and DS
-  SmROVOnlyInPS, // RasterizerOrdered objects are only allowed in 5.0+ pixel shaders
-  SmRayShaderPayloadSize, // For shader '%0', %1 size is smaller than argument's allocation size
-  SmRayShaderSignatures, // Ray tracing shader '%0' should not have any shader signatures
+  SmPSMultipleDepthSemantic, // Pixel Shader only allows one type of depth semantic to be declared.
+  SmPSOutputSemantic, // Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found.
+  SmPSTargetCol0, // SV_Target packed location must start at column 0.
+  SmPSTargetIndexMatchesRow, // SV_Target semantic index must match packed row location.
+  SmPatchConstantOnlyForHSDS, // patch constant signature only valid in HS and DS.
+  SmROVOnlyInPS, // RasterizerOrdered objects are only allowed in 5.0+ pixel shaders.
+  SmRayShaderPayloadSize, // For shader '%0', %1 size is smaller than argument's allocation size.
+  SmRayShaderSignatures, // Ray tracing shader '%0' should not have any shader signatures.
   SmResourceRangeOverlap, // Resource ranges must not overlap
-  SmSampleCountOnlyOn2DMS, // Only Texture2DMS/2DMSArray could has sample count
+  SmSampleCountOnlyOn2DMS, // Only Texture2DMS/2DMSArray could has sample count.
   SmSemantic, // Semantic must be defined in target shader model
-  SmStreamIndexRange, // Stream index (%0) must between 0 and %1
-  SmTessFactorForDomain, // Required TessFactor for domain not found declared anywhere in Patch Constant data
+  SmStreamIndexRange, // Stream index (%0) must between 0 and %1.
+  SmTessFactorForDomain, // Required TessFactor for domain not found declared anywhere in Patch Constant data.
   SmTessFactorSizeMatchDomain, // TessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.
-  SmThreadGroupChannelRange, // Declared Thread Group %0 size %1 outside valid range [%2..%3]
-  SmTriOutputPrimitiveMismatch, // 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
-  SmUndefinedOutput, // Not all elements of output %0 were written
-  SmValidDomain, // Invalid Tessellator Domain specified. Must be isoline, tri or quad
+  SmThreadGroupChannelRange, // Declared Thread Group %0 size %1 outside valid range [%2..%3].
+  SmTriOutputPrimitiveMismatch, // 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.
+  SmUndefinedOutput, // Not all elements of output %0 were written.
+  SmValidDomain, // Invalid Tessellator Domain specified. Must be isoline, tri or quad.
   SmViewIDNeedsSlot, // ViewID requires compatible space in pixel shader input signature
-  SmZeroHSInputControlPointWithInput, // When HS input control point count is 0, no input signature should exist
+  SmZeroHSInputControlPointWithInput, // When HS input control point count is 0, no input signature should exist.
 
   // Type system
   TypesDefined, // Type must be defined based on DXIL primitives
-  TypesI8, // I8 can only used as immediate value for intrinsic
+  TypesI8, // I8 can only be used as immediate value for intrinsic.
   TypesIntWidth, // Int type must be of valid width
-  TypesNoMultiDim, // Only one dimension allowed for array type
-  TypesNoPtrToPtr, // Pointers to pointers, or pointers in structures are not allowed
+  TypesNoMultiDim, // Only one dimension allowed for array type.
+  TypesNoPtrToPtr, // Pointers to pointers, or pointers in structures are not allowed.
   TypesNoVector, // Vector types must not be present
 };
 // VALRULE-ENUM:END

+ 6 - 2
include/llvm/IR/DiagnosticInfo.h

@@ -481,6 +481,9 @@ void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn,
 /// where location information is stored in metadata
 class DiagnosticInfoDxil : public DiagnosticInfo {
 private:
+  // Function
+  const Function *Func;
+
   // Location information
   const DILocation *DLoc;
 
@@ -490,10 +493,11 @@ private:
 public:
   /// This class does not copy \p MsgStr, therefore the reference must be valid
   /// for the whole life time of the Diagnostic.
-  DiagnosticInfoDxil(const DILocation *Loc, const Twine &MsgStr,
+  DiagnosticInfoDxil(const Function *F, const DILocation *Loc, const Twine &MsgStr,
                      DiagnosticSeverity Severity = DS_Error)
-    : DiagnosticInfo(DK_DXIL, Severity), DLoc(Loc), MsgStr(MsgStr) {}
+    : DiagnosticInfo(DK_DXIL, Severity), Func(F), DLoc(Loc), MsgStr(MsgStr) {}
 
+  const Function *getFunction() const { return Func; }
   const DILocation *getLocation() const { return DLoc; }
   const Twine &getMsgStr() const { return MsgStr; }
 

+ 50 - 36
lib/DXIL/DxilUtil.cpp

@@ -241,7 +241,7 @@ DIGlobalVariable *FindGlobalVariableDebugInfo(GlobalVariable *GV,
 }
 
 static void EmitWarningOrErrorOnInstruction(Instruction *I, Twine Msg,
-                                            bool bWarning);
+                                            DiagnosticSeverity severity);
 
 // If we don't have debug location and this is select/phi,
 // try recursing users to find instruction with debug info.
@@ -249,18 +249,18 @@ static void EmitWarningOrErrorOnInstruction(Instruction *I, Twine Msg,
 // too much work if no debug location found.
 static bool EmitWarningOrErrorOnInstructionFollowPhiSelect(Instruction *I,
                                                            Twine Msg,
-                                                           bool bWarning,
+                                                           DiagnosticSeverity severity,
                                                            unsigned depth = 0) {
   if (depth > 4)
     return false;
   if (I->getDebugLoc().get()) {
-    EmitWarningOrErrorOnInstruction(I, Msg, bWarning);
+    EmitWarningOrErrorOnInstruction(I, Msg, severity);
     return true;
   }
   if (isa<PHINode>(I) || isa<SelectInst>(I)) {
     for (auto U : I->users())
       if (Instruction *UI = dyn_cast<Instruction>(U))
-        if (EmitWarningOrErrorOnInstructionFollowPhiSelect(UI, Msg, bWarning,
+        if (EmitWarningOrErrorOnInstructionFollowPhiSelect(UI, Msg, severity,
                                                            depth + 1))
           return true;
   }
@@ -268,79 +268,75 @@ static bool EmitWarningOrErrorOnInstructionFollowPhiSelect(Instruction *I,
 }
 
 static void EmitWarningOrErrorOnInstruction(Instruction *I, Twine Msg,
-                                            bool bWarning) {
+                                            DiagnosticSeverity severity) {
   const DebugLoc &DL = I->getDebugLoc();
-  DiagnosticSeverity severity = DiagnosticSeverity::DS_Error;
-
   if (!DL.get() && (isa<PHINode>(I) || isa<SelectInst>(I))) {
-    if (EmitWarningOrErrorOnInstructionFollowPhiSelect(I, Msg, bWarning))
+    if (EmitWarningOrErrorOnInstructionFollowPhiSelect(I, Msg, severity))
       return;
   }
 
-  if (bWarning)
-    severity = DiagnosticSeverity::DS_Warning;
-
-  I->getContext().diagnose(DiagnosticInfoDxil(DL.get(), Msg, severity));
+  I->getContext().diagnose(DiagnosticInfoDxil(I->getParent()->getParent(),
+                                              DL.get(), Msg, severity));
 }
 
 void EmitErrorOnInstruction(Instruction *I, Twine Msg) {
-  EmitWarningOrErrorOnInstruction(I, Msg, /*bWarning*/false);
+  EmitWarningOrErrorOnInstruction(I, Msg, DiagnosticSeverity::DS_Error);
 }
 
 void EmitWarningOnInstruction(Instruction *I, Twine Msg) {
-  EmitWarningOrErrorOnInstruction(I, Msg, /*bWarning*/true);
+  EmitWarningOrErrorOnInstruction(I, Msg, DiagnosticSeverity::DS_Warning);
 }
 
 static void EmitWarningOrErrorOnFunction(Function *F, Twine Msg,
-                                         bool bWarning) {
+                                         DiagnosticSeverity severity) {
   DISubprogram *DISP = getDISubprogram(F);
-  DiagnosticSeverity severity = DiagnosticSeverity::DS_Error;
-  if (bWarning)
-    severity = DiagnosticSeverity::DS_Warning;
-
   DILocation *DLoc = nullptr;
   if (DISP) {
     DLoc = DILocation::get(F->getContext(), DISP->getLine(), 0,
                            DISP, nullptr /*InlinedAt*/);
   }
-  F->getContext().diagnose(DiagnosticInfoDxil(DLoc, Msg, severity));
-
+  F->getContext().diagnose(DiagnosticInfoDxil(F, DLoc, Msg, severity));
 }
 
 void EmitErrorOnFunction(Function *F, Twine Msg) {
-  EmitWarningOrErrorOnFunction(F, Msg, /*bWarning*/false);
+  EmitWarningOrErrorOnFunction(F, Msg, DiagnosticSeverity::DS_Error);
 }
 
 void EmitWarningOnFunction(Function *F, Twine Msg) {
-  EmitWarningOrErrorOnFunction(F, Msg, /*bWarning*/true);
+  EmitWarningOrErrorOnFunction(F, Msg, DiagnosticSeverity::DS_Warning);
 }
 
 static void EmitWarningOrErrorOnGlobalVariable(GlobalVariable *GV,
-                                               Twine Msg, bool bWarning) {
+                                               Twine Msg, DiagnosticSeverity severity) {
   DIVariable *DIV = nullptr;
-  DiagnosticSeverity severity = DiagnosticSeverity::DS_Error;
   if (!GV) return;
 
-  if (bWarning)
-    severity = DiagnosticSeverity::DS_Warning;
-
-  DIV = FindGlobalVariableDebugInfo(GV, GV->getParent()->GetDxilModule().GetOrCreateDebugInfoFinder());
-
+  Module &M = *GV->getParent();
   DILocation *DLoc = nullptr;
-  if (DIV) {
-    DLoc = DILocation::get(GV->getContext(), DIV->getLine(), 0,
-                           DIV->getScope(), nullptr /*InlinedAt*/);
+
+  if (getDebugMetadataVersionFromModule(M) != 0) {
+    DebugInfoFinder FinderObj;
+    DebugInfoFinder &Finder = FinderObj;
+    // Debug modules have no dxil modules. Use it if you got it.
+    if (M.HasDxilModule())
+      Finder = M.GetDxilModule().GetOrCreateDebugInfoFinder();
+    else
+      Finder.processModule(M);
+    DIV = FindGlobalVariableDebugInfo(GV, Finder);
+    if (DIV)
+      DLoc = DILocation::get(GV->getContext(), DIV->getLine(), 0,
+                             DIV->getScope(), nullptr /*InlinedAt*/);
   }
 
-  GV->getContext().diagnose(DiagnosticInfoDxil(DLoc, Msg, severity));
+  GV->getContext().diagnose(DiagnosticInfoDxil(nullptr /*Function*/, DLoc, Msg, severity));
 }
 
 void EmitErrorOnGlobalVariable(GlobalVariable *GV, Twine Msg) {
-  EmitWarningOrErrorOnGlobalVariable(GV, Msg, /*bWarning*/false);
+  EmitWarningOrErrorOnGlobalVariable(GV, Msg, DiagnosticSeverity::DS_Error);
 }
 
 void EmitWarningOnGlobalVariable(GlobalVariable *GV, Twine Msg) {
-  EmitWarningOrErrorOnGlobalVariable(GV, Msg, /*bWarning*/true);
+  EmitWarningOrErrorOnGlobalVariable(GV, Msg, DiagnosticSeverity::DS_Warning);
 }
 
 const char *kResourceMapErrorMsg =
@@ -349,6 +345,24 @@ void EmitResMappingError(Instruction *Res) {
   EmitErrorOnInstruction(Res, kResourceMapErrorMsg);
 }
 
+// Mostly just a locationless diagnostic output
+static void EmitWarningOrErrorOnContext(LLVMContext &Ctx, Twine Msg, DiagnosticSeverity severity) {
+  Ctx.diagnose(DiagnosticInfoDxil(nullptr /*Func*/, nullptr /*DLoc*/,
+                                  Msg, severity));
+}
+
+void EmitErrorOnContext(LLVMContext &Ctx, Twine Msg) {
+  EmitWarningOrErrorOnContext(Ctx, Msg, DiagnosticSeverity::DS_Error);
+}
+
+void EmitWarningOnContext(LLVMContext &Ctx, Twine Msg) {
+  EmitWarningOrErrorOnContext(Ctx, Msg, DiagnosticSeverity::DS_Warning);
+}
+
+void EmitNoteOnContext(LLVMContext &Ctx, Twine Msg) {
+  EmitWarningOrErrorOnContext(Ctx, Msg, DiagnosticSeverity::DS_Note);
+}
+
 void CollectSelect(llvm::Instruction *Inst,
                    std::unordered_set<llvm::Instruction *> &selectSet) {
   unsigned startOpIdx = 0;

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 311 - 352
lib/HLSL/DxilValidation.cpp


+ 1 - 1
lib/HLSL/HLSignatureLower.cpp

@@ -1201,7 +1201,7 @@ void HLSignatureLower::GenerateDxilCSInputs() {
     if (semanticStr.empty()) {
       dxilutil::EmitErrorOnFunction(Entry, "Semantic must be defined for all "
                                     "parameters of an entry function or patch "
-                                    "constant function");
+                                    "constant function.");
       return;
     }
 

+ 12 - 6
lib/IR/DiagnosticInfo.cpp

@@ -233,22 +233,28 @@ void llvm::emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn,
 // HLSL Change start - Dxil Diagnostic Info reporter
 
 // Slapdash printing of diagnostic information as a last resort
-// Used by dxl. Doesn't include source snippets.
+// Used by validation and linker errors. Doesn't include source snippets.
 void DiagnosticInfoDxil::print(DiagnosticPrinter &DP) const {
   if (DLoc) {
     DIScope *scope = cast<DIScope>(DLoc->getRawScope());
-    DP << scope->getFilename() << DLoc->getLine() << ":";
+    DP << scope->getFilename() << ":" << DLoc->getLine() << ":";
     unsigned Column = DLoc->getColumn();
     if (Column > 0)
       DP << Column << ":";
+    DP << " ";
+  } else if (Func) {
+    DP << "Function: " << Func->getName() << ": ";
   }
 
+  bool ZiPrompt = true;
   switch (getSeverity()) {
-  case DiagnosticSeverity::DS_Note:    DP << " note: "; break;
-  case DiagnosticSeverity::DS_Remark:  DP << " remark: "; break;
-  case DiagnosticSeverity::DS_Warning: DP << " warning: "; break;
-  case DiagnosticSeverity::DS_Error:   DP << " error: "; break;
+  case DiagnosticSeverity::DS_Note:    DP << "note: "; ZiPrompt = false; break;
+  case DiagnosticSeverity::DS_Remark:  DP << "remark: "; ZiPrompt = false; break;
+  case DiagnosticSeverity::DS_Warning: DP << "warning: "; break;
+  case DiagnosticSeverity::DS_Error:   DP << "error: "; break;
   }
   DP << getMsgStr();
+  if (!DLoc && ZiPrompt)
+    DP << " Use /Zi for source location.";
 }
 // HLSL Change end - Dxil Diagnostic Info reporter

+ 7 - 6
lib/Transforms/Scalar/DxilLoopUnroll.cpp

@@ -137,11 +137,12 @@ public:
 
 char DxilLoopUnroll::ID;
 
-static void FailLoopUnroll(bool WarnOnly, LLVMContext &Ctx, DebugLoc DL, const Twine &Message) {
+static void FailLoopUnroll(bool WarnOnly, Function *F, DebugLoc DL, const Twine &Message) {
+  LLVMContext &Ctx = F->getContext();
   DiagnosticSeverity severity = DiagnosticSeverity::DS_Error;
   if (WarnOnly)
     severity = DiagnosticSeverity::DS_Warning;
-  Ctx.diagnose(DiagnosticInfoDxil(DL.get(), Message, severity));
+  Ctx.diagnose(DiagnosticInfoDxil(F, DL.get(), Message, severity));
 }
 
 struct LoopIteration {
@@ -637,7 +638,7 @@ bool DxilLoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
   unsigned ExplicitUnrollCount = 0;
   if (HasExplicitLoopCount) {
     if (ExplicitUnrollCountSigned < 1) {
-      FailLoopUnroll(false, F->getContext(), LoopLoc, "Could not unroll loop. Invalid unroll count.");
+      FailLoopUnroll(false, F, LoopLoc, "Could not unroll loop. Invalid unroll count.");
       return false;
     }
     ExplicitUnrollCount = (unsigned)ExplicitUnrollCountSigned;
@@ -1006,7 +1007,7 @@ bool DxilLoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
     // Now that we potentially turned some GEP indices into constants,
     // try to clean up their allocas.
     if (!BreakUpArrayAllocas(FxcCompatMode /* allow oob index */, ProblemAllocas.begin(), ProblemAllocas.end(), DT, AC, DVC)) {
-      FailLoopUnroll(false, F->getContext(), LoopLoc, "Could not unroll loop due to out of bound array access.");
+      FailLoopUnroll(false, F, LoopLoc, "Could not unroll loop due to out of bound array access.");
     }
 
     return true;
@@ -1018,10 +1019,10 @@ bool DxilLoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
         "Could not unroll loop. Loop bound could not be deduced at compile time. "
         "Use [unroll(n)] to give an explicit count.";
     if (FxcCompatMode) {
-      FailLoopUnroll(true /*warn only*/, F->getContext(), LoopLoc, Msg);
+      FailLoopUnroll(true /*warn only*/, F, LoopLoc, Msg);
     }
     else {
-      FailLoopUnroll(false /*warn only*/, F->getContext(), LoopLoc,
+      FailLoopUnroll(false /*warn only*/, F, LoopLoc,
         Twine(Msg) + Twine(" Use '-HV 2016' to treat this as warning."));
     }
 

+ 12 - 11
tools/clang/lib/CodeGen/CGDebugInfo.cpp

@@ -312,7 +312,7 @@ void CGDebugInfo::CreateCompileUnit() {
   // because that's what the SourceManager says)
 
   // Get absolute path name.
-  SourceManager &SM = CGM.getContext().getSourceManager();
+  // SourceManager &SM = CGM.getContext().getSourceManager(); // HLSL Change - unused
   std::string MainFileName = CGM.getCodeGenOpts().MainFileName;
   if (MainFileName.empty())
     MainFileName = "<stdin>";
@@ -321,17 +321,18 @@ void CGDebugInfo::CreateCompileUnit() {
   // the file name itself with no path information. This file name may have had
   // a relative path, so we look into the actual file entry for the main
   // file to determine the real absolute path for the file.
-  if (!llvm::sys::path::is_absolute(MainFileName)) { // HLSL Change: we put the full path in -main-file-name
-    std::string MainFileDir;
-    if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
-      MainFileDir = MainFile->getDir()->getName();
-      if (MainFileDir != ".") {
-        llvm::SmallString<1024> MainFileDirSS(MainFileDir);
-        llvm::sys::path::append(MainFileDirSS, MainFileName);
-        MainFileName = MainFileDirSS.str();
-      }
+
+#if 0  // HLSL change. The directory is already part of the name, this would duplicate it
+  std::string MainFileDir;
+  if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
+    MainFileDir = MainFile->getDir()->getName();
+    if (MainFileDir != ".") {
+      llvm::SmallString<1024> MainFileDirSS(MainFileDir);
+      llvm::sys::path::append(MainFileDirSS, MainFileName);
+      MainFileName = MainFileDirSS.str();
     }
-  } // HLSL Change
+  }
+#endif  // HLSL change. The full path is already here
 
   // Save filename string.
   StringRef Filename = internString(MainFileName);

+ 6 - 1
tools/clang/lib/CodeGen/CodeGenAction.cpp

@@ -20,6 +20,7 @@
 #include "clang/CodeGen/ModuleBuilder.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
+#include "clang/Frontend/TextDiagnosticPrinter.h" // HLSL Change
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Bitcode/ReaderWriter.h"
@@ -556,8 +557,12 @@ BackendConsumer::DxilDiagHandler(const llvm::DiagnosticInfoDxil &D) {
   FullSourceLoc Loc(DILoc, SourceMgr);
 
   // If no location information is available, prompt for debug flag
-  if (Loc.isInvalid())
+  // and add function name to give some information
+  if (Loc.isInvalid()) {
     Message += " Use /Zi for source location.";
+    if (auto *DiagClient = dynamic_cast<TextDiagnosticPrinter*>(Diags.getClient()))
+      DiagClient->setPrefix("Function: " + D.getFunction()->getName().str());
+  }
   Diags.Report(Loc, DiagID).AddString(Message);
 
   return true;

+ 4 - 2
tools/clang/test/CodeGenHLSL/mesh-val/asOversizePayload.hlsl

@@ -1,6 +1,8 @@
-// RUN: %dxc -E main -T as_6_5 %s | FileCheck %s
+// RUN: %dxc -Zi -E main -T as_6_5 %s | FileCheck %s -check-prefix=CHK_DB
+// RUN: %dxc -E main -T as_6_5 %s | FileCheck %s -check-prefix=CHK_NODB
 
-// CHECK: payload size is greater than 16384
+// CHK_DB: 23:5: error: For amplification shader with entry 'main', payload size 16400 is greater than maximum size of 16384 bytes.
+// CHK_NODB: For amplification shader with entry 'main', payload size 16400 is greater than maximum size of 16384 bytes.
 
 #define NUM_THREADS 32
 

+ 4 - 2
tools/clang/test/CodeGenHLSL/mesh-val/msOversizePayload.hlsl

@@ -1,6 +1,8 @@
-// RUN: %dxc -E main -T ms_6_5 %s | FileCheck %s
+// RUN: %dxc -Zi -E main -T ms_6_5 %s | FileCheck %s -check-prefix=CHK_DB
+// RUN: %dxc -E main -T ms_6_5 %s | FileCheck %s -check-prefix=CHK_NODB
 
-// CHECK: payload size is greater than 16384
+// CHK_DB: :29: error: For mesh shader with entry 'main', payload size 16404 is greater than maximum size of 16384 bytes.
+// CHK_NODB: error: For mesh shader with entry 'main', payload size 16404 is greater than maximum size of 16384 bytes. Use /Zi for source location.
 
 #define MAX_VERT 32
 #define MAX_PRIM 16

+ 9 - 9
tools/clang/unittests/HLSL/ValidationTest.cpp

@@ -1070,7 +1070,7 @@ TEST_F(ValidationTest, LocalResCopy) {
       L"..\\DXILValidation\\resCopy.hlsl", "cs_6_0", {"ret void"},
       {"%H = alloca %dx.types.ResRet.i32\n"
        "ret void"},
-      {"Dxil struct types should only used by ExtractValue"});
+      {"Dxil struct types should only be used by ExtractValue"});
 }
 
 TEST_F(ValidationTest, WhenIncorrectModelThenFail) {
@@ -1271,7 +1271,7 @@ TEST_F(ValidationTest, StructBufGlobalCoherentAndCounter) {
       L"..\\DXILValidation\\struct_buf1.hlsl", "ps_6_0",
       "!\"buf2\", i32 0, i32 0, i32 1, i32 12, i1 false, i1 false",
       "!\"buf2\", i32 0, i32 0, i32 1, i32 12, i1 true, i1 true",
-      "globallycoherent cannot be used with append/consume buffers'buf2'");
+      "globallycoherent cannot be used with append/consume buffers: 'buf2'");
 }
 
 TEST_F(ValidationTest, StructBufStrideAlign) {
@@ -1589,7 +1589,7 @@ TEST_F(ValidationTest, I8Type) {
                           "%([0-9]+) = alloca \\[4 x i32\\]",
                           "%\\1 = alloca [4 x i32]\n"
                           "  %m8 = alloca i8",
-                          "I8 can only used as immediate value for intrinsic",
+                          "I8 can only be used as immediate value for intrinsic",
     /*bRegex*/true);
 }
 
@@ -2047,8 +2047,8 @@ void main( \
       "!\\9 = !{i32 4, !\"SV_CullDistance\", i8 9, i8 7, !\\10, i8 2, i32 1, i8 1, i32 1, i8 0, \\11}\n",
       "!1012 =" },
 
-    "signature element SV_ClipDistance at location \\(2,0\\) size \\(1,2\\) violates component ordering rule \\(arb < sv < sgv\\).\n"
-    "signature element SV_CullDistance at location \\(1,0\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\).",
+      {"signature element SV_ClipDistance at location \\(2,0\\) size \\(1,2\\) violates component ordering rule \\(arb < sv < sgv\\).",
+       "signature element SV_CullDistance at location \\(1,0\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\)."},
     /*bRegex*/true);
 }
 
@@ -2073,8 +2073,8 @@ float4 main( \
     "!\\2 = !{i32 2, !\"SV_PrimitiveID\", i8 5, i8 10, !\\3, i8 1, i32 1, i8 1, i32 1, i8 0, null}\n"
     "!\\4 = !{i32 3, !\"SV_IsFrontFace\", i8 \\5, i8 13, !\\6, i8 1, i32 1, i8 1, i32 1, i8 1, null}\n",
 
-    "signature element SV_PrimitiveID at location \\(1,0\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\).\n"
-    "signature element SV_IsFrontFace at location \\(1,1\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\).",
+    {"signature element SV_PrimitiveID at location \\(1,0\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\).",
+     "signature element SV_IsFrontFace at location \\(1,1\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\)."},
     /*bRegex*/true);
 }
 
@@ -2104,8 +2104,8 @@ float4 main( \
       "!\\7 = !{i32 4, !\"ViewPortArrayIndex\", i8 5, i8 0, !\\8, i8 1, i32 1, i8 1, i32 1, i8 3, null}\n",
       "!1012 ="},
 
-    "signature element SV_PrimitiveID at location \\(1,0\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\).\n"
-    "signature element ViewPortArrayIndex at location \\(1,3\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\).",
+    {"signature element SV_PrimitiveID at location \\(1,0\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\).",
+     "signature element ViewPortArrayIndex at location \\(1,3\\) size \\(1,1\\) violates component ordering rule \\(arb < sv < sgv\\)."},
     /*bRegex*/true);
 }
 

+ 188 - 188
utils/hct/hctdb.py

@@ -2365,7 +2365,7 @@ class db_dxil(object):
         self.interpretation_table = table
 
     def build_valrules(self):
-        self.add_valrule_msg("Bitcode.Valid", "TODO - Module must be bitcode-valid", "Module bitcode is invalid")
+        self.add_valrule_msg("Bitcode.Valid", "TODO - Module must be bitcode-valid", "Module bitcode is invalid.")
 
         self.add_valrule_msg("Container.PartMatches", "DXIL Container Parts must match Module", "Container part '%0' does not match expected for module.")
         self.add_valrule_msg("Container.PartRepeated", "DXIL Container must have only one of each part type", "More than one container part '%0'.")
@@ -2373,24 +2373,24 @@ class db_dxil(object):
         self.add_valrule_msg("Container.PartInvalid", "DXIL Container must not contain unknown parts", "Unknown part '%0' found in DXIL container.")
         self.add_valrule_msg("Container.RootSignatureIncompatible", "Root Signature in DXIL Container must be compatible with shader", "Root Signature in DXIL container is not compatible with shader.")
 
-        self.add_valrule("Meta.Required", "TODO - Required metadata missing")
-        self.add_valrule_msg("Meta.Known", "Named metadata should be known", "Named metadata '%0' is unknown")
-        self.add_valrule("Meta.Used", "All metadata must be used by dxil")
-        self.add_valrule_msg("Meta.Target", "Target triple must be 'dxil-ms-dx'", "Unknown target triple '%0'")
-        self.add_valrule("Meta.WellFormed", "TODO - Metadata must be well-formed in operand count and types")
-        self.add_valrule("Meta.SemanticLen", "Semantic length must be at least 1 and at most 64")
-        self.add_valrule_msg("Meta.InterpModeValid", "Interpolation mode must be valid", "Invalid interpolation mode for '%0'")
-        self.add_valrule_msg("Meta.SemaKindValid", "Semantic kind must be valid", "Semantic kind for '%0' is invalid")
-        self.add_valrule_msg("Meta.NoSemanticOverlap", "Semantics must not overlap", "Semantic '%0' overlap at %1")
-        self.add_valrule_msg("Meta.SemaKindMatchesName", "Semantic name must match system value, when defined.", "Semantic name %0 does not match System Value kind %1")
+        self.add_valrule("Meta.Required", "TODO - Required metadata missing.")
+        self.add_valrule_msg("Meta.Known", "Named metadata should be known", "Named metadata '%0' is unknown.")
+        self.add_valrule("Meta.Used", "All metadata must be used by dxil.")
+        self.add_valrule_msg("Meta.Target", "Target triple must be 'dxil-ms-dx'", "Unknown target triple '%0'.")
+        self.add_valrule("Meta.WellFormed", "TODO - Metadata must be well-formed in operand count and types.")
+        self.add_valrule("Meta.SemanticLen", "Semantic length must be at least 1 and at most 64.")
+        self.add_valrule_msg("Meta.InterpModeValid", "Interpolation mode must be valid", "Invalid interpolation mode for '%0'.")
+        self.add_valrule_msg("Meta.SemaKindValid", "Semantic kind must be valid", "Semantic kind for '%0' is invalid.")
+        self.add_valrule_msg("Meta.NoSemanticOverlap", "Semantics must not overlap", "Semantic '%0' overlap at %1.")
+        self.add_valrule_msg("Meta.SemaKindMatchesName", "Semantic name must match system value, when defined.", "Semantic name %0 does not match System Value kind %1.")
         self.add_valrule_msg("Meta.DuplicateSysValue", "System value may only appear once in signature", "System value %0 appears more than once in the same signature.")
-        self.add_valrule_msg("Meta.SemanticIndexMax", "System value semantics have a maximum valid semantic index", "%0 semantic index exceeds maximum (%1)")
-        self.add_valrule_msg("Meta.SystemValueRows", "System value may only have 1 row", "rows for system value semantic %0 must be 1")
-        self.add_valrule_msg("Meta.SemanticShouldBeAllocated", "Semantic should have a valid packing location", "%0 Semantic '%1' should have a valid packing location")
-        self.add_valrule_msg("Meta.SemanticShouldNotBeAllocated", "Semantic should have a packing location of -1", "%0 Semantic '%1' should have a packing location of -1")
-        self.add_valrule("Meta.ValueRange", "Metadata value must be within range")
-        self.add_valrule("Meta.FlagsUsage", "Flags must match usage")
-        self.add_valrule("Meta.DenseResIDs", "Resource identifiers must be zero-based and dense")
+        self.add_valrule_msg("Meta.SemanticIndexMax", "System value semantics have a maximum valid semantic index", "%0 semantic index exceeds maximum (%1).")
+        self.add_valrule_msg("Meta.SystemValueRows", "System value may only have 1 row", "rows for system value semantic %0 must be 1.")
+        self.add_valrule_msg("Meta.SemanticShouldBeAllocated", "Semantic should have a valid packing location", "%0 Semantic '%1' should have a valid packing location.")
+        self.add_valrule_msg("Meta.SemanticShouldNotBeAllocated", "Semantic should have a packing location of -1", "%0 Semantic '%1' should have a packing location of -1.")
+        self.add_valrule("Meta.ValueRange", "Metadata value must be within range.")
+        self.add_valrule("Meta.FlagsUsage", "Flags must match usage.")
+        self.add_valrule("Meta.DenseResIDs", "Resource identifiers must be zero-based and dense.")
         self.add_valrule_msg("Meta.SignatureOverlap", "Signature elements may not overlap in packing location.", "signature element %0 at location (%1,%2) size (%3,%4) overlaps another signature element.")
         self.add_valrule_msg("Meta.SignatureOutOfRange", "Signature elements must fit within maximum signature size", "signature element %0 at location (%1,%2) size (%3,%4) is out of range.")
         self.add_valrule_msg("Meta.SignatureIndexConflict", "Only elements with compatible indexing rules may be packed together", "signature element %0 at location (%1,%2) size (%3,%4) has an indexing conflict with another signature element packed into the same row.")
@@ -2398,111 +2398,111 @@ class db_dxil(object):
         self.add_valrule_msg("Meta.SignatureDataWidth", "Data width must be identical for all elements packed into the same row.", "signature element %0 at location (%1, %2) size (%3, %4) has data width that differs from another element packed into the same row.")
         self.add_valrule_msg("Meta.IntegerInterpMode", "Interpolation mode on integer must be Constant", "signature element %0 specifies invalid interpolation mode for integer component type.")
         self.add_valrule_msg("Meta.InterpModeInOneRow", "Interpolation mode must be identical for all elements packed into the same row.", "signature element %0 at location (%1,%2) size (%3,%4) has interpolation mode that differs from another element packed into the same row.")
-        self.add_valrule("Meta.SemanticCompType", "%0 must be %1")
+        self.add_valrule("Meta.SemanticCompType", "%0 must be %1.")
         self.add_valrule_msg("Meta.ClipCullMaxRows", "Combined elements of SV_ClipDistance and SV_CullDistance must fit in two rows.", "ClipDistance and CullDistance occupy more than the maximum of 2 rows combined.")
         self.add_valrule_msg("Meta.ClipCullMaxComponents", "Combined elements of SV_ClipDistance and SV_CullDistance must fit in 8 components", "ClipDistance and CullDistance use more than the maximum of 8 components combined.")
-        self.add_valrule("Meta.SignatureCompType", "signature %0 specifies unrecognized or invalid component type")
+        self.add_valrule("Meta.SignatureCompType", "signature %0 specifies unrecognized or invalid component type.")
         self.add_valrule("Meta.TessellatorPartition", "Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even.")
         self.add_valrule("Meta.TessellatorOutputPrimitive", "Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW.")
-        self.add_valrule("Meta.MaxTessFactor", "Hull Shader MaxTessFactor must be [%0..%1].  %2 specified")
-        self.add_valrule("Meta.ValidSamplerMode", "Invalid sampler mode on sampler ")
-        self.add_valrule("Meta.GlcNotOnAppendConsume", "globallycoherent cannot be used with append/consume buffers")
-        self.add_valrule_msg("Meta.StructBufAlignment", "StructuredBuffer stride not aligned","structured buffer element size must be a multiple of %0 bytes (actual size %1 bytes)")
-        self.add_valrule_msg("Meta.StructBufAlignmentOutOfBound", "StructuredBuffer stride out of bounds","structured buffer elements cannot be larger than %0 bytes (actual size %1 bytes)")
-        self.add_valrule("Meta.EntryFunction", "entrypoint not found")
-        self.add_valrule("Meta.InvalidControlFlowHint", "Invalid control flow hint")
-        self.add_valrule("Meta.BranchFlatten", "Can't use branch and flatten attributes together")
-        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.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.MaxTessFactor", "Hull Shader MaxTessFactor must be [%0..%1].  %2 specified.")
+        self.add_valrule("Meta.ValidSamplerMode", "Invalid sampler mode on sampler .")
+        self.add_valrule("Meta.GlcNotOnAppendConsume", "globallycoherent cannot be used with append/consume buffers: '%0'.")
+        self.add_valrule_msg("Meta.StructBufAlignment", "StructuredBuffer stride not aligned","structured buffer element size must be a multiple of %0 bytes (actual size %1 bytes).")
+        self.add_valrule_msg("Meta.StructBufAlignmentOutOfBound", "StructuredBuffer stride out of bounds","structured buffer elements cannot be larger than %0 bytes (actual size %1 bytes).")
+        self.add_valrule("Meta.EntryFunction", "entrypoint not found.")
+        self.add_valrule("Meta.InvalidControlFlowHint", "Invalid control flow hint.")
+        self.add_valrule("Meta.BranchFlatten", "Can't use branch and flatten attributes together.")
+        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.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("Meta.BarycentricsTwoPerspectives", "There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode.")
-        self.add_valrule("Meta.NoEntryPropsForEntry", "EntryPoints must have entry properties.")
-
-        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("Instr.PtrBitCast", "Pointer type bitcast must be have same size")
-        self.add_valrule("Instr.MinPrecisonBitCast", "Bitcast on minprecison types is not allowed")
-        self.add_valrule("Instr.StructBitCast", "Bitcast on struct types is not allowed")
-        self.add_valrule("Instr.Status", "Resource status should only used by CheckAccessFullyMapped")
-        self.add_valrule("Instr.CheckAccessFullyMapped", "CheckAccessFullyMapped should only used on resource status")
-        self.add_valrule_msg("Instr.OpConst", "DXIL intrinsic requires an immediate constant operand", "%0 of %1 must be an immediate constant")
-        self.add_valrule("Instr.Allowed", "Instructions must be of an allowed type")
-        self.add_valrule("Instr.OpCodeReserved", "Instructions must not reference reserved opcodes")
-        self.add_valrule_msg("Instr.OperandRange", "DXIL intrinsic operand must be within defined range", "expect %0 between %1, got %2")
-        self.add_valrule("Instr.NoReadingUninitialized", "Instructions should not read uninitialized value")
-        self.add_valrule("Instr.NoGenericPtrAddrSpaceCast", "Address space cast between pointer types must have one part to be generic address space")
-        self.add_valrule("Instr.InBoundsAccess", "Access to out-of-bounds memory is disallowed")
-        self.add_valrule("Instr.OpConstRange", "Constant values must be in-range for operation")
-        self.add_valrule("Instr.ImmBiasForSampleB", "bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate")
+        self.add_valrule("Meta.NoEntryPropsForEntry", "Entry point %0 must have entry properties.")
+
+        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("Instr.PtrBitCast", "Pointer type bitcast must be have same size.")
+        self.add_valrule("Instr.MinPrecisonBitCast", "Bitcast on minprecison types is not allowed.")
+        self.add_valrule("Instr.StructBitCast", "Bitcast on struct types is not allowed.")
+        self.add_valrule("Instr.Status", "Resource status should only be used by CheckAccessFullyMapped.")
+        self.add_valrule("Instr.CheckAccessFullyMapped", "CheckAccessFullyMapped should only be used on resource status.")
+        self.add_valrule_msg("Instr.OpConst", "DXIL intrinsic requires an immediate constant operand", "%0 of %1 must be an immediate constant.")
+        self.add_valrule("Instr.Allowed", "Instructions must be of an allowed type.")
+        self.add_valrule("Instr.OpCodeReserved", "Instructions must not reference reserved opcodes.")
+        self.add_valrule_msg("Instr.OperandRange", "DXIL intrinsic operand must be within defined range", "expect %0 between %1, got %2.")
+        self.add_valrule("Instr.NoReadingUninitialized", "Instructions should not read uninitialized value.")
+        self.add_valrule("Instr.NoGenericPtrAddrSpaceCast", "Address space cast between pointer types must have one part to be generic address space.")
+        self.add_valrule("Instr.InBoundsAccess", "Access to out-of-bounds memory is disallowed.")
+        self.add_valrule("Instr.OpConstRange", "Constant values must be in-range for operation.")
+        self.add_valrule("Instr.ImmBiasForSampleB", "bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate.")
         # If streams have not been declared, you must use cut instead of cut_stream in GS - is there an equivalent rule here?
 
         # Need to clean up all error messages and actually implement.
         # Midlevel
-        self.add_valrule("Instr.NoIndefiniteLog", "No indefinite logarithm")
-        self.add_valrule("Instr.NoIndefiniteAsin", "No indefinite arcsine")
-        self.add_valrule("Instr.NoIndefiniteAcos", "No indefinite arccosine")
-        self.add_valrule("Instr.NoIDivByZero", "No signed integer division by zero")
-        self.add_valrule("Instr.NoUDivByZero", "No unsigned integer division by zero")
-        self.add_valrule("Instr.NoIndefiniteDsxy", "No indefinite derivative calculation")
-        self.add_valrule("Instr.MinPrecisionNotPrecise", "Instructions marked precise may not refer to minprecision values")
+        self.add_valrule("Instr.NoIndefiniteLog", "No indefinite logarithm.")
+        self.add_valrule("Instr.NoIndefiniteAsin", "No indefinite arcsine.")
+        self.add_valrule("Instr.NoIndefiniteAcos", "No indefinite arccosine.")
+        self.add_valrule("Instr.NoIDivByZero", "No signed integer division by zero.")
+        self.add_valrule("Instr.NoUDivByZero", "No unsigned integer division by zero.")
+        self.add_valrule("Instr.NoIndefiniteDsxy", "No indefinite derivative calculation.")
+        self.add_valrule("Instr.MinPrecisionNotPrecise", "Instructions marked precise may not refer to minprecision values.")
 
         # Backend
         self.add_valrule("Instr.OnlyOneAllocConsume", "RWStructuredBuffers may increment or decrement their counters, but not both.")
 
         # CCompiler
-        self.add_valrule("Instr.TextureOffset", "offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7")
+        self.add_valrule("Instr.TextureOffset", "offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7.")
         # D3D12
-        self.add_valrule_msg("Instr.CannotPullPosition", "pull-model evaluation of position disallowed", "%0 does not support pull-model evaluation of position")
+        self.add_valrule_msg("Instr.CannotPullPosition", "pull-model evaluation of position disallowed", "%0 does not support pull-model evaluation of position.")
         #self.add_valrule("Instr.ERR_GUARANTEED_RACE_CONDITION_UAV", "TODO - race condition writing to shared resource detected, consider making this write conditional.") warning on fxc.
         #self.add_valrule("Instr.ERR_GUARANTEED_RACE_CONDITION_GSM", "TODO - race condition writing to shared memory detected, consider making this write conditional.") warning on fxc.
         #self.add_valrule("Instr.ERR_INFINITE_LOOP", "TODO - ERR_INFINITE_LOOP") fxc will report error if it can prove the loop is infinite.
-        self.add_valrule("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")
-        self.add_valrule("Instr.ResourceCoordinateMiss", "coord uninitialized")
-        self.add_valrule("Instr.ResourceCoordinateTooMany", "out of bound coord must be undef")
-        self.add_valrule("Instr.ResourceOffsetMiss", "offset uninitialized")
-        self.add_valrule("Instr.ResourceOffsetTooMany", "out of bound offset must be undef")
-        self.add_valrule("Instr.UndefResultForGetDimension", "GetDimensions used undef dimension %0 on %1")
-        self.add_valrule("Instr.SamplerModeForLOD", "lod instruction requires sampler declared in default mode")
-        self.add_valrule("Instr.SamplerModeForSample", "sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode")
-        self.add_valrule("Instr.SamplerModeForSampleC", "sample_c_*/gather_c instructions require sampler declared in comparison mode")
+        self.add_valrule("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.")
+        self.add_valrule("Instr.ResourceCoordinateMiss", "coord uninitialized.")
+        self.add_valrule("Instr.ResourceCoordinateTooMany", "out of bound coord must be undef.")
+        self.add_valrule("Instr.ResourceOffsetMiss", "offset uninitialized.")
+        self.add_valrule("Instr.ResourceOffsetTooMany", "out of bound offset must be undef.")
+        self.add_valrule("Instr.UndefResultForGetDimension", "GetDimensions used undef dimension %0 on %1.")
+        self.add_valrule("Instr.SamplerModeForLOD", "lod instruction requires sampler declared in default mode.")
+        self.add_valrule("Instr.SamplerModeForSample", "sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode.")
+        self.add_valrule("Instr.SamplerModeForSampleC", "sample_c_*/gather_c instructions require sampler declared in comparison mode.")
         self.add_valrule("Instr.SampleCompType", "sample_* instructions require resource to be declared to return UNORM, SNORM or FLOAT.")
         self.add_valrule("Instr.BarrierModeUselessUGroup", "sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.")
-        self.add_valrule("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. ")
-        self.add_valrule("Instr.BarrierModeForNonCS", "sync in a non-Compute/Amplification/Mesh Shader must only sync UAV (sync_uglobal)")
-        self.add_valrule("Instr.WriteMaskForTypedUAVStore", "store on typed uav must write to all four components of the UAV")
-        self.add_valrule("Instr.ResourceKindForCalcLOD","lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray")
-        self.add_valrule("Instr.ResourceKindForSample", "sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray")
-        self.add_valrule("Instr.ResourceKindForSampleC", "samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray")
-        self.add_valrule("Instr.ResourceKindForGather", "gather requires resource declared as texture/2D/Cube/2DArray/CubeArray")
-        self.add_valrule("Instr.WriteMaskMatchValueForUAVStore", "uav store write mask must match store value mask, write mask is %0 and store value mask is %1")
-        self.add_valrule("Instr.ResourceKindForBufferLoadStore", "buffer load/store only works on Raw/Typed/StructuredBuffer")
-        self.add_valrule("Instr.ResourceKindForTextureStore", "texture store only works on Texture1D/1DArray/2D/2DArray/3D")
-        self.add_valrule("Instr.ResourceKindForGetDim", "Invalid resource kind on GetDimensions")
-        self.add_valrule("Instr.ResourceKindForTextureLoad", "texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray")
+        self.add_valrule("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.")
+        self.add_valrule("Instr.BarrierModeForNonCS", "sync in a non-Compute/Amplification/Mesh Shader must only sync UAV (sync_uglobal).")
+        self.add_valrule("Instr.WriteMaskForTypedUAVStore", "store on typed uav must write to all four components of the UAV.")
+        self.add_valrule("Instr.ResourceKindForCalcLOD","lod requires resource declared as texture1D/2D/3D/Cube/CubeArray/1DArray/2DArray.")
+        self.add_valrule("Instr.ResourceKindForSample", "sample/_l/_d requires resource declared as texture1D/2D/3D/Cube/1DArray/2DArray/CubeArray.")
+        self.add_valrule("Instr.ResourceKindForSampleC", "samplec requires resource declared as texture1D/2D/Cube/1DArray/2DArray/CubeArray.")
+        self.add_valrule("Instr.ResourceKindForGather", "gather requires resource declared as texture/2D/Cube/2DArray/CubeArray.")
+        self.add_valrule("Instr.WriteMaskMatchValueForUAVStore", "uav store write mask must match store value mask, write mask is %0 and store value mask is %1.")
+        self.add_valrule("Instr.ResourceKindForBufferLoadStore", "buffer load/store only works on Raw/Typed/StructuredBuffer.")
+        self.add_valrule("Instr.ResourceKindForTextureStore", "texture store only works on Texture1D/1DArray/2D/2DArray/3D.")
+        self.add_valrule("Instr.ResourceKindForGetDim", "Invalid resource kind on GetDimensions.")
+        self.add_valrule("Instr.ResourceKindForTextureLoad", "texture load only works on Texture1D/1DArray/2D/2DArray/3D/MS2D/MS2DArray.")
         self.add_valrule("Instr.ResourceClassForSamplerGather", "sample, lod and gather should be on srv resource.")
         self.add_valrule("Instr.ResourceClassForUAVStore", "store should be on uav resource.")
-        self.add_valrule("Instr.ResourceClassForLoad", "load can only run on UAV/SRV resource")
-        self.add_valrule("Instr.ResourceMapToSingleEntry", "Fail to map resource to resource table")
-        self.add_valrule("Instr.ResourceUser", "Resource should only used by Load/GEP/Call")
-        self.add_valrule("Instr.ResourceKindForTraceRay", "TraceRay should only use RTAccelerationStructure")
-        self.add_valrule("Instr.OffsetOnUAVLoad", "uav load don't support offset")
-        self.add_valrule("Instr.MipOnUAVLoad", "uav load don't support mipLevel/sampleIndex")
-        self.add_valrule("Instr.SampleIndexForLoad2DMS", "load on Texture2DMS/2DMSArray require sampleIndex")
-        self.add_valrule("Instr.CoordinateCountForRawTypedBuf", "raw/typed buffer don't need 2 coordinates")
-        self.add_valrule("Instr.CoordinateCountForStructBuf", "structured buffer require 2 coordinates")
-        self.add_valrule("Instr.MipLevelForGetDimension", "Use mip level on buffer when GetDimensions")
-        self.add_valrule("Instr.DxilStructUser", "Dxil struct types should only used by ExtractValue")
-        self.add_valrule("Instr.DxilStructUserOutOfBound", "Index out of bound when extract value from dxil struct types")
-        self.add_valrule("Instr.HandleNotFromCreateHandle", "Resource handle should returned by createHandle")
-        self.add_valrule("Instr.BufferUpdateCounterOnUAV", "BufferUpdateCounter valid only on UAV")
-        self.add_valrule("Instr.BufferUpdateCounterOnResHasCounter", "BufferUpdateCounter valid only when HasCounter is true")
-        self.add_valrule("Instr.CBufferOutOfBound", "Cbuffer access out of bound")
-        self.add_valrule("Instr.CBufferClassForCBufferHandle", "Expect Cbuffer for CBufferLoad handle")
+        self.add_valrule("Instr.ResourceClassForLoad", "load can only run on UAV/SRV resource.")
+        self.add_valrule("Instr.ResourceMapToSingleEntry", "Fail to map resource to resource table.")
+        self.add_valrule("Instr.ResourceUser", "Resource should only be used by Load/GEP/Call.")
+        self.add_valrule("Instr.ResourceKindForTraceRay", "TraceRay should only use RTAccelerationStructure.")
+        self.add_valrule("Instr.OffsetOnUAVLoad", "uav load don't support offset.")
+        self.add_valrule("Instr.MipOnUAVLoad", "uav load don't support mipLevel/sampleIndex.")
+        self.add_valrule("Instr.SampleIndexForLoad2DMS", "load on Texture2DMS/2DMSArray require sampleIndex.")
+        self.add_valrule("Instr.CoordinateCountForRawTypedBuf", "raw/typed buffer don't need 2 coordinates.")
+        self.add_valrule("Instr.CoordinateCountForStructBuf", "structured buffer require 2 coordinates.")
+        self.add_valrule("Instr.MipLevelForGetDimension", "Use mip level on buffer when GetDimensions.")
+        self.add_valrule("Instr.DxilStructUser", "Dxil struct types should only be used by ExtractValue.")
+        self.add_valrule("Instr.DxilStructUserOutOfBound", "Index out of bound when extract value from dxil struct types.")
+        self.add_valrule("Instr.HandleNotFromCreateHandle", "Resource handle should returned by createHandle.")
+        self.add_valrule("Instr.BufferUpdateCounterOnUAV", "BufferUpdateCounter valid only on UAV.")
+        self.add_valrule("Instr.BufferUpdateCounterOnResHasCounter", "BufferUpdateCounter valid only when HasCounter is true.")
+        self.add_valrule("Instr.CBufferOutOfBound", "Cbuffer access out of bound.")
+        self.add_valrule("Instr.CBufferClassForCBufferHandle", "Expect Cbuffer for CBufferLoad handle.")
         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.TGSMRaceCond", "Race condition writing to shared memory detected, consider making this write conditional")
+        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.AttributeAtVertexNoInterpolation", "Attribute %0 must have nointerpolation mode in order to use GetAttributeAtVertex function.")
         self.add_valrule("Instr.CreateHandleImmRangeID", "Local resource must map to global resource.")
         self.add_valrule("Instr.SignatureOperationNotInEntry", "Dxil operation for input output signature must be in entryPoints.")
@@ -2520,84 +2520,84 @@ class db_dxil(object):
         # - multiple rules regarding interfaces, which isn't a supported feature for DXIL
         # - rules for DX9-style intrinsics, which aren't supported for DXIL
        
-        self.add_valrule_msg("Types.NoVector", "Vector types must not be present", "Vector type '%0' is not allowed")
-        self.add_valrule_msg("Types.Defined", "Type must be defined based on DXIL primitives", "Type '%0' is not defined on DXIL primitives")
-        self.add_valrule_msg("Types.IntWidth", "Int type must be of valid width", "Int type '%0' has an invalid width")
-        self.add_valrule("Types.NoMultiDim", "Only one dimension allowed for array type")
-        self.add_valrule("Types.NoPtrToPtr", "Pointers to pointers, or pointers in structures are not allowed")
-        self.add_valrule("Types.I8", "I8 can only used as immediate value for intrinsic")
-
-        self.add_valrule_msg("Sm.Name", "Target shader model name must be known", "Unknown shader model '%0'")
-        self.add_valrule_msg("Sm.DxilVersion", "Target shader model requires specific Dxil Version", "Shader model requires Dxil Version %0,%1")
-        self.add_valrule_msg("Sm.Opcode", "Opcode must be defined in target shader model", "Opcode %0 not valid in shader model %1")
-        self.add_valrule("Sm.Operand", "Operand must be defined in target shader model")
-        self.add_valrule_msg("Sm.Semantic", "Semantic must be defined in target shader model", "Semantic '%0' is invalid as %1 %2")
-        self.add_valrule_msg("Sm.NoInterpMode", "Interpolation mode must be undefined for VS input/PS output/patch constant.", "Interpolation mode for '%0' is set but should be undefined")
-        self.add_valrule_msg("Sm.ConstantInterpMode", "Interpolation mode must be constant for MS primitive output.", "Interpolation mode for '%0' should be constant")
+        self.add_valrule_msg("Types.NoVector", "Vector types must not be present", "Vector type '%0' is not allowed.")
+        self.add_valrule_msg("Types.Defined", "Type must be defined based on DXIL primitives", "Type '%0' is not defined on DXIL primitives.")
+        self.add_valrule_msg("Types.IntWidth", "Int type must be of valid width", "Int type '%0' has an invalid width.")
+        self.add_valrule("Types.NoMultiDim", "Only one dimension allowed for array type.")
+        self.add_valrule("Types.NoPtrToPtr", "Pointers to pointers, or pointers in structures are not allowed.")
+        self.add_valrule("Types.I8", "I8 can only be used as immediate value for intrinsic.")
+
+        self.add_valrule_msg("Sm.Name", "Target shader model name must be known", "Unknown shader model '%0'.")
+        self.add_valrule_msg("Sm.DxilVersion", "Target shader model requires specific Dxil Version", "Shader model requires Dxil Version %0,%1.")
+        self.add_valrule_msg("Sm.Opcode", "Opcode must be defined in target shader model", "Opcode %0 not valid in shader model %1.")
+        self.add_valrule("Sm.Operand", "Operand must be defined in target shader model.")
+        self.add_valrule_msg("Sm.Semantic", "Semantic must be defined in target shader model", "Semantic '%0' is invalid as %1 %2.")
+        self.add_valrule_msg("Sm.NoInterpMode", "Interpolation mode must be undefined for VS input/PS output/patch constant.", "Interpolation mode for '%0' is set but should be undefined.")
+        self.add_valrule_msg("Sm.ConstantInterpMode", "Interpolation mode must be constant for MS primitive output.", "Interpolation mode for '%0' should be constant.")
         self.add_valrule("Sm.NoPSOutputIdx", "Pixel shader output registers are not indexable.")# TODO restrict to PS
-        self.add_valrule("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)")
-        self.add_valrule("Sm.ThreadGroupChannelRange", "Declared Thread Group %0 size %1 outside valid range [%2..%3]")
-        self.add_valrule("Sm.MaxTheadGroup", "Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1")
-        self.add_valrule("Sm.MaxTGSMSize", "Total Thread Group Shared Memory storage is %0, exceeded %1")
-        self.add_valrule("Sm.ROVOnlyInPS", "RasterizerOrdered objects are only allowed in 5.0+ pixel shaders")
-        self.add_valrule("Sm.TessFactorForDomain", "Required TessFactor for domain not found declared anywhere in Patch Constant data")
+        self.add_valrule("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).")
+        self.add_valrule("Sm.ThreadGroupChannelRange", "Declared Thread Group %0 size %1 outside valid range [%2..%3].")
+        self.add_valrule("Sm.MaxTheadGroup", "Declared Thread Group Count %0 (X*Y*Z) is beyond the valid maximum of %1.")
+        self.add_valrule("Sm.MaxTGSMSize", "Total Thread Group Shared Memory storage is %0, exceeded %1.")
+        self.add_valrule("Sm.ROVOnlyInPS", "RasterizerOrdered objects are only allowed in 5.0+ pixel shaders.")
+        self.add_valrule("Sm.TessFactorForDomain", "Required TessFactor for domain not found declared anywhere in Patch Constant data.")
         self.add_valrule("Sm.TessFactorSizeMatchDomain", "TessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.")
         self.add_valrule("Sm.InsideTessFactorSizeMatchDomain", "InsideTessFactor rows, columns (%0, %1) invalid for domain %2.  Expected %3 rows and 1 column.")
         self.add_valrule("Sm.DomainLocationIdxOOB", "DomainLocation component index out of bounds for the domain.")
         self.add_valrule("Sm.HullPassThruControlPointCountMatch", "For pass thru hull shader, input control point count must match output control point count");
-        self.add_valrule("Sm.OutputControlPointsTotalScalars", "Total number of scalars across all HS output control points must not exceed ")
+        self.add_valrule("Sm.OutputControlPointsTotalScalars", "Total number of scalars across all HS output control points must not exceed .")
         self.add_valrule("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.")
-        self.add_valrule("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")
-        self.add_valrule("Sm.ValidDomain", "Invalid Tessellator Domain specified. Must be isoline, tri or quad")
-        self.add_valrule("Sm.PatchConstantOnlyForHSDS", "patch constant signature only valid in HS and DS")
-        self.add_valrule("Sm.StreamIndexRange", "Stream index (%0) must between 0 and %1")
-        self.add_valrule("Sm.PSOutputSemantic", "Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found")
-        self.add_valrule("Sm.PSMultipleDepthSemantic", "Pixel Shader only allows one type of depth semantic to be declared")
-        self.add_valrule("Sm.PSTargetIndexMatchesRow", "SV_Target semantic index must match packed row location")
-        self.add_valrule("Sm.PSTargetCol0", "SV_Target packed location must start at column 0")
+        self.add_valrule("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.")
+        self.add_valrule("Sm.ValidDomain", "Invalid Tessellator Domain specified. Must be isoline, tri or quad.")
+        self.add_valrule("Sm.PatchConstantOnlyForHSDS", "patch constant signature only valid in HS and DS.")
+        self.add_valrule("Sm.StreamIndexRange", "Stream index (%0) must between 0 and %1.")
+        self.add_valrule("Sm.PSOutputSemantic", "Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, %0 found.")
+        self.add_valrule("Sm.PSMultipleDepthSemantic", "Pixel Shader only allows one type of depth semantic to be declared.")
+        self.add_valrule("Sm.PSTargetIndexMatchesRow", "SV_Target semantic index must match packed row location.")
+        self.add_valrule("Sm.PSTargetCol0", "SV_Target packed location must start at column 0.")
         self.add_valrule("Sm.PSCoverageAndInnerCoverage", "InnerCoverage and Coverage are mutually exclusive.")
-        self.add_valrule("Sm.GSOutputVertexCountRange", "GS output vertex count must be [0..%0].  %1 specified")
-        self.add_valrule("Sm.GSInstanceCountRange", "GS instance count must be [1..%0].  %1 specified")
-        self.add_valrule("Sm.DSInputControlPointCountRange", "DS input control point count must be [0..%0].  %1 specified")
-        self.add_valrule("Sm.HSInputControlPointCountRange", "HS input control point count must be [0..%0].  %1 specified")
-        self.add_valrule("Sm.ZeroHSInputControlPointWithInput", "When HS input control point count is 0, no input signature should exist")
-        self.add_valrule("Sm.OutputControlPointCountRange", "output control point count must be [0..%0].  %1 specified")
-        self.add_valrule("Sm.GSValidInputPrimitive", "GS input primitive unrecognized")
-        self.add_valrule("Sm.GSValidOutputPrimitiveTopology", "GS output primitive topology unrecognized")
+        self.add_valrule("Sm.GSOutputVertexCountRange", "GS output vertex count must be [0..%0].  %1 specified.")
+        self.add_valrule("Sm.GSInstanceCountRange", "GS instance count must be [1..%0].  %1 specified.")
+        self.add_valrule("Sm.DSInputControlPointCountRange", "DS input control point count must be [0..%0].  %1 specified.")
+        self.add_valrule("Sm.HSInputControlPointCountRange", "HS input control point count must be [0..%0].  %1 specified.")
+        self.add_valrule("Sm.ZeroHSInputControlPointWithInput", "When HS input control point count is 0, no input signature should exist.")
+        self.add_valrule("Sm.OutputControlPointCountRange", "output control point count must be [0..%0].  %1 specified.")
+        self.add_valrule("Sm.GSValidInputPrimitive", "GS input primitive unrecognized.")
+        self.add_valrule("Sm.GSValidOutputPrimitiveTopology", "GS output primitive topology unrecognized.")
         self.add_valrule("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.")
-        self.add_valrule("Sm.InvalidTextureKindOnUAV", "Texture2DMS[Array] or TextureCube[Array] resources are not supported with UAVs")
-        self.add_valrule("Sm.InvalidResourceKind", "Invalid resources kind")
-        self.add_valrule("Sm.InvalidResourceCompType","Invalid resource return type")
-        self.add_valrule("Sm.InvalidSamplerFeedbackType","Invalid sampler feedback type")
-        self.add_valrule("Sm.SampleCountOnlyOn2DMS","Only Texture2DMS/2DMSArray could has sample count")
-        self.add_valrule("Sm.CounterOnlyOnStructBuf", "BufferUpdateCounter valid only on structured buffers")
-        self.add_valrule("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")
-        self.add_valrule_msg("Sm.MultiStreamMustBePoint", "When multiple GS output streams are used they must be pointlists", "Multiple GS output streams are used but '%0' is not pointlist")
-        self.add_valrule("Sm.CompletePosition", "Not all elements of SV_Position were written")
-        self.add_valrule("Sm.UndefinedOutput", "Not all elements of output %0 were written")
+        self.add_valrule("Sm.InvalidTextureKindOnUAV", "Texture2DMS[Array] or TextureCube[Array] resources are not supported with UAVs.")
+        self.add_valrule("Sm.InvalidResourceKind", "Invalid resources kind.")
+        self.add_valrule("Sm.InvalidResourceCompType","Invalid resource return type.")
+        self.add_valrule("Sm.InvalidSamplerFeedbackType","Invalid sampler feedback type.")
+        self.add_valrule("Sm.SampleCountOnlyOn2DMS","Only Texture2DMS/2DMSArray could has sample count.")
+        self.add_valrule("Sm.CounterOnlyOnStructBuf", "BufferUpdateCounter valid only on structured buffers.")
+        self.add_valrule("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.")
+        self.add_valrule_msg("Sm.MultiStreamMustBePoint", "When multiple GS output streams are used they must be pointlists", "Multiple GS output streams are used but '%0' is not pointlist.")
+        self.add_valrule("Sm.CompletePosition", "Not all elements of SV_Position were written.")
+        self.add_valrule("Sm.UndefinedOutput", "Not all elements of output %0 were written.")
         self.add_valrule("Sm.CSNoSignatures", "Compute shaders must not have shader signatures.")
-        self.add_valrule("Sm.CBufferTemplateTypeMustBeStruct", "D3D12 constant/texture buffer template element can only be a struct")
-        self.add_valrule_msg("Sm.ResourceRangeOverlap", "Resource ranges must not overlap", "Resource %0 with base %1 size %2 overlap with other resource with base %3 size %4 in space %5")
-        self.add_valrule_msg("Sm.CBufferOffsetOverlap", "CBuffer offsets must not overlap", "CBuffer %0 has offset overlaps at %1")
-        self.add_valrule_msg("Sm.CBufferElementOverflow", "CBuffer elements must not overflow", "CBuffer %0 size insufficient for element at offset %1")
-        self.add_valrule_msg("Sm.CBufferArrayOffsetAlignment", "CBuffer array offset must be aligned to 16-bytes", "CBuffer %0 has unaligned array offset at %1")
-        self.add_valrule_msg("Sm.OpcodeInInvalidFunction", "Invalid DXIL opcode usage like StorePatchConstant in patch constant function", "opcode '%0' should only be used in '%1'")
-        self.add_valrule_msg("Sm.ViewIDNeedsSlot", "ViewID requires compatible space in pixel shader input signature", "Pixel shader input signature lacks available space for ViewID")
-        self.add_valrule("Sm.64bitRawBufferLoadStore", "i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3")
-        self.add_valrule("Sm.RayShaderSignatures", "Ray tracing shader '%0' should not have any shader signatures")
-        self.add_valrule("Sm.RayShaderPayloadSize", "For shader '%0', %1 size is smaller than argument's allocation size")
-        self.add_valrule("Sm.MeshShaderMaxVertexCount", "MS max vertex output count must be [0..%0].  %1 specified")
-        self.add_valrule("Sm.MeshShaderMaxPrimitiveCount", "MS max primitive output count must be [0..%0].  %1 specified")
-        self.add_valrule("Sm.MeshShaderPayloadSize", "For shader '%0', payload size is greater than %1")
-        self.add_valrule("Sm.MeshShaderPayloadSizeDeclared", "For shader '%0', payload size %1 is greater than declared size of %2 bytes")
-        self.add_valrule("Sm.MeshShaderOutputSize", "For shader '%0', vertex plus primitive output size is greater than %1")
-        self.add_valrule("Sm.MeshShaderInOutSize", "For shader '%0', payload plus output size is greater than %1")
-        self.add_valrule("Sm.MeshVSigRowCount", "For shader '%0', vertex output signatures are taking up more than %1 rows")
-        self.add_valrule("Sm.MeshPSigRowCount", "For shader '%0', primitive output signatures are taking up more than %1 rows")
-        self.add_valrule("Sm.MeshTotalSigRowCount", "For shader '%0', vertex and primitive output signatures are taking up more than %1 rows")
-        self.add_valrule("Sm.MaxMSSMSize", "Total Thread Group Shared Memory storage is %0, exceeded %1")
-        self.add_valrule("Sm.AmplificationShaderPayloadSize", "For shader '%0', payload size is greater than %1")
-        self.add_valrule("Sm.AmplificationShaderPayloadSizeDeclared", "For shader '%0', payload size %1 is greater than declared size of %2 bytes")
+        self.add_valrule("Sm.CBufferTemplateTypeMustBeStruct", "D3D12 constant/texture buffer template element can only be a struct.")
+        self.add_valrule_msg("Sm.ResourceRangeOverlap", "Resource ranges must not overlap", "Resource %0 with base %1 size %2 overlap with other resource with base %3 size %4 in space %5.")
+        self.add_valrule_msg("Sm.CBufferOffsetOverlap", "CBuffer offsets must not overlap", "CBuffer %0 has offset overlaps at %1.")
+        self.add_valrule_msg("Sm.CBufferElementOverflow", "CBuffer elements must not overflow", "CBuffer %0 size insufficient for element at offset %1.")
+        self.add_valrule_msg("Sm.CBufferArrayOffsetAlignment", "CBuffer array offset must be aligned to 16-bytes", "CBuffer %0 has unaligned array offset at %1.")
+        self.add_valrule_msg("Sm.OpcodeInInvalidFunction", "Invalid DXIL opcode usage like StorePatchConstant in patch constant function", "opcode '%0' should only be used in '%1'.")
+        self.add_valrule_msg("Sm.ViewIDNeedsSlot", "ViewID requires compatible space in pixel shader input signature", "Pixel shader input signature lacks available space for ViewID.")
+        self.add_valrule("Sm.64bitRawBufferLoadStore", "i64/f64 rawBufferLoad/Store overloads are allowed after SM 6.3.")
+        self.add_valrule("Sm.RayShaderSignatures", "Ray tracing shader '%0' should not have any shader signatures.")
+        self.add_valrule("Sm.RayShaderPayloadSize", "For shader '%0', %1 size is smaller than argument's allocation size.")
+        self.add_valrule("Sm.MeshShaderMaxVertexCount", "MS max vertex output count must be [0..%0].  %1 specified.")
+        self.add_valrule("Sm.MeshShaderMaxPrimitiveCount", "MS max primitive output count must be [0..%0].  %1 specified.")
+        self.add_valrule("Sm.MeshShaderPayloadSize", "For mesh shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes.")
+        self.add_valrule("Sm.MeshShaderPayloadSizeDeclared", "For mesh shader with entry '%0', payload size %1 is greater than declared size of %2 bytes.")
+        self.add_valrule("Sm.MeshShaderOutputSize", "For shader '%0', vertex plus primitive output size is greater than %1.")
+        self.add_valrule("Sm.MeshShaderInOutSize", "For shader '%0', payload plus output size is greater than %1.")
+        self.add_valrule("Sm.MeshVSigRowCount", "For shader '%0', vertex output signatures are taking up more than %1 rows.")
+        self.add_valrule("Sm.MeshPSigRowCount", "For shader '%0', primitive output signatures are taking up more than %1 rows.")
+        self.add_valrule("Sm.MeshTotalSigRowCount", "For shader '%0', vertex and primitive output signatures are taking up more than %1 rows.")
+        self.add_valrule("Sm.MaxMSSMSize", "Total Thread Group Shared Memory storage is %0, exceeded %1.")
+        self.add_valrule("Sm.AmplificationShaderPayloadSize", "For amplification shader with entry '%0', payload size %1 is greater than maximum size of %2 bytes.")
+        self.add_valrule("Sm.AmplificationShaderPayloadSizeDeclared", "For amplification shader with entry '%0', payload size %1 is greater than declared size of %2 bytes.")
 
         # fxc relaxed check of gradient check.
         #self.add_valrule("Uni.NoUniInDiv", "TODO - No instruction requiring uniform execution can be present in divergent block")
@@ -2605,26 +2605,26 @@ class db_dxil(object):
         #self.add_valrule("Uni.ThreadSync", "TODO - Thread sync operation must be in non-varying flow control due to a potential race condition, adding a sync after reading any values controlling shader execution at this point")
         #self.add_valrule("Uni.NoWaveSensitiveGradient", "Gradient operations are not affected by wave-sensitive data or control flow.")
         
-        self.add_valrule("Flow.Reducible", "Execution flow must be reducible")
-        self.add_valrule("Flow.NoRecusion", "Recursion is not permitted")
-        self.add_valrule("Flow.DeadLoop", "Loop must have break")
-        self.add_valrule_msg("Flow.FunctionCall", "Function with parameter is not permitted", "Function %0 with parameter is not permitted, it should be inlined")
-
-        self.add_valrule_msg("Decl.DxilNsReserved", "The DXIL reserved prefixes must only be used by built-in functions and types", "Declaration '%0' uses a reserved prefix")
-        self.add_valrule_msg("Decl.DxilFnExtern", "External function must be a DXIL function", "External function '%0' is not a DXIL function")
-        self.add_valrule_msg("Decl.UsedInternal", "Internal declaration must be used", "Internal declaration '%0' is unused")
-        self.add_valrule_msg("Decl.NotUsedExternal", "External declaration should not be used", "External declaration '%0' is unused")
-        self.add_valrule_msg("Decl.UsedExternalFunction", "External function must be used", "External function '%0' is unused")
-        self.add_valrule_msg("Decl.FnIsCalled", "Functions can only be used by call instructions", "Function '%0' is used for something other than calling")
-        self.add_valrule_msg("Decl.FnFlattenParam", "Function parameters must not use struct types", "Type '%0' is a struct type but is used as a parameter in function '%1'")
-        self.add_valrule_msg("Decl.FnAttribute", "Functions should only contain known function attributes", "Function '%0' contains invalid attribute '%1' with value '%2'")
-        self.add_valrule_msg("Decl.ResourceInFnSig", "Resources not allowed in function signatures", "Function '%0' uses resource in function signature")
-        self.add_valrule_msg("Decl.PayloadStruct", "Payload parameter must be struct type", "Argument '%0' must be a struct type for payload in shader function '%1'")
-        self.add_valrule_msg("Decl.AttrStruct", "Attributes parameter must be struct type", "Argument '%0' must be a struct type for attributes in shader function '%1'")
-        self.add_valrule_msg("Decl.ParamStruct", "Callable function parameter must be struct type", "Argument '%0' must be a struct type for callable shader function '%1'")
-        self.add_valrule_msg("Decl.ExtraArgs", "Extra arguments not allowed for shader functions", "Extra argument '%0' not allowed for shader function '%1'")
-        self.add_valrule_msg("Decl.ShaderReturnVoid", "Shader functions must return void", "Shader function '%0' must have void return type")
-        self.add_valrule_msg("Decl.ShaderMissingArg", "payload/params/attributes parameter is required for certain shader types", "%0 shader '%1' missing required %2 parameter")
+        self.add_valrule("Flow.Reducible", "Execution flow must be reducible.")
+        self.add_valrule("Flow.NoRecusion", "Recursion is not permitted.")
+        self.add_valrule("Flow.DeadLoop", "Loop must have break.")
+        self.add_valrule_msg("Flow.FunctionCall", "Function with parameter is not permitted", "Function %0 with parameter is not permitted, it should be inlined.")
+
+        self.add_valrule_msg("Decl.DxilNsReserved", "The DXIL reserved prefixes must only be used by built-in functions and types", "Declaration '%0' uses a reserved prefix.")
+        self.add_valrule_msg("Decl.DxilFnExtern", "External function must be a DXIL function", "External function '%0' is not a DXIL function.")
+        self.add_valrule_msg("Decl.UsedInternal", "Internal declaration must be used", "Internal declaration '%0' is unused.")
+        self.add_valrule_msg("Decl.NotUsedExternal", "External declaration should not be used", "External declaration '%0' is unused.")
+        self.add_valrule_msg("Decl.UsedExternalFunction", "External function must be used", "External function '%0' is unused.")
+        self.add_valrule_msg("Decl.FnIsCalled", "Functions can only be used by call instructions", "Function '%0' is used for something other than calling.")
+        self.add_valrule_msg("Decl.FnFlattenParam", "Function parameters must not use struct types", "Type '%0' is a struct type but is used as a parameter in function '%1'.")
+        self.add_valrule_msg("Decl.FnAttribute", "Functions should only contain known function attributes", "Function '%0' contains invalid attribute '%1' with value '%2'.")
+        self.add_valrule_msg("Decl.ResourceInFnSig", "Resources not allowed in function signatures", "Function '%0' uses resource in function signature.")
+        self.add_valrule_msg("Decl.PayloadStruct", "Payload parameter must be struct type", "Argument '%0' must be a struct type for payload in shader function '%1'.")
+        self.add_valrule_msg("Decl.AttrStruct", "Attributes parameter must be struct type", "Argument '%0' must be a struct type for attributes in shader function '%1'.")
+        self.add_valrule_msg("Decl.ParamStruct", "Callable function parameter must be struct type", "Argument '%0' must be a struct type for callable shader function '%1'.")
+        self.add_valrule_msg("Decl.ExtraArgs", "Extra arguments not allowed for shader functions", "Extra argument '%0' not allowed for shader function '%1'.")
+        self.add_valrule_msg("Decl.ShaderReturnVoid", "Shader functions must return void", "Shader function '%0' must have void return type.")
+        self.add_valrule_msg("Decl.ShaderMissingArg", "payload/params/attributes parameter is required for certain shader types", "%0 shader '%1' missing required %2 parameter.")
 
         # Assign sensible category names and build up an enumeration description
         cat_names = {

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott