Skip to content

Instantly share code, notes, and snippets.

@xranby
Created March 6, 2015 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xranby/5503c00de6f1bdaca7f1 to your computer and use it in GitHub Desktop.
Save xranby/5503c00de6f1bdaca7f1 to your computer and use it in GitHub Desktop.
helloworld GLSL to SPIR-V using glslang
xranby@Xerxes-ESPRIMO:~/glslang/Install/Linux$ cat hello.frag
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
varying vec4 varying_Color;
void main (void)
{
gl_FragColor = varying_Color;
}
xranby@Xerxes-ESPRIMO:~/glslang/Install/Linux$ ./glslangValidator hello.frag -V -H
hello.frag
Linked fragment stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 14
Source GLSL 100
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4
Name 4 "main"
Name 10 "gl_FragColor"
Name 12 "varying_Color"
Decorate 10(gl_FragColor) PrecisionMedium
Decorate 10(gl_FragColor) Built-In FragColor
Decorate 12(varying_Color) PrecisionMedium
Decorate 12(varying_Color) Smooth
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 4
9: TypePointer Output 8(fvec4)
10(gl_FragColor): 9(ptr) Variable Output
11: TypePointer Input 8(fvec4)
12(varying_Color): 11(ptr) Variable Input
4(main): 2 Function NoControl 3
5: Label
13: 8(fvec4) Load 12(varying_Color)
Store 10(gl_FragColor) 13
Branch 6
6: Label
Return
FunctionEnd
xranby@Xerxes-ESPRIMO:~/glslang/Install/Linux$ hexdump frag.spv
0000000 0203 0723 0063 0000 00bb 051a 000e 0000
0000010 0000 0000 0001 0003 0002 0000 0064 0000
0000020 0004 0006 0001 0000 4c47 4c53 732e 6474
0000030 342e 3035 0000 0000 0005 0003 0000 0000
0000040 0001 0000 0006 0003 0004 0000 0004 0000
0000050 0036 0004 0004 0000 616d 6e69 0000 0000
0000060 0036 0006 000a 0000 6c67 465f 6172 4367
0000070 6c6f 726f 0000 0000 0036 0006 000c 0000
0000080 6176 7972 6e69 5f67 6f43 6f6c 0072 0000
0000090 0032 0003 000a 0000 0001 0000 0032 0004
00000a0 000a 0000 0027 0000 0015 0000 0032 0003
00000b0 000c 0000 0001 0000 0032 0003 000c 0000
00000c0 000b 0000 0008 0002 0002 0000 0015 0003
00000d0 0003 0000 0002 0000 000b 0003 0007 0000
00000e0 0020 0000 000c 0004 0008 0000 0007 0000
00000f0 0004 0000 0014 0004 0009 0000 0003 0000
0000100 0008 0000 0026 0004 0009 0000 000a 0000
0000110 0003 0000 0014 0004 000b 0000 0001 0000
0000120 0008 0000 0026 0004 000b 0000 000c 0000
0000130 0001 0000 0028 0005 0002 0000 0004 0000
0000140 0000 0000 0003 0000 00d0 0002 0005 0000
0000150 002e 0004 0008 0000 000d 0000 000c 0000
0000160 002f 0003 000a 0000 000d 0000 00d1 0002
0000170 0006 0000 00d0 0002 0006 0000 00d5 0001
0000180 002a 0001
0000184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment