aboutsummaryrefslogtreecommitdiff
path: root/Spv.Generator
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-07-31 18:26:06 -0300
committerGitHub <noreply@github.com>2022-07-31 18:26:06 -0300
commit2232e4ae876c6841e8a5290bd197855367f8d621 (patch)
tree8d0819207e1dede6fcdfc8685abcc3dcf023b471 /Spv.Generator
parent14ce9e15672d03cb6fc067316f90d81471398ebc (diff)
Vulkan backend (#2518)
* WIP Vulkan implementation * No need to initialize attributes on the SPIR-V backend anymore * Allow multithreading shaderc and vkCreateShaderModule You'll only really see the benefit here with threaded-gal or parallel shader cache compile. Fix shaderc multithreaded changes Thread safety for shaderc Options constructor Dunno how they managed to make a constructor not thread safe, but you do you. May avoid some freezes. * Support multiple levels/layers for blit. Fixes MK8D when scaled, maybe a few other games. AMD software "safe" blit not supported right now. * TextureStorage should hold a ref of the foreign storage, otherwise it might be freed while in use * New depth-stencil blit method for AMD * Workaround for AMD driver bug * Fix some tessellation related issues (still doesn't work?) * Submit command buffer before Texture GetData. (UE4 fix) * DrawTexture support * Fix BGRA on OpenGL backend * Fix rebase build break * Support format aliasing on SetImage * Fix uniform buffers being lost when bindings are out of order * Fix storage buffers being lost when bindings are out of order (also avoid allocations when changing bindings) * Use current command buffer for unscaled copy (perf) Avoids flushing commands and renting a command buffer when fulfilling copy dependencies and when games do unscaled copies. * Update to .net6 * Update Silk.NET to version 2.10.1 Somehow, massive performance boost. Seems like their vtable for looking up vulkan methods was really slow before. * Fix PrimitivesGenerated query, disable Transform Feedback queries for now Lets Splatoon 2 work on nvidia. (mostly) * Update counter queue to be similar to the OGL one Fixes softlocks when games had to flush counters. * Don't throw when ending conditional rendering for now This should be re-enabled when conditional rendering is enabled on nvidia etc. * Update findMSB/findLSB to match master's instruction enum * Fix triangle overlay on SMO, Captain Toad, maybe others? * Don't make Intel Mesa pay for Intel Windows bugs * Fix samplers with MinFilter Linear or Nearest (fixes New Super Mario Bros U Deluxe black borders) * Update Spv.Generator * Add alpha test emulation on shader (but no shader specialisation yet...) * Fix R4G4B4A4Unorm texture format permutation * Validation layers should be enabled for any log level other than None * Add barriers around vkCmdCopyImage Write->Read barrier for src image (we want to wait for a write to read it) Write->Read barrier for dst image (we want to wait for the copy to complete before use) * Be a bit more careful with texture access flags, since it can be used for anything * Device local mapping for all buffers May avoid issues with drivers with NVIDIA on linux/older gpus on windows when using large buffers (?) Also some performance things and fixes issues with opengl games loading textures weird. * Cleanup, disable device local buffers for now. * Add single queue support Multiqueue seems to be a bit more responsive on NVIDIA. Should fix texture flush on intel. AMD has been forced to single queue for an experiment. * Fix some validation errors around extended dynamic state * Remove Intel bug workaround, it was fixed on the latest driver * Use circular queue for checking consumption on command buffers Speeds up games that spam command buffers a little. Avoids checking multiple command buffers if multiple are active at once. * Use SupportBufferUpdater, add single layer flush * Fix counter queue leak when game decides to use host conditional rendering * Force device local storage for textures (fixes linux performance) * Port #3019 * Insert barriers around vkCmdBlitImage (may fix some amd flicker) * Fix transform feedback on Intel, gl_Position feedback and clears to inexistent depth buffers * Don't pause transform feedback for multi draw * Fix draw outside of render pass and missing capability * Workaround for wrong last attribute on AMD (affects FFVII, STRIKERS1945, probably more) * Better workaround for AMD vertex buffer size alignment issue * More instructions + fixes on SPIR-V backend * Allow custom aspect ratio on Vulkan * Correct GTK UI status bar positions * SPIR-V: Functions must always end with a return * SPIR-V: Fix ImageQuerySizeLod * SPIR-V: Set DepthReplacing execution mode when FragDepth is modified * SPIR-V: Implement LoopContinue IR instruction * SPIR-V: Geometry shader support * SPIR-V: Use correct binding number on storage buffers array * Reduce allocations for Spir-v serialization Passes BinaryWriter instead of the stream to Write and WriteOperand - Removes creation of BinaryWriter for each instruction - Removes allocations for literal string * Some optimizations to Spv.Generator - Dictionary for lookups of type declarations, constants, extinst - LiteralInteger internal data format -> ushort - Deterministic HashCode implementation to avoid spirv result not being the same between runs - Inline operand list instead of List<T>, falls back to array if many operands. (large performance boost) TODO: improve instruction allocation, structured program creator, ssa? * Pool Spv.Generator resources, cache delegates, spv opts - Pools for Instructions and LiteralIntegers. Can be passed in when creating the generator module. - NewInstruction is called instead of new Instruction() - Ryujinx SpirvGenerator passes in some pools that are static. The idea is for these to be shared between threads eventually. - Estimate code size when creating the output MemoryStream - LiteralInteger pools using ThreadStatic pools that are initialized before and after creation... not sure of a better way since the way these are created is via implicit cast. Also, cache delegates for Spv.Generator for functions that are passed around to GenerateBinary etc, since passing the function raw creates a delegate on each call. TODO: update python spv cs generator to make the coregrammar with NewInstruction and the `params` overloads. * LocalDefMap for Ssa Rewriter Rather than allocating a large array of all registers for each block in the shader, allocate one array of all registers and clear it between blocks. Reduces allocations in the shader translator. * SPIR-V: Transform feedback support * SPIR-V: Fragment shader interlock support (and image coherency) * SPIR-V: Add early fragment tests support * SPIR-V: Implement SwizzleAdd, add missing Triangles ExecutionMode for geometry shaders, remove SamplerType field from TextureMeta * Don't pass depth clip state right now (fix decals) Explicitly disabling it is incorrect. OpenGL currently automatically disables based on depth clamp, which is the behaviour if this state is omitted. * Multisampling support * Multisampling: Use resolve if src samples count > dst samples count * Multisampling: We can only resolve for unscaled copies * SPIR-V: Only add FSI exec mode if used. * SPIR-V: Use ConstantComposite for Texture Offset Vector Fixes a bunch of freezes with SPIR-V on AMD hardware, and validation errors. Note: Obviously assumes input offsets are constant, which they currently are. * SPIR-V: Don't OpReturn if we already OpExit'ed Fixes spir-v parse failure and stack smashing in RADV (obviously you still need bolist) * SPIR-V: Only use input attribute type for input attributes Output vertex attributes should always be of type float. * Multithreaded Pipeline Compilation * Address some feedback * Make this 32 * Update topology with GpuAccessorState * Cleanup for merge (note: disables spir-v) * Make more robust to shader compilation failure - Don't freeze when GLSL compilation fails - Background SPIR-V pipeline compile failure results in skipped draws, similar to GLSL compilation failure. * Fix Multisampling * Only update fragment scale count if a vertex texture needs a scale. Fixes a performance regression introduced by texture scaling in the vertex stage where support buffer updates would be very frequent, even at 1x, if any textures were used on the vertex stage. This check doesn't exactly look cheap (a flag in the shader stage would probably be preferred), but it is much cheaper than uploading scales in both vulkan and opengl, so it will do for now. * Use a bitmap to do granular tracking for buffer uploads. This path is only taken if the much faster check of "is the buffer rented at all" is triggered, so it doesn't actually end up costing too much, and the time saved by not ending render passes (and on gpu for not waiting on barriers) is probably helpful. Avoids ending render passes to update buffer data (not all the time) - 140-180 to 35-45 in SMO metro kingdom (these updates are in the UI) - Very variable 60-150(!) to 16-25 in mario kart 8 (these updates are in the UI) As well as allowing more data to be preloaded persistently, this will also allow more data to be loaded in the preload buffer, which should be faster as it doesn't need to insert barriers between draws. (and on tbdr, does not need to flush and reload tile memory) Improves performance in GPU limited scenarios. Should notably improve performance on TBDR gpus. Still a lot more to do here. * Copy query results after RP ends, rather than ending to copy We need to end the render pass to get the data (submit command buffer) anyways... Reduces render passes created in games that use queries. * Rework Query stuff a bit to avoid render pass end Tries to reset returned queries in background when possible, rather than ending the render pass. Still ends render pass when resetting a counter after draws, but maybe that can be solved too. (by just pulling an empty object off the pool?) * Remove unnecessary lines Was for testing * Fix validation error for query reset Need to think of a better way to do this. * SPIR-V: Fix SwizzleAdd and some validation errors * SPIR-V: Implement attribute indexing and StoreAttribute * SPIR-V: Fix TextureSize for MS and Buffer sampler types * Fix relaunch issues * SPIR-V: Implement LogicalExclusiveOr * SPIR-V: Constant buffer indexing support * Ignore unsupported attributes rather than throwing (matches current GLSL behaviour) * SPIR-V: Implement tessellation support * SPIR-V: Geometry shader passthrough support * SPIR-V: Implement StoreShader8/16 and StoreStorage8/16 * SPIR-V: Resolution scale support and fix TextureSample multisample with LOD bug * SPIR-V: Fix field index for scale count * SPIR-V: Fix another case of wrong field index * SPIRV/GLSL: More scaling related fixes * SPIR-V: Fix ImageLoad CompositeExtract component type * SPIR-V: Workaround for Intel FrontFacing bug * Enable SPIR-V backend by default * Allow null samplers (samplers are not required when only using texelFetch to access the texture) * Fix some validation errors related to texel block view usage flag and invalid image barrier base level * Use explicit subgroup size if we can (might fix some block flickering on AMD) * Take componentMask and scissor into account when clearing framebuffer attachments * Add missing barriers around CmdFillBuffer (fixes Monster Hunter Rise flickering on NVIDIA) * Use ClampToEdge for Clamp sampler address mode on Vulkan (fixes Hollow Knight) Clamp is unsupported on Vulkan, but ClampToEdge behaves almost the same. ClampToBorder on the other hand (which was being used before) is pretty different * Shader specialization for new Vulkan required state (fixes remaining alpha test issues, vertex stretching on AMD on Crash Bandicoot, etc) * Check if the subgroup size is supported before passing a explicit size * Only enable ShaderFloat64 if the GPU supports it * We don't need to recompile shaders if alpha test state changed but alpha test is disabled * Enable shader cache on Vulkan and implement MultiplyHighS32/U32 on SPIR-V (missed those before) * Fix pipeline state saving before it is updated. This should fix a few warnings and potential stutters due to bad pipeline states being saved in the cache. You may need to clear your guest cache. * Allow null samplers on OpenGL backend * _unit0Sampler should be set only for binding 0 * Remove unused PipelineConverter format variable (was causing IOR) * Raise textures limit to 64 on Vulkan * No need to pack the shader binaries if shader cache is disabled * Fix backbuffer not being cleared and scissor not being re-enabled on OpenGL * Do not clear unbound framebuffer color attachments * Geometry shader passthrough emulation * Consolidate UpdateDepthMode and GetDepthMode implementation * Fix A1B5G5R5 texture format and support R4G4 on Vulkan * Add barrier before use of some modified images * Report 32 bit query result on AMD windows (smo issue) * Add texture recompression support (disabled for now) It recompresses ASTC textures into BC7, which might reduce VRAM usage significantly on games that uses ASTC textures * Do not report R4G4 format as supported on Vulkan It was causing mario head to become white on Super Mario 64 (???) * Improvements to -1 to 1 depth mode. - Transformation is only applied on the last stage in the vertex pipeline. - Should fix some issues with geometry and tessellation (hopefully) - Reading back FragCoord Z on fragment will transform back to -1 to 1. * Geometry Shader index count from ThreadsPerInputPrimitive Generally fixes SPIR-V emitting too many triangles, may change games in OpenGL * Remove gl_FragDepth scaling This is always 0-1; the other two issues were causing the problems. Fixes regression with Xenoblade. * Add Gl StencilOp enum values to Vulkan * Update guest cache to v1.1 (due to specialization state changes) This will explode your shader cache from earlier vulkan build, but it must be done. :pensive: * Vulkan/SPIR-V support for viewport inverse * Fix typo * Don't create query pools for unsupported query types * Return of the Vector Indexing Bug One day, everyone will get this right. * Check for transform feedback query support Sometimes transform feedback is supported without the query type. * Fix gl_FragCoord.z transformation FragCoord.z is always in 0-1, even when the real depth range is -1 to 1. Turns out the only bug was geo and tess stage outputs. Fixes Pokemon Sword/Shield, possibly others. * Fix Avalonia Rebase Vulkan is currently not available on Avalonia, but the build does work and you can use opengl. * Fix headless build * Add support for BC6 and BC7 decompression, decompress all BC formats if they are not supported by the host * Fix BCn 4/5 conversion, GetTextureTarget BCn 4/5 could generate invalid data when a line's size in bytes was not divisible by 4, which both backends expect. GetTextureTarget was not creating a view with the replacement format. * Fix dependency * Fix inverse viewport transform vector type on SPIR-V * Do not require null descriptors support * If MultiViewport is not supported, do not try to set more than one viewport/scissor * Bounds check on bitmap add. * Flush queries on attachment change rather than program change Occlusion queries are usually used in a depth only pass so the attachments changing is a better indication of the query block ending. Write mask changes are also considered since some games do depth only pass by setting 0 write mask on all the colour targets. * Add support for avalonia (#6) * add avalonia support * only lock around skia flush * addressed review * cleanup * add fallback size if avalonia attempts to render but the window size is 0. read desktop scale after enabling dpi check * fix getting window handle on linux. skip render is size is 0 * Combine non-buffer with buffer image descriptor sets * Support multisample texture copy with automatic resolve on Vulkan * Remove old CompileShader methods from the Vulkan backend * Add minimal pipeline layouts that only contains used bindings They are used by helper shaders, the intention is avoiding needing to recompile the shaders (from GLSL to SPIR-V) if the bindings changes on the translated guest shaders * Pre-compile helper shader as SPIR-V, and some fixes * Remove pre-compiled shaderc binary for Windows as its no longer needed by default * Workaround RADV crash Enabling the descriptor indexing extension, even if it is not used, forces the radv driver to use "bolist". * Use RobustBufferAccess on NVIDIA gpus Avoids the SMO waterfall triangle on older NVIDIA gpus. * Implement GPU selector and expose texture recompression on the UI and config * Fix and enable background compute shader compilation Also disables warnings from shader cache pipeline misses. * Fix error due to missing subpass dependency when Attachment Write -> Shader Read barriers are added * If S8D24 is not supported, use D32FS8 * Ensure all fences are destroyed on dispose * Pre-allocate arrays up front on DescriptorSetUpdater, allows the removal of some checks * Add missing clear layer parameter after rebase * Use selected gpu from config for avalonia (#7) * use configured device * address review * Fix D32S8 copy workaround (AMD) Fixes water in Pokemon Legends Arceus on AMD GPUs. Possibly fixes other things. * Use push descriptors for uniform buffer updates (disabled for now) * Push descriptor support check, buffer redundancy checks Should make push descriptors faster, needs more testing though. * Increase light command buffer pool to 2 command buffers, throw rather than returning invalid cbs * Adjust bindings array sizes * Force submit command buffers if memory in use by its resources is high * Add workaround for AMD GCN cubemap view sins `ImageCreateCubeCompatibleBit` seems to generally break 2D array textures with mipmaps... even if they are eventually aliased as a cubemap with mipmaps. Forcing a copy here works around the issue. This could be used in future if enabling this bit reduces performance on certain GPUs. (mobile class is generally a worry) Currently also enabled on Linux as I don't know if they managed to dodge this bug (someone please tell me). Not enabled on Vega at the moment, but easy to add if the issue is there. * Add mobile, non-RX variants to the GCN regex. Also make sure that the 3 digit ones only include numbers starting with 7 or 8. * Increase image limit per stage from 8 to 16 Xenoblade Chronicles 2 was hiting the limit of 8 * Minor code cleanup * Fix NRE caused by SupportBufferUpdater calling pipeline ClearBuffer * Add gpu selector to Avalonia (#8) * Add gpu selector to avalonia settings * show backend label on window * some fixes * address review * Minor changes to the Avalonia UI * Update graphics window UI and locales. (#9) * Update xaml and update locales * locale updates Did my best here but likely needs to be checked by native speakers, especially the use of ampersands in greek, russian and turkish? * Fix locales with more (?) correct translations. * add separator to render widget * fix spanish and portuguese * Add new IdList, replaces buffer list that could not remove elements and had unbounded growth * Don't crash the settings window if Vulkan is not supported * Fix Actions menu not being clickable on GTK UI after relaunch * Rename VulkanGraphicsDevice to VulkanRenderer and Renderer to OpenGLRenderer * Fix IdList and make it not thread safe * Revert useless OpenGL format table changes * Fix headless project build * List throws ArgumentOutOfRangeException * SPIR-V: Fix tessellation * Increase shader cache version due to tessellation fix * Reduce number of Sync objects created (improves perf in some specific titles) * Fix vulkan validation errors for NPOT compressed upload and GCN workaround. * Add timestamp to the shader cache and force rebuild if host cache is outdated * Prefer Mail box present mode for popups (#11) * Prefer Mail box present mode * fix debug * switch present mode when vsync is toggled * only disable vsync on the main window * SPIR-V: Fix geometry shader input load with transform feedback * BC7 Encoder: Prefer more precision on alpha rather than RGB when alpha is 0 * Fix Avalonia build * Address initial PR feedback * Only set transform feedback outputs on last vertex stage * Address riperiperi PR feedback * Remove outdated comment * Remove unused constructor * Only throw for negative results * Throw for QueueSubmit and other errors No point in delaying the inevitable * Transform feedback decorations inside gl_PerVertex struct breaks the NVIDIA compiler * Fix some resolution scale issues * No need for two UpdateScale calls * Fix comments on SPIR-V generator project * Try to fix shader local memory size On DOOM, a shader is using local memory, but both Low and High size are 0, CRS size is 1536, it seems to store on that region? * Remove RectangleF that is now unused * Fix ImageGather with multiple offsets Needs ImageGatherExtended capability, and must use `ConstantComposite` instead of `CompositeConstruct` * Address PR feedback from jD in all projects except Avalonia * Address most of jD PR feedback on Avalonia * Remove unsafe * Fix VulkanSkiaGpu * move present mode request out of Create Swapchain method * split more parts of create swapchain * addressed reviews * addressed review * Address second batch of jD PR feedback * Fix buffer <-> image copy row length and height alignment AlignUp helper does not support NPOT alignment, and ASTC textures can have NPOT block sizes * Better fix for NPOT alignment issue * Use switch expressions on Vulkan EnumConversion Thanks jD * Fix Avalonia build * Add Vulkan selection prompt on startup * Grammar fixes on Vulkan prompt message * Add missing Vulkan migration flag Co-authored-by: riperiperi <rhy3756547@hotmail.com> Co-authored-by: Emmanuel Hansen <emmausssss@gmail.com> Co-authored-by: MutantAura <44103205+MutantAura@users.noreply.github.com>
Diffstat (limited to 'Spv.Generator')
-rw-r--r--Spv.Generator/Autogenerated/CoreGrammar.cs5315
-rw-r--r--Spv.Generator/Autogenerated/GlslStd450Grammar.cs441
-rw-r--r--Spv.Generator/Autogenerated/OpenClGrammar.cs841
-rw-r--r--Spv.Generator/ConstantKey.cs30
-rw-r--r--Spv.Generator/DeterministicHashCode.cs109
-rw-r--r--Spv.Generator/DeterministicStringKey.cs30
-rw-r--r--Spv.Generator/GeneratorPool.cs58
-rw-r--r--Spv.Generator/Instruction.cs232
-rw-r--r--Spv.Generator/InstructionOperands.cs53
-rw-r--r--Spv.Generator/LICENSE23
-rw-r--r--Spv.Generator/LiteralInteger.cs103
-rw-r--r--Spv.Generator/LiteralString.cs52
-rw-r--r--Spv.Generator/Module.cs365
-rw-r--r--Spv.Generator/Operand.cs14
-rw-r--r--Spv.Generator/OperandType.cs10
-rw-r--r--Spv.Generator/Spv.Generator.csproj7
-rw-r--r--Spv.Generator/TypeDeclarationKey.cs30
-rw-r--r--Spv.Generator/spirv.cs1625
18 files changed, 9338 insertions, 0 deletions
diff --git a/Spv.Generator/Autogenerated/CoreGrammar.cs b/Spv.Generator/Autogenerated/CoreGrammar.cs
new file mode 100644
index 00000000..3b2f6fa6
--- /dev/null
+++ b/Spv.Generator/Autogenerated/CoreGrammar.cs
@@ -0,0 +1,5315 @@
+// AUTOGENERATED: DO NOT EDIT
+// Last update date: 2021-01-06 23:02:26.837899
+#region Grammar License
+// Copyright (c) 2014-2020 The Khronos Group Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and/or associated documentation files (the "Materials"),
+// to deal in the Materials without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Materials, and to permit persons to whom the
+// Materials are furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Materials.
+//
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
+// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
+// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
+//
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
+// IN THE MATERIALS.
+#endregion
+
+using static Spv.Specification;
+
+namespace Spv.Generator
+{
+ public partial class Module
+ {
+ // Miscellaneous
+
+ public Instruction Nop()
+ {
+ Instruction result = NewInstruction(Op.OpNop);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Undef(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpUndef, GetNewId(), resultType);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SizeOf(Instruction resultType, Instruction pointer)
+ {
+ Instruction result = NewInstruction(Op.OpSizeOf, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Debug
+
+ public Instruction SourceContinued(string continuedSource)
+ {
+ Instruction result = NewInstruction(Op.OpSourceContinued);
+
+ result.AddOperand(continuedSource);
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction Source(SourceLanguage sourceLanguage, LiteralInteger version, Instruction file = null, string source = null)
+ {
+ Instruction result = NewInstruction(Op.OpSource);
+
+ result.AddOperand(sourceLanguage);
+ result.AddOperand(version);
+ if (file != null)
+ {
+ result.AddOperand(file);
+ }
+ if (source != null)
+ {
+ result.AddOperand(source);
+ }
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction SourceExtension(string extension)
+ {
+ Instruction result = NewInstruction(Op.OpSourceExtension);
+
+ result.AddOperand(extension);
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction Name(Instruction target, string name)
+ {
+ Instruction result = NewInstruction(Op.OpName);
+
+ result.AddOperand(target);
+ result.AddOperand(name);
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction MemberName(Instruction type, LiteralInteger member, string name)
+ {
+ Instruction result = NewInstruction(Op.OpMemberName);
+
+ result.AddOperand(type);
+ result.AddOperand(member);
+ result.AddOperand(name);
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction String(string str)
+ {
+ Instruction result = NewInstruction(Op.OpString, GetNewId());
+
+ result.AddOperand(str);
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction Line(Instruction file, LiteralInteger line, LiteralInteger column)
+ {
+ Instruction result = NewInstruction(Op.OpLine);
+
+ result.AddOperand(file);
+ result.AddOperand(line);
+ result.AddOperand(column);
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction NoLine()
+ {
+ Instruction result = NewInstruction(Op.OpNoLine);
+
+ AddDebug(result);
+
+ return result;
+ }
+
+ public Instruction ModuleProcessed(string process)
+ {
+ Instruction result = NewInstruction(Op.OpModuleProcessed);
+
+ result.AddOperand(process);
+ AddDebug(result);
+
+ return result;
+ }
+
+ // Annotation
+
+ public Instruction Decorate(Instruction target, Decoration decoration)
+ {
+ Instruction result = NewInstruction(Op.OpDecorate);
+
+ result.AddOperand(target);
+ result.AddOperand(decoration);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction Decorate(Instruction target, Decoration decoration, Operand parameter)
+ {
+ Instruction result = NewInstruction(Op.OpDecorate);
+
+ result.AddOperand(target);
+ result.AddOperand(decoration);
+ result.AddOperand(parameter);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction Decorate(Instruction target, Decoration decoration, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpDecorate);
+
+ result.AddOperand(target);
+ result.AddOperand(decoration);
+ result.AddOperand(parameters);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration)
+ {
+ Instruction result = NewInstruction(Op.OpMemberDecorate);
+
+ result.AddOperand(structureType);
+ result.AddOperand(member);
+ result.AddOperand(decoration);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, Operand parameter)
+ {
+ Instruction result = NewInstruction(Op.OpMemberDecorate);
+
+ result.AddOperand(structureType);
+ result.AddOperand(member);
+ result.AddOperand(decoration);
+ result.AddOperand(parameter);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpMemberDecorate);
+
+ result.AddOperand(structureType);
+ result.AddOperand(member);
+ result.AddOperand(decoration);
+ result.AddOperand(parameters);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction DecorationGroup()
+ {
+ Instruction result = NewInstruction(Op.OpDecorationGroup, GetNewId());
+
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction GroupDecorate(Instruction decorationGroup, params Instruction[] targets)
+ {
+ Instruction result = NewInstruction(Op.OpGroupDecorate);
+
+ result.AddOperand(decorationGroup);
+ result.AddOperand(targets);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction GroupMemberDecorate(Instruction decorationGroup, params Operand[] targets)
+ {
+ Instruction result = NewInstruction(Op.OpGroupMemberDecorate);
+
+ result.AddOperand(decorationGroup);
+ result.AddOperand(targets);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction DecorateId(Instruction target, Decoration decoration, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpDecorateId);
+
+ result.AddOperand(target);
+ result.AddOperand(decoration);
+ result.AddOperand(parameters);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction DecorateString(Instruction target, Decoration decoration, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpDecorateString);
+
+ result.AddOperand(target);
+ result.AddOperand(decoration);
+ result.AddOperand(parameters);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction DecorateStringGOOGLE(Instruction target, Decoration decoration, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpDecorateStringGOOGLE);
+
+ result.AddOperand(target);
+ result.AddOperand(decoration);
+ result.AddOperand(parameters);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction MemberDecorateString(Instruction structType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpMemberDecorateString);
+
+ result.AddOperand(structType);
+ result.AddOperand(member);
+ result.AddOperand(decoration);
+ result.AddOperand(parameters);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ public Instruction MemberDecorateStringGOOGLE(Instruction structType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpMemberDecorateStringGOOGLE);
+
+ result.AddOperand(structType);
+ result.AddOperand(member);
+ result.AddOperand(decoration);
+ result.AddOperand(parameters);
+ AddAnnotation(result);
+
+ return result;
+ }
+
+ // Type-Declaration
+
+ public Instruction TypeVoid(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeVoid);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeBool(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeBool);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeInt(LiteralInteger width, LiteralInteger signedness, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeInt);
+
+ result.AddOperand(width);
+ result.AddOperand(signedness);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeFloat(LiteralInteger width, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeFloat);
+
+ result.AddOperand(width);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeVector(Instruction componentType, LiteralInteger componentCount, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeVector);
+
+ result.AddOperand(componentType);
+ result.AddOperand(componentCount);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeMatrix(Instruction columnType, LiteralInteger columnCount, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeMatrix);
+
+ result.AddOperand(columnType);
+ result.AddOperand(columnCount);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeImage(Instruction sampledType, Dim dim, LiteralInteger depth, LiteralInteger arrayed, LiteralInteger mS, LiteralInteger sampled, ImageFormat imageFormat, AccessQualifier accessQualifier = (AccessQualifier)int.MaxValue, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeImage);
+
+ result.AddOperand(sampledType);
+ result.AddOperand(dim);
+ result.AddOperand(depth);
+ result.AddOperand(arrayed);
+ result.AddOperand(mS);
+ result.AddOperand(sampled);
+ result.AddOperand(imageFormat);
+ if (accessQualifier != (AccessQualifier)int.MaxValue)
+ {
+ result.AddOperand(accessQualifier);
+ }
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeSampler(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeSampler);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeSampledImage(Instruction imageType, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeSampledImage);
+
+ result.AddOperand(imageType);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeArray(Instruction elementType, Instruction length, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeArray);
+
+ result.AddOperand(elementType);
+ result.AddOperand(length);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeRuntimeArray(Instruction elementType, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeRuntimeArray);
+
+ result.AddOperand(elementType);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeStruct(bool forceIdAllocation, params Instruction[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpTypeStruct);
+
+ result.AddOperand(parameters);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeOpaque(string thenameoftheopaquetype, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeOpaque);
+
+ result.AddOperand(thenameoftheopaquetype);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypePointer(StorageClass storageClass, Instruction type, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypePointer);
+
+ result.AddOperand(storageClass);
+ result.AddOperand(type);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeFunction(Instruction returnType, bool forceIdAllocation, params Instruction[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpTypeFunction);
+
+ result.AddOperand(returnType);
+ result.AddOperand(parameters);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeEvent(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeEvent);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeDeviceEvent(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeDeviceEvent);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeReserveId(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeReserveId);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeQueue(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeQueue);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypePipe(AccessQualifier qualifier, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypePipe);
+
+ result.AddOperand(qualifier);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeForwardPointer(Instruction pointerType, StorageClass storageClass, bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeForwardPointer);
+
+ result.AddOperand(pointerType);
+ result.AddOperand(storageClass);
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypePipeStorage(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypePipeStorage);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ public Instruction TypeNamedBarrier(bool forceIdAllocation = false)
+ {
+ Instruction result = NewInstruction(Op.OpTypeNamedBarrier);
+
+ AddTypeDeclaration(result, forceIdAllocation);
+
+ return result;
+ }
+
+ // Constant-Creation
+
+ public Instruction ConstantTrue(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpConstantTrue, Instruction.InvalidId, resultType);
+
+ AddConstant(result);
+
+ return result;
+ }
+
+ public Instruction ConstantFalse(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpConstantFalse, Instruction.InvalidId, resultType);
+
+ AddConstant(result);
+
+ return result;
+ }
+
+ public Instruction Constant(Instruction resultType, LiteralInteger value)
+ {
+ Instruction result = NewInstruction(Op.OpConstant, Instruction.InvalidId, resultType);
+
+ result.AddOperand(value);
+ AddConstant(result);
+
+ return result;
+ }
+
+ public Instruction ConstantComposite(Instruction resultType, params Instruction[] constituents)
+ {
+ Instruction result = NewInstruction(Op.OpConstantComposite, Instruction.InvalidId, resultType);
+
+ result.AddOperand(constituents);
+ AddConstant(result);
+
+ return result;
+ }
+
+ public Instruction ConstantSampler(Instruction resultType, SamplerAddressingMode samplerAddressingMode, LiteralInteger param, SamplerFilterMode samplerFilterMode)
+ {
+ Instruction result = NewInstruction(Op.OpConstantSampler, Instruction.InvalidId, resultType);
+
+ result.AddOperand(samplerAddressingMode);
+ result.AddOperand(param);
+ result.AddOperand(samplerFilterMode);
+ AddConstant(result);
+
+ return result;
+ }
+
+ public Instruction ConstantNull(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpConstantNull, Instruction.InvalidId, resultType);
+
+ AddConstant(result);
+
+ return result;
+ }
+
+ public Instruction SpecConstantTrue(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpSpecConstantTrue, GetNewId(), resultType);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SpecConstantFalse(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpSpecConstantFalse, GetNewId(), resultType);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SpecConstant(Instruction resultType, LiteralInteger value)
+ {
+ Instruction result = NewInstruction(Op.OpSpecConstant, GetNewId(), resultType);
+
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SpecConstantComposite(Instruction resultType, params Instruction[] constituents)
+ {
+ Instruction result = NewInstruction(Op.OpSpecConstantComposite, GetNewId(), resultType);
+
+ result.AddOperand(constituents);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SpecConstantOp(Instruction resultType, LiteralInteger opcode)
+ {
+ Instruction result = NewInstruction(Op.OpSpecConstantOp, GetNewId(), resultType);
+
+ result.AddOperand(opcode);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Memory
+
+ public Instruction Variable(Instruction resultType, StorageClass storageClass, Instruction initializer = null)
+ {
+ Instruction result = NewInstruction(Op.OpVariable, GetNewId(), resultType);
+
+ result.AddOperand(storageClass);
+ if (initializer != null)
+ {
+ result.AddOperand(initializer);
+ }
+ return result;
+ }
+
+ public Instruction ImageTexelPointer(Instruction resultType, Instruction image, Instruction coordinate, Instruction sample)
+ {
+ Instruction result = NewInstruction(Op.OpImageTexelPointer, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ result.AddOperand(sample);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Load(Instruction resultType, Instruction pointer, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
+ {
+ Instruction result = NewInstruction(Op.OpLoad, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ if (memoryAccess != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Store(Instruction pointer, Instruction obj, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
+ {
+ Instruction result = NewInstruction(Op.OpStore);
+
+ result.AddOperand(pointer);
+ result.AddOperand(obj);
+ if (memoryAccess != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CopyMemory(Instruction target, Instruction source, MemoryAccessMask memoryAccess0 = (MemoryAccessMask)int.MaxValue, MemoryAccessMask memoryAccess1 = (MemoryAccessMask)int.MaxValue)
+ {
+ Instruction result = NewInstruction(Op.OpCopyMemory);
+
+ result.AddOperand(target);
+ result.AddOperand(source);
+ if (memoryAccess0 != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess0);
+ }
+ if (memoryAccess1 != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess1);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CopyMemorySized(Instruction target, Instruction source, Instruction size, MemoryAccessMask memoryAccess0 = (MemoryAccessMask)int.MaxValue, MemoryAccessMask memoryAccess1 = (MemoryAccessMask)int.MaxValue)
+ {
+ Instruction result = NewInstruction(Op.OpCopyMemorySized);
+
+ result.AddOperand(target);
+ result.AddOperand(source);
+ result.AddOperand(size);
+ if (memoryAccess0 != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess0);
+ }
+ if (memoryAccess1 != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess1);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AccessChain(Instruction resultType, Instruction baseObj, Instruction index)
+ {
+ Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(index);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AccessChain(Instruction resultType, Instruction baseObj, Instruction index0, Instruction index1)
+ {
+ Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(index0);
+ result.AddOperand(index1);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AccessChain(Instruction resultType, Instruction baseObj, Instruction index0, Instruction index1, Instruction index2)
+ {
+ Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(index0);
+ result.AddOperand(index1);
+ result.AddOperand(index2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AccessChain(Instruction resultType, Instruction baseObj, params Instruction[] indexes)
+ {
+ Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(indexes);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction InBoundsAccessChain(Instruction resultType, Instruction baseObj, params Instruction[] indexes)
+ {
+ Instruction result = NewInstruction(Op.OpInBoundsAccessChain, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(indexes);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction PtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params Instruction[] indexes)
+ {
+ Instruction result = NewInstruction(Op.OpPtrAccessChain, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(element);
+ result.AddOperand(indexes);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ArrayLength(Instruction resultType, Instruction structure, LiteralInteger arraymember)
+ {
+ Instruction result = NewInstruction(Op.OpArrayLength, GetNewId(), resultType);
+
+ result.AddOperand(structure);
+ result.AddOperand(arraymember);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GenericPtrMemSemantics(Instruction resultType, Instruction pointer)
+ {
+ Instruction result = NewInstruction(Op.OpGenericPtrMemSemantics, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction InBoundsPtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params Instruction[] indexes)
+ {
+ Instruction result = NewInstruction(Op.OpInBoundsPtrAccessChain, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(element);
+ result.AddOperand(indexes);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction PtrEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpPtrEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction PtrNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpPtrNotEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction PtrDiff(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpPtrDiff, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Function
+
+ public Instruction Function(Instruction resultType, FunctionControlMask functionControl, Instruction functionType)
+ {
+ Instruction result = NewInstruction(Op.OpFunction, GetNewId(), resultType);
+
+ result.AddOperand(functionControl);
+ result.AddOperand(functionType);
+
+ return result;
+ }
+
+ public void AddFunction(Instruction function)
+ {
+ AddToFunctionDefinitions(function);
+ }
+
+ public Instruction FunctionParameter(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpFunctionParameter, GetNewId(), resultType);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FunctionEnd()
+ {
+ Instruction result = NewInstruction(Op.OpFunctionEnd);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FunctionCall(Instruction resultType, Instruction function, params Instruction[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpFunctionCall, GetNewId(), resultType);
+
+ result.AddOperand(function);
+ result.AddOperand(parameters);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Image
+
+ public Instruction SampledImage(Instruction resultType, Instruction image, Instruction sampler)
+ {
+ Instruction result = NewInstruction(Op.OpSampledImage, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(sampler);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleDrefImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleDrefExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleProjImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleProjExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleProjDrefImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleProjDrefExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageFetch, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageGather, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(component);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageDrefGather, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageRead, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageWrite(Instruction image, Instruction coordinate, Instruction texel, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageWrite);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ result.AddOperand(texel);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Image(Instruction resultType, Instruction sampledImage)
+ {
+ Instruction result = NewInstruction(Op.OpImage, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageQueryFormat(Instruction resultType, Instruction image)
+ {
+ Instruction result = NewInstruction(Op.OpImageQueryFormat, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageQueryOrder(Instruction resultType, Instruction image)
+ {
+ Instruction result = NewInstruction(Op.OpImageQueryOrder, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageQuerySizeLod(Instruction resultType, Instruction image, Instruction levelofDetail)
+ {
+ Instruction result = NewInstruction(Op.OpImageQuerySizeLod, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(levelofDetail);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageQuerySize(Instruction resultType, Instruction image)
+ {
+ Instruction result = NewInstruction(Op.OpImageQuerySize, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageQueryLod(Instruction resultType, Instruction sampledImage, Instruction coordinate)
+ {
+ Instruction result = NewInstruction(Op.OpImageQueryLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageQueryLevels(Instruction resultType, Instruction image)
+ {
+ Instruction result = NewInstruction(Op.OpImageQueryLevels, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageQuerySamples(Instruction resultType, Instruction image)
+ {
+ Instruction result = NewInstruction(Op.OpImageQuerySamples, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleDrefImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleDrefExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleProjImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleProjExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefImplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefExplicitLod, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ result.AddOperand(imageOperands);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseFetch, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseGather, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(component);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseDrefGather, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(dRef);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseTexelsResident(Instruction resultType, Instruction residentCode)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseTexelsResident, GetNewId(), resultType);
+
+ result.AddOperand(residentCode);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSparseRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSparseRead, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ImageSampleFootprintNV(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction granularity, Instruction coarse, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
+ {
+ Instruction result = NewInstruction(Op.OpImageSampleFootprintNV, GetNewId(), resultType);
+
+ result.AddOperand(sampledImage);
+ result.AddOperand(coordinate);
+ result.AddOperand(granularity);
+ result.AddOperand(coarse);
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperands);
+ }
+ if (imageOperands != (ImageOperandsMask)int.MaxValue)
+ {
+ result.AddOperand(imageOperandIds);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Conversion
+
+ public Instruction ConvertFToU(Instruction resultType, Instruction floatValue)
+ {
+ Instruction result = NewInstruction(Op.OpConvertFToU, GetNewId(), resultType);
+
+ result.AddOperand(floatValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ConvertFToS(Instruction resultType, Instruction floatValue)
+ {
+ Instruction result = NewInstruction(Op.OpConvertFToS, GetNewId(), resultType);
+
+ result.AddOperand(floatValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ConvertSToF(Instruction resultType, Instruction signedValue)
+ {
+ Instruction result = NewInstruction(Op.OpConvertSToF, GetNewId(), resultType);
+
+ result.AddOperand(signedValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ConvertUToF(Instruction resultType, Instruction unsignedValue)
+ {
+ Instruction result = NewInstruction(Op.OpConvertUToF, GetNewId(), resultType);
+
+ result.AddOperand(unsignedValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UConvert(Instruction resultType, Instruction unsignedValue)
+ {
+ Instruction result = NewInstruction(Op.OpUConvert, GetNewId(), resultType);
+
+ result.AddOperand(unsignedValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SConvert(Instruction resultType, Instruction signedValue)
+ {
+ Instruction result = NewInstruction(Op.OpSConvert, GetNewId(), resultType);
+
+ result.AddOperand(signedValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FConvert(Instruction resultType, Instruction floatValue)
+ {
+ Instruction result = NewInstruction(Op.OpFConvert, GetNewId(), resultType);
+
+ result.AddOperand(floatValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction QuantizeToF16(Instruction resultType, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpQuantizeToF16, GetNewId(), resultType);
+
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ConvertPtrToU(Instruction resultType, Instruction pointer)
+ {
+ Instruction result = NewInstruction(Op.OpConvertPtrToU, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SatConvertSToU(Instruction resultType, Instruction signedValue)
+ {
+ Instruction result = NewInstruction(Op.OpSatConvertSToU, GetNewId(), resultType);
+
+ result.AddOperand(signedValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SatConvertUToS(Instruction resultType, Instruction unsignedValue)
+ {
+ Instruction result = NewInstruction(Op.OpSatConvertUToS, GetNewId(), resultType);
+
+ result.AddOperand(unsignedValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ConvertUToPtr(Instruction resultType, Instruction integerValue)
+ {
+ Instruction result = NewInstruction(Op.OpConvertUToPtr, GetNewId(), resultType);
+
+ result.AddOperand(integerValue);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction PtrCastToGeneric(Instruction resultType, Instruction pointer)
+ {
+ Instruction result = NewInstruction(Op.OpPtrCastToGeneric, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GenericCastToPtr(Instruction resultType, Instruction pointer)
+ {
+ Instruction result = NewInstruction(Op.OpGenericCastToPtr, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GenericCastToPtrExplicit(Instruction resultType, Instruction pointer, StorageClass storage)
+ {
+ Instruction result = NewInstruction(Op.OpGenericCastToPtrExplicit, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(storage);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Bitcast(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpBitcast, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Composite
+
+ public Instruction VectorExtractDynamic(Instruction resultType, Instruction vector, Instruction index)
+ {
+ Instruction result = NewInstruction(Op.OpVectorExtractDynamic, GetNewId(), resultType);
+
+ result.AddOperand(vector);
+ result.AddOperand(index);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction VectorInsertDynamic(Instruction resultType, Instruction vector, Instruction component, Instruction index)
+ {
+ Instruction result = NewInstruction(Op.OpVectorInsertDynamic, GetNewId(), resultType);
+
+ result.AddOperand(vector);
+ result.AddOperand(component);
+ result.AddOperand(index);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction VectorShuffle(Instruction resultType, Instruction vector1, Instruction vector2, params LiteralInteger[] components)
+ {
+ Instruction result = NewInstruction(Op.OpVectorShuffle, GetNewId(), resultType);
+
+ result.AddOperand(vector1);
+ result.AddOperand(vector2);
+ result.AddOperand(components);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CompositeConstruct(Instruction resultType, params Instruction[] constituents)
+ {
+ Instruction result = NewInstruction(Op.OpCompositeConstruct, GetNewId(), resultType);
+
+ result.AddOperand(constituents);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CompositeExtract(Instruction resultType, Instruction composite, params LiteralInteger[] indexes)
+ {
+ Instruction result = NewInstruction(Op.OpCompositeExtract, GetNewId(), resultType);
+
+ result.AddOperand(composite);
+ result.AddOperand(indexes);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CompositeInsert(Instruction resultType, Instruction obj, Instruction composite, params LiteralInteger[] indexes)
+ {
+ Instruction result = NewInstruction(Op.OpCompositeInsert, GetNewId(), resultType);
+
+ result.AddOperand(obj);
+ result.AddOperand(composite);
+ result.AddOperand(indexes);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CopyObject(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpCopyObject, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Transpose(Instruction resultType, Instruction matrix)
+ {
+ Instruction result = NewInstruction(Op.OpTranspose, GetNewId(), resultType);
+
+ result.AddOperand(matrix);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CopyLogical(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpCopyLogical, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Arithmetic
+
+ public Instruction SNegate(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpSNegate, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FNegate(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpFNegate, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IAdd(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIAdd, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FAdd(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFAdd, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ISub(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpISub, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FSub(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFSub, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IMul(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIMul, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FMul(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFMul, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UDiv(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUDiv, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SDiv(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSDiv, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FDiv(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFDiv, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UMod(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUMod, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SRem(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSRem, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SMod(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSMod, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FRem(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFRem, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FMod(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFMod, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction VectorTimesScalar(Instruction resultType, Instruction vector, Instruction scalar)
+ {
+ Instruction result = NewInstruction(Op.OpVectorTimesScalar, GetNewId(), resultType);
+
+ result.AddOperand(vector);
+ result.AddOperand(scalar);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction MatrixTimesScalar(Instruction resultType, Instruction matrix, Instruction scalar)
+ {
+ Instruction result = NewInstruction(Op.OpMatrixTimesScalar, GetNewId(), resultType);
+
+ result.AddOperand(matrix);
+ result.AddOperand(scalar);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction VectorTimesMatrix(Instruction resultType, Instruction vector, Instruction matrix)
+ {
+ Instruction result = NewInstruction(Op.OpVectorTimesMatrix, GetNewId(), resultType);
+
+ result.AddOperand(vector);
+ result.AddOperand(matrix);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction MatrixTimesVector(Instruction resultType, Instruction matrix, Instruction vector)
+ {
+ Instruction result = NewInstruction(Op.OpMatrixTimesVector, GetNewId(), resultType);
+
+ result.AddOperand(matrix);
+ result.AddOperand(vector);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction MatrixTimesMatrix(Instruction resultType, Instruction leftMatrix, Instruction rightMatrix)
+ {
+ Instruction result = NewInstruction(Op.OpMatrixTimesMatrix, GetNewId(), resultType);
+
+ result.AddOperand(leftMatrix);
+ result.AddOperand(rightMatrix);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction OuterProduct(Instruction resultType, Instruction vector1, Instruction vector2)
+ {
+ Instruction result = NewInstruction(Op.OpOuterProduct, GetNewId(), resultType);
+
+ result.AddOperand(vector1);
+ result.AddOperand(vector2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Dot(Instruction resultType, Instruction vector1, Instruction vector2)
+ {
+ Instruction result = NewInstruction(Op.OpDot, GetNewId(), resultType);
+
+ result.AddOperand(vector1);
+ result.AddOperand(vector2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IAddCarry(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIAddCarry, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ISubBorrow(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpISubBorrow, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UMulExtended(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUMulExtended, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SMulExtended(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSMulExtended, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Bit
+
+ public Instruction ShiftRightLogical(Instruction resultType, Instruction baseObj, Instruction shift)
+ {
+ Instruction result = NewInstruction(Op.OpShiftRightLogical, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(shift);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ShiftRightArithmetic(Instruction resultType, Instruction baseObj, Instruction shift)
+ {
+ Instruction result = NewInstruction(Op.OpShiftRightArithmetic, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(shift);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ShiftLeftLogical(Instruction resultType, Instruction baseObj, Instruction shift)
+ {
+ Instruction result = NewInstruction(Op.OpShiftLeftLogical, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(shift);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitwiseOr(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpBitwiseOr, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitwiseXor(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpBitwiseXor, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitwiseAnd(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpBitwiseAnd, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Not(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpNot, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitFieldInsert(Instruction resultType, Instruction baseObj, Instruction insert, Instruction offset, Instruction count)
+ {
+ Instruction result = NewInstruction(Op.OpBitFieldInsert, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(insert);
+ result.AddOperand(offset);
+ result.AddOperand(count);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitFieldSExtract(Instruction resultType, Instruction baseObj, Instruction offset, Instruction count)
+ {
+ Instruction result = NewInstruction(Op.OpBitFieldSExtract, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(offset);
+ result.AddOperand(count);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitFieldUExtract(Instruction resultType, Instruction baseObj, Instruction offset, Instruction count)
+ {
+ Instruction result = NewInstruction(Op.OpBitFieldUExtract, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ result.AddOperand(offset);
+ result.AddOperand(count);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitReverse(Instruction resultType, Instruction baseObj)
+ {
+ Instruction result = NewInstruction(Op.OpBitReverse, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BitCount(Instruction resultType, Instruction baseObj)
+ {
+ Instruction result = NewInstruction(Op.OpBitCount, GetNewId(), resultType);
+
+ result.AddOperand(baseObj);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Relational_and_Logical
+
+ public Instruction Any(Instruction resultType, Instruction vector)
+ {
+ Instruction result = NewInstruction(Op.OpAny, GetNewId(), resultType);
+
+ result.AddOperand(vector);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction All(Instruction resultType, Instruction vector)
+ {
+ Instruction result = NewInstruction(Op.OpAll, GetNewId(), resultType);
+
+ result.AddOperand(vector);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IsNan(Instruction resultType, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpIsNan, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IsInf(Instruction resultType, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpIsInf, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IsFinite(Instruction resultType, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpIsFinite, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IsNormal(Instruction resultType, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpIsNormal, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SignBitSet(Instruction resultType, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpSignBitSet, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LessOrGreater(Instruction resultType, Instruction x, Instruction y)
+ {
+ Instruction result = NewInstruction(Op.OpLessOrGreater, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ result.AddOperand(y);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Ordered(Instruction resultType, Instruction x, Instruction y)
+ {
+ Instruction result = NewInstruction(Op.OpOrdered, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ result.AddOperand(y);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Unordered(Instruction resultType, Instruction x, Instruction y)
+ {
+ Instruction result = NewInstruction(Op.OpUnordered, GetNewId(), resultType);
+
+ result.AddOperand(x);
+ result.AddOperand(y);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LogicalEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpLogicalEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LogicalNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpLogicalNotEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LogicalOr(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpLogicalOr, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LogicalAnd(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpLogicalAnd, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LogicalNot(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpLogicalNot, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Select(Instruction resultType, Instruction condition, Instruction object1, Instruction object2)
+ {
+ Instruction result = NewInstruction(Op.OpSelect, GetNewId(), resultType);
+
+ result.AddOperand(condition);
+ result.AddOperand(object1);
+ result.AddOperand(object2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction INotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpINotEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUGreaterThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSGreaterThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUGreaterThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSGreaterThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ULessThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpULessThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SLessThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSLessThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ULessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpULessThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SLessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpSLessThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FOrdEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFOrdEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FUnordEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFUnordEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FOrdNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFOrdNotEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FUnordNotEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFUnordNotEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FOrdLessThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFOrdLessThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FUnordLessThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFUnordLessThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FOrdGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFOrdGreaterThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FUnordGreaterThan(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFUnordGreaterThan, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FOrdLessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFOrdLessThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FUnordLessThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFUnordLessThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FOrdGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFOrdGreaterThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FUnordGreaterThanEqual(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpFUnordGreaterThanEqual, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Derivative
+
+ public Instruction DPdx(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpDPdx, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction DPdy(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpDPdy, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Fwidth(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpFwidth, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction DPdxFine(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpDPdxFine, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction DPdyFine(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpDPdyFine, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FwidthFine(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpFwidthFine, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction DPdxCoarse(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpDPdxCoarse, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction DPdyCoarse(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpDPdyCoarse, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FwidthCoarse(Instruction resultType, Instruction p)
+ {
+ Instruction result = NewInstruction(Op.OpFwidthCoarse, GetNewId(), resultType);
+
+ result.AddOperand(p);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Control-Flow
+
+ public Instruction Phi(Instruction resultType, params Instruction[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpPhi, GetNewId(), resultType);
+
+ result.AddOperand(parameters);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LoopMerge(Instruction mergeBlock, Instruction continueTarget, LoopControlMask loopControl)
+ {
+ Instruction result = NewInstruction(Op.OpLoopMerge);
+
+ result.AddOperand(mergeBlock);
+ result.AddOperand(continueTarget);
+ result.AddOperand(loopControl);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SelectionMerge(Instruction mergeBlock, SelectionControlMask selectionControl)
+ {
+ Instruction result = NewInstruction(Op.OpSelectionMerge);
+
+ result.AddOperand(mergeBlock);
+ result.AddOperand(selectionControl);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Label()
+ {
+ Instruction result = NewInstruction(Op.OpLabel);
+
+ return result;
+ }
+
+ public Instruction Branch(Instruction targetLabel)
+ {
+ Instruction result = NewInstruction(Op.OpBranch);
+
+ result.AddOperand(targetLabel);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BranchConditional(Instruction condition, Instruction trueLabel, Instruction falseLabel, params LiteralInteger[] branchweights)
+ {
+ Instruction result = NewInstruction(Op.OpBranchConditional);
+
+ result.AddOperand(condition);
+ result.AddOperand(trueLabel);
+ result.AddOperand(falseLabel);
+ result.AddOperand(branchweights);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Switch(Instruction selector, Instruction defaultObj, params Operand[] target)
+ {
+ Instruction result = NewInstruction(Op.OpSwitch);
+
+ result.AddOperand(selector);
+ result.AddOperand(defaultObj);
+ result.AddOperand(target);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Kill()
+ {
+ Instruction result = NewInstruction(Op.OpKill);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Return()
+ {
+ Instruction result = NewInstruction(Op.OpReturn);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReturnValue(Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpReturnValue);
+
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction Unreachable()
+ {
+ Instruction result = NewInstruction(Op.OpUnreachable);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LifetimeStart(Instruction pointer, LiteralInteger size)
+ {
+ Instruction result = NewInstruction(Op.OpLifetimeStart);
+
+ result.AddOperand(pointer);
+ result.AddOperand(size);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LifetimeStop(Instruction pointer, LiteralInteger size)
+ {
+ Instruction result = NewInstruction(Op.OpLifetimeStop);
+
+ result.AddOperand(pointer);
+ result.AddOperand(size);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TerminateInvocation()
+ {
+ Instruction result = NewInstruction(Op.OpTerminateInvocation);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Atomic
+
+ public Instruction AtomicLoad(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicLoad, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicStore(Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicStore);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicExchange(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicExchange, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicCompareExchange(Instruction resultType, Instruction pointer, Instruction memory, Instruction equal, Instruction unequal, Instruction value, Instruction comparator)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicCompareExchange, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(equal);
+ result.AddOperand(unequal);
+ result.AddOperand(value);
+ result.AddOperand(comparator);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicCompareExchangeWeak(Instruction resultType, Instruction pointer, Instruction memory, Instruction equal, Instruction unequal, Instruction value, Instruction comparator)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicCompareExchangeWeak, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(equal);
+ result.AddOperand(unequal);
+ result.AddOperand(value);
+ result.AddOperand(comparator);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicIIncrement(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicIIncrement, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicIDecrement(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicIDecrement, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicIAdd(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicIAdd, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicISub(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicISub, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicSMin(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicSMin, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicUMin(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicUMin, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicSMax(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicSMax, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicUMax(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicUMax, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicAnd(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicAnd, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicOr(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicOr, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicXor(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicXor, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicFlagTestAndSet(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicFlagTestAndSet, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicFlagClear(Instruction pointer, Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicFlagClear);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AtomicFAddEXT(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpAtomicFAddEXT, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Primitive
+
+ public Instruction EmitVertex()
+ {
+ Instruction result = NewInstruction(Op.OpEmitVertex);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction EndPrimitive()
+ {
+ Instruction result = NewInstruction(Op.OpEndPrimitive);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction EmitStreamVertex(Instruction stream)
+ {
+ Instruction result = NewInstruction(Op.OpEmitStreamVertex);
+
+ result.AddOperand(stream);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction EndStreamPrimitive(Instruction stream)
+ {
+ Instruction result = NewInstruction(Op.OpEndStreamPrimitive);
+
+ result.AddOperand(stream);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Barrier
+
+ public Instruction ControlBarrier(Instruction execution, Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpControlBarrier);
+
+ result.AddOperand(execution);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction MemoryBarrier(Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpMemoryBarrier);
+
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction NamedBarrierInitialize(Instruction resultType, Instruction subgroupCount)
+ {
+ Instruction result = NewInstruction(Op.OpNamedBarrierInitialize, GetNewId(), resultType);
+
+ result.AddOperand(subgroupCount);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction MemoryNamedBarrier(Instruction namedBarrier, Instruction memory, Instruction semantics)
+ {
+ Instruction result = NewInstruction(Op.OpMemoryNamedBarrier);
+
+ result.AddOperand(namedBarrier);
+ result.AddOperand(memory);
+ result.AddOperand(semantics);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Group
+
+ public Instruction GroupAsyncCopy(Instruction resultType, Instruction execution, Instruction destination, Instruction source, Instruction numElements, Instruction stride, Instruction eventObj)
+ {
+ Instruction result = NewInstruction(Op.OpGroupAsyncCopy, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(destination);
+ result.AddOperand(source);
+ result.AddOperand(numElements);
+ result.AddOperand(stride);
+ result.AddOperand(eventObj);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupWaitEvents(Instruction execution, Instruction numEvents, Instruction eventsList)
+ {
+ Instruction result = NewInstruction(Op.OpGroupWaitEvents);
+
+ result.AddOperand(execution);
+ result.AddOperand(numEvents);
+ result.AddOperand(eventsList);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupAll(Instruction resultType, Instruction execution, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpGroupAll, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupAny(Instruction resultType, Instruction execution, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpGroupAny, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupBroadcast(Instruction resultType, Instruction execution, Instruction value, Instruction localId)
+ {
+ Instruction result = NewInstruction(Op.OpGroupBroadcast, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(localId);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupIAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupIAdd, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupFAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupFAdd, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupFMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupFMin, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupUMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupUMin, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupSMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupSMin, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupFMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupFMax, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupUMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupUMax, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupSMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupSMax, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupBallotKHR(Instruction resultType, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupBallotKHR, GetNewId(), resultType);
+
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupFirstInvocationKHR(Instruction resultType, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupFirstInvocationKHR, GetNewId(), resultType);
+
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupAllKHR(Instruction resultType, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupAllKHR, GetNewId(), resultType);
+
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupAnyKHR(Instruction resultType, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupAnyKHR, GetNewId(), resultType);
+
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupAllEqualKHR(Instruction resultType, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupAllEqualKHR, GetNewId(), resultType);
+
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupReadInvocationKHR(Instruction resultType, Instruction value, Instruction index)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupReadInvocationKHR, GetNewId(), resultType);
+
+ result.AddOperand(value);
+ result.AddOperand(index);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupIAddNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupIAddNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupFAddNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupFAddNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupFMinNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupFMinNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupUMinNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupUMinNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupSMinNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupSMinNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupFMaxNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupFMaxNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupUMaxNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupUMaxNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupSMaxNonUniformAMD(Instruction resultType, Instruction execution, GroupOperation operation, Instruction x)
+ {
+ Instruction result = NewInstruction(Op.OpGroupSMaxNonUniformAMD, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(x);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupShuffleINTEL(Instruction resultType, Instruction data, Instruction invocationId)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupShuffleINTEL, GetNewId(), resultType);
+
+ result.AddOperand(data);
+ result.AddOperand(invocationId);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupShuffleDownINTEL(Instruction resultType, Instruction current, Instruction next, Instruction delta)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupShuffleDownINTEL, GetNewId(), resultType);
+
+ result.AddOperand(current);
+ result.AddOperand(next);
+ result.AddOperand(delta);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupShuffleUpINTEL(Instruction resultType, Instruction previous, Instruction current, Instruction delta)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupShuffleUpINTEL, GetNewId(), resultType);
+
+ result.AddOperand(previous);
+ result.AddOperand(current);
+ result.AddOperand(delta);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupShuffleXorINTEL(Instruction resultType, Instruction data, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupShuffleXorINTEL, GetNewId(), resultType);
+
+ result.AddOperand(data);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupBlockReadINTEL(Instruction resultType, Instruction ptr)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupBlockReadINTEL, GetNewId(), resultType);
+
+ result.AddOperand(ptr);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupBlockWriteINTEL(Instruction ptr, Instruction data)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupBlockWriteINTEL);
+
+ result.AddOperand(ptr);
+ result.AddOperand(data);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupImageBlockReadINTEL(Instruction resultType, Instruction image, Instruction coordinate)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupImageBlockReadINTEL, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupImageBlockWriteINTEL(Instruction image, Instruction coordinate, Instruction data)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupImageBlockWriteINTEL);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ result.AddOperand(data);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupImageMediaBlockReadINTEL(Instruction resultType, Instruction image, Instruction coordinate, Instruction width, Instruction height)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupImageMediaBlockReadINTEL, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ result.AddOperand(width);
+ result.AddOperand(height);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SubgroupImageMediaBlockWriteINTEL(Instruction image, Instruction coordinate, Instruction width, Instruction height, Instruction data)
+ {
+ Instruction result = NewInstruction(Op.OpSubgroupImageMediaBlockWriteINTEL);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ result.AddOperand(width);
+ result.AddOperand(height);
+ result.AddOperand(data);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Device-Side_Enqueue
+
+ public Instruction EnqueueMarker(Instruction resultType, Instruction queue, Instruction numEvents, Instruction waitEvents, Instruction retEvent)
+ {
+ Instruction result = NewInstruction(Op.OpEnqueueMarker, GetNewId(), resultType);
+
+ result.AddOperand(queue);
+ result.AddOperand(numEvents);
+ result.AddOperand(waitEvents);
+ result.AddOperand(retEvent);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction EnqueueKernel(Instruction resultType, Instruction queue, Instruction flags, Instruction nDRange, Instruction numEvents, Instruction waitEvents, Instruction retEvent, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign, params Instruction[] localSize)
+ {
+ Instruction result = NewInstruction(Op.OpEnqueueKernel, GetNewId(), resultType);
+
+ result.AddOperand(queue);
+ result.AddOperand(flags);
+ result.AddOperand(nDRange);
+ result.AddOperand(numEvents);
+ result.AddOperand(waitEvents);
+ result.AddOperand(retEvent);
+ result.AddOperand(invoke);
+ result.AddOperand(param);
+ result.AddOperand(paramSize);
+ result.AddOperand(paramAlign);
+ result.AddOperand(localSize);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetKernelNDrangeSubGroupCount(Instruction resultType, Instruction nDRange, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
+ {
+ Instruction result = NewInstruction(Op.OpGetKernelNDrangeSubGroupCount, GetNewId(), resultType);
+
+ result.AddOperand(nDRange);
+ result.AddOperand(invoke);
+ result.AddOperand(param);
+ result.AddOperand(paramSize);
+ result.AddOperand(paramAlign);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetKernelNDrangeMaxSubGroupSize(Instruction resultType, Instruction nDRange, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
+ {
+ Instruction result = NewInstruction(Op.OpGetKernelNDrangeMaxSubGroupSize, GetNewId(), resultType);
+
+ result.AddOperand(nDRange);
+ result.AddOperand(invoke);
+ result.AddOperand(param);
+ result.AddOperand(paramSize);
+ result.AddOperand(paramAlign);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetKernelWorkGroupSize(Instruction resultType, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
+ {
+ Instruction result = NewInstruction(Op.OpGetKernelWorkGroupSize, GetNewId(), resultType);
+
+ result.AddOperand(invoke);
+ result.AddOperand(param);
+ result.AddOperand(paramSize);
+ result.AddOperand(paramAlign);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetKernelPreferredWorkGroupSizeMultiple(Instruction resultType, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
+ {
+ Instruction result = NewInstruction(Op.OpGetKernelPreferredWorkGroupSizeMultiple, GetNewId(), resultType);
+
+ result.AddOperand(invoke);
+ result.AddOperand(param);
+ result.AddOperand(paramSize);
+ result.AddOperand(paramAlign);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RetainEvent(Instruction eventObj)
+ {
+ Instruction result = NewInstruction(Op.OpRetainEvent);
+
+ result.AddOperand(eventObj);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReleaseEvent(Instruction eventObj)
+ {
+ Instruction result = NewInstruction(Op.OpReleaseEvent);
+
+ result.AddOperand(eventObj);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CreateUserEvent(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpCreateUserEvent, GetNewId(), resultType);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IsValidEvent(Instruction resultType, Instruction eventObj)
+ {
+ Instruction result = NewInstruction(Op.OpIsValidEvent, GetNewId(), resultType);
+
+ result.AddOperand(eventObj);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction SetUserEventStatus(Instruction eventObj, Instruction status)
+ {
+ Instruction result = NewInstruction(Op.OpSetUserEventStatus);
+
+ result.AddOperand(eventObj);
+ result.AddOperand(status);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CaptureEventProfilingInfo(Instruction eventObj, Instruction profilingInfo, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpCaptureEventProfilingInfo);
+
+ result.AddOperand(eventObj);
+ result.AddOperand(profilingInfo);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetDefaultQueue(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpGetDefaultQueue, GetNewId(), resultType);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BuildNDRange(Instruction resultType, Instruction globalWorkSize, Instruction localWorkSize, Instruction globalWorkOffset)
+ {
+ Instruction result = NewInstruction(Op.OpBuildNDRange, GetNewId(), resultType);
+
+ result.AddOperand(globalWorkSize);
+ result.AddOperand(localWorkSize);
+ result.AddOperand(globalWorkOffset);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetKernelLocalSizeForSubgroupCount(Instruction resultType, Instruction subgroupCount, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
+ {
+ Instruction result = NewInstruction(Op.OpGetKernelLocalSizeForSubgroupCount, GetNewId(), resultType);
+
+ result.AddOperand(subgroupCount);
+ result.AddOperand(invoke);
+ result.AddOperand(param);
+ result.AddOperand(paramSize);
+ result.AddOperand(paramAlign);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetKernelMaxNumSubgroups(Instruction resultType, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign)
+ {
+ Instruction result = NewInstruction(Op.OpGetKernelMaxNumSubgroups, GetNewId(), resultType);
+
+ result.AddOperand(invoke);
+ result.AddOperand(param);
+ result.AddOperand(paramSize);
+ result.AddOperand(paramAlign);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Pipe
+
+ public Instruction ReadPipe(Instruction resultType, Instruction pipe, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpReadPipe, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(pointer);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction WritePipe(Instruction resultType, Instruction pipe, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpWritePipe, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(pointer);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReservedReadPipe(Instruction resultType, Instruction pipe, Instruction reserveId, Instruction index, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpReservedReadPipe, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(reserveId);
+ result.AddOperand(index);
+ result.AddOperand(pointer);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReservedWritePipe(Instruction resultType, Instruction pipe, Instruction reserveId, Instruction index, Instruction pointer, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpReservedWritePipe, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(reserveId);
+ result.AddOperand(index);
+ result.AddOperand(pointer);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReserveReadPipePackets(Instruction resultType, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpReserveReadPipePackets, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(numPackets);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReserveWritePipePackets(Instruction resultType, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpReserveWritePipePackets, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(numPackets);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CommitReadPipe(Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpCommitReadPipe);
+
+ result.AddOperand(pipe);
+ result.AddOperand(reserveId);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CommitWritePipe(Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpCommitWritePipe);
+
+ result.AddOperand(pipe);
+ result.AddOperand(reserveId);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IsValidReserveId(Instruction resultType, Instruction reserveId)
+ {
+ Instruction result = NewInstruction(Op.OpIsValidReserveId, GetNewId(), resultType);
+
+ result.AddOperand(reserveId);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetNumPipePackets(Instruction resultType, Instruction pipe, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpGetNumPipePackets, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GetMaxPipePackets(Instruction resultType, Instruction pipe, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpGetMaxPipePackets, GetNewId(), resultType);
+
+ result.AddOperand(pipe);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupReserveReadPipePackets(Instruction resultType, Instruction execution, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpGroupReserveReadPipePackets, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(pipe);
+ result.AddOperand(numPackets);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupReserveWritePipePackets(Instruction resultType, Instruction execution, Instruction pipe, Instruction numPackets, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpGroupReserveWritePipePackets, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(pipe);
+ result.AddOperand(numPackets);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupCommitReadPipe(Instruction execution, Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpGroupCommitReadPipe);
+
+ result.AddOperand(execution);
+ result.AddOperand(pipe);
+ result.AddOperand(reserveId);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupCommitWritePipe(Instruction execution, Instruction pipe, Instruction reserveId, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpGroupCommitWritePipe);
+
+ result.AddOperand(execution);
+ result.AddOperand(pipe);
+ result.AddOperand(reserveId);
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ConstantPipeStorage(Instruction resultType, LiteralInteger packetSize, LiteralInteger packetAlignment, LiteralInteger capacity)
+ {
+ Instruction result = NewInstruction(Op.OpConstantPipeStorage, GetNewId(), resultType);
+
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ result.AddOperand(capacity);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CreatePipeFromPipeStorage(Instruction resultType, Instruction pipeStorage)
+ {
+ Instruction result = NewInstruction(Op.OpCreatePipeFromPipeStorage, GetNewId(), resultType);
+
+ result.AddOperand(pipeStorage);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReadPipeBlockingINTEL(Instruction resultType, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpReadPipeBlockingINTEL, GetNewId(), resultType);
+
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction WritePipeBlockingINTEL(Instruction resultType, Instruction packetSize, Instruction packetAlignment)
+ {
+ Instruction result = NewInstruction(Op.OpWritePipeBlockingINTEL, GetNewId(), resultType);
+
+ result.AddOperand(packetSize);
+ result.AddOperand(packetAlignment);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Non-Uniform
+
+ public Instruction GroupNonUniformElect(Instruction resultType, Instruction execution)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformElect, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformAll(Instruction resultType, Instruction execution, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformAll, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformAny(Instruction resultType, Instruction execution, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformAny, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformAllEqual(Instruction resultType, Instruction execution, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformAllEqual, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBroadcast(Instruction resultType, Instruction execution, Instruction value, Instruction id)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBroadcast, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(id);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBroadcastFirst(Instruction resultType, Instruction execution, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBroadcastFirst, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBallot(Instruction resultType, Instruction execution, Instruction predicate)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBallot, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(predicate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformInverseBallot(Instruction resultType, Instruction execution, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformInverseBallot, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBallotBitExtract(Instruction resultType, Instruction execution, Instruction value, Instruction index)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBallotBitExtract, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(index);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBallotBitCount(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBallotBitCount, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBallotFindLSB(Instruction resultType, Instruction execution, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBallotFindLSB, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBallotFindMSB(Instruction resultType, Instruction execution, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBallotFindMSB, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformShuffle(Instruction resultType, Instruction execution, Instruction value, Instruction id)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformShuffle, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(id);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformShuffleXor(Instruction resultType, Instruction execution, Instruction value, Instruction mask)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformShuffleXor, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(mask);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformShuffleUp(Instruction resultType, Instruction execution, Instruction value, Instruction delta)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformShuffleUp, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(delta);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformShuffleDown(Instruction resultType, Instruction execution, Instruction value, Instruction delta)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformShuffleDown, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(delta);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformIAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformIAdd, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformFAdd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformFAdd, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformIMul(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformIMul, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformFMul(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformFMul, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformSMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformSMin, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformUMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformUMin, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformFMin(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformFMin, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformSMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformSMax, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformUMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformUMax, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformFMax(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformFMax, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBitwiseAnd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBitwiseAnd, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBitwiseOr(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBitwiseOr, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformBitwiseXor(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformBitwiseXor, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformLogicalAnd(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformLogicalAnd, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformLogicalOr(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformLogicalOr, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformLogicalXor(Instruction resultType, Instruction execution, GroupOperation operation, Instruction value, Instruction clusterSize = null)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformLogicalXor, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(operation);
+ result.AddOperand(value);
+ if (clusterSize != null)
+ {
+ result.AddOperand(clusterSize);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformQuadBroadcast(Instruction resultType, Instruction execution, Instruction value, Instruction index)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformQuadBroadcast, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(index);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformQuadSwap(Instruction resultType, Instruction execution, Instruction value, Instruction direction)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformQuadSwap, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ result.AddOperand(value);
+ result.AddOperand(direction);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction GroupNonUniformPartitionNV(Instruction resultType, Instruction value)
+ {
+ Instruction result = NewInstruction(Op.OpGroupNonUniformPartitionNV, GetNewId(), resultType);
+
+ result.AddOperand(value);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ // Reserved
+
+ public Instruction TraceRayKHR(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payload)
+ {
+ Instruction result = NewInstruction(Op.OpTraceRayKHR);
+
+ result.AddOperand(accel);
+ result.AddOperand(rayFlags);
+ result.AddOperand(cullMask);
+ result.AddOperand(sBTOffset);
+ result.AddOperand(sBTStride);
+ result.AddOperand(missIndex);
+ result.AddOperand(rayOrigin);
+ result.AddOperand(rayTmin);
+ result.AddOperand(rayDirection);
+ result.AddOperand(rayTmax);
+ result.AddOperand(payload);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ExecuteCallableKHR(Instruction sBTIndex, Instruction callableData)
+ {
+ Instruction result = NewInstruction(Op.OpExecuteCallableKHR);
+
+ result.AddOperand(sBTIndex);
+ result.AddOperand(callableData);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ConvertUToAccelerationStructureKHR(Instruction resultType, Instruction accel)
+ {
+ Instruction result = NewInstruction(Op.OpConvertUToAccelerationStructureKHR, GetNewId(), resultType);
+
+ result.AddOperand(accel);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IgnoreIntersectionKHR()
+ {
+ Instruction result = NewInstruction(Op.OpIgnoreIntersectionKHR);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TerminateRayKHR()
+ {
+ Instruction result = NewInstruction(Op.OpTerminateRayKHR);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TypeRayQueryKHR()
+ {
+ Instruction result = NewInstruction(Op.OpTypeRayQueryKHR, GetNewId());
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryInitializeKHR(Instruction rayQuery, Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction rayOrigin, Instruction rayTMin, Instruction rayDirection, Instruction rayTMax)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryInitializeKHR);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(accel);
+ result.AddOperand(rayFlags);
+ result.AddOperand(cullMask);
+ result.AddOperand(rayOrigin);
+ result.AddOperand(rayTMin);
+ result.AddOperand(rayDirection);
+ result.AddOperand(rayTMax);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryTerminateKHR(Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryTerminateKHR);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGenerateIntersectionKHR(Instruction rayQuery, Instruction hitT)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGenerateIntersectionKHR);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(hitT);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryConfirmIntersectionKHR(Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryConfirmIntersectionKHR);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryProceedKHR(Instruction resultType, Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryProceedKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionTypeKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionTypeKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FragmentMaskFetchAMD(Instruction resultType, Instruction image, Instruction coordinate)
+ {
+ Instruction result = NewInstruction(Op.OpFragmentMaskFetchAMD, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FragmentFetchAMD(Instruction resultType, Instruction image, Instruction coordinate, Instruction fragmentIndex)
+ {
+ Instruction result = NewInstruction(Op.OpFragmentFetchAMD, GetNewId(), resultType);
+
+ result.AddOperand(image);
+ result.AddOperand(coordinate);
+ result.AddOperand(fragmentIndex);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReadClockKHR(Instruction resultType, Instruction execution)
+ {
+ Instruction result = NewInstruction(Op.OpReadClockKHR, GetNewId(), resultType);
+
+ result.AddOperand(execution);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction WritePackedPrimitiveIndices4x8NV(Instruction indexOffset, Instruction packedIndices)
+ {
+ Instruction result = NewInstruction(Op.OpWritePackedPrimitiveIndices4x8NV);
+
+ result.AddOperand(indexOffset);
+ result.AddOperand(packedIndices);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReportIntersectionNV(Instruction resultType, Instruction hit, Instruction hitKind)
+ {
+ Instruction result = NewInstruction(Op.OpReportIntersectionNV, GetNewId(), resultType);
+
+ result.AddOperand(hit);
+ result.AddOperand(hitKind);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ReportIntersectionKHR(Instruction resultType, Instruction hit, Instruction hitKind)
+ {
+ Instruction result = NewInstruction(Op.OpReportIntersectionKHR, GetNewId(), resultType);
+
+ result.AddOperand(hit);
+ result.AddOperand(hitKind);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IgnoreIntersectionNV()
+ {
+ Instruction result = NewInstruction(Op.OpIgnoreIntersectionNV);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TerminateRayNV()
+ {
+ Instruction result = NewInstruction(Op.OpTerminateRayNV);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TraceNV(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payloadId)
+ {
+ Instruction result = NewInstruction(Op.OpTraceNV);
+
+ result.AddOperand(accel);
+ result.AddOperand(rayFlags);
+ result.AddOperand(cullMask);
+ result.AddOperand(sBTOffset);
+ result.AddOperand(sBTStride);
+ result.AddOperand(missIndex);
+ result.AddOperand(rayOrigin);
+ result.AddOperand(rayTmin);
+ result.AddOperand(rayDirection);
+ result.AddOperand(rayTmax);
+ result.AddOperand(payloadId);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TypeAccelerationStructureNV()
+ {
+ Instruction result = NewInstruction(Op.OpTypeAccelerationStructureNV, GetNewId());
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TypeAccelerationStructureKHR()
+ {
+ Instruction result = NewInstruction(Op.OpTypeAccelerationStructureKHR, GetNewId());
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ExecuteCallableNV(Instruction sBTIndex, Instruction callableDataId)
+ {
+ Instruction result = NewInstruction(Op.OpExecuteCallableNV);
+
+ result.AddOperand(sBTIndex);
+ result.AddOperand(callableDataId);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction TypeCooperativeMatrixNV(Instruction componentType, Instruction execution, Instruction rows, Instruction columns)
+ {
+ Instruction result = NewInstruction(Op.OpTypeCooperativeMatrixNV, GetNewId());
+
+ result.AddOperand(componentType);
+ result.AddOperand(execution);
+ result.AddOperand(rows);
+ result.AddOperand(columns);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CooperativeMatrixLoadNV(Instruction resultType, Instruction pointer, Instruction stride, Instruction columnMajor, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
+ {
+ Instruction result = NewInstruction(Op.OpCooperativeMatrixLoadNV, GetNewId(), resultType);
+
+ result.AddOperand(pointer);
+ result.AddOperand(stride);
+ result.AddOperand(columnMajor);
+ if (memoryAccess != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CooperativeMatrixStoreNV(Instruction pointer, Instruction obj, Instruction stride, Instruction columnMajor, MemoryAccessMask memoryAccess = (MemoryAccessMask)int.MaxValue)
+ {
+ Instruction result = NewInstruction(Op.OpCooperativeMatrixStoreNV);
+
+ result.AddOperand(pointer);
+ result.AddOperand(obj);
+ result.AddOperand(stride);
+ result.AddOperand(columnMajor);
+ if (memoryAccess != (MemoryAccessMask)int.MaxValue)
+ {
+ result.AddOperand(memoryAccess);
+ }
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CooperativeMatrixMulAddNV(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ Instruction result = NewInstruction(Op.OpCooperativeMatrixMulAddNV, GetNewId(), resultType);
+
+ result.AddOperand(a);
+ result.AddOperand(b);
+ result.AddOperand(c);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction CooperativeMatrixLengthNV(Instruction resultType, Instruction type)
+ {
+ Instruction result = NewInstruction(Op.OpCooperativeMatrixLengthNV, GetNewId(), resultType);
+
+ result.AddOperand(type);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction BeginInvocationInterlockEXT()
+ {
+ Instruction result = NewInstruction(Op.OpBeginInvocationInterlockEXT);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction EndInvocationInterlockEXT()
+ {
+ Instruction result = NewInstruction(Op.OpEndInvocationInterlockEXT);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction DemoteToHelperInvocationEXT()
+ {
+ Instruction result = NewInstruction(Op.OpDemoteToHelperInvocationEXT);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IsHelperInvocationEXT(Instruction resultType)
+ {
+ Instruction result = NewInstruction(Op.OpIsHelperInvocationEXT, GetNewId(), resultType);
+
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UCountLeadingZerosINTEL(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpUCountLeadingZerosINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UCountTrailingZerosINTEL(Instruction resultType, Instruction operand)
+ {
+ Instruction result = NewInstruction(Op.OpUCountTrailingZerosINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AbsISubINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpAbsISubINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction AbsUSubINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpAbsUSubINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IAddSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIAddSatINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UAddSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUAddSatINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IAverageINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIAverageINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UAverageINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUAverageINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IAverageRoundedINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIAverageRoundedINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UAverageRoundedINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUAverageRoundedINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction ISubSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpISubSatINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction USubSatINTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUSubSatINTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction IMul32x16INTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpIMul32x16INTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction UMul32x16INTEL(Instruction resultType, Instruction operand1, Instruction operand2)
+ {
+ Instruction result = NewInstruction(Op.OpUMul32x16INTEL, GetNewId(), resultType);
+
+ result.AddOperand(operand1);
+ result.AddOperand(operand2);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction LoopControlINTEL(params LiteralInteger[] loopControlParameters)
+ {
+ Instruction result = NewInstruction(Op.OpLoopControlINTEL);
+
+ result.AddOperand(loopControlParameters);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction FPGARegINTEL(Instruction resultType, Instruction resultObj, Instruction input)
+ {
+ Instruction result = NewInstruction(Op.OpFPGARegINTEL, GetNewId(), resultType);
+
+ result.AddOperand(resultObj);
+ result.AddOperand(input);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetRayTMinKHR(Instruction resultType, Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetRayTMinKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetRayFlagsKHR(Instruction resultType, Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetRayFlagsKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionTKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionTKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionInstanceCustomIndexKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionInstanceCustomIndexKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionInstanceIdKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionInstanceIdKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionGeometryIndexKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionGeometryIndexKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionPrimitiveIndexKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionPrimitiveIndexKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionBarycentricsKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionBarycentricsKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionFrontFaceKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionFrontFaceKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionCandidateAABBOpaqueKHR(Instruction resultType, Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionCandidateAABBOpaqueKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionObjectRayDirectionKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionObjectRayDirectionKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionObjectRayOriginKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionObjectRayOriginKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetWorldRayDirectionKHR(Instruction resultType, Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetWorldRayDirectionKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetWorldRayOriginKHR(Instruction resultType, Instruction rayQuery)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetWorldRayOriginKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionObjectToWorldKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionObjectToWorldKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public Instruction RayQueryGetIntersectionWorldToObjectKHR(Instruction resultType, Instruction rayQuery, Instruction intersection)
+ {
+ Instruction result = NewInstruction(Op.OpRayQueryGetIntersectionWorldToObjectKHR, GetNewId(), resultType);
+
+ result.AddOperand(rayQuery);
+ result.AddOperand(intersection);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ }
+}
diff --git a/Spv.Generator/Autogenerated/GlslStd450Grammar.cs b/Spv.Generator/Autogenerated/GlslStd450Grammar.cs
new file mode 100644
index 00000000..4722d2e4
--- /dev/null
+++ b/Spv.Generator/Autogenerated/GlslStd450Grammar.cs
@@ -0,0 +1,441 @@
+// AUTOGENERATED: DO NOT EDIT
+// Last update date: 2021-01-06 23:02:26.955269
+#region Grammar License
+// Copyright (c) 2014-2016 The Khronos Group Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and/or associated documentation files (the "Materials"),
+// to deal in the Materials without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Materials, and to permit persons to whom the
+// Materials are furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Materials.
+//
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
+// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
+// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
+//
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
+// IN THE MATERIALS.
+#endregion
+
+using static Spv.Specification;
+
+namespace Spv.Generator
+{
+ public partial class Module
+ {
+ public Instruction GlslRound(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 1, x);
+ }
+
+ public Instruction GlslRoundEven(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 2, x);
+ }
+
+ public Instruction GlslTrunc(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 3, x);
+ }
+
+ public Instruction GlslFAbs(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 4, x);
+ }
+
+ public Instruction GlslSAbs(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 5, x);
+ }
+
+ public Instruction GlslFSign(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 6, x);
+ }
+
+ public Instruction GlslSSign(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 7, x);
+ }
+
+ public Instruction GlslFloor(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 8, x);
+ }
+
+ public Instruction GlslCeil(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 9, x);
+ }
+
+ public Instruction GlslFract(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 10, x);
+ }
+
+ public Instruction GlslRadians(Instruction resultType, Instruction degrees)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 11, degrees);
+ }
+
+ public Instruction GlslDegrees(Instruction resultType, Instruction radians)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 12, radians);
+ }
+
+ public Instruction GlslSin(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 13, x);
+ }
+
+ public Instruction GlslCos(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 14, x);
+ }
+
+ public Instruction GlslTan(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 15, x);
+ }
+
+ public Instruction GlslAsin(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 16, x);
+ }
+
+ public Instruction GlslAcos(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 17, x);
+ }
+
+ public Instruction GlslAtan(Instruction resultType, Instruction y_over_x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 18, y_over_x);
+ }
+
+ public Instruction GlslSinh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 19, x);
+ }
+
+ public Instruction GlslCosh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 20, x);
+ }
+
+ public Instruction GlslTanh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 21, x);
+ }
+
+ public Instruction GlslAsinh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 22, x);
+ }
+
+ public Instruction GlslAcosh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 23, x);
+ }
+
+ public Instruction GlslAtanh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 24, x);
+ }
+
+ public Instruction GlslAtan2(Instruction resultType, Instruction y, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 25, y, x);
+ }
+
+ public Instruction GlslPow(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 26, x, y);
+ }
+
+ public Instruction GlslExp(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 27, x);
+ }
+
+ public Instruction GlslLog(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 28, x);
+ }
+
+ public Instruction GlslExp2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 29, x);
+ }
+
+ public Instruction GlslLog2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 30, x);
+ }
+
+ public Instruction GlslSqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 31, x);
+ }
+
+ public Instruction GlslInverseSqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 32, x);
+ }
+
+ public Instruction GlslDeterminant(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 33, x);
+ }
+
+ public Instruction GlslMatrixInverse(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 34, x);
+ }
+
+ public Instruction GlslModf(Instruction resultType, Instruction x, Instruction i)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 35, x, i);
+ }
+
+ public Instruction GlslModfStruct(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 36, x);
+ }
+
+ public Instruction GlslFMin(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 37, x, y);
+ }
+
+ public Instruction GlslUMin(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 38, x, y);
+ }
+
+ public Instruction GlslSMin(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 39, x, y);
+ }
+
+ public Instruction GlslFMax(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 40, x, y);
+ }
+
+ public Instruction GlslUMax(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 41, x, y);
+ }
+
+ public Instruction GlslSMax(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 42, x, y);
+ }
+
+ public Instruction GlslFClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 43, x, minVal, maxVal);
+ }
+
+ public Instruction GlslUClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 44, x, minVal, maxVal);
+ }
+
+ public Instruction GlslSClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 45, x, minVal, maxVal);
+ }
+
+ public Instruction GlslFMix(Instruction resultType, Instruction x, Instruction y, Instruction a)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 46, x, y, a);
+ }
+
+ public Instruction GlslIMix(Instruction resultType, Instruction x, Instruction y, Instruction a)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 47, x, y, a);
+ }
+
+ public Instruction GlslStep(Instruction resultType, Instruction edge, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 48, edge, x);
+ }
+
+ public Instruction GlslSmoothStep(Instruction resultType, Instruction edge0, Instruction edge1, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 49, edge0, edge1, x);
+ }
+
+ public Instruction GlslFma(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 50, a, b, c);
+ }
+
+ public Instruction GlslFrexp(Instruction resultType, Instruction x, Instruction exp)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 51, x, exp);
+ }
+
+ public Instruction GlslFrexpStruct(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 52, x);
+ }
+
+ public Instruction GlslLdexp(Instruction resultType, Instruction x, Instruction exp)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 53, x, exp);
+ }
+
+ public Instruction GlslPackSnorm4x8(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 54, v);
+ }
+
+ public Instruction GlslPackUnorm4x8(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 55, v);
+ }
+
+ public Instruction GlslPackSnorm2x16(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 56, v);
+ }
+
+ public Instruction GlslPackUnorm2x16(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 57, v);
+ }
+
+ public Instruction GlslPackHalf2x16(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 58, v);
+ }
+
+ public Instruction GlslPackDouble2x32(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 59, v);
+ }
+
+ public Instruction GlslUnpackSnorm2x16(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 60, p);
+ }
+
+ public Instruction GlslUnpackUnorm2x16(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 61, p);
+ }
+
+ public Instruction GlslUnpackHalf2x16(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 62, v);
+ }
+
+ public Instruction GlslUnpackSnorm4x8(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 63, p);
+ }
+
+ public Instruction GlslUnpackUnorm4x8(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 64, p);
+ }
+
+ public Instruction GlslUnpackDouble2x32(Instruction resultType, Instruction v)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 65, v);
+ }
+
+ public Instruction GlslLength(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 66, x);
+ }
+
+ public Instruction GlslDistance(Instruction resultType, Instruction p0, Instruction p1)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 67, p0, p1);
+ }
+
+ public Instruction GlslCross(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 68, x, y);
+ }
+
+ public Instruction GlslNormalize(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 69, x);
+ }
+
+ public Instruction GlslFaceForward(Instruction resultType, Instruction n, Instruction i, Instruction nref)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 70, n, i, nref);
+ }
+
+ public Instruction GlslReflect(Instruction resultType, Instruction i, Instruction n)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 71, i, n);
+ }
+
+ public Instruction GlslRefract(Instruction resultType, Instruction i, Instruction n, Instruction eta)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 72, i, n, eta);
+ }
+
+ public Instruction GlslFindILsb(Instruction resultType, Instruction value)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 73, value);
+ }
+
+ public Instruction GlslFindSMsb(Instruction resultType, Instruction value)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 74, value);
+ }
+
+ public Instruction GlslFindUMsb(Instruction resultType, Instruction value)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 75, value);
+ }
+
+ public Instruction GlslInterpolateAtCentroid(Instruction resultType, Instruction interpolant)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 76, interpolant);
+ }
+
+ public Instruction GlslInterpolateAtSample(Instruction resultType, Instruction interpolant, Instruction sample)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 77, interpolant, sample);
+ }
+
+ public Instruction GlslInterpolateAtOffset(Instruction resultType, Instruction interpolant, Instruction offset)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 78, interpolant, offset);
+ }
+
+ public Instruction GlslNMin(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 79, x, y);
+ }
+
+ public Instruction GlslNMax(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 80, x, y);
+ }
+
+ public Instruction GlslNClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
+ {
+ return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 81, x, minVal, maxVal);
+ }
+
+ }
+}
diff --git a/Spv.Generator/Autogenerated/OpenClGrammar.cs b/Spv.Generator/Autogenerated/OpenClGrammar.cs
new file mode 100644
index 00000000..ac990fbc
--- /dev/null
+++ b/Spv.Generator/Autogenerated/OpenClGrammar.cs
@@ -0,0 +1,841 @@
+// AUTOGENERATED: DO NOT EDIT
+// Last update date: 2021-01-06 23:02:27.020534
+#region Grammar License
+// Copyright (c) 2014-2016 The Khronos Group Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and/or associated documentation files (the "Materials"),
+// to deal in the Materials without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Materials, and to permit persons to whom the
+// Materials are furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Materials.
+//
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
+// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
+// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
+//
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
+// IN THE MATERIALS.
+#endregion
+
+using static Spv.Specification;
+
+namespace Spv.Generator
+{
+ public partial class Module
+ {
+ public Instruction OpenClAcos(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 0, x);
+ }
+
+ public Instruction OpenClAcosh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 1, x);
+ }
+
+ public Instruction OpenClAcospi(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 2, x);
+ }
+
+ public Instruction OpenClAsin(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 3, x);
+ }
+
+ public Instruction OpenClAsinh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 4, x);
+ }
+
+ public Instruction OpenClAsinpi(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 5, x);
+ }
+
+ public Instruction OpenClAtan(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 6, x);
+ }
+
+ public Instruction OpenClAtan2(Instruction resultType, Instruction y, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 7, y, x);
+ }
+
+ public Instruction OpenClAtanh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 8, x);
+ }
+
+ public Instruction OpenClAtanpi(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 9, x);
+ }
+
+ public Instruction OpenClAtan2pi(Instruction resultType, Instruction y, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 10, y, x);
+ }
+
+ public Instruction OpenClCbrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 11, x);
+ }
+
+ public Instruction OpenClCeil(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 12, x);
+ }
+
+ public Instruction OpenClCopysign(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 13, x, y);
+ }
+
+ public Instruction OpenClCos(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 14, x);
+ }
+
+ public Instruction OpenClCosh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 15, x);
+ }
+
+ public Instruction OpenClCospi(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 16, x);
+ }
+
+ public Instruction OpenClErfc(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 17, x);
+ }
+
+ public Instruction OpenClErf(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 18, x);
+ }
+
+ public Instruction OpenClExp(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 19, x);
+ }
+
+ public Instruction OpenClExp2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 20, x);
+ }
+
+ public Instruction OpenClExp10(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 21, x);
+ }
+
+ public Instruction OpenClExpm1(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 22, x);
+ }
+
+ public Instruction OpenClFabs(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 23, x);
+ }
+
+ public Instruction OpenClFdim(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 24, x, y);
+ }
+
+ public Instruction OpenClFloor(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 25, x);
+ }
+
+ public Instruction OpenClFma(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 26, a, b, c);
+ }
+
+ public Instruction OpenClFmax(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 27, x, y);
+ }
+
+ public Instruction OpenClFmin(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 28, x, y);
+ }
+
+ public Instruction OpenClFmod(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 29, x, y);
+ }
+
+ public Instruction OpenClFract(Instruction resultType, Instruction x, Instruction ptr)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 30, x, ptr);
+ }
+
+ public Instruction OpenClFrexp(Instruction resultType, Instruction x, Instruction exp)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 31, x, exp);
+ }
+
+ public Instruction OpenClHypot(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 32, x, y);
+ }
+
+ public Instruction OpenClIlogb(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 33, x);
+ }
+
+ public Instruction OpenClLdexp(Instruction resultType, Instruction x, Instruction k)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 34, x, k);
+ }
+
+ public Instruction OpenClLgamma(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 35, x);
+ }
+
+ public Instruction OpenClLgamma_r(Instruction resultType, Instruction x, Instruction signp)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 36, x, signp);
+ }
+
+ public Instruction OpenClLog(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 37, x);
+ }
+
+ public Instruction OpenClLog2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 38, x);
+ }
+
+ public Instruction OpenClLog10(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 39, x);
+ }
+
+ public Instruction OpenClLog1p(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 40, x);
+ }
+
+ public Instruction OpenClLogb(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 41, x);
+ }
+
+ public Instruction OpenClMad(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 42, a, b, c);
+ }
+
+ public Instruction OpenClMaxmag(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 43, x, y);
+ }
+
+ public Instruction OpenClMinmag(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 44, x, y);
+ }
+
+ public Instruction OpenClModf(Instruction resultType, Instruction x, Instruction iptr)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 45, x, iptr);
+ }
+
+ public Instruction OpenClNan(Instruction resultType, Instruction nancode)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 46, nancode);
+ }
+
+ public Instruction OpenClNextafter(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 47, x, y);
+ }
+
+ public Instruction OpenClPow(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 48, x, y);
+ }
+
+ public Instruction OpenClPown(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 49, x, y);
+ }
+
+ public Instruction OpenClPowr(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 50, x, y);
+ }
+
+ public Instruction OpenClRemainder(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 51, x, y);
+ }
+
+ public Instruction OpenClRemquo(Instruction resultType, Instruction x, Instruction y, Instruction quo)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 52, x, y, quo);
+ }
+
+ public Instruction OpenClRint(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 53, x);
+ }
+
+ public Instruction OpenClRootn(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 54, x, y);
+ }
+
+ public Instruction OpenClRound(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 55, x);
+ }
+
+ public Instruction OpenClRsqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 56, x);
+ }
+
+ public Instruction OpenClSin(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 57, x);
+ }
+
+ public Instruction OpenClSincos(Instruction resultType, Instruction x, Instruction cosval)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 58, x, cosval);
+ }
+
+ public Instruction OpenClSinh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 59, x);
+ }
+
+ public Instruction OpenClSinpi(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 60, x);
+ }
+
+ public Instruction OpenClSqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 61, x);
+ }
+
+ public Instruction OpenClTan(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 62, x);
+ }
+
+ public Instruction OpenClTanh(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 63, x);
+ }
+
+ public Instruction OpenClTanpi(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 64, x);
+ }
+
+ public Instruction OpenClTgamma(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 65, x);
+ }
+
+ public Instruction OpenClTrunc(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 66, x);
+ }
+
+ public Instruction OpenClHalf_cos(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 67, x);
+ }
+
+ public Instruction OpenClHalf_divide(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 68, x, y);
+ }
+
+ public Instruction OpenClHalf_exp(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 69, x);
+ }
+
+ public Instruction OpenClHalf_exp2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 70, x);
+ }
+
+ public Instruction OpenClHalf_exp10(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 71, x);
+ }
+
+ public Instruction OpenClHalf_log(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 72, x);
+ }
+
+ public Instruction OpenClHalf_log2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 73, x);
+ }
+
+ public Instruction OpenClHalf_log10(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 74, x);
+ }
+
+ public Instruction OpenClHalf_powr(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 75, x, y);
+ }
+
+ public Instruction OpenClHalf_recip(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 76, x);
+ }
+
+ public Instruction OpenClHalf_rsqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 77, x);
+ }
+
+ public Instruction OpenClHalf_sin(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 78, x);
+ }
+
+ public Instruction OpenClHalf_sqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 79, x);
+ }
+
+ public Instruction OpenClHalf_tan(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 80, x);
+ }
+
+ public Instruction OpenClNative_cos(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 81, x);
+ }
+
+ public Instruction OpenClNative_divide(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 82, x, y);
+ }
+
+ public Instruction OpenClNative_exp(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 83, x);
+ }
+
+ public Instruction OpenClNative_exp2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 84, x);
+ }
+
+ public Instruction OpenClNative_exp10(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 85, x);
+ }
+
+ public Instruction OpenClNative_log(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 86, x);
+ }
+
+ public Instruction OpenClNative_log2(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 87, x);
+ }
+
+ public Instruction OpenClNative_log10(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 88, x);
+ }
+
+ public Instruction OpenClNative_powr(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 89, x, y);
+ }
+
+ public Instruction OpenClNative_recip(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 90, x);
+ }
+
+ public Instruction OpenClNative_rsqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 91, x);
+ }
+
+ public Instruction OpenClNative_sin(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 92, x);
+ }
+
+ public Instruction OpenClNative_sqrt(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 93, x);
+ }
+
+ public Instruction OpenClNative_tan(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 94, x);
+ }
+
+ public Instruction OpenClS_abs(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 141, x);
+ }
+
+ public Instruction OpenClS_abs_diff(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 142, x, y);
+ }
+
+ public Instruction OpenClS_add_sat(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 143, x, y);
+ }
+
+ public Instruction OpenClU_add_sat(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 144, x, y);
+ }
+
+ public Instruction OpenClS_hadd(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 145, x, y);
+ }
+
+ public Instruction OpenClU_hadd(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 146, x, y);
+ }
+
+ public Instruction OpenClS_rhadd(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 147, x, y);
+ }
+
+ public Instruction OpenClU_rhadd(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 148, x, y);
+ }
+
+ public Instruction OpenClS_clamp(Instruction resultType, Instruction x, Instruction minval, Instruction maxval)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 149, x, minval, maxval);
+ }
+
+ public Instruction OpenClU_clamp(Instruction resultType, Instruction x, Instruction minval, Instruction maxval)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 150, x, minval, maxval);
+ }
+
+ public Instruction OpenClClz(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 151, x);
+ }
+
+ public Instruction OpenClCtz(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 152, x);
+ }
+
+ public Instruction OpenClS_mad_hi(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 153, a, b, c);
+ }
+
+ public Instruction OpenClU_mad_sat(Instruction resultType, Instruction x, Instruction y, Instruction z)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 154, x, y, z);
+ }
+
+ public Instruction OpenClS_mad_sat(Instruction resultType, Instruction x, Instruction y, Instruction z)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 155, x, y, z);
+ }
+
+ public Instruction OpenClS_max(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 156, x, y);
+ }
+
+ public Instruction OpenClU_max(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 157, x, y);
+ }
+
+ public Instruction OpenClS_min(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 158, x, y);
+ }
+
+ public Instruction OpenClU_min(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 159, x, y);
+ }
+
+ public Instruction OpenClS_mul_hi(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 160, x, y);
+ }
+
+ public Instruction OpenClRotate(Instruction resultType, Instruction v, Instruction i)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 161, v, i);
+ }
+
+ public Instruction OpenClS_sub_sat(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 162, x, y);
+ }
+
+ public Instruction OpenClU_sub_sat(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 163, x, y);
+ }
+
+ public Instruction OpenClU_upsample(Instruction resultType, Instruction hi, Instruction lo)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 164, hi, lo);
+ }
+
+ public Instruction OpenClS_upsample(Instruction resultType, Instruction hi, Instruction lo)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 165, hi, lo);
+ }
+
+ public Instruction OpenClPopcount(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 166, x);
+ }
+
+ public Instruction OpenClS_mad24(Instruction resultType, Instruction x, Instruction y, Instruction z)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 167, x, y, z);
+ }
+
+ public Instruction OpenClU_mad24(Instruction resultType, Instruction x, Instruction y, Instruction z)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 168, x, y, z);
+ }
+
+ public Instruction OpenClS_mul24(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 169, x, y);
+ }
+
+ public Instruction OpenClU_mul24(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 170, x, y);
+ }
+
+ public Instruction OpenClU_abs(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 201, x);
+ }
+
+ public Instruction OpenClU_abs_diff(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 202, x, y);
+ }
+
+ public Instruction OpenClU_mul_hi(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 203, x, y);
+ }
+
+ public Instruction OpenClU_mad_hi(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 204, a, b, c);
+ }
+
+ public Instruction OpenClFclamp(Instruction resultType, Instruction x, Instruction minval, Instruction maxval)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 95, x, minval, maxval);
+ }
+
+ public Instruction OpenClDegrees(Instruction resultType, Instruction radians)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 96, radians);
+ }
+
+ public Instruction OpenClFmax_common(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 97, x, y);
+ }
+
+ public Instruction OpenClFmin_common(Instruction resultType, Instruction x, Instruction y)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 98, x, y);
+ }
+
+ public Instruction OpenClMix(Instruction resultType, Instruction x, Instruction y, Instruction a)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 99, x, y, a);
+ }
+
+ public Instruction OpenClRadians(Instruction resultType, Instruction degrees)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 100, degrees);
+ }
+
+ public Instruction OpenClStep(Instruction resultType, Instruction edge, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 101, edge, x);
+ }
+
+ public Instruction OpenClSmoothstep(Instruction resultType, Instruction edge0, Instruction edge1, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 102, edge0, edge1, x);
+ }
+
+ public Instruction OpenClSign(Instruction resultType, Instruction x)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 103, x);
+ }
+
+ public Instruction OpenClCross(Instruction resultType, Instruction p0, Instruction p1)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 104, p0, p1);
+ }
+
+ public Instruction OpenClDistance(Instruction resultType, Instruction p0, Instruction p1)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 105, p0, p1);
+ }
+
+ public Instruction OpenClLength(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 106, p);
+ }
+
+ public Instruction OpenClNormalize(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 107, p);
+ }
+
+ public Instruction OpenClFast_distance(Instruction resultType, Instruction p0, Instruction p1)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 108, p0, p1);
+ }
+
+ public Instruction OpenClFast_length(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 109, p);
+ }
+
+ public Instruction OpenClFast_normalize(Instruction resultType, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 110, p);
+ }
+
+ public Instruction OpenClBitselect(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 186, a, b, c);
+ }
+
+ public Instruction OpenClSelect(Instruction resultType, Instruction a, Instruction b, Instruction c)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 187, a, b, c);
+ }
+
+ public Instruction OpenClVloadn(Instruction resultType, Instruction offset, Instruction p, LiteralInteger n)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 171, offset, p, n);
+ }
+
+ public Instruction OpenClVstoren(Instruction resultType, Instruction data, Instruction offset, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 172, data, offset, p);
+ }
+
+ public Instruction OpenClVload_half(Instruction resultType, Instruction offset, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 173, offset, p);
+ }
+
+ public Instruction OpenClVload_halfn(Instruction resultType, Instruction offset, Instruction p, LiteralInteger n)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 174, offset, p, n);
+ }
+
+ public Instruction OpenClVstore_half(Instruction resultType, Instruction data, Instruction offset, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 175, data, offset, p);
+ }
+
+ public Instruction OpenClVstore_half_r(Instruction resultType, Instruction data, Instruction offset, Instruction p, FPRoundingMode mode)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 176, data, offset, p, LiteralInteger.CreateForEnum(mode));
+ }
+
+ public Instruction OpenClVstore_halfn(Instruction resultType, Instruction data, Instruction offset, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 177, data, offset, p);
+ }
+
+ public Instruction OpenClVstore_halfn_r(Instruction resultType, Instruction data, Instruction offset, Instruction p, FPRoundingMode mode)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 178, data, offset, p, LiteralInteger.CreateForEnum(mode));
+ }
+
+ public Instruction OpenClVloada_halfn(Instruction resultType, Instruction offset, Instruction p, LiteralInteger n)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 179, offset, p, n);
+ }
+
+ public Instruction OpenClVstorea_halfn(Instruction resultType, Instruction data, Instruction offset, Instruction p)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 180, data, offset, p);
+ }
+
+ public Instruction OpenClVstorea_halfn_r(Instruction resultType, Instruction data, Instruction offset, Instruction p, FPRoundingMode mode)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 181, data, offset, p, LiteralInteger.CreateForEnum(mode));
+ }
+
+ public Instruction OpenClShuffle(Instruction resultType, Instruction x, Instruction shufflemask)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 182, x, shufflemask);
+ }
+
+ public Instruction OpenClShuffle2(Instruction resultType, Instruction x, Instruction y, Instruction shufflemask)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 183, x, y, shufflemask);
+ }
+
+ public Instruction OpenClPrefetch(Instruction resultType, Instruction ptr, Instruction numelements)
+ {
+ return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 185, ptr, numelements);
+ }
+
+ }
+}
diff --git a/Spv.Generator/ConstantKey.cs b/Spv.Generator/ConstantKey.cs
new file mode 100644
index 00000000..d3c1b905
--- /dev/null
+++ b/Spv.Generator/ConstantKey.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Spv.Generator
+{
+ internal struct ConstantKey : IEquatable<ConstantKey>
+ {
+ private Instruction _constant;
+
+ public ConstantKey(Instruction constant)
+ {
+ _constant = constant;
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(_constant.Opcode, _constant.GetHashCodeContent(), _constant.GetHashCodeResultType());
+ }
+
+ public bool Equals(ConstantKey other)
+ {
+ return _constant.Opcode == other._constant.Opcode && _constant.EqualsContent(other._constant) && _constant.EqualsResultType(other._constant);
+ }
+
+ public override bool Equals([NotNullWhen(true)] object obj)
+ {
+ return obj is ConstantKey && Equals((ConstantKey)obj);
+ }
+ }
+}
diff --git a/Spv.Generator/DeterministicHashCode.cs b/Spv.Generator/DeterministicHashCode.cs
new file mode 100644
index 00000000..1bf0b468
--- /dev/null
+++ b/Spv.Generator/DeterministicHashCode.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace Spv.Generator
+{
+ /// <summary>
+ /// Similar to System.HashCode, but without introducing random values.
+ /// The same primes and shifts are used.
+ /// </summary>
+ internal static class DeterministicHashCode
+ {
+ private const uint Prime1 = 2654435761U;
+ private const uint Prime2 = 2246822519U;
+ private const uint Prime3 = 3266489917U;
+ private const uint Prime4 = 668265263U;
+
+ public static int GetHashCode(string value)
+ {
+ uint hash = (uint)value.Length + Prime1;
+
+ for (int i = 0; i < value.Length; i++)
+ {
+ hash += (hash << 7) ^ value[i];
+ }
+
+ return (int)MixFinal(hash);
+ }
+
+ public static int Combine<T>(ReadOnlySpan<T> values)
+ {
+ uint hashCode = Prime2;
+ hashCode += 4 * (uint)values.Length;
+
+ foreach (T value in values)
+ {
+ uint hc = (uint)(value?.GetHashCode() ?? 0);
+ hashCode = MixStep(hashCode, hc);
+ }
+
+ return (int)MixFinal(hashCode);
+ }
+
+ public static int Combine<T1, T2>(T1 value1, T2 value2)
+ {
+ uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
+ uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
+
+ uint hash = Prime2;
+ hash += 8;
+
+ hash = MixStep(hash, hc1);
+ hash = MixStep(hash, hc2);
+
+ return (int)MixFinal(hash);
+ }
+
+ public static int Combine<T1, T2, T3>(T1 value1, T2 value2, T3 value3)
+ {
+ uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
+ uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
+ uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
+
+ uint hash = Prime2;
+ hash += 12;
+
+ hash = MixStep(hash, hc1);
+ hash = MixStep(hash, hc2);
+ hash = MixStep(hash, hc3);
+
+ return (int)MixFinal(hash);
+ }
+
+ public static int Combine<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4)
+ {
+ uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
+ uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
+ uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
+ uint hc4 = (uint)(value4?.GetHashCode() ?? 0);
+
+ uint hash = Prime2;
+ hash += 16;
+
+ hash = MixStep(hash, hc1);
+ hash = MixStep(hash, hc2);
+ hash = MixStep(hash, hc3);
+ hash = MixStep(hash, hc4);
+
+ return (int)MixFinal(hash);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static uint MixStep(uint hashCode, uint mixValue)
+ {
+ return BitOperations.RotateLeft(hashCode + mixValue * Prime3, 17) * Prime4;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static uint MixFinal(uint hash)
+ {
+ hash ^= hash >> 15;
+ hash *= Prime2;
+ hash ^= hash >> 13;
+ hash *= Prime3;
+ hash ^= hash >> 16;
+ return hash;
+ }
+ }
+}
diff --git a/Spv.Generator/DeterministicStringKey.cs b/Spv.Generator/DeterministicStringKey.cs
new file mode 100644
index 00000000..491bb745
--- /dev/null
+++ b/Spv.Generator/DeterministicStringKey.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Spv.Generator
+{
+ internal class DeterministicStringKey : IEquatable<DeterministicStringKey>
+ {
+ private string _value;
+
+ public DeterministicStringKey(string value)
+ {
+ _value = value;
+ }
+
+ public override int GetHashCode()
+ {
+ return DeterministicHashCode.GetHashCode(_value);
+ }
+
+ public bool Equals(DeterministicStringKey other)
+ {
+ return _value == other._value;
+ }
+
+ public override bool Equals([NotNullWhen(true)] object obj)
+ {
+ return obj is DeterministicStringKey && Equals((DeterministicStringKey)obj);
+ }
+ }
+}
diff --git a/Spv.Generator/GeneratorPool.cs b/Spv.Generator/GeneratorPool.cs
new file mode 100644
index 00000000..f6c92918
--- /dev/null
+++ b/Spv.Generator/GeneratorPool.cs
@@ -0,0 +1,58 @@
+using System.Collections.Generic;
+
+namespace Spv.Generator
+{
+ public class GeneratorPool<T> where T : class, new()
+ {
+ private List<T[]> _pool;
+ private int _chunkIndex = -1;
+ private int _poolIndex = -1;
+ private int _initialSize;
+ private int _poolSizeIncrement;
+
+ public GeneratorPool(): this(1000, 200) { }
+
+ public GeneratorPool(int chunkSizeLimit, int poolSizeIncrement)
+ {
+ _initialSize = chunkSizeLimit;
+ _poolSizeIncrement = poolSizeIncrement;
+
+ _pool = new(chunkSizeLimit * 2);
+
+ AddChunkIfNeeded();
+ }
+
+ public T Allocate()
+ {
+ if (++_poolIndex >= _poolSizeIncrement)
+ {
+ AddChunkIfNeeded();
+
+ _poolIndex = 0;
+ }
+
+ return _pool[_chunkIndex][_poolIndex];
+ }
+
+ private void AddChunkIfNeeded()
+ {
+ if (++_chunkIndex >= _pool.Count)
+ {
+ T[] pool = new T[_poolSizeIncrement];
+
+ for (int i = 0; i < _poolSizeIncrement; i++)
+ {
+ pool[i] = new T();
+ }
+
+ _pool.Add(pool);
+ }
+ }
+
+ public void Clear()
+ {
+ _chunkIndex = 0;
+ _poolIndex = -1;
+ }
+ }
+}
diff --git a/Spv.Generator/Instruction.cs b/Spv.Generator/Instruction.cs
new file mode 100644
index 00000000..92299404
--- /dev/null
+++ b/Spv.Generator/Instruction.cs
@@ -0,0 +1,232 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace Spv.Generator
+{
+ public sealed class Instruction : Operand, IEquatable<Instruction>
+ {
+ public const uint InvalidId = uint.MaxValue;
+
+ public Specification.Op Opcode { get; private set; }
+ private Instruction _resultType;
+ private InstructionOperands _operands;
+
+ public uint Id { get; set; }
+
+ public Instruction() { }
+
+ public void Set(Specification.Op opcode, uint id = InvalidId, Instruction resultType = null)
+ {
+ Opcode = opcode;
+ Id = id;
+ _resultType = resultType;
+
+ _operands = new InstructionOperands();
+ }
+
+ public void SetId(uint id)
+ {
+ Id = id;
+ }
+
+ public OperandType Type => OperandType.Instruction;
+
+ public ushort GetTotalWordCount()
+ {
+ ushort result = WordCount;
+
+ if (Id != InvalidId)
+ {
+ result++;
+ }
+
+ if (_resultType != null)
+ {
+ result += _resultType.WordCount;
+ }
+
+ Span<Operand> operands = _operands.ToSpan();
+ for (int i = 0; i < operands.Length; i++)
+ {
+ result += operands[i].WordCount;
+ }
+
+ return result;
+ }
+
+ public ushort WordCount => 1;
+
+ public void AddOperand(Operand value)
+ {
+ Debug.Assert(value != null);
+ _operands.Add(value);
+ }
+
+ public void AddOperand(Operand[] value)
+ {
+ foreach (Operand instruction in value)
+ {
+ AddOperand(instruction);
+ }
+ }
+
+ public void AddOperand(LiteralInteger[] value)
+ {
+ foreach (LiteralInteger instruction in value)
+ {
+ AddOperand(instruction);
+ }
+ }
+
+ public void AddOperand(LiteralInteger value)
+ {
+ AddOperand((Operand)value);
+ }
+
+ public void AddOperand(Instruction[] value)
+ {
+ foreach (Instruction instruction in value)
+ {
+ AddOperand(instruction);
+ }
+ }
+
+ public void AddOperand(Instruction value)
+ {
+ AddOperand((Operand)value);
+ }
+
+ public void AddOperand(string value)
+ {
+ AddOperand(new LiteralString(value));
+ }
+
+ public void AddOperand<T>(T value) where T: Enum
+ {
+ AddOperand(LiteralInteger.CreateForEnum(value));
+ }
+
+ public void Write(BinaryWriter writer)
+ {
+ // Word 0
+ writer.Write((ushort)Opcode);
+ writer.Write(GetTotalWordCount());
+
+ _resultType?.WriteOperand(writer);
+
+ if (Id != InvalidId)
+ {
+ writer.Write(Id);
+ }
+
+ Span<Operand> operands = _operands.ToSpan();
+ for (int i = 0; i < operands.Length; i++)
+ {
+ operands[i].WriteOperand(writer);
+ }
+ }
+
+ public void WriteOperand(BinaryWriter writer)
+ {
+ Debug.Assert(Id != InvalidId);
+
+ if (Id == InvalidId)
+ {
+ string methodToCall;
+
+ if (Opcode == Specification.Op.OpVariable)
+ {
+ methodToCall = "AddLocalVariable or AddGlobalVariable";
+ }
+ else if (Opcode == Specification.Op.OpLabel)
+ {
+ methodToCall = "AddLabel";
+ }
+ else
+ {
+ throw new InvalidOperationException("Internal error");
+ }
+
+ throw new InvalidOperationException($"Id wasn't bound to the module, please make sure to call {methodToCall}");
+ }
+
+ writer.Write(Id);
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is Instruction instruction && Equals(instruction);
+ }
+
+ public bool Equals(Instruction cmpObj)
+ {
+ bool result = Type == cmpObj.Type && Id == cmpObj.Id;
+
+ if (result)
+ {
+ if (_resultType != null && cmpObj._resultType != null)
+ {
+ result &= _resultType.Equals(cmpObj._resultType);
+ }
+ else if (_resultType != null || cmpObj._resultType != null)
+ {
+ return false;
+ }
+ }
+
+ if (result)
+ {
+ result &= EqualsContent(cmpObj);
+ }
+
+ return result;
+ }
+
+ public bool EqualsContent(Instruction cmpObj)
+ {
+ Span<Operand> thisOperands = _operands.ToSpan();
+ Span<Operand> cmpOperands = cmpObj._operands.ToSpan();
+
+ if (thisOperands.Length != cmpOperands.Length)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < thisOperands.Length; i++)
+ {
+ if (!thisOperands[i].Equals(cmpOperands[i]))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public bool EqualsResultType(Instruction cmpObj)
+ {
+ return _resultType.Opcode == cmpObj._resultType.Opcode && _resultType.EqualsContent(cmpObj._resultType);
+ }
+
+ public int GetHashCodeContent()
+ {
+ return DeterministicHashCode.Combine<Operand>(_operands.ToSpan());
+ }
+
+ public int GetHashCodeResultType()
+ {
+ return DeterministicHashCode.Combine(_resultType.Opcode, _resultType.GetHashCodeContent());
+ }
+
+ public override int GetHashCode()
+ {
+ return DeterministicHashCode.Combine(Opcode, Id, _resultType, DeterministicHashCode.Combine<Operand>(_operands.ToSpan()));
+ }
+
+ public bool Equals(Operand obj)
+ {
+ return obj is Instruction instruction && Equals(instruction);
+ }
+ }
+}
diff --git a/Spv.Generator/InstructionOperands.cs b/Spv.Generator/InstructionOperands.cs
new file mode 100644
index 00000000..c7170ec1
--- /dev/null
+++ b/Spv.Generator/InstructionOperands.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Spv.Generator
+{
+ public struct InstructionOperands
+ {
+ private const int InternalCount = 5;
+
+ public int Count;
+ public Operand Operand1;
+ public Operand Operand2;
+ public Operand Operand3;
+ public Operand Operand4;
+ public Operand Operand5;
+ public Operand[] Overflow;
+
+ public Span<Operand> ToSpan()
+ {
+ if (Count > InternalCount)
+ {
+ return MemoryMarshal.CreateSpan(ref this.Overflow[0], Count);
+ }
+ else
+ {
+ return MemoryMarshal.CreateSpan(ref this.Operand1, Count);
+ }
+ }
+
+ public void Add(Operand operand)
+ {
+ if (Count < InternalCount)
+ {
+ MemoryMarshal.CreateSpan(ref this.Operand1, Count + 1)[Count] = operand;
+ Count++;
+ }
+ else
+ {
+ if (Overflow == null)
+ {
+ Overflow = new Operand[InternalCount * 2];
+ MemoryMarshal.CreateSpan(ref this.Operand1, InternalCount).CopyTo(Overflow.AsSpan());
+ }
+ else if (Count == Overflow.Length)
+ {
+ Array.Resize(ref Overflow, Overflow.Length * 2);
+ }
+
+ Overflow[Count++] = operand;
+ }
+ }
+ }
+}
diff --git a/Spv.Generator/LICENSE b/Spv.Generator/LICENSE
new file mode 100644
index 00000000..31aa7938
--- /dev/null
+++ b/Spv.Generator/LICENSE
@@ -0,0 +1,23 @@
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/Spv.Generator/LiteralInteger.cs b/Spv.Generator/LiteralInteger.cs
new file mode 100644
index 00000000..3193ed6e
--- /dev/null
+++ b/Spv.Generator/LiteralInteger.cs
@@ -0,0 +1,103 @@
+using System;
+using System.IO;
+
+namespace Spv.Generator
+{
+ public class LiteralInteger : Operand, IEquatable<LiteralInteger>
+ {
+ [ThreadStatic]
+ private static GeneratorPool<LiteralInteger> _pool;
+
+ internal static void RegisterPool(GeneratorPool<LiteralInteger> pool)
+ {
+ _pool = pool;
+ }
+
+ internal static void UnregisterPool()
+ {
+ _pool = null;
+ }
+
+ public OperandType Type => OperandType.Number;
+
+ private enum IntegerType
+ {
+ UInt32,
+ Int32,
+ UInt64,
+ Int64,
+ Float32,
+ Float64,
+ }
+
+ private IntegerType _integerType;
+ private ulong _data;
+
+ public ushort WordCount { get; private set; }
+
+ public LiteralInteger() { }
+
+ private static LiteralInteger New()
+ {
+ return _pool.Allocate();
+ }
+
+ private LiteralInteger Set(ulong data, IntegerType integerType, ushort wordCount)
+ {
+ _data = data;
+ _integerType = integerType;
+
+ WordCount = wordCount;
+
+ return this;
+ }
+
+ public static implicit operator LiteralInteger(int value) => New().Set((ulong)value, IntegerType.Int32, 1);
+ public static implicit operator LiteralInteger(uint value) => New().Set(value, IntegerType.UInt32, 1);
+ public static implicit operator LiteralInteger(long value) => New().Set((ulong)value, IntegerType.Int64, 2);
+ public static implicit operator LiteralInteger(ulong value) => New().Set(value, IntegerType.UInt64, 2);
+ public static implicit operator LiteralInteger(float value) => New().Set(BitConverter.SingleToUInt32Bits(value), IntegerType.Float32, 1);
+ public static implicit operator LiteralInteger(double value) => New().Set(BitConverter.DoubleToUInt64Bits(value), IntegerType.Float64, 2);
+ public static implicit operator LiteralInteger(Enum value) => New().Set((ulong)(int)(object)value, IntegerType.Int32, 1);
+
+ // NOTE: this is not in the standard, but this is some syntax sugar useful in some instructions (TypeInt ect)
+ public static implicit operator LiteralInteger(bool value) => New().Set(Convert.ToUInt64(value), IntegerType.Int32, 1);
+
+ public static LiteralInteger CreateForEnum<T>(T value) where T : Enum
+ {
+ return value;
+ }
+
+ public void WriteOperand(BinaryWriter writer)
+ {
+ if (WordCount == 1)
+ {
+ writer.Write((uint)_data);
+ }
+ else
+ {
+ writer.Write(_data);
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is LiteralInteger literalInteger && Equals(literalInteger);
+ }
+
+ public bool Equals(LiteralInteger cmpObj)
+ {
+ return Type == cmpObj.Type && _integerType == cmpObj._integerType && _data == cmpObj._data;
+ }
+
+ public override int GetHashCode()
+ {
+ return DeterministicHashCode.Combine(Type, _data);
+ }
+
+ public bool Equals(Operand obj)
+ {
+ return obj is LiteralInteger literalInteger && Equals(literalInteger);
+ }
+ }
+}
diff --git a/Spv.Generator/LiteralString.cs b/Spv.Generator/LiteralString.cs
new file mode 100644
index 00000000..4ed9e52b
--- /dev/null
+++ b/Spv.Generator/LiteralString.cs
@@ -0,0 +1,52 @@
+using System;
+using System.IO;
+using System.Text;
+
+namespace Spv.Generator
+{
+ public class LiteralString : Operand, IEquatable<LiteralString>
+ {
+ public OperandType Type => OperandType.String;
+
+ private string _value;
+
+ public LiteralString(string value)
+ {
+ _value = value;
+ }
+
+ public ushort WordCount => (ushort)(_value.Length / 4 + 1);
+
+ public void WriteOperand(BinaryWriter writer)
+ {
+ writer.Write(_value.AsSpan());
+
+ // String must be padded to the word size (which is 4 bytes).
+ int paddingSize = 4 - (Encoding.ASCII.GetByteCount(_value) % 4);
+
+ Span<byte> padding = stackalloc byte[paddingSize];
+
+ writer.Write(padding);
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is LiteralString literalString && Equals(literalString);
+ }
+
+ public bool Equals(LiteralString cmpObj)
+ {
+ return Type == cmpObj.Type && _value.Equals(cmpObj._value);
+ }
+
+ public override int GetHashCode()
+ {
+ return DeterministicHashCode.Combine(Type, DeterministicHashCode.GetHashCode(_value));
+ }
+
+ public bool Equals(Operand obj)
+ {
+ return obj is LiteralString literalString && Equals(literalString);
+ }
+ }
+}
diff --git a/Spv.Generator/Module.cs b/Spv.Generator/Module.cs
new file mode 100644
index 00000000..34ad6036
--- /dev/null
+++ b/Spv.Generator/Module.cs
@@ -0,0 +1,365 @@
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using static Spv.Specification;
+
+namespace Spv.Generator
+{
+ public partial class Module
+ {
+ // TODO: Register on SPIR-V registry.
+ private const int GeneratorId = 0;
+
+ private readonly uint _version;
+
+ private uint _bound;
+
+ // Follow spec order here while keeping it as simple as possible.
+ private List<Capability> _capabilities;
+ private List<string> _extensions;
+ private Dictionary<DeterministicStringKey, Instruction> _extInstImports;
+ private AddressingModel _addressingModel;
+ private MemoryModel _memoryModel;
+
+ private List<Instruction> _entrypoints;
+ private List<Instruction> _executionModes;
+ private List<Instruction> _debug;
+ private List<Instruction> _annotations;
+
+ // In the declaration block.
+ private Dictionary<TypeDeclarationKey, Instruction> _typeDeclarations;
+ // In the declaration block.
+ private List<Instruction> _globals;
+ // In the declaration block.
+ private Dictionary<ConstantKey, Instruction> _constants;
+ // In the declaration block, for function that aren't defined in the module.
+ private List<Instruction> _functionsDeclarations;
+
+ private List<Instruction> _functionsDefinitions;
+
+ private GeneratorPool<Instruction> _instPool;
+ private GeneratorPool<LiteralInteger> _integerPool;
+
+ public Module(uint version, GeneratorPool<Instruction> instPool = null, GeneratorPool<LiteralInteger> integerPool = null)
+ {
+ _version = version;
+ _bound = 1;
+ _capabilities = new List<Capability>();
+ _extensions = new List<string>();
+ _extInstImports = new Dictionary<DeterministicStringKey, Instruction>();
+ _addressingModel = AddressingModel.Logical;
+ _memoryModel = MemoryModel.Simple;
+ _entrypoints = new List<Instruction>();
+ _executionModes = new List<Instruction>();
+ _debug = new List<Instruction>();
+ _annotations = new List<Instruction>();
+ _typeDeclarations = new Dictionary<TypeDeclarationKey, Instruction>();
+ _constants = new Dictionary<ConstantKey, Instruction>();
+ _globals = new List<Instruction>();
+ _functionsDeclarations = new List<Instruction>();
+ _functionsDefinitions = new List<Instruction>();
+
+ _instPool = instPool ?? new GeneratorPool<Instruction>();
+ _integerPool = integerPool ?? new GeneratorPool<LiteralInteger>();
+
+ LiteralInteger.RegisterPool(_integerPool);
+ }
+
+ private uint GetNewId()
+ {
+ return _bound++;
+ }
+
+ public void AddCapability(Capability capability)
+ {
+ _capabilities.Add(capability);
+ }
+
+ public void AddExtension(string extension)
+ {
+ _extensions.Add(extension);
+ }
+
+ public Instruction NewInstruction(Op opcode, uint id = Instruction.InvalidId, Instruction resultType = null)
+ {
+ var result = _instPool.Allocate();
+ result.Set(opcode, id, resultType);
+
+ return result;
+ }
+
+ public Instruction AddExtInstImport(string import)
+ {
+ var key = new DeterministicStringKey(import);
+
+ if (_extInstImports.TryGetValue(key, out Instruction extInstImport))
+ {
+ // Update the duplicate instance to use the good id so it ends up being encoded correctly.
+ return extInstImport;
+ }
+
+ Instruction instruction = NewInstruction(Op.OpExtInstImport);
+ instruction.AddOperand(import);
+
+ instruction.SetId(GetNewId());
+
+ _extInstImports.Add(key, instruction);
+
+ return instruction;
+ }
+
+ private void AddTypeDeclaration(Instruction instruction, bool forceIdAllocation)
+ {
+ var key = new TypeDeclarationKey(instruction);
+
+ if (!forceIdAllocation)
+ {
+ if (_typeDeclarations.TryGetValue(key, out Instruction typeDeclaration))
+ {
+ // Update the duplicate instance to use the good id so it ends up being encoded correctly.
+
+ instruction.SetId(typeDeclaration.Id);
+
+ return;
+ }
+ }
+
+ instruction.SetId(GetNewId());
+
+ _typeDeclarations.Add(key, instruction);
+ }
+
+ public void AddEntryPoint(ExecutionModel executionModel, Instruction function, string name, params Instruction[] interfaces)
+ {
+ Debug.Assert(function.Opcode == Op.OpFunction);
+
+ Instruction entryPoint = NewInstruction(Op.OpEntryPoint);
+
+ entryPoint.AddOperand(executionModel);
+ entryPoint.AddOperand(function);
+ entryPoint.AddOperand(name);
+ entryPoint.AddOperand(interfaces);
+
+ _entrypoints.Add(entryPoint);
+ }
+
+ public void AddExecutionMode(Instruction function, ExecutionMode mode, params Operand[] parameters)
+ {
+ Debug.Assert(function.Opcode == Op.OpFunction);
+
+ Instruction executionModeInstruction = NewInstruction(Op.OpExecutionMode);
+
+ executionModeInstruction.AddOperand(function);
+ executionModeInstruction.AddOperand(mode);
+ executionModeInstruction.AddOperand(parameters);
+
+ _executionModes.Add(executionModeInstruction);
+ }
+
+ private void AddToFunctionDefinitions(Instruction instruction)
+ {
+ Debug.Assert(instruction.Opcode != Op.OpTypeInt);
+ _functionsDefinitions.Add(instruction);
+ }
+
+ private void AddAnnotation(Instruction annotation)
+ {
+ _annotations.Add(annotation);
+ }
+
+ private void AddDebug(Instruction debug)
+ {
+ _debug.Add(debug);
+ }
+
+ public void AddLabel(Instruction label)
+ {
+ Debug.Assert(label.Opcode == Op.OpLabel);
+
+ label.SetId(GetNewId());
+
+ AddToFunctionDefinitions(label);
+ }
+
+ public void AddLocalVariable(Instruction variable)
+ {
+ // TODO: Ensure it has the local modifier.
+ Debug.Assert(variable.Opcode == Op.OpVariable);
+
+ variable.SetId(GetNewId());
+
+ AddToFunctionDefinitions(variable);
+ }
+
+ public void AddGlobalVariable(Instruction variable)
+ {
+ // TODO: Ensure it has the global modifier.
+ // TODO: All constants opcodes (OpSpecXXX and the rest of the OpConstantXXX).
+ Debug.Assert(variable.Opcode == Op.OpVariable);
+
+ variable.SetId(GetNewId());
+
+ _globals.Add(variable);
+ }
+
+ private void AddConstant(Instruction constant)
+ {
+ Debug.Assert(constant.Opcode == Op.OpConstant ||
+ constant.Opcode == Op.OpConstantFalse ||
+ constant.Opcode == Op.OpConstantTrue ||
+ constant.Opcode == Op.OpConstantNull ||
+ constant.Opcode == Op.OpConstantComposite);
+
+ var key = new ConstantKey(constant);
+
+ if (_constants.TryGetValue(key, out Instruction global))
+ {
+ // Update the duplicate instance to use the good id so it ends up being encoded correctly.
+ constant.SetId(global.Id);
+
+ return;
+ }
+
+ constant.SetId(GetNewId());
+
+ _constants.Add(key, constant);
+ }
+
+ public Instruction ExtInst(Instruction resultType, Instruction set, LiteralInteger instruction, params Operand[] parameters)
+ {
+ Instruction result = NewInstruction(Op.OpExtInst, GetNewId(), resultType);
+
+ result.AddOperand(set);
+ result.AddOperand(instruction);
+ result.AddOperand(parameters);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public void SetMemoryModel(AddressingModel addressingModel, MemoryModel memoryModel)
+ {
+ _addressingModel = addressingModel;
+ _memoryModel = memoryModel;
+ }
+
+ // TODO: Find a way to make the auto generate one used.
+ public Instruction OpenClPrintf(Instruction resultType, Instruction format, params Instruction[] additionalarguments)
+ {
+ Instruction result = NewInstruction(Op.OpExtInst, GetNewId(), resultType);
+
+ result.AddOperand(AddExtInstImport("OpenCL.std"));
+ result.AddOperand((LiteralInteger)184);
+ result.AddOperand(format);
+ result.AddOperand(additionalarguments);
+ AddToFunctionDefinitions(result);
+
+ return result;
+ }
+
+ public byte[] Generate()
+ {
+ // Estimate the size needed for the generated code, to avoid expanding the MemoryStream.
+ int sizeEstimate = 1024 + _functionsDefinitions.Count * 32;
+
+ using (MemoryStream stream = new MemoryStream(sizeEstimate))
+ {
+ BinaryWriter writer = new BinaryWriter(stream, System.Text.Encoding.ASCII);
+
+ // Header
+ writer.Write(MagicNumber);
+ writer.Write(_version);
+ writer.Write(GeneratorId);
+ writer.Write(_bound);
+ writer.Write(0u);
+
+ // 1.
+ foreach (Capability capability in _capabilities)
+ {
+ Instruction capabilityInstruction = NewInstruction(Op.OpCapability);
+
+ capabilityInstruction.AddOperand(capability);
+ capabilityInstruction.Write(writer);
+ }
+
+ // 2.
+ foreach (string extension in _extensions)
+ {
+ Instruction extensionInstruction = NewInstruction(Op.OpExtension);
+
+ extensionInstruction.AddOperand(extension);
+ extensionInstruction.Write(writer);
+ }
+
+ // 3.
+ foreach (Instruction extInstImport in _extInstImports.Values)
+ {
+ extInstImport.Write(writer);
+ }
+
+ // 4.
+ Instruction memoryModelInstruction = NewInstruction(Op.OpMemoryModel);
+ memoryModelInstruction.AddOperand(_addressingModel);
+ memoryModelInstruction.AddOperand(_memoryModel);
+ memoryModelInstruction.Write(writer);
+
+ // 5.
+ foreach (Instruction entrypoint in _entrypoints)
+ {
+ entrypoint.Write(writer);
+ }
+
+ // 6.
+ foreach (Instruction executionMode in _executionModes)
+ {
+ executionMode.Write(writer);
+ }
+
+ // 7.
+ // TODO: Order debug information correctly.
+ foreach (Instruction debug in _debug)
+ {
+ debug.Write(writer);
+ }
+
+ // 8.
+ foreach (Instruction annotation in _annotations)
+ {
+ annotation.Write(writer);
+ }
+
+ // Ensure that everything is in the right order in the declarations section.
+ List<Instruction> declarations = new List<Instruction>();
+ declarations.AddRange(_typeDeclarations.Values);
+ declarations.AddRange(_globals);
+ declarations.AddRange(_constants.Values);
+ declarations.Sort((Instruction x, Instruction y) => x.Id.CompareTo(y.Id));
+
+ // 9.
+ foreach (Instruction declaration in declarations)
+ {
+ declaration.Write(writer);
+ }
+
+ // 10.
+ foreach (Instruction functionDeclaration in _functionsDeclarations)
+ {
+ functionDeclaration.Write(writer);
+ }
+
+ // 11.
+ foreach (Instruction functionDefinition in _functionsDefinitions)
+ {
+ functionDefinition.Write(writer);
+ }
+
+ _instPool.Clear();
+ _integerPool.Clear();
+
+ LiteralInteger.UnregisterPool();
+
+ return stream.ToArray();
+ }
+ }
+ }
+}
diff --git a/Spv.Generator/Operand.cs b/Spv.Generator/Operand.cs
new file mode 100644
index 00000000..eaa2e13e
--- /dev/null
+++ b/Spv.Generator/Operand.cs
@@ -0,0 +1,14 @@
+using System;
+using System.IO;
+
+namespace Spv.Generator
+{
+ public interface Operand : IEquatable<Operand>
+ {
+ OperandType Type { get; }
+
+ ushort WordCount { get; }
+
+ void WriteOperand(BinaryWriter writer);
+ }
+}
diff --git a/Spv.Generator/OperandType.cs b/Spv.Generator/OperandType.cs
new file mode 100644
index 00000000..06e8e1fb
--- /dev/null
+++ b/Spv.Generator/OperandType.cs
@@ -0,0 +1,10 @@
+namespace Spv.Generator
+{
+ public enum OperandType
+ {
+ Invalid,
+ Number,
+ String,
+ Instruction,
+ }
+}
diff --git a/Spv.Generator/Spv.Generator.csproj b/Spv.Generator/Spv.Generator.csproj
new file mode 100644
index 00000000..fff78129
--- /dev/null
+++ b/Spv.Generator/Spv.Generator.csproj
@@ -0,0 +1,7 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>net6.0</TargetFramework>
+ </PropertyGroup>
+
+</Project>
diff --git a/Spv.Generator/TypeDeclarationKey.cs b/Spv.Generator/TypeDeclarationKey.cs
new file mode 100644
index 00000000..a4aa9563
--- /dev/null
+++ b/Spv.Generator/TypeDeclarationKey.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Spv.Generator
+{
+ internal struct TypeDeclarationKey : IEquatable<TypeDeclarationKey>
+ {
+ private Instruction _typeDeclaration;
+
+ public TypeDeclarationKey(Instruction typeDeclaration)
+ {
+ _typeDeclaration = typeDeclaration;
+ }
+
+ public override int GetHashCode()
+ {
+ return DeterministicHashCode.Combine(_typeDeclaration.Opcode, _typeDeclaration.GetHashCodeContent());
+ }
+
+ public bool Equals(TypeDeclarationKey other)
+ {
+ return _typeDeclaration.Opcode == other._typeDeclaration.Opcode && _typeDeclaration.EqualsContent(other._typeDeclaration);
+ }
+
+ public override bool Equals([NotNullWhen(true)] object obj)
+ {
+ return obj is TypeDeclarationKey && Equals((TypeDeclarationKey)obj);
+ }
+ }
+}
diff --git a/Spv.Generator/spirv.cs b/Spv.Generator/spirv.cs
new file mode 100644
index 00000000..df28438b
--- /dev/null
+++ b/Spv.Generator/spirv.cs
@@ -0,0 +1,1625 @@
+// Copyright (c) 2014-2020 The Khronos Group Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and/or associated documentation files (the "Materials"),
+// to deal in the Materials without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Materials, and to permit persons to whom the
+// Materials are furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Materials.
+//
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
+// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
+// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
+//
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
+// IN THE MATERIALS.
+
+// This header is automatically generated by the same tool that creates
+// the Binary Section of the SPIR-V specification.
+
+// Enumeration tokens for SPIR-V, in various styles:
+// C, C++, C++11, JSON, Lua, Python, C#, D
+//
+// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL
+// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL
+// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL
+// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL
+// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL']
+// - C# will use enum classes in the Specification class located in the "Spv" namespace,
+// e.g.: Spv.Specification.SourceLanguage.GLSL
+// - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL
+//
+// Some tokens act like mask values, which can be OR'd together,
+// while others are mutually exclusive. The mask-like ones have
+// "Mask" in their name, and a parallel enum that has the shift
+// amount (1 << x) for each corresponding enumerant.
+
+namespace Spv
+{
+
+ public static class Specification
+ {
+ public const uint MagicNumber = 0x07230203;
+ public const uint Version = 0x00010500;
+ public const uint Revision = 4;
+ public const uint OpCodeMask = 0xffff;
+ public const uint WordCountShift = 16;
+
+ public enum SourceLanguage
+ {
+ Unknown = 0,
+ ESSL = 1,
+ GLSL = 2,
+ OpenCL_C = 3,
+ OpenCL_CPP = 4,
+ HLSL = 5,
+ }
+
+ public enum ExecutionModel
+ {
+ Vertex = 0,
+ TessellationControl = 1,
+ TessellationEvaluation = 2,
+ Geometry = 3,
+ Fragment = 4,
+ GLCompute = 5,
+ Kernel = 6,
+ TaskNV = 5267,
+ MeshNV = 5268,
+ RayGenerationKHR = 5313,
+ RayGenerationNV = 5313,
+ IntersectionKHR = 5314,
+ IntersectionNV = 5314,
+ AnyHitKHR = 5315,
+ AnyHitNV = 5315,
+ ClosestHitKHR = 5316,
+ ClosestHitNV = 5316,
+ MissKHR = 5317,
+ MissNV = 5317,
+ CallableKHR = 5318,
+ CallableNV = 5318,
+ }
+
+ public enum AddressingModel
+ {
+ Logical = 0,
+ Physical32 = 1,
+ Physical64 = 2,
+ PhysicalStorageBuffer64 = 5348,
+ PhysicalStorageBuffer64EXT = 5348,
+ }
+
+ public enum MemoryModel
+ {
+ Simple = 0,
+ GLSL450 = 1,
+ OpenCL = 2,
+ Vulkan = 3,
+ VulkanKHR = 3,
+ }
+
+ public enum ExecutionMode
+ {
+ Invocations = 0,
+ SpacingEqual = 1,
+ SpacingFractionalEven = 2,
+ SpacingFractionalOdd = 3,
+ VertexOrderCw = 4,
+ VertexOrderCcw = 5,
+ PixelCenterInteger = 6,
+ OriginUpperLeft = 7,
+ OriginLowerLeft = 8,
+ EarlyFragmentTests = 9,
+ PointMode = 10,
+ Xfb = 11,
+ DepthReplacing = 12,
+ DepthGreater = 14,
+ DepthLess = 15,
+ DepthUnchanged = 16,
+ LocalSize = 17,
+ LocalSizeHint = 18,
+ InputPoints = 19,
+ InputLines = 20,
+ InputLinesAdjacency = 21,
+ Triangles = 22,
+ InputTrianglesAdjacency = 23,
+ Quads = 24,
+ Isolines = 25,
+ OutputVertices = 26,
+ OutputPoints = 27,
+ OutputLineStrip = 28,
+ OutputTriangleStrip = 29,
+ VecTypeHint = 30,
+ ContractionOff = 31,
+ Initializer = 33,
+ Finalizer = 34,
+ SubgroupSize = 35,
+ SubgroupsPerWorkgroup = 36,
+ SubgroupsPerWorkgroupId = 37,
+ LocalSizeId = 38,
+ LocalSizeHintId = 39,
+ PostDepthCoverage = 4446,
+ DenormPreserve = 4459,
+ DenormFlushToZero = 4460,
+ SignedZeroInfNanPreserve = 4461,
+ RoundingModeRTE = 4462,
+ RoundingModeRTZ = 4463,
+ StencilRefReplacingEXT = 5027,
+ OutputLinesNV = 5269,
+ OutputPrimitivesNV = 5270,
+ DerivativeGroupQuadsNV = 5289,
+ DerivativeGroupLinearNV = 5290,
+ OutputTrianglesNV = 5298,
+ PixelInterlockOrderedEXT = 5366,
+ PixelInterlockUnorderedEXT = 5367,
+ SampleInterlockOrderedEXT = 5368,
+ SampleInterlockUnorderedEXT = 5369,
+ ShadingRateInterlockOrderedEXT = 5370,
+ ShadingRateInterlockUnorderedEXT = 5371,
+ MaxWorkgroupSizeINTEL = 5893,
+ MaxWorkDimINTEL = 5894,
+ NoGlobalOffsetINTEL = 5895,
+ NumSIMDWorkitemsINTEL = 5896,
+ }
+
+ public enum StorageClass
+ {
+ UniformConstant = 0,
+ Input = 1,
+ Uniform = 2,
+ Output = 3,
+ Workgroup = 4,
+ CrossWorkgroup = 5,
+ Private = 6,
+ Function = 7,
+ Generic = 8,
+ PushConstant = 9,
+ AtomicCounter = 10,
+ Image = 11,
+ StorageBuffer = 12,
+ CallableDataKHR = 5328,
+ CallableDataNV = 5328,
+ IncomingCallableDataKHR = 5329,
+ IncomingCallableDataNV = 5329,
+ RayPayloadKHR = 5338,
+ RayPayloadNV = 5338,
+ HitAttributeKHR = 5339,
+ HitAttributeNV = 5339,
+ IncomingRayPayloadKHR = 5342,
+ IncomingRayPayloadNV = 5342,
+ ShaderRecordBufferKHR = 5343,
+ ShaderRecordBufferNV = 5343,
+ PhysicalStorageBuffer = 5349,
+ PhysicalStorageBufferEXT = 5349,
+ CodeSectionINTEL = 5605,
+ }
+
+ public enum Dim
+ {
+ Dim1D = 0,
+ Dim2D = 1,
+ Dim3D = 2,
+ Cube = 3,
+ Rect = 4,
+ Buffer = 5,
+ SubpassData = 6,
+ }
+
+ public enum SamplerAddressingMode
+ {
+ None = 0,
+ ClampToEdge = 1,
+ Clamp = 2,
+ Repeat = 3,
+ RepeatMirrored = 4,
+ }
+
+ public enum SamplerFilterMode
+ {
+ Nearest = 0,
+ Linear = 1,
+ }
+
+ public enum ImageFormat
+ {
+ Unknown = 0,
+ Rgba32f = 1,
+ Rgba16f = 2,
+ R32f = 3,
+ Rgba8 = 4,
+ Rgba8Snorm = 5,
+ Rg32f = 6,
+ Rg16f = 7,
+ R11fG11fB10f = 8,
+ R16f = 9,
+ Rgba16 = 10,
+ Rgb10A2 = 11,
+ Rg16 = 12,
+ Rg8 = 13,
+ R16 = 14,
+ R8 = 15,
+ Rgba16Snorm = 16,
+ Rg16Snorm = 17,
+ Rg8Snorm = 18,
+ R16Snorm = 19,
+ R8Snorm = 20,
+ Rgba32i = 21,
+ Rgba16i = 22,
+ Rgba8i = 23,
+ R32i = 24,
+ Rg32i = 25,
+ Rg16i = 26,
+ Rg8i = 27,
+ R16i = 28,
+ R8i = 29,
+ Rgba32ui = 30,
+ Rgba16ui = 31,
+ Rgba8ui = 32,
+ R32ui = 33,
+ Rgb10a2ui = 34,
+ Rg32ui = 35,
+ Rg16ui = 36,
+ Rg8ui = 37,
+ R16ui = 38,
+ R8ui = 39,
+ R64ui = 40,
+ R64i = 41,
+ }
+
+ public enum ImageChannelOrder
+ {
+ R = 0,
+ A = 1,
+ RG = 2,
+ RA = 3,
+ RGB = 4,
+ RGBA = 5,
+ BGRA = 6,
+ ARGB = 7,
+ Intensity = 8,
+ Luminance = 9,
+ Rx = 10,
+ RGx = 11,
+ RGBx = 12,
+ Depth = 13,
+ DepthStencil = 14,
+ sRGB = 15,
+ sRGBx = 16,
+ sRGBA = 17,
+ sBGRA = 18,
+ ABGR = 19,
+ }
+
+ public enum ImageChannelDataType
+ {
+ SnormInt8 = 0,
+ SnormInt16 = 1,
+ UnormInt8 = 2,
+ UnormInt16 = 3,
+ UnormShort565 = 4,
+ UnormShort555 = 5,
+ UnormInt101010 = 6,
+ SignedInt8 = 7,
+ SignedInt16 = 8,
+ SignedInt32 = 9,
+ UnsignedInt8 = 10,
+ UnsignedInt16 = 11,
+ UnsignedInt32 = 12,
+ HalfFloat = 13,
+ Float = 14,
+ UnormInt24 = 15,
+ UnormInt101010_2 = 16,
+ }
+
+ public enum ImageOperandsShift
+ {
+ Bias = 0,
+ Lod = 1,
+ Grad = 2,
+ ConstOffset = 3,
+ Offset = 4,
+ ConstOffsets = 5,
+ Sample = 6,
+ MinLod = 7,
+ MakeTexelAvailable = 8,
+ MakeTexelAvailableKHR = 8,
+ MakeTexelVisible = 9,
+ MakeTexelVisibleKHR = 9,
+ NonPrivateTexel = 10,
+ NonPrivateTexelKHR = 10,
+ VolatileTexel = 11,
+ VolatileTexelKHR = 11,
+ SignExtend = 12,
+ ZeroExtend = 13,
+ }
+
+ public enum ImageOperandsMask
+ {
+ MaskNone = 0,
+ Bias = 0x00000001,
+ Lod = 0x00000002,
+ Grad = 0x00000004,
+ ConstOffset = 0x00000008,
+ Offset = 0x00000010,
+ ConstOffsets = 0x00000020,
+ Sample = 0x00000040,
+ MinLod = 0x00000080,
+ MakeTexelAvailable = 0x00000100,
+ MakeTexelAvailableKHR = 0x00000100,
+ MakeTexelVisible = 0x00000200,
+ MakeTexelVisibleKHR = 0x00000200,
+ NonPrivateTexel = 0x00000400,
+ NonPrivateTexelKHR = 0x00000400,
+ VolatileTexel = 0x00000800,
+ VolatileTexelKHR = 0x00000800,
+ SignExtend = 0x00001000,
+ ZeroExtend = 0x00002000,
+ Offsets = 0x00010000,
+ }
+
+ public enum FPFastMathModeShift
+ {
+ NotNaN = 0,
+ NotInf = 1,
+ NSZ = 2,
+ AllowRecip = 3,
+ Fast = 4,
+ }
+
+ public enum FPFastMathModeMask
+ {
+ MaskNone = 0,
+ NotNaN = 0x00000001,
+ NotInf = 0x00000002,
+ NSZ = 0x00000004,
+ AllowRecip = 0x00000008,
+ Fast = 0x00000010,
+ }
+
+ public enum FPRoundingMode
+ {
+ RTE = 0,
+ RTZ = 1,
+ RTP = 2,
+ RTN = 3,
+ }
+
+ public enum LinkageType
+ {
+ Export = 0,
+ Import = 1,
+ }
+
+ public enum AccessQualifier
+ {
+ ReadOnly = 0,
+ WriteOnly = 1,
+ ReadWrite = 2,
+ }
+
+ public enum FunctionParameterAttribute
+ {
+ Zext = 0,
+ Sext = 1,
+ ByVal = 2,
+ Sret = 3,
+ NoAlias = 4,
+ NoCapture = 5,
+ NoWrite = 6,
+ NoReadWrite = 7,
+ }
+
+ public enum Decoration
+ {
+ RelaxedPrecision = 0,
+ SpecId = 1,
+ Block = 2,
+ BufferBlock = 3,
+ RowMajor = 4,
+ ColMajor = 5,
+ ArrayStride = 6,
+ MatrixStride = 7,
+ GLSLShared = 8,
+ GLSLPacked = 9,
+ CPacked = 10,
+ BuiltIn = 11,
+ NoPerspective = 13,
+ Flat = 14,
+ Patch = 15,
+ Centroid = 16,
+ Sample = 17,
+ Invariant = 18,
+ Restrict = 19,
+ Aliased = 20,
+ Volatile = 21,
+ Constant = 22,
+ Coherent = 23,
+ NonWritable = 24,
+ NonReadable = 25,
+ Uniform = 26,
+ UniformId = 27,
+ SaturatedConversion = 28,
+ Stream = 29,
+ Location = 30,
+ Component = 31,
+ Index = 32,
+ Binding = 33,
+ DescriptorSet = 34,
+ Offset = 35,
+ XfbBuffer = 36,
+ XfbStride = 37,
+ FuncParamAttr = 38,
+ FPRoundingMode = 39,
+ FPFastMathMode = 40,
+ LinkageAttributes = 41,
+ NoContraction = 42,
+ InputAttachmentIndex = 43,
+ Alignment = 44,
+ MaxByteOffset = 45,
+ AlignmentId = 46,
+ MaxByteOffsetId = 47,
+ NoSignedWrap = 4469,
+ NoUnsignedWrap = 4470,
+ ExplicitInterpAMD = 4999,
+ OverrideCoverageNV = 5248,
+ PassthroughNV = 5250,
+ ViewportRelativeNV = 5252,
+ SecondaryViewportRelativeNV = 5256,
+ PerPrimitiveNV = 5271,
+ PerViewNV = 5272,
+ PerTaskNV = 5273,
+ PerVertexNV = 5285,
+ NonUniform = 5300,
+ NonUniformEXT = 5300,
+ RestrictPointer = 5355,
+ RestrictPointerEXT = 5355,
+ AliasedPointer = 5356,
+ AliasedPointerEXT = 5356,
+ ReferencedIndirectlyINTEL = 5602,
+ CounterBuffer = 5634,
+ HlslCounterBufferGOOGLE = 5634,
+ HlslSemanticGOOGLE = 5635,
+ UserSemantic = 5635,
+ UserTypeGOOGLE = 5636,
+ RegisterINTEL = 5825,
+ MemoryINTEL = 5826,
+ NumbanksINTEL = 5827,
+ BankwidthINTEL = 5828,
+ MaxPrivateCopiesINTEL = 5829,
+ SinglepumpINTEL = 5830,
+ DoublepumpINTEL = 5831,
+ MaxReplicatesINTEL = 5832,
+ SimpleDualPortINTEL = 5833,
+ MergeINTEL = 5834,
+ BankBitsINTEL = 5835,
+ ForcePow2DepthINTEL = 5836,
+ }
+
+ public enum BuiltIn
+ {
+ Position = 0,
+ PointSize = 1,
+ ClipDistance = 3,
+ CullDistance = 4,
+ VertexId = 5,
+ InstanceId = 6,
+ PrimitiveId = 7,
+ InvocationId = 8,
+ Layer = 9,
+ ViewportIndex = 10,
+ TessLevelOuter = 11,
+ TessLevelInner = 12,
+ TessCoord = 13,
+ PatchVertices = 14,
+ FragCoord = 15,
+ PointCoord = 16,
+ FrontFacing = 17,
+ SampleId = 18,
+ SamplePosition = 19,
+ SampleMask = 20,
+ FragDepth = 22,
+ HelperInvocation = 23,
+ NumWorkgroups = 24,
+ WorkgroupSize = 25,
+ WorkgroupId = 26,
+ LocalInvocationId = 27,
+ GlobalInvocationId = 28,
+ LocalInvocationIndex = 29,
+ WorkDim = 30,
+ GlobalSize = 31,
+ EnqueuedWorkgroupSize = 32,
+ GlobalOffset = 33,
+ GlobalLinearId = 34,
+ SubgroupSize = 36,
+ SubgroupMaxSize = 37,
+ NumSubgroups = 38,
+ NumEnqueuedSubgroups = 39,
+ SubgroupId = 40,
+ SubgroupLocalInvocationId = 41,
+ VertexIndex = 42,
+ InstanceIndex = 43,
+ SubgroupEqMask = 4416,
+ SubgroupEqMaskKHR = 4416,
+ SubgroupGeMask = 4417,
+ SubgroupGeMaskKHR = 4417,
+ SubgroupGtMask = 4418,
+ SubgroupGtMaskKHR = 4418,
+ SubgroupLeMask = 4419,
+ SubgroupLeMaskKHR = 4419,
+ SubgroupLtMask = 4420,
+ SubgroupLtMaskKHR = 4420,
+ BaseVertex = 4424,
+ BaseInstance = 4425,
+ DrawIndex = 4426,
+ PrimitiveShadingRateKHR = 4432,
+ DeviceIndex = 4438,
+ ViewIndex = 4440,
+ ShadingRateKHR = 4444,
+ BaryCoordNoPerspAMD = 4992,
+ BaryCoordNoPerspCentroidAMD = 4993,
+ BaryCoordNoPerspSampleAMD = 4994,
+ BaryCoordSmoothAMD = 4995,
+ BaryCoordSmoothCentroidAMD = 4996,
+ BaryCoordSmoothSampleAMD = 4997,
+ BaryCoordPullModelAMD = 4998,
+ FragStencilRefEXT = 5014,
+ ViewportMaskNV = 5253,
+ SecondaryPositionNV = 5257,
+ SecondaryViewportMaskNV = 5258,
+ PositionPerViewNV = 5261,
+ ViewportMaskPerViewNV = 5262,
+ FullyCoveredEXT = 5264,
+ TaskCountNV = 5274,
+ PrimitiveCountNV = 5275,
+ PrimitiveIndicesNV = 5276,
+ ClipDistancePerViewNV = 5277,
+ CullDistancePerViewNV = 5278,
+ LayerPerViewNV = 5279,
+ MeshViewCountNV = 5280,
+ MeshViewIndicesNV = 5281,
+ BaryCoordNV = 5286,
+ BaryCoordNoPerspNV = 5287,
+ FragSizeEXT = 5292,
+ FragmentSizeNV = 5292,
+ FragInvocationCountEXT = 5293,
+ InvocationsPerPixelNV = 5293,
+ LaunchIdKHR = 5319,
+ LaunchIdNV = 5319,
+ LaunchSizeKHR = 5320,
+ LaunchSizeNV = 5320,
+ WorldRayOriginKHR = 5321,
+ WorldRayOriginNV = 5321,
+ WorldRayDirectionKHR = 5322,
+ WorldRayDirectionNV = 5322,
+ ObjectRayOriginKHR = 5323,
+ ObjectRayOriginNV = 5323,
+ ObjectRayDirectionKHR = 5324,
+ ObjectRayDirectionNV = 5324,
+ RayTminKHR = 5325,
+ RayTminNV = 5325,
+ RayTmaxKHR = 5326,
+ RayTmaxNV = 5326,
+ InstanceCustomIndexKHR = 5327,
+ InstanceCustomIndexNV = 5327,
+ ObjectToWorldKHR = 5330,
+ ObjectToWorldNV = 5330,
+ WorldToObjectKHR = 5331,
+ WorldToObjectNV = 5331,
+ HitTNV = 5332,
+ HitKindKHR = 5333,
+ HitKindNV = 5333,
+ IncomingRayFlagsKHR = 5351,
+ IncomingRayFlagsNV = 5351,
+ RayGeometryIndexKHR = 5352,
+ WarpsPerSMNV = 5374,
+ SMCountNV = 5375,
+ WarpIDNV = 5376,
+ SMIDNV = 5377,
+ }
+
+ public enum SelectionControlShift
+ {
+ Flatten = 0,
+ DontFlatten = 1,
+ }
+
+ public enum SelectionControlMask
+ {
+ MaskNone = 0,
+ Flatten = 0x00000001,
+ DontFlatten = 0x00000002,
+ }
+
+ public enum LoopControlShift
+ {
+ Unroll = 0,
+ DontUnroll = 1,
+ DependencyInfinite = 2,
+ DependencyLength = 3,
+ MinIterations = 4,
+ MaxIterations = 5,
+ IterationMultiple = 6,
+ PeelCount = 7,
+ PartialCount = 8,
+ InitiationIntervalINTEL = 16,
+ MaxConcurrencyINTEL = 17,
+ DependencyArrayINTEL = 18,
+ PipelineEnableINTEL = 19,
+ LoopCoalesceINTEL = 20,
+ MaxInterleavingINTEL = 21,
+ SpeculatedIterationsINTEL = 22,
+ }
+
+ public enum LoopControlMask
+ {
+ MaskNone = 0,
+ Unroll = 0x00000001,
+ DontUnroll = 0x00000002,
+ DependencyInfinite = 0x00000004,
+ DependencyLength = 0x00000008,
+ MinIterations = 0x00000010,
+ MaxIterations = 0x00000020,
+ IterationMultiple = 0x00000040,
+ PeelCount = 0x00000080,
+ PartialCount = 0x00000100,
+ InitiationIntervalINTEL = 0x00010000,
+ MaxConcurrencyINTEL = 0x00020000,
+ DependencyArrayINTEL = 0x00040000,
+ PipelineEnableINTEL = 0x00080000,
+ LoopCoalesceINTEL = 0x00100000,
+ MaxInterleavingINTEL = 0x00200000,
+ SpeculatedIterationsINTEL = 0x00400000,
+ }
+
+ public enum FunctionControlShift
+ {
+ Inline = 0,
+ DontInline = 1,
+ Pure = 2,
+ Const = 3,
+ }
+
+ public enum FunctionControlMask
+ {
+ MaskNone = 0,
+ Inline = 0x00000001,
+ DontInline = 0x00000002,
+ Pure = 0x00000004,
+ Const = 0x00000008,
+ }
+
+ public enum MemorySemanticsShift
+ {
+ Acquire = 1,
+ Release = 2,
+ AcquireRelease = 3,
+ SequentiallyConsistent = 4,
+ UniformMemory = 6,
+ SubgroupMemory = 7,
+ WorkgroupMemory = 8,
+ CrossWorkgroupMemory = 9,
+ AtomicCounterMemory = 10,
+ ImageMemory = 11,
+ OutputMemory = 12,
+ OutputMemoryKHR = 12,
+ MakeAvailable = 13,
+ MakeAvailableKHR = 13,
+ MakeVisible = 14,
+ MakeVisibleKHR = 14,
+ Volatile = 15,
+ }
+
+ public enum MemorySemanticsMask
+ {
+ MaskNone = 0,
+ Acquire = 0x00000002,
+ Release = 0x00000004,
+ AcquireRelease = 0x00000008,
+ SequentiallyConsistent = 0x00000010,
+ UniformMemory = 0x00000040,
+ SubgroupMemory = 0x00000080,
+ WorkgroupMemory = 0x00000100,
+ CrossWorkgroupMemory = 0x00000200,
+ AtomicCounterMemory = 0x00000400,
+ ImageMemory = 0x00000800,
+ OutputMemory = 0x00001000,
+ OutputMemoryKHR = 0x00001000,
+ MakeAvailable = 0x00002000,
+ MakeAvailableKHR = 0x00002000,
+ MakeVisible = 0x00004000,
+ MakeVisibleKHR = 0x00004000,
+ Volatile = 0x00008000,
+ }
+
+ public enum MemoryAccessShift
+ {
+ Volatile = 0,
+ Aligned = 1,
+ Nontemporal = 2,
+ MakePointerAvailable = 3,
+ MakePointerAvailableKHR = 3,
+ MakePointerVisible = 4,
+ MakePointerVisibleKHR = 4,
+ NonPrivatePointer = 5,
+ NonPrivatePointerKHR = 5,
+ }
+
+ public enum MemoryAccessMask
+ {
+ MaskNone = 0,
+ Volatile = 0x00000001,
+ Aligned = 0x00000002,
+ Nontemporal = 0x00000004,
+ MakePointerAvailable = 0x00000008,
+ MakePointerAvailableKHR = 0x00000008,
+ MakePointerVisible = 0x00000010,
+ MakePointerVisibleKHR = 0x00000010,
+ NonPrivatePointer = 0x00000020,
+ NonPrivatePointerKHR = 0x00000020,
+ }
+
+ public enum Scope
+ {
+ CrossDevice = 0,
+ Device = 1,
+ Workgroup = 2,
+ Subgroup = 3,
+ Invocation = 4,
+ QueueFamily = 5,
+ QueueFamilyKHR = 5,
+ ShaderCallKHR = 6,
+ }
+
+ public enum GroupOperation
+ {
+ Reduce = 0,
+ InclusiveScan = 1,
+ ExclusiveScan = 2,
+ ClusteredReduce = 3,
+ PartitionedReduceNV = 6,
+ PartitionedInclusiveScanNV = 7,
+ PartitionedExclusiveScanNV = 8,
+ }
+
+ public enum KernelEnqueueFlags
+ {
+ NoWait = 0,
+ WaitKernel = 1,
+ WaitWorkGroup = 2,
+ }
+
+ public enum KernelProfilingInfoShift
+ {
+ CmdExecTime = 0,
+ }
+
+ public enum KernelProfilingInfoMask
+ {
+ MaskNone = 0,
+ CmdExecTime = 0x00000001,
+ }
+
+ public enum Capability
+ {
+ Matrix = 0,
+ Shader = 1,
+ Geometry = 2,
+ Tessellation = 3,
+ Addresses = 4,
+ Linkage = 5,
+ Kernel = 6,
+ Vector16 = 7,
+ Float16Buffer = 8,
+ Float16 = 9,
+ Float64 = 10,
+ Int64 = 11,
+ Int64Atomics = 12,
+ ImageBasic = 13,
+ ImageReadWrite = 14,
+ ImageMipmap = 15,
+ Pipes = 17,
+ Groups = 18,
+ DeviceEnqueue = 19,
+ LiteralSampler = 20,
+ AtomicStorage = 21,
+ Int16 = 22,
+ TessellationPointSize = 23,
+ GeometryPointSize = 24,
+ ImageGatherExtended = 25,
+ StorageImageMultisample = 27,
+ UniformBufferArrayDynamicIndexing = 28,
+ SampledImageArrayDynamicIndexing = 29,
+ StorageBufferArrayDynamicIndexing = 30,
+ StorageImageArrayDynamicIndexing = 31,
+ ClipDistance = 32,
+ CullDistance = 33,
+ ImageCubeArray = 34,
+ SampleRateShading = 35,
+ ImageRect = 36,
+ SampledRect = 37,
+ GenericPointer = 38,
+ Int8 = 39,
+ InputAttachment = 40,
+ SparseResidency = 41,
+ MinLod = 42,
+ Sampled1D = 43,
+ Image1D = 44,
+ SampledCubeArray = 45,
+ SampledBuffer = 46,
+ ImageBuffer = 47,
+ ImageMSArray = 48,
+ StorageImageExtendedFormats = 49,
+ ImageQuery = 50,
+ DerivativeControl = 51,
+ InterpolationFunction = 52,
+ TransformFeedback = 53,
+ GeometryStreams = 54,
+ StorageImageReadWithoutFormat = 55,
+ StorageImageWriteWithoutFormat = 56,
+ MultiViewport = 57,
+ SubgroupDispatch = 58,
+ NamedBarrier = 59,
+ PipeStorage = 60,
+ GroupNonUniform = 61,
+ GroupNonUniformVote = 62,
+ GroupNonUniformArithmetic = 63,
+ GroupNonUniformBallot = 64,
+ GroupNonUniformShuffle = 65,
+ GroupNonUniformShuffleRelative = 66,
+ GroupNonUniformClustered = 67,
+ GroupNonUniformQuad = 68,
+ ShaderLayer = 69,
+ ShaderViewportIndex = 70,
+ FragmentShadingRateKHR = 4422,
+ SubgroupBallotKHR = 4423,
+ DrawParameters = 4427,
+ SubgroupVoteKHR = 4431,
+ StorageBuffer16BitAccess = 4433,
+ StorageUniformBufferBlock16 = 4433,
+ StorageUniform16 = 4434,
+ UniformAndStorageBuffer16BitAccess = 4434,
+ StoragePushConstant16 = 4435,
+ StorageInputOutput16 = 4436,
+ DeviceGroup = 4437,
+ MultiView = 4439,
+ VariablePointersStorageBuffer = 4441,
+ VariablePointers = 4442,
+ AtomicStorageOps = 4445,
+ SampleMaskPostDepthCoverage = 4447,
+ StorageBuffer8BitAccess = 4448,
+ UniformAndStorageBuffer8BitAccess = 4449,
+ StoragePushConstant8 = 4450,
+ DenormPreserve = 4464,
+ DenormFlushToZero = 4465,
+ SignedZeroInfNanPreserve = 4466,
+ RoundingModeRTE = 4467,
+ RoundingModeRTZ = 4468,
+ RayQueryProvisionalKHR = 4471,
+ RayQueryKHR = 4472,
+ RayTraversalPrimitiveCullingKHR = 4478,
+ RayTracingKHR = 4479,
+ Float16ImageAMD = 5008,
+ ImageGatherBiasLodAMD = 5009,
+ FragmentMaskAMD = 5010,
+ StencilExportEXT = 5013,
+ ImageReadWriteLodAMD = 5015,
+ Int64ImageEXT = 5016,
+ ShaderClockKHR = 5055,
+ SampleMaskOverrideCoverageNV = 5249,
+ GeometryShaderPassthroughNV = 5251,
+ ShaderViewportIndexLayerEXT = 5254,
+ ShaderViewportIndexLayerNV = 5254,
+ ShaderViewportMaskNV = 5255,
+ ShaderStereoViewNV = 5259,
+ PerViewAttributesNV = 5260,
+ FragmentFullyCoveredEXT = 5265,
+ MeshShadingNV = 5266,
+ ImageFootprintNV = 5282,
+ FragmentBarycentricNV = 5284,
+ ComputeDerivativeGroupQuadsNV = 5288,
+ FragmentDensityEXT = 5291,
+ ShadingRateNV = 5291,
+ GroupNonUniformPartitionedNV = 5297,
+ ShaderNonUniform = 5301,
+ ShaderNonUniformEXT = 5301,
+ RuntimeDescriptorArray = 5302,
+ RuntimeDescriptorArrayEXT = 5302,
+ InputAttachmentArrayDynamicIndexing = 5303,
+ InputAttachmentArrayDynamicIndexingEXT = 5303,
+ UniformTexelBufferArrayDynamicIndexing = 5304,
+ UniformTexelBufferArrayDynamicIndexingEXT = 5304,
+ StorageTexelBufferArrayDynamicIndexing = 5305,
+ StorageTexelBufferArrayDynamicIndexingEXT = 5305,
+ UniformBufferArrayNonUniformIndexing = 5306,
+ UniformBufferArrayNonUniformIndexingEXT = 5306,
+ SampledImageArrayNonUniformIndexing = 5307,
+ SampledImageArrayNonUniformIndexingEXT = 5307,
+ StorageBufferArrayNonUniformIndexing = 5308,
+ StorageBufferArrayNonUniformIndexingEXT = 5308,
+ StorageImageArrayNonUniformIndexing = 5309,
+ StorageImageArrayNonUniformIndexingEXT = 5309,
+ InputAttachmentArrayNonUniformIndexing = 5310,
+ InputAttachmentArrayNonUniformIndexingEXT = 5310,
+ UniformTexelBufferArrayNonUniformIndexing = 5311,
+ UniformTexelBufferArrayNonUniformIndexingEXT = 5311,
+ StorageTexelBufferArrayNonUniformIndexing = 5312,
+ StorageTexelBufferArrayNonUniformIndexingEXT = 5312,
+ RayTracingNV = 5340,
+ VulkanMemoryModel = 5345,
+ VulkanMemoryModelKHR = 5345,
+ VulkanMemoryModelDeviceScope = 5346,
+ VulkanMemoryModelDeviceScopeKHR = 5346,
+ PhysicalStorageBufferAddresses = 5347,
+ PhysicalStorageBufferAddressesEXT = 5347,
+ ComputeDerivativeGroupLinearNV = 5350,
+ RayTracingProvisionalKHR = 5353,
+ CooperativeMatrixNV = 5357,
+ FragmentShaderSampleInterlockEXT = 5363,
+ FragmentShaderShadingRateInterlockEXT = 5372,
+ ShaderSMBuiltinsNV = 5373,
+ FragmentShaderPixelInterlockEXT = 5378,
+ DemoteToHelperInvocationEXT = 5379,
+ SubgroupShuffleINTEL = 5568,
+ SubgroupBufferBlockIOINTEL = 5569,
+ SubgroupImageBlockIOINTEL = 5570,
+ SubgroupImageMediaBlockIOINTEL = 5579,
+ IntegerFunctions2INTEL = 5584,
+ FunctionPointersINTEL = 5603,
+ IndirectReferencesINTEL = 5604,
+ SubgroupAvcMotionEstimationINTEL = 5696,
+ SubgroupAvcMotionEstimationIntraINTEL = 5697,
+ SubgroupAvcMotionEstimationChromaINTEL = 5698,
+ FPGAMemoryAttributesINTEL = 5824,
+ UnstructuredLoopControlsINTEL = 5886,
+ FPGALoopControlsINTEL = 5888,
+ KernelAttributesINTEL = 5892,
+ FPGAKernelAttributesINTEL = 5897,
+ BlockingPipesINTEL = 5945,
+ FPGARegINTEL = 5948,
+ AtomicFloat32AddEXT = 6033,
+ AtomicFloat64AddEXT = 6034,
+ }
+
+ public enum RayFlagsShift
+ {
+ OpaqueKHR = 0,
+ NoOpaqueKHR = 1,
+ TerminateOnFirstHitKHR = 2,
+ SkipClosestHitShaderKHR = 3,
+ CullBackFacingTrianglesKHR = 4,
+ CullFrontFacingTrianglesKHR = 5,
+ CullOpaqueKHR = 6,
+ CullNoOpaqueKHR = 7,
+ SkipTrianglesKHR = 8,
+ SkipAABBsKHR = 9,
+ }
+
+ public enum RayFlagsMask
+ {
+ MaskNone = 0,
+ OpaqueKHR = 0x00000001,
+ NoOpaqueKHR = 0x00000002,
+ TerminateOnFirstHitKHR = 0x00000004,
+ SkipClosestHitShaderKHR = 0x00000008,
+ CullBackFacingTrianglesKHR = 0x00000010,
+ CullFrontFacingTrianglesKHR = 0x00000020,
+ CullOpaqueKHR = 0x00000040,
+ CullNoOpaqueKHR = 0x00000080,
+ SkipTrianglesKHR = 0x00000100,
+ SkipAABBsKHR = 0x00000200,
+ }
+
+ public enum RayQueryIntersection
+ {
+ RayQueryCandidateIntersectionKHR = 0,
+ RayQueryCommittedIntersectionKHR = 1,
+ }
+
+ public enum RayQueryCommittedIntersectionType
+ {
+ RayQueryCommittedIntersectionNoneKHR = 0,
+ RayQueryCommittedIntersectionTriangleKHR = 1,
+ RayQueryCommittedIntersectionGeneratedKHR = 2,
+ }
+
+ public enum RayQueryCandidateIntersectionType
+ {
+ RayQueryCandidateIntersectionTriangleKHR = 0,
+ RayQueryCandidateIntersectionAABBKHR = 1,
+ }
+
+ public enum FragmentShadingRateShift
+ {
+ Vertical2Pixels = 0,
+ Vertical4Pixels = 1,
+ Horizontal2Pixels = 2,
+ Horizontal4Pixels = 3,
+ }
+
+ public enum FragmentShadingRateMask
+ {
+ MaskNone = 0,
+ Vertical2Pixels = 0x00000001,
+ Vertical4Pixels = 0x00000002,
+ Horizontal2Pixels = 0x00000004,
+ Horizontal4Pixels = 0x00000008,
+ }
+
+ public enum Op
+ {
+ OpNop = 0,
+ OpUndef = 1,
+ OpSourceContinued = 2,
+ OpSource = 3,
+ OpSourceExtension = 4,
+ OpName = 5,
+ OpMemberName = 6,
+ OpString = 7,
+ OpLine = 8,
+ OpExtension = 10,
+ OpExtInstImport = 11,
+ OpExtInst = 12,
+ OpMemoryModel = 14,
+ OpEntryPoint = 15,
+ OpExecutionMode = 16,
+ OpCapability = 17,
+ OpTypeVoid = 19,
+ OpTypeBool = 20,
+ OpTypeInt = 21,
+ OpTypeFloat = 22,
+ OpTypeVector = 23,
+ OpTypeMatrix = 24,
+ OpTypeImage = 25,
+ OpTypeSampler = 26,
+ OpTypeSampledImage = 27,
+ OpTypeArray = 28,
+ OpTypeRuntimeArray = 29,
+ OpTypeStruct = 30,
+ OpTypeOpaque = 31,
+ OpTypePointer = 32,
+ OpTypeFunction = 33,
+ OpTypeEvent = 34,
+ OpTypeDeviceEvent = 35,
+ OpTypeReserveId = 36,
+ OpTypeQueue = 37,
+ OpTypePipe = 38,
+ OpTypeForwardPointer = 39,
+ OpConstantTrue = 41,
+ OpConstantFalse = 42,
+ OpConstant = 43,
+ OpConstantComposite = 44,
+ OpConstantSampler = 45,
+ OpConstantNull = 46,
+ OpSpecConstantTrue = 48,
+ OpSpecConstantFalse = 49,
+ OpSpecConstant = 50,
+ OpSpecConstantComposite = 51,
+ OpSpecConstantOp = 52,
+ OpFunction = 54,
+ OpFunctionParameter = 55,
+ OpFunctionEnd = 56,
+ OpFunctionCall = 57,
+ OpVariable = 59,
+ OpImageTexelPointer = 60,
+ OpLoad = 61,
+ OpStore = 62,
+ OpCopyMemory = 63,
+ OpCopyMemorySized = 64,
+ OpAccessChain = 65,
+ OpInBoundsAccessChain = 66,
+ OpPtrAccessChain = 67,
+ OpArrayLength = 68,
+ OpGenericPtrMemSemantics = 69,
+ OpInBoundsPtrAccessChain = 70,
+ OpDecorate = 71,
+ OpMemberDecorate = 72,
+ OpDecorationGroup = 73,
+ OpGroupDecorate = 74,
+ OpGroupMemberDecorate = 75,
+ OpVectorExtractDynamic = 77,
+ OpVectorInsertDynamic = 78,
+ OpVectorShuffle = 79,
+ OpCompositeConstruct = 80,
+ OpCompositeExtract = 81,
+ OpCompositeInsert = 82,
+ OpCopyObject = 83,
+ OpTranspose = 84,
+ OpSampledImage = 86,
+ OpImageSampleImplicitLod = 87,
+ OpImageSampleExplicitLod = 88,
+ OpImageSampleDrefImplicitLod = 89,
+ OpImageSampleDrefExplicitLod = 90,
+ OpImageSampleProjImplicitLod = 91,
+ OpImageSampleProjExplicitLod = 92,
+ OpImageSampleProjDrefImplicitLod = 93,
+ OpImageSampleProjDrefExplicitLod = 94,
+ OpImageFetch = 95,
+ OpImageGather = 96,
+ OpImageDrefGather = 97,
+ OpImageRead = 98,
+ OpImageWrite = 99,
+ OpImage = 100,
+ OpImageQueryFormat = 101,
+ OpImageQueryOrder = 102,
+ OpImageQuerySizeLod = 103,
+ OpImageQuerySize = 104,
+ OpImageQueryLod = 105,
+ OpImageQueryLevels = 106,
+ OpImageQuerySamples = 107,
+ OpConvertFToU = 109,
+ OpConvertFToS = 110,
+ OpConvertSToF = 111,
+ OpConvertUToF = 112,
+ OpUConvert = 113,
+ OpSConvert = 114,
+ OpFConvert = 115,
+ OpQuantizeToF16 = 116,
+ OpConvertPtrToU = 117,
+ OpSatConvertSToU = 118,
+ OpSatConvertUToS = 119,
+ OpConvertUToPtr = 120,
+ OpPtrCastToGeneric = 121,
+ OpGenericCastToPtr = 122,
+ OpGenericCastToPtrExplicit = 123,
+ OpBitcast = 124,
+ OpSNegate = 126,
+ OpFNegate = 127,
+ OpIAdd = 128,
+ OpFAdd = 129,
+ OpISub = 130,
+ OpFSub = 131,
+ OpIMul = 132,
+ OpFMul = 133,
+ OpUDiv = 134,
+ OpSDiv = 135,
+ OpFDiv = 136,
+ OpUMod = 137,
+ OpSRem = 138,
+ OpSMod = 139,
+ OpFRem = 140,
+ OpFMod = 141,
+ OpVectorTimesScalar = 142,
+ OpMatrixTimesScalar = 143,
+ OpVectorTimesMatrix = 144,
+ OpMatrixTimesVector = 145,
+ OpMatrixTimesMatrix = 146,
+ OpOuterProduct = 147,
+ OpDot = 148,
+ OpIAddCarry = 149,
+ OpISubBorrow = 150,
+ OpUMulExtended = 151,
+ OpSMulExtended = 152,
+ OpAny = 154,
+ OpAll = 155,
+ OpIsNan = 156,
+ OpIsInf = 157,
+ OpIsFinite = 158,
+ OpIsNormal = 159,
+ OpSignBitSet = 160,
+ OpLessOrGreater = 161,
+ OpOrdered = 162,
+ OpUnordered = 163,
+ OpLogicalEqual = 164,
+ OpLogicalNotEqual = 165,
+ OpLogicalOr = 166,
+ OpLogicalAnd = 167,
+ OpLogicalNot = 168,
+ OpSelect = 169,
+ OpIEqual = 170,
+ OpINotEqual = 171,
+ OpUGreaterThan = 172,
+ OpSGreaterThan = 173,
+ OpUGreaterThanEqual = 174,
+ OpSGreaterThanEqual = 175,
+ OpULessThan = 176,
+ OpSLessThan = 177,
+ OpULessThanEqual = 178,
+ OpSLessThanEqual = 179,
+ OpFOrdEqual = 180,
+ OpFUnordEqual = 181,
+ OpFOrdNotEqual = 182,
+ OpFUnordNotEqual = 183,
+ OpFOrdLessThan = 184,
+ OpFUnordLessThan = 185,
+ OpFOrdGreaterThan = 186,
+ OpFUnordGreaterThan = 187,
+ OpFOrdLessThanEqual = 188,
+ OpFUnordLessThanEqual = 189,
+ OpFOrdGreaterThanEqual = 190,
+ OpFUnordGreaterThanEqual = 191,
+ OpShiftRightLogical = 194,
+ OpShiftRightArithmetic = 195,
+ OpShiftLeftLogical = 196,
+ OpBitwiseOr = 197,
+ OpBitwiseXor = 198,
+ OpBitwiseAnd = 199,
+ OpNot = 200,
+ OpBitFieldInsert = 201,
+ OpBitFieldSExtract = 202,
+ OpBitFieldUExtract = 203,
+ OpBitReverse = 204,
+ OpBitCount = 205,
+ OpDPdx = 207,
+ OpDPdy = 208,
+ OpFwidth = 209,
+ OpDPdxFine = 210,
+ OpDPdyFine = 211,
+ OpFwidthFine = 212,
+ OpDPdxCoarse = 213,
+ OpDPdyCoarse = 214,
+ OpFwidthCoarse = 215,
+ OpEmitVertex = 218,
+ OpEndPrimitive = 219,
+ OpEmitStreamVertex = 220,
+ OpEndStreamPrimitive = 221,
+ OpControlBarrier = 224,
+ OpMemoryBarrier = 225,
+ OpAtomicLoad = 227,
+ OpAtomicStore = 228,
+ OpAtomicExchange = 229,
+ OpAtomicCompareExchange = 230,
+ OpAtomicCompareExchangeWeak = 231,
+ OpAtomicIIncrement = 232,
+ OpAtomicIDecrement = 233,
+ OpAtomicIAdd = 234,
+ OpAtomicISub = 235,
+ OpAtomicSMin = 236,
+ OpAtomicUMin = 237,
+ OpAtomicSMax = 238,
+ OpAtomicUMax = 239,
+ OpAtomicAnd = 240,
+ OpAtomicOr = 241,
+ OpAtomicXor = 242,
+ OpPhi = 245,
+ OpLoopMerge = 246,
+ OpSelectionMerge = 247,
+ OpLabel = 248,
+ OpBranch = 249,
+ OpBranchConditional = 250,
+ OpSwitch = 251,
+ OpKill = 252,
+ OpReturn = 253,
+ OpReturnValue = 254,
+ OpUnreachable = 255,
+ OpLifetimeStart = 256,
+ OpLifetimeStop = 257,
+ OpGroupAsyncCopy = 259,
+ OpGroupWaitEvents = 260,
+ OpGroupAll = 261,
+ OpGroupAny = 262,
+ OpGroupBroadcast = 263,
+ OpGroupIAdd = 264,
+ OpGroupFAdd = 265,
+ OpGroupFMin = 266,
+ OpGroupUMin = 267,
+ OpGroupSMin = 268,
+ OpGroupFMax = 269,
+ OpGroupUMax = 270,
+ OpGroupSMax = 271,
+ OpReadPipe = 274,
+ OpWritePipe = 275,
+ OpReservedReadPipe = 276,
+ OpReservedWritePipe = 277,
+ OpReserveReadPipePackets = 278,
+ OpReserveWritePipePackets = 279,
+ OpCommitReadPipe = 280,
+ OpCommitWritePipe = 281,
+ OpIsValidReserveId = 282,
+ OpGetNumPipePackets = 283,
+ OpGetMaxPipePackets = 284,
+ OpGroupReserveReadPipePackets = 285,
+ OpGroupReserveWritePipePackets = 286,
+ OpGroupCommitReadPipe = 287,
+ OpGroupCommitWritePipe = 288,
+ OpEnqueueMarker = 291,
+ OpEnqueueKernel = 292,
+ OpGetKernelNDrangeSubGroupCount = 293,
+ OpGetKernelNDrangeMaxSubGroupSize = 294,
+ OpGetKernelWorkGroupSize = 295,
+ OpGetKernelPreferredWorkGroupSizeMultiple = 296,
+ OpRetainEvent = 297,
+ OpReleaseEvent = 298,
+ OpCreateUserEvent = 299,
+ OpIsValidEvent = 300,
+ OpSetUserEventStatus = 301,
+ OpCaptureEventProfilingInfo = 302,
+ OpGetDefaultQueue = 303,
+ OpBuildNDRange = 304,
+ OpImageSparseSampleImplicitLod = 305,
+ OpImageSparseSampleExplicitLod = 306,
+ OpImageSparseSampleDrefImplicitLod = 307,
+ OpImageSparseSampleDrefExplicitLod = 308,
+ OpImageSparseSampleProjImplicitLod = 309,
+ OpImageSparseSampleProjExplicitLod = 310,
+ OpImageSparseSampleProjDrefImplicitLod = 311,
+ OpImageSparseSampleProjDrefExplicitLod = 312,
+ OpImageSparseFetch = 313,
+ OpImageSparseGather = 314,
+ OpImageSparseDrefGather = 315,
+ OpImageSparseTexelsResident = 316,
+ OpNoLine = 317,
+ OpAtomicFlagTestAndSet = 318,
+ OpAtomicFlagClear = 319,
+ OpImageSparseRead = 320,
+ OpSizeOf = 321,
+ OpTypePipeStorage = 322,
+ OpConstantPipeStorage = 323,
+ OpCreatePipeFromPipeStorage = 324,
+ OpGetKernelLocalSizeForSubgroupCount = 325,
+ OpGetKernelMaxNumSubgroups = 326,
+ OpTypeNamedBarrier = 327,
+ OpNamedBarrierInitialize = 328,
+ OpMemoryNamedBarrier = 329,
+ OpModuleProcessed = 330,
+ OpExecutionModeId = 331,
+ OpDecorateId = 332,
+ OpGroupNonUniformElect = 333,
+ OpGroupNonUniformAll = 334,
+ OpGroupNonUniformAny = 335,
+ OpGroupNonUniformAllEqual = 336,
+ OpGroupNonUniformBroadcast = 337,
+ OpGroupNonUniformBroadcastFirst = 338,
+ OpGroupNonUniformBallot = 339,
+ OpGroupNonUniformInverseBallot = 340,
+ OpGroupNonUniformBallotBitExtract = 341,
+ OpGroupNonUniformBallotBitCount = 342,
+ OpGroupNonUniformBallotFindLSB = 343,
+ OpGroupNonUniformBallotFindMSB = 344,
+ OpGroupNonUniformShuffle = 345,
+ OpGroupNonUniformShuffleXor = 346,
+ OpGroupNonUniformShuffleUp = 347,
+ OpGroupNonUniformShuffleDown = 348,
+ OpGroupNonUniformIAdd = 349,
+ OpGroupNonUniformFAdd = 350,
+ OpGroupNonUniformIMul = 351,
+ OpGroupNonUniformFMul = 352,
+ OpGroupNonUniformSMin = 353,
+ OpGroupNonUniformUMin = 354,
+ OpGroupNonUniformFMin = 355,
+ OpGroupNonUniformSMax = 356,
+ OpGroupNonUniformUMax = 357,
+ OpGroupNonUniformFMax = 358,
+ OpGroupNonUniformBitwiseAnd = 359,
+ OpGroupNonUniformBitwiseOr = 360,
+ OpGroupNonUniformBitwiseXor = 361,
+ OpGroupNonUniformLogicalAnd = 362,
+ OpGroupNonUniformLogicalOr = 363,
+ OpGroupNonUniformLogicalXor = 364,
+ OpGroupNonUniformQuadBroadcast = 365,
+ OpGroupNonUniformQuadSwap = 366,
+ OpCopyLogical = 400,
+ OpPtrEqual = 401,
+ OpPtrNotEqual = 402,
+ OpPtrDiff = 403,
+ OpTerminateInvocation = 4416,
+ OpSubgroupBallotKHR = 4421,
+ OpSubgroupFirstInvocationKHR = 4422,
+ OpSubgroupAllKHR = 4428,
+ OpSubgroupAnyKHR = 4429,
+ OpSubgroupAllEqualKHR = 4430,
+ OpSubgroupReadInvocationKHR = 4432,
+ OpTraceRayKHR = 4445,
+ OpExecuteCallableKHR = 4446,
+ OpConvertUToAccelerationStructureKHR = 4447,
+ OpIgnoreIntersectionKHR = 4448,
+ OpTerminateRayKHR = 4449,
+ OpTypeRayQueryKHR = 4472,
+ OpRayQueryInitializeKHR = 4473,
+ OpRayQueryTerminateKHR = 4474,
+ OpRayQueryGenerateIntersectionKHR = 4475,
+ OpRayQueryConfirmIntersectionKHR = 4476,
+ OpRayQueryProceedKHR = 4477,
+ OpRayQueryGetIntersectionTypeKHR = 4479,
+ OpGroupIAddNonUniformAMD = 5000,
+ OpGroupFAddNonUniformAMD = 5001,
+ OpGroupFMinNonUniformAMD = 5002,
+ OpGroupUMinNonUniformAMD = 5003,
+ OpGroupSMinNonUniformAMD = 5004,
+ OpGroupFMaxNonUniformAMD = 5005,
+ OpGroupUMaxNonUniformAMD = 5006,
+ OpGroupSMaxNonUniformAMD = 5007,
+ OpFragmentMaskFetchAMD = 5011,
+ OpFragmentFetchAMD = 5012,
+ OpReadClockKHR = 5056,
+ OpImageSampleFootprintNV = 5283,
+ OpGroupNonUniformPartitionNV = 5296,
+ OpWritePackedPrimitiveIndices4x8NV = 5299,
+ OpReportIntersectionKHR = 5334,
+ OpReportIntersectionNV = 5334,
+ OpIgnoreIntersectionNV = 5335,
+ OpTerminateRayNV = 5336,
+ OpTraceNV = 5337,
+ OpTypeAccelerationStructureKHR = 5341,
+ OpTypeAccelerationStructureNV = 5341,
+ OpExecuteCallableNV = 5344,
+ OpTypeCooperativeMatrixNV = 5358,
+ OpCooperativeMatrixLoadNV = 5359,
+ OpCooperativeMatrixStoreNV = 5360,
+ OpCooperativeMatrixMulAddNV = 5361,
+ OpCooperativeMatrixLengthNV = 5362,
+ OpBeginInvocationInterlockEXT = 5364,
+ OpEndInvocationInterlockEXT = 5365,
+ OpDemoteToHelperInvocationEXT = 5380,
+ OpIsHelperInvocationEXT = 5381,
+ OpSubgroupShuffleINTEL = 5571,
+ OpSubgroupShuffleDownINTEL = 5572,
+ OpSubgroupShuffleUpINTEL = 5573,
+ OpSubgroupShuffleXorINTEL = 5574,
+ OpSubgroupBlockReadINTEL = 5575,
+ OpSubgroupBlockWriteINTEL = 5576,
+ OpSubgroupImageBlockReadINTEL = 5577,
+ OpSubgroupImageBlockWriteINTEL = 5578,
+ OpSubgroupImageMediaBlockReadINTEL = 5580,
+ OpSubgroupImageMediaBlockWriteINTEL = 5581,
+ OpUCountLeadingZerosINTEL = 5585,
+ OpUCountTrailingZerosINTEL = 5586,
+ OpAbsISubINTEL = 5587,
+ OpAbsUSubINTEL = 5588,
+ OpIAddSatINTEL = 5589,
+ OpUAddSatINTEL = 5590,
+ OpIAverageINTEL = 5591,
+ OpUAverageINTEL = 5592,
+ OpIAverageRoundedINTEL = 5593,
+ OpUAverageRoundedINTEL = 5594,
+ OpISubSatINTEL = 5595,
+ OpUSubSatINTEL = 5596,
+ OpIMul32x16INTEL = 5597,
+ OpUMul32x16INTEL = 5598,
+ OpFunctionPointerINTEL = 5600,
+ OpFunctionPointerCallINTEL = 5601,
+ OpDecorateString = 5632,
+ OpDecorateStringGOOGLE = 5632,
+ OpMemberDecorateString = 5633,
+ OpMemberDecorateStringGOOGLE = 5633,
+ OpVmeImageINTEL = 5699,
+ OpTypeVmeImageINTEL = 5700,
+ OpTypeAvcImePayloadINTEL = 5701,
+ OpTypeAvcRefPayloadINTEL = 5702,
+ OpTypeAvcSicPayloadINTEL = 5703,
+ OpTypeAvcMcePayloadINTEL = 5704,
+ OpTypeAvcMceResultINTEL = 5705,
+ OpTypeAvcImeResultINTEL = 5706,
+ OpTypeAvcImeResultSingleReferenceStreamoutINTEL = 5707,
+ OpTypeAvcImeResultDualReferenceStreamoutINTEL = 5708,
+ OpTypeAvcImeSingleReferenceStreaminINTEL = 5709,
+ OpTypeAvcImeDualReferenceStreaminINTEL = 5710,
+ OpTypeAvcRefResultINTEL = 5711,
+ OpTypeAvcSicResultINTEL = 5712,
+ OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL = 5713,
+ OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL = 5714,
+ OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL = 5715,
+ OpSubgroupAvcMceSetInterShapePenaltyINTEL = 5716,
+ OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL = 5717,
+ OpSubgroupAvcMceSetInterDirectionPenaltyINTEL = 5718,
+ OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL = 5719,
+ OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL = 5720,
+ OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL = 5721,
+ OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL = 5722,
+ OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL = 5723,
+ OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL = 5724,
+ OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL = 5725,
+ OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL = 5726,
+ OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL = 5727,
+ OpSubgroupAvcMceSetAcOnlyHaarINTEL = 5728,
+ OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL = 5729,
+ OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL = 5730,
+ OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL = 5731,
+ OpSubgroupAvcMceConvertToImePayloadINTEL = 5732,
+ OpSubgroupAvcMceConvertToImeResultINTEL = 5733,
+ OpSubgroupAvcMceConvertToRefPayloadINTEL = 5734,
+ OpSubgroupAvcMceConvertToRefResultINTEL = 5735,
+ OpSubgroupAvcMceConvertToSicPayloadINTEL = 5736,
+ OpSubgroupAvcMceConvertToSicResultINTEL = 5737,
+ OpSubgroupAvcMceGetMotionVectorsINTEL = 5738,
+ OpSubgroupAvcMceGetInterDistortionsINTEL = 5739,
+ OpSubgroupAvcMceGetBestInterDistortionsINTEL = 5740,
+ OpSubgroupAvcMceGetInterMajorShapeINTEL = 5741,
+ OpSubgroupAvcMceGetInterMinorShapeINTEL = 5742,
+ OpSubgroupAvcMceGetInterDirectionsINTEL = 5743,
+ OpSubgroupAvcMceGetInterMotionVectorCountINTEL = 5744,
+ OpSubgroupAvcMceGetInterReferenceIdsINTEL = 5745,
+ OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL = 5746,
+ OpSubgroupAvcImeInitializeINTEL = 5747,
+ OpSubgroupAvcImeSetSingleReferenceINTEL = 5748,
+ OpSubgroupAvcImeSetDualReferenceINTEL = 5749,
+ OpSubgroupAvcImeRefWindowSizeINTEL = 5750,
+ OpSubgroupAvcImeAdjustRefOffsetINTEL = 5751,
+ OpSubgroupAvcImeConvertToMcePayloadINTEL = 5752,
+ OpSubgroupAvcImeSetMaxMotionVectorCountINTEL = 5753,
+ OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL = 5754,
+ OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL = 5755,
+ OpSubgroupAvcImeSetWeightedSadINTEL = 5756,
+ OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL = 5757,
+ OpSubgroupAvcImeEvaluateWithDualReferenceINTEL = 5758,
+ OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL = 5759,
+ OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL = 5760,
+ OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL = 5761,
+ OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL = 5762,
+ OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL = 5763,
+ OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL = 5764,
+ OpSubgroupAvcImeConvertToMceResultINTEL = 5765,
+ OpSubgroupAvcImeGetSingleReferenceStreaminINTEL = 5766,
+ OpSubgroupAvcImeGetDualReferenceStreaminINTEL = 5767,
+ OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL = 5768,
+ OpSubgroupAvcImeStripDualReferenceStreamoutINTEL = 5769,
+ OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL = 5770,
+ OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL = 5771,
+ OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL = 5772,
+ OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL = 5773,
+ OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL = 5774,
+ OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL = 5775,
+ OpSubgroupAvcImeGetBorderReachedINTEL = 5776,
+ OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL = 5777,
+ OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL = 5778,
+ OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL = 5779,
+ OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL = 5780,
+ OpSubgroupAvcFmeInitializeINTEL = 5781,
+ OpSubgroupAvcBmeInitializeINTEL = 5782,
+ OpSubgroupAvcRefConvertToMcePayloadINTEL = 5783,
+ OpSubgroupAvcRefSetBidirectionalMixDisableINTEL = 5784,
+ OpSubgroupAvcRefSetBilinearFilterEnableINTEL = 5785,
+ OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL = 5786,
+ OpSubgroupAvcRefEvaluateWithDualReferenceINTEL = 5787,
+ OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL = 5788,
+ OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL = 5789,
+ OpSubgroupAvcRefConvertToMceResultINTEL = 5790,
+ OpSubgroupAvcSicInitializeINTEL = 5791,
+ OpSubgroupAvcSicConfigureSkcINTEL = 5792,
+ OpSubgroupAvcSicConfigureIpeLumaINTEL = 5793,
+ OpSubgroupAvcSicConfigureIpeLumaChromaINTEL = 5794,
+ OpSubgroupAvcSicGetMotionVectorMaskINTEL = 5795,
+ OpSubgroupAvcSicConvertToMcePayloadINTEL = 5796,
+ OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL = 5797,
+ OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL = 5798,
+ OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL = 5799,
+ OpSubgroupAvcSicSetBilinearFilterEnableINTEL = 5800,
+ OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL = 5801,
+ OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL = 5802,
+ OpSubgroupAvcSicEvaluateIpeINTEL = 5803,
+ OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL = 5804,
+ OpSubgroupAvcSicEvaluateWithDualReferenceINTEL = 5805,
+ OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL = 5806,
+ OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL = 5807,
+ OpSubgroupAvcSicConvertToMceResultINTEL = 5808,
+ OpSubgroupAvcSicGetIpeLumaShapeINTEL = 5809,
+ OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL = 5810,
+ OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL = 5811,
+ OpSubgroupAvcSicGetPackedIpeLumaModesINTEL = 5812,
+ OpSubgroupAvcSicGetIpeChromaModeINTEL = 5813,
+ OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814,
+ OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815,
+ OpSubgroupAvcSicGetInterRawSadsINTEL = 5816,
+ OpLoopControlINTEL = 5887,
+ OpReadPipeBlockingINTEL = 5946,
+ OpWritePipeBlockingINTEL = 5947,
+ OpFPGARegINTEL = 5949,
+ OpRayQueryGetRayTMinKHR = 6016,
+ OpRayQueryGetRayFlagsKHR = 6017,
+ OpRayQueryGetIntersectionTKHR = 6018,
+ OpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019,
+ OpRayQueryGetIntersectionInstanceIdKHR = 6020,
+ OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021,
+ OpRayQueryGetIntersectionGeometryIndexKHR = 6022,
+ OpRayQueryGetIntersectionPrimitiveIndexKHR = 6023,
+ OpRayQueryGetIntersectionBarycentricsKHR = 6024,
+ OpRayQueryGetIntersectionFrontFaceKHR = 6025,
+ OpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026,
+ OpRayQueryGetIntersectionObjectRayDirectionKHR = 6027,
+ OpRayQueryGetIntersectionObjectRayOriginKHR = 6028,
+ OpRayQueryGetWorldRayDirectionKHR = 6029,
+ OpRayQueryGetWorldRayOriginKHR = 6030,
+ OpRayQueryGetIntersectionObjectToWorldKHR = 6031,
+ OpRayQueryGetIntersectionWorldToObjectKHR = 6032,
+ OpAtomicFAddEXT = 6035,
+ }
+ }
+}
+