SPIR-V | a simple SPIR-V parser | Parser library

 by   kusma C Version: Current License: No License

kandi X-RAY | SPIR-V Summary

kandi X-RAY | SPIR-V Summary

SPIR-V is a C library typically used in Utilities, Parser applications. SPIR-V has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

SPIR-V
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              SPIR-V has a low active ecosystem.
              It has 23 star(s) with 1 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of SPIR-V is current.

            kandi-Quality Quality

              SPIR-V has 0 bugs and 0 code smells.

            kandi-Security Security

              SPIR-V has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              SPIR-V code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              SPIR-V does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              SPIR-V releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SPIR-V
            Get all kandi verified functions for this library.

            SPIR-V Key Features

            No Key Features are available at this moment for SPIR-V.

            SPIR-V Examples and Code Snippets

            No Code Snippets are available at this moment for SPIR-V.

            Community Discussions

            QUESTION

            Can not use Vulkan Subgroup operations in Android Studio
            Asked 2022-Feb-08 at 09:23

            I'm writing a Vulkan compute shader in Android studio and launching it on Android phone. The problem I'm experiencing is next - I can not use any subgroup operations like subgroupAdd and subgroupElect. When I'm trying to use these functions I have an error like this:

            reduce_vec.comp:35: error: 'subgroup op' : requires SPIR-V 1.3

            I have checked - my Android phone supports subgroups, and my shader accepts such extensions:

            ...

            ANSWER

            Answered 2022-Feb-08 at 09:23

            Android solution

            You can pass arguments to the Android shaderc compiler in your Gradle DSL:

            https://developer.android.com/ndk/guides/graphics/shader-compilers

            You need glslcArgs to contain --target-env=vulkan1.1

            Flexible solution

            Build your own compilation pipeline to compile from source into SPIR-V, and then include the SPIR-V binary files directly into your Android project.

            There are multiple language front-ends that can generate SPIR-V, for GLSL the Khronos tools are here:

            Source https://stackoverflow.com/questions/71019902

            QUESTION

            when do i need GL_EXT_nonuniform_qualifier?
            Asked 2022-Feb-02 at 02:17

            I want to compile the following code into SPIR-V ...

            ANSWER

            Answered 2022-Feb-02 at 02:17

            It is 3 am in the morning over here, I should just go to sleep.
            Chances anyone end up having the same problem are small, but I'd still rather answer it myself than delete it:
            I simply had to add a SpecializationConstant to set the size of the sampler2D array, now it works without requiring any extension.
            Good night

            Source https://stackoverflow.com/questions/70949572

            QUESTION

            Is there way to force SPIR-V assembly function to accept both Private and Function storage class arrays?
            Asked 2022-Jan-31 at 16:54

            I am in the process of writing a binary processing module for SPIR-V shaders to fix alignment issues with float4x3[6] matrices because of driver bugs. Right now i have:

            • injected necessary appropriate OpTypes and OpTypePointers.
            • processed the binary to change constant buffer members from float4x3[6] to vec4[18]
            • injected function properly unpacking vec4[18] into float4x3[6] accepting vec4[18] as a pointer to Uniform array 18.
            • created Private storage qualifier matrix unpack targets as OpVariables.(Private in SPIR-V just means invocation-level global...).
            • injected preambles about composite extraction and construction to call my new function. (since from what im seeing we need to copy arguments from constant buffers to functions always, so thats what I do).
            • called the function from entrypoint, for every float4x3[6] member to have ready unpacked matrices when main() starts.
            • changed OpAccessChain operations that referenced given members in constant buffers and swapped them with access chains referencing my new Private targets.

            But now i ran into trouble. It looks like a function in SPIR-V can either accept Private or Function storage qualifier pointers. Not both. Is there any way i can tell SPIR-V "Yeah, you can dump both of those storage classes here as arguments"?

            Or do i need to rework my solution to utilize Function storage class matrix targets, and inject them and calls to unpack them every single time they are used in a new function? This seems much less elegant since there might be way more unpack operations then. And much less hassle-free, since i would have to scan every OpFunction block separately and inject OpVariables with Function storage into every block that uses the matrices.

            My problem is, after all this machinery is done my targets are living as OpTypePointer of Private Storage Duration. Therefore i cannot use them in ANY SPIR-V function generated from HLSL, since they take OpTypePointers of Function duration. My unpack function is sole exception to this since i injected it directly in SPIR-V asm, byte by byte and was able to precisely tune OpFunctionParameters in header.

            ...

            ANSWER

            Answered 2022-Jan-31 at 16:54

            This is a matter of calling conventions. Or rather, the lack of calling conventions in SPIR-V.

            Higher-level languages like GLSL and HLSL have calling conventions. They explain what it means for a function to take an input parameter and how that relates to the argument being given to it.

            SPIR-V doesn't have calling conventions in that sense. Or more to the point, you have to construct the calling conventions you want using SPIR-V.

            Parameters in HLSL are conceptually always passed by copy. If the parameter is an input parameter, then the copy is initialized with the given argument. If the parameter is an output parameter, the data from the function is copied into the argument after calling the function.

            The HLSL compiler must implement this in SPIR-V. So if a function takes a struct input parameter, that function's input parameter must be new storage from any existing object. When a caller tries to call this function, it must create storage for that parameter. That storage will use the Function storage qualifier, so the parameter also uses that qualifier.

            SPIR-V requires that pointer types specify the storage qualifier of the objects they point to. This is important, as how the compiler goes about generating the GPU assembly which accesses the object can be different (perhaps drastically). As such, a function cannot accept a pointer that points to different storage classes; the function has to pick one.

            So if your SPIR-V adjustment system sees a function call whose source data comes from something you need to adjust, then you have two options:

            1. Create a new function which is a copy of the old one, except that it takes a Private pointer.

            2. Follow the calling convention by creating Function-local storage and copying from your Private data into it prior to calling the function (and copying back out if it is an output parameter). There's probably code to do that sitting there already, so you probably only need to change where it copies from/to.

            Source https://stackoverflow.com/questions/70924048

            QUESTION

            Copy output of custom target in one CSPROJ into another CSPROJ
            Asked 2022-Jan-14 at 05:57

            So I'm developing a game engine framework for myself in C#/.NET and I have been trying to simplify building shader files (the rendering engine consumes SPIR-V files, which I want to generate from GLSL source). My current approach has been to use a custom .targets file which is imported into a CSPROJ, and that file defines a custom target like this:

            ...

            ANSWER

            Answered 2022-Jan-14 at 02:16

            I am not sure I understand your problem correctly, but if you want your .vert.spv copied to another folder use File.Copy()

            Source https://stackoverflow.com/questions/70705195

            QUESTION

            Using debugPrintfEXT in Vulkan
            Asked 2022-Jan-12 at 20:44

            I'm trying to figure out how to use debugPrintfEXT but with no luck. First I've enabled the extension in my vertex shader

            ...

            ANSWER

            Answered 2022-Jan-12 at 20:44

            You also need to enable the VK_KHR_shader_non_semantic_info device extension in your application code when you create the device.

            LunarG has also recently published a white paper about debugPrintfEXT.

            Source https://stackoverflow.com/questions/68575596

            QUESTION

            Wgsl Naga - How can I use builtin textureStore() with texture_storage_2d?
            Asked 2021-Dec-17 at 21:21

            Naga validate this snippet:

            ...

            ANSWER

            Answered 2021-Dec-17 at 20:42

            To store in a rgba8uint, you need to use the type vec4. See here for the corresponding type for each texture storage. If that's not working, you may have a different problem. (Are you passing in 10. etc to the vec4? It should be 10u. Wgsl is very strict about types.)

            Source https://stackoverflow.com/questions/70391717

            QUESTION

            vkCreateComputePipelines takes too long
            Asked 2021-Sep-30 at 13:16

            I encountered a strange problem with compiling Vulkan compute shader. I have this shader (which is not even all that complex)

            ...

            ANSWER

            Answered 2021-Sep-30 at 13:16

            Upon closer inspection I noticed that normally all the generated SPIR-V files for my shaders take about 10-30KB. However, this one shader takes 178KB.

            With help of spirv-dis I looked inside the generated assembly and noticed that vast majority of the op-codes was OpConstant. It was because I had structs that looked like

            Source https://stackoverflow.com/questions/69392228

            QUESTION

            Non uniform texture access in vulkan glsl
            Asked 2021-Aug-24 at 15:35

            I am trying to write a compute shader that raytraces an image, pixels on the right of the yz plane sample from image A, those on the left from image B.

            I don't want to have to sample both images so I am trying to use non uniform access by doing:

            texture(textures[nonuniformEXT(sampler_id)], vec2(0.5));

            and enabling the relevant extension in the shader. This triggers the following validaiton layer error:

            ...

            ANSWER

            Answered 2021-Aug-24 at 15:35

            You have to enable the feature at device creation.

            You can check for support of the feature by calling vkGetPhysicalDeviceFeatures2 and following the pNext chain through to a VkPhysicalDeviceVulkan12Features, and checking that shaderSampledImageArrayNonUniformIndexing member is to VK_TRUE.

            After that when creating the device with vkCreateDevice, inside the pCreateInfo structure, in the pNext chain you have to have a VkPhysicalDeviceVulkan12Features with shaderSampledImageArrayNonUniformIndexing set to VK_TRUE.

            Source https://stackoverflow.com/questions/68900001

            QUESTION

            Adding support for floating point atomic operations in Vulkan
            Asked 2021-Aug-06 at 06:52

            Recently the extension VK_EXT_shader_atomic_float has been added. I'm trying to figure out how to use it.

            I've added the appropriate flag to my shader

            ...

            ANSWER

            Answered 2021-Aug-06 at 06:52

            QUESTION

            Vulkan Array of Specialization Constants
            Asked 2021-Mar-02 at 06:08

            Is is possible to have an array of specialization constants such that the glsl code looks similar to the following:

            ...

            ANSWER

            Answered 2021-Mar-02 at 06:08

            While Vulkan-flavored GLSL requires that specialization constants are scalars, SPIR-V itself is not so restrictive. You can declare a specialization constant array, just as you can declare a non-specialized constant array. The latter effectively becomes the former upon specialization constants being provided. The interface for specializing constants in Vulkan acknowledges the possibility that different constants being specialized have different sizes, so an array of them would be valid from an API perspective.

            But so long as you are stuck with GLSL, you have to live within its limitations. At least, as far as SPIR-V generation is concerned.

            However, if you're willing to do some surgery on the SPIR-V after generating it, you can construct what you need. Given the name of the array in question, you can track down the OpName that matches that array name. Once you find it, you can find the ResultID (every SPIR-V opcode has one) that the OpName opcode specifies. That opcode should be an OpConstantComposite.

            All you need to do is turn this OpConstantComposite opcode into OpSpecConstantComposite. The two codes use the same parameters and so forth, so you're just swapping the opcode out for the other one.

            Source https://stackoverflow.com/questions/66433585

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install SPIR-V

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/kusma/SPIR-V.git

          • CLI

            gh repo clone kusma/SPIR-V

          • sshUrl

            git@github.com:kusma/SPIR-V.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link