[{"data":1,"prerenderedAt":782},["ShallowReactive",2],{"hhr5HO6wbk":3},{"title":4,"description":5,"type":6,"xrefs":7,"body":8,"_type":781,"_id":4},"PrimitiveId","Primitive ID","builtins",[],{"type":9,"children":10,"toc":777},"root",[11,24,37,42,56,68,80,85,90,95,100,172],{"type":12,"tag":13,"props":14,"children":16},"element","h6",{"id":15},"primitiveid",[17],{"type":12,"tag":18,"props":19,"children":21},"code",{"className":20},[],[22],{"type":23,"value":4},"text",{"type":12,"tag":25,"props":26,"children":27},"p",{},[28,30,35],{"type":23,"value":29},"Decorating a variable with the ",{"type":12,"tag":18,"props":31,"children":33},{"className":32},[],[34],{"type":23,"value":4},{"type":23,"value":36}," built-in decoration will\nmake that variable contain the index of the current primitive.",{"type":12,"tag":25,"props":38,"children":39},{},[40],{"type":23,"value":41},"The index of the first primitive generated by a drawing command is zero, and\nthe index is incremented after every individual point, line, or triangle\nprimitive is processed.",{"type":12,"tag":25,"props":43,"children":44},{},[45,47,54],{"type":23,"value":46},"For triangles drawn as points or line segments (see ",{"type":12,"tag":48,"props":49,"children":51},"a",{"href":50},"/chapters/primsrast#primsrast-polygonmode",[52],{"type":23,"value":53},"Polygon Mode",{"type":23,"value":55},"), the primitive index is incremented only once, even if\nmultiple points or lines are eventually drawn.",{"type":12,"tag":25,"props":57,"children":58},{},[59,61,66],{"type":23,"value":60},"Variables decorated with ",{"type":12,"tag":18,"props":62,"children":64},{"className":63},[],[65],{"type":23,"value":4},{"type":23,"value":67}," are reset to zero between each\ninstance drawn.",{"type":12,"tag":25,"props":69,"children":70},{},[71,73,78],{"type":23,"value":72},"Restarting a primitive topology using primitive restart has no effect on the\nvalue of variables decorated with ",{"type":12,"tag":18,"props":74,"children":76},{"className":75},[],[77],{"type":23,"value":4},{"type":23,"value":79},".",{"type":12,"tag":25,"props":81,"children":82},{},[83],{"type":23,"value":84},"In tessellation control and tessellation evaluation shaders, it will contain\nthe index of the patch within the current set of rendering primitives that\ncorresponds to the shader invocation.",{"type":12,"tag":25,"props":86,"children":87},{},[88],{"type":23,"value":89},"In a geometry shader, it will contain the number of primitives presented as\ninput to the shader since the current set of rendering primitives was\nstarted.",{"type":12,"tag":25,"props":91,"children":92},{},[93],{"type":23,"value":94},"In a fragment shader, it will contain the primitive index written by the\nmesh shader if a mesh shader is present, or the primitive index written by\nthe\ngeometry shader if a geometry shader is present, or with the value that\nwould have been presented as input to the geometry shader had it been\npresent.",{"type":12,"tag":25,"props":96,"children":97},{},[98],{"type":23,"value":99},"In an intersection, any-hit, or closest hit shader, it will contain the\nindex within the geometry of the triangle or bounding box being processed.",{"type":12,"tag":101,"props":102,"children":103},"note",{},[104,123],{"type":12,"tag":25,"props":105,"children":106},{},[107,109,114,116,121],{"type":23,"value":108},"When the ",{"type":12,"tag":18,"props":110,"children":112},{"className":111},[],[113],{"type":23,"value":4},{"type":23,"value":115}," decoration is applied to an output variable in the\nmesh shader or\ngeometry shader, the resulting value is seen through the ",{"type":12,"tag":18,"props":117,"children":119},{"className":118},[],[120],{"type":23,"value":4},{"type":23,"value":122},"\ndecorated input variable in the fragment shader.",{"type":12,"tag":25,"props":124,"children":125},{},[126,128,133,135,141,143,149,150,156,158,164,166,171],{"type":23,"value":127},"The fragment shader using ",{"type":12,"tag":18,"props":129,"children":131},{"className":130},[],[132],{"type":23,"value":4},{"type":23,"value":134}," will need to declare either the\n",{"type":12,"tag":18,"props":136,"children":138},{"className":137},[],[139],{"type":23,"value":140},"MeshShadingNV",{"type":23,"value":142},",\n",{"type":12,"tag":18,"props":144,"children":146},{"className":145},[],[147],{"type":23,"value":148},"MeshShadingEXT",{"type":23,"value":142},{"type":12,"tag":18,"props":151,"children":153},{"className":152},[],[154],{"type":23,"value":155},"Geometry",{"type":23,"value":157}," or ",{"type":12,"tag":18,"props":159,"children":161},{"className":160},[],[162],{"type":23,"value":163},"Tessellation",{"type":23,"value":165}," capability to satisfy the requirement\nSPIR-V has to use ",{"type":12,"tag":18,"props":167,"children":169},{"className":168},[],[170],{"type":23,"value":4},{"type":23,"value":79},{"type":12,"tag":173,"props":174,"children":176},"validity-group",{"name":175},"Valid Usage",[177,281,351,429,494,585,650,711,730],{"type":12,"tag":178,"props":179,"children":181},"validity-field",{"name":180},"VUID-PrimitiveId-PrimitiveId-04330",[182,264],{"type":12,"tag":25,"props":183,"children":184},{},[185,187,192,194,199,201,207,209,215,216,222,223,229,230,236,237,243,244,250,251,256,258],{"type":23,"value":186},"The ",{"type":12,"tag":18,"props":188,"children":190},{"className":189},[],[191],{"type":23,"value":4},{"type":23,"value":193}," decoration ",{"type":12,"tag":195,"props":196,"children":198},"normative",{"type":197},"must",[],{"type":23,"value":200}," be used only within the\n",{"type":12,"tag":18,"props":202,"children":204},{"className":203},[],[205],{"type":23,"value":206},"MeshEXT",{"type":23,"value":208},", ",{"type":12,"tag":18,"props":210,"children":212},{"className":211},[],[213],{"type":23,"value":214},"MeshNV",{"type":23,"value":208},{"type":12,"tag":18,"props":217,"children":219},{"className":218},[],[220],{"type":23,"value":221},"IntersectionKHR",{"type":23,"value":208},{"type":12,"tag":18,"props":224,"children":226},{"className":225},[],[227],{"type":23,"value":228},"AnyHitKHR",{"type":23,"value":142},{"type":12,"tag":18,"props":231,"children":233},{"className":232},[],[234],{"type":23,"value":235},"ClosestHitKHR",{"type":23,"value":208},{"type":12,"tag":18,"props":238,"children":240},{"className":239},[],[241],{"type":23,"value":242},"TessellationControl",{"type":23,"value":142},{"type":12,"tag":18,"props":245,"children":247},{"className":246},[],[248],{"type":23,"value":249},"TessellationEvaluation",{"type":23,"value":208},{"type":12,"tag":18,"props":252,"children":254},{"className":253},[],[255],{"type":23,"value":155},{"type":23,"value":257},", or ",{"type":12,"tag":18,"props":259,"children":261},{"className":260},[],[262],{"type":23,"value":263},"Fragment",{"type":12,"tag":25,"props":265,"children":266},{},[267,273,275],{"type":12,"tag":18,"props":268,"children":270},{"className":269},[],[271],{"type":23,"value":272},"Execution",{"type":23,"value":274}," ",{"type":12,"tag":18,"props":276,"children":278},{"className":277},[],[279],{"type":23,"value":280},"Model",{"type":12,"tag":178,"props":282,"children":284},{"name":283},"VUID-PrimitiveId-Fragment-04331",[285,302],{"type":12,"tag":25,"props":286,"children":287},{},[288,290,295,297],{"type":23,"value":289},"If pipeline contains both the ",{"type":12,"tag":18,"props":291,"children":293},{"className":292},[],[294],{"type":23,"value":263},{"type":23,"value":296}," and ",{"type":12,"tag":18,"props":298,"children":300},{"className":299},[],[301],{"type":23,"value":155},{"type":12,"tag":25,"props":303,"children":304},{},[305,310,311,316,318,323,325,330,332,337,339,342,344,349],{"type":12,"tag":18,"props":306,"children":308},{"className":307},[],[309],{"type":23,"value":272},{"type":23,"value":274},{"type":12,"tag":18,"props":312,"children":314},{"className":313},[],[315],{"type":23,"value":280},{"type":23,"value":317}," and a variable decorated with ",{"type":12,"tag":18,"props":319,"children":321},{"className":320},[],[322],{"type":23,"value":4},{"type":23,"value":324}," is read\nfrom ",{"type":12,"tag":18,"props":326,"children":328},{"className":327},[],[329],{"type":23,"value":263},{"type":23,"value":331}," shader, then the ",{"type":12,"tag":18,"props":333,"children":335},{"className":334},[],[336],{"type":23,"value":155},{"type":23,"value":338}," shader ",{"type":12,"tag":195,"props":340,"children":341},{"type":197},[],{"type":23,"value":343}," write to\nthe output variables decorated with ",{"type":12,"tag":18,"props":345,"children":347},{"className":346},[],[348],{"type":23,"value":4},{"type":23,"value":350}," in all execution\npaths",{"type":12,"tag":178,"props":352,"children":354},{"name":353},"VUID-PrimitiveId-Fragment-04332",[355],{"type":12,"tag":25,"props":356,"children":357},{},[358,359,364,365,370,372,377,378,383,384,389,391,396,398,403,405,410,411,416,417,420,422,427],{"type":23,"value":289},{"type":12,"tag":18,"props":360,"children":362},{"className":361},[],[363],{"type":23,"value":263},{"type":23,"value":296},{"type":12,"tag":18,"props":366,"children":368},{"className":367},[],[369],{"type":23,"value":206},{"type":23,"value":371}," or\n",{"type":12,"tag":18,"props":373,"children":375},{"className":374},[],[376],{"type":23,"value":214},{"type":23,"value":274},{"type":12,"tag":18,"props":379,"children":381},{"className":380},[],[382],{"type":23,"value":272},{"type":23,"value":274},{"type":12,"tag":18,"props":385,"children":387},{"className":386},[],[388],{"type":23,"value":280},{"type":23,"value":390}," and a variable decorated with\n",{"type":12,"tag":18,"props":392,"children":394},{"className":393},[],[395],{"type":23,"value":4},{"type":23,"value":397}," is read from ",{"type":12,"tag":18,"props":399,"children":401},{"className":400},[],[402],{"type":23,"value":263},{"type":23,"value":404}," shader, then the\n",{"type":12,"tag":18,"props":406,"children":408},{"className":407},[],[409],{"type":23,"value":206},{"type":23,"value":157},{"type":12,"tag":18,"props":412,"children":414},{"className":413},[],[415],{"type":23,"value":214},{"type":23,"value":338},{"type":12,"tag":195,"props":418,"children":419},{"type":197},[],{"type":23,"value":421}," write to the output variables\ndecorated with ",{"type":12,"tag":18,"props":423,"children":425},{"className":424},[],[426],{"type":23,"value":4},{"type":23,"value":428}," in all execution paths",{"type":12,"tag":178,"props":430,"children":432},{"name":431},"VUID-PrimitiveId-Fragment-04333",[433],{"type":12,"tag":25,"props":434,"children":435},{},[436,438,443,444,449,450,455,457,462,464,469,470,475,476,481,482,487,489,492],{"type":23,"value":437},"If ",{"type":12,"tag":18,"props":439,"children":441},{"className":440},[],[442],{"type":23,"value":263},{"type":23,"value":274},{"type":12,"tag":18,"props":445,"children":447},{"className":446},[],[448],{"type":23,"value":272},{"type":23,"value":274},{"type":12,"tag":18,"props":451,"children":453},{"className":452},[],[454],{"type":23,"value":280},{"type":23,"value":456}," contains a variable decorated with\n",{"type":12,"tag":18,"props":458,"children":460},{"className":459},[],[461],{"type":23,"value":4},{"type":23,"value":463},", then either the ",{"type":12,"tag":18,"props":465,"children":467},{"className":466},[],[468],{"type":23,"value":148},{"type":23,"value":142},{"type":12,"tag":18,"props":471,"children":473},{"className":472},[],[474],{"type":23,"value":140},{"type":23,"value":208},{"type":12,"tag":18,"props":477,"children":479},{"className":478},[],[480],{"type":23,"value":155},{"type":23,"value":157},{"type":12,"tag":18,"props":483,"children":485},{"className":484},[],[486],{"type":23,"value":163},{"type":23,"value":488}," capability ",{"type":12,"tag":195,"props":490,"children":491},{"type":197},[],{"type":23,"value":493},"\nalso be declared",{"type":12,"tag":178,"props":495,"children":497},{"name":496},"VUID-PrimitiveId-PrimitiveId-04334",[498,545],{"type":12,"tag":25,"props":499,"children":500},{},[501,503,508,510,515,516,521,522,527,528,533,534,539,540],{"type":23,"value":502},"The variable decorated with ",{"type":12,"tag":18,"props":504,"children":506},{"className":505},[],[507],{"type":23,"value":4},{"type":23,"value":509}," within the\n",{"type":12,"tag":18,"props":511,"children":513},{"className":512},[],[514],{"type":23,"value":242},{"type":23,"value":208},{"type":12,"tag":18,"props":517,"children":519},{"className":518},[],[520],{"type":23,"value":249},{"type":23,"value":208},{"type":12,"tag":18,"props":523,"children":525},{"className":524},[],[526],{"type":23,"value":263},{"type":23,"value":142},{"type":12,"tag":18,"props":529,"children":531},{"className":530},[],[532],{"type":23,"value":221},{"type":23,"value":208},{"type":12,"tag":18,"props":535,"children":537},{"className":536},[],[538],{"type":23,"value":228},{"type":23,"value":257},{"type":12,"tag":18,"props":541,"children":543},{"className":542},[],[544],{"type":23,"value":235},{"type":12,"tag":25,"props":546,"children":547},{},[548,553,554,559,560,563,565,571,572,578,579],{"type":12,"tag":18,"props":549,"children":551},{"className":550},[],[552],{"type":23,"value":272},{"type":23,"value":274},{"type":12,"tag":18,"props":555,"children":557},{"className":556},[],[558],{"type":23,"value":280},{"type":23,"value":274},{"type":12,"tag":195,"props":561,"children":562},{"type":197},[],{"type":23,"value":564}," be declared using the ",{"type":12,"tag":18,"props":566,"children":568},{"className":567},[],[569],{"type":23,"value":570},"Input",{"type":23,"value":274},{"type":12,"tag":18,"props":573,"children":575},{"className":574},[],[576],{"type":23,"value":577},"Storage",{"type":23,"value":274},{"type":12,"tag":18,"props":580,"children":582},{"className":581},[],[583],{"type":23,"value":584},"Class",{"type":12,"tag":178,"props":586,"children":588},{"name":587},"VUID-PrimitiveId-PrimitiveId-04335",[589,605,636],{"type":12,"tag":25,"props":590,"children":591},{},[592,593,598,600],{"type":23,"value":502},{"type":12,"tag":18,"props":594,"children":596},{"className":595},[],[597],{"type":23,"value":4},{"type":23,"value":599}," within the ",{"type":12,"tag":18,"props":601,"children":603},{"className":602},[],[604],{"type":23,"value":155},{"type":12,"tag":25,"props":606,"children":607},{},[608,613,614,619,620,623,624,629,630],{"type":12,"tag":18,"props":609,"children":611},{"className":610},[],[612],{"type":23,"value":272},{"type":23,"value":274},{"type":12,"tag":18,"props":615,"children":617},{"className":616},[],[618],{"type":23,"value":280},{"type":23,"value":274},{"type":12,"tag":195,"props":621,"children":622},{"type":197},[],{"type":23,"value":564},{"type":12,"tag":18,"props":625,"children":627},{"className":626},[],[628],{"type":23,"value":570},{"type":23,"value":157},{"type":12,"tag":18,"props":631,"children":633},{"className":632},[],[634],{"type":23,"value":635},"Output",{"type":12,"tag":25,"props":637,"children":638},{},[639,644,645],{"type":12,"tag":18,"props":640,"children":642},{"className":641},[],[643],{"type":23,"value":577},{"type":23,"value":274},{"type":12,"tag":18,"props":646,"children":648},{"className":647},[],[649],{"type":23,"value":584},{"type":12,"tag":178,"props":651,"children":653},{"name":652},"VUID-PrimitiveId-PrimitiveId-04336",[654,697],{"type":12,"tag":25,"props":655,"children":656},{},[657,658,663,664,669,670,675,676,681,682,687,688,691,692],{"type":23,"value":502},{"type":12,"tag":18,"props":659,"children":661},{"className":660},[],[662],{"type":23,"value":4},{"type":23,"value":599},{"type":12,"tag":18,"props":665,"children":667},{"className":666},[],[668],{"type":23,"value":206},{"type":23,"value":371},{"type":12,"tag":18,"props":671,"children":673},{"className":672},[],[674],{"type":23,"value":214},{"type":23,"value":274},{"type":12,"tag":18,"props":677,"children":679},{"className":678},[],[680],{"type":23,"value":272},{"type":23,"value":274},{"type":12,"tag":18,"props":683,"children":685},{"className":684},[],[686],{"type":23,"value":280},{"type":23,"value":274},{"type":12,"tag":195,"props":689,"children":690},{"type":197},[],{"type":23,"value":564},{"type":12,"tag":18,"props":693,"children":695},{"className":694},[],[696],{"type":23,"value":635},{"type":12,"tag":25,"props":698,"children":699},{},[700,705,706],{"type":12,"tag":18,"props":701,"children":703},{"className":702},[],[704],{"type":23,"value":577},{"type":23,"value":274},{"type":12,"tag":18,"props":707,"children":709},{"className":708},[],[710],{"type":23,"value":584},{"type":12,"tag":178,"props":712,"children":714},{"name":713},"VUID-PrimitiveId-PrimitiveId-04337",[715],{"type":12,"tag":25,"props":716,"children":717},{},[718,719,724,725,728],{"type":23,"value":502},{"type":12,"tag":18,"props":720,"children":722},{"className":721},[],[723],{"type":23,"value":4},{"type":23,"value":274},{"type":12,"tag":195,"props":726,"children":727},{"type":197},[],{"type":23,"value":729}," be declared as a\nscalar 32-bit integer value",{"type":12,"tag":178,"props":731,"children":733},{"name":732},"VUID-PrimitiveId-PrimitiveId-07040",[734,749],{"type":12,"tag":25,"props":735,"children":736},{},[737,738,743,744],{"type":23,"value":502},{"type":12,"tag":18,"props":739,"children":741},{"className":740},[],[742],{"type":23,"value":4},{"type":23,"value":599},{"type":12,"tag":18,"props":745,"children":747},{"className":746},[],[748],{"type":23,"value":206},{"type":12,"tag":25,"props":750,"children":751},{},[752,757,758,763,764,767,769,775],{"type":12,"tag":18,"props":753,"children":755},{"className":754},[],[756],{"type":23,"value":272},{"type":23,"value":274},{"type":12,"tag":18,"props":759,"children":761},{"className":760},[],[762],{"type":23,"value":280},{"type":23,"value":274},{"type":12,"tag":195,"props":765,"children":766},{"type":197},[],{"type":23,"value":768}," also be decorated with the ",{"type":12,"tag":18,"props":770,"children":772},{"className":771},[],[773],{"type":23,"value":774},"PerPrimitiveEXT",{"type":23,"value":776},"\ndecoration",{"title":778,"searchDepth":779,"depth":779,"links":780},"",2,[],"markdown",1729612426442]