Questions tagged [spir-v]

SPIR-V is an intermediate representation language designed by the Khronos Group for use by OpenCL (2.0+), OpenGL (4.6+), and Vulkan (all versions). Do not use this tag for questions about SPIR, the earlier standard used with OpenCL before 2.0.

SPIR-V (Standard, Portable, Intermediate Representation-V) is an intermediate representation language for parallel compute and graphics programs. It is intended to be a target for higher-level languages to be compiled into, and is consumed by compute/graphics APIs like OpenCL, OpenGL, and Vulkan.

For Vulkan, SPIR-V is the only option for providing shaders (though there is an extension to directly send a version of GLSL to the Vulkan compiler, it is not widely implemented). OpenGL supports SPIR-V only in version 4.6 (and as an extension). OpenCL 2.0 and above support versions of SPIR-V.

The current version of SPIR-V is 1.3.

Note that SPIR-V is quite distinct from the older SPIR. SPIR was just a way of translating OpenCL C into LLVM's IR language.

102 questions
2
votes
1 answer

glslc - Missing entry point even with -fentry-point

When using glslc --targe-env="vulkan1.1" -fentry-point="mainColor" test.frag, I get the error test.frag: error: Linking fragment stage: Missing entry point: Each stage requires one entry point test.frag content : #version 450 layout…
Calvin-Ruiz
  • 173
  • 1
  • 1
  • 9
2
votes
1 answer

error: 'subgroup op' : requires SPIR-V 1.3

I am compiling a GLSL file to SPIR-V using the command: C:/VulkanSDK/1.2.148.1/Bin/glslc C:/Users/jonat/Projects/sum.comp -o C:/Users/jonat/Projects/sum.spv Getting the error: error: 'subgroup op' : requires SPIR-V 1.3 The error occurs on lines 32…
Jonathan Woollett-light
  • 2,813
  • 5
  • 30
  • 58
2
votes
0 answers

Unexpected indices sort problem on a compute kernel

I have a weird problem when I try to do an indices sort in descending order. I'm pretty sure I'm missing some basic idea about how GPUs work, as I would expect this program to execute fine: layout(binding = 0, std430) buffer _6_3 { uint _m0[]; }…
jhaavist
  • 681
  • 7
  • 11
2
votes
1 answer

Translate OpenCL SPIR-V to Vulkan SPIR-V

Is it possible to translate OpenCL-style SPIR-V to Vulkan-style SPIR-V? I know that it is possible to use clspv to compile OpenCL C to Vulkan-style SPIR-V, but I haven't seen any indication that it also supports ingesting OpenCL-style SPIR-V. Thank…
fodinabor
  • 451
  • 5
  • 15
2
votes
0 answers

How to properly use clCreateProgramWithIL() with a spir-v binary kernel?

I need to create an OpenCL application that instruments the code of the OpenCL kernel that it receives as input, for some exotic profiling purposes (haven't found what I need, so I need/want to do it myself). I want to compile the kernel to an…
Zehanort
  • 458
  • 2
  • 10
2
votes
2 answers

Is it possible to compile a Vulkano shader at runtime?

I've been using Vulkano in order to get some simple 3D graphics going on. Generally, I like to write my GLSL shaders in text and restart my program, or even changing shaders while the program is running. The examples given in Vulkano appear to use a…
Oni
  • 652
  • 2
  • 9
  • 22
2
votes
1 answer

What is the status of NVIDIA SPIR support as of mid-2018?

This question: Does NVidia support OpenCL SPIR? was asked 5 years ago. Since then, NVIDIA support for Khronos OpenCL has improved over this period, and it has also adopted Khronos Vulkan (of which I know little), I was wondering whether things had…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
2
votes
1 answer

vertexPipelineStoresAndAtomics warning for Vulkan SSBO vertex shader

I want to use an array of vec3 in my Vertex shader. I created layout(binding = 1) readonly buffer MyBuffer { vec3 buf[]; } myBuffer; ... vec test = myBuffer[gl_VertexIndex]; layout in my GLSL and glslc it over to my SPIR-V where it has it's…
FrickeFresh
  • 1,688
  • 1
  • 19
  • 31
2
votes
1 answer

Is it allowed to use a VkBool32 as a push constant?

I am trying to create a VkBool32 in my C++ code: VkBool32 myBool = VK_FALSE; and push it to GLSL via a push constant: vkCmdPushConstants(..., sizeof(myBool), &myBool); which is recieved by a bool inside a uniform storage…
Brotcrunsher
  • 1,964
  • 10
  • 32
2
votes
3 answers

Does SPIR-V bytecode provide obfuscation?

It is straightforward for a reverse engineer to attach a graphics debugger to an OpenGL application to extract the shader source code. It is my understanding that Vulkan, on the other hand, uses SPIR-V bytecode, rather than passing plaintext shaders…
plátano plomo
  • 1,672
  • 1
  • 18
  • 26
1
vote
1 answer

Where do shader "static" variables reside in memory?

I want to write an hlsl shader that renders a 2D textured quad onto a render target. I wrote the following vertex shader: struct VertexData { float2 position; float2 uv; }; // 2 2D triangles that cover the whole render target static…
Elad Maimoni
  • 3,703
  • 3
  • 20
  • 37
1
vote
1 answer

Difference between Spir-v, GLSL and HLSL

I'm trying to find out the difference between all the shader langage. I'm working on a game in c++ with Vulkan currently witch mean (if i've read correctly) that every shader i present to Vulkan must be in spir-v extension. But i've seen sometimes…
miyoku
  • 107
  • 1
  • 13
1
vote
0 answers

AMD OpenCL load program from SPIR-V

I trying to load OpenCL program from SPIR-V. Program code is trivial, i.e. just two kernels with naive matrix to matrix multiplication i.e. BLAS like gemm and matrix transpose from nvidia examples, it looks like following. #define BLOCK_SIZE…
Victor Gubin
  • 2,782
  • 10
  • 24
1
vote
0 answers

Should I reuse VkDecriptorSetLayout objects?

In my Vulkan code, I use spir-v reflection (spirv-reflect) to construct a compatible VkPipeline object for a combination of shader modules (VkShaderModule). Once a VkPipeline object is created for a specific combination, it is cached so it won't…
Elad Maimoni
  • 3,703
  • 3
  • 20
  • 37
1
vote
0 answers

Vulkan ShaderViewportIndexLayerEXT support

I'm in the process of porting some rendering code to Vulkan. I've been using the SPIR-V cross-compiler to avoid the requirement of re-writing all my shaders, which has been working well in most cases, but now I've hit an issue I just can't get…
Varrak
  • 708
  • 3
  • 13