shady-gang / shady

Research shading language IR
MIT License
206 stars 11 forks source link

vcc command fails to compile the example #39

Closed NoNaeAbC closed 5 days ago

NoNaeAbC commented 6 days ago

I try to get vcc working, bu I can't. I'm trying to compile the example from https://shady-gang.github.io/vcc/, but I can't.

$ vcc t.cpp -o e.spv --verbose
clang version 17.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
built command: clang -c -emit-llvm -S -g -O0 -ffreestanding -Wno-main-return-type -Xclang -fpreserve-vec3-type --target=spir64-unknown-unknown -isystem"/usr/local/bin/../share/vcc/include/" -D__SHADY__=1 -o 2H6KmBNdl7kH7NOPtuiZgAMREimob8fd "t.cpp" "--verbose"
clang version 17.0.6
Target: spir64-unknown-unknown
Thread model: posix
InstalledDir: /usr/bin
 (in-process)
 "/usr/bin/clang-17" -cc1 -triple spir64-unknown-unknown -Wspir-compat -emit-llvm -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name t.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -ffreestanding -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/*** -resource-dir /usr/lib/clang/17 -isystem /usr/local/bin/../share/vcc/include/ -D __SHADY__=1 -O0 -Wno-main-return-type -fdeprecated-macro -fdebug-compilation-dir=/home/*** -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -fpreserve-vec3-type -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o 2H6KmBNdl7kH7NOPtuiZgAMREimob8fd -x c++ t.cpp
clang -cc1 version 17.0.6 based upon LLVM 17.0.6 default target x86_64-pc-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/bin/../share/vcc/include
 /usr/local/include
 /usr/lib/clang/17/include
 /usr/include
End of search list.
t.cpp:5:41: error: unknown type name 'uniform'
    5 | descriptor_set(0) descriptor_binding(1) uniform sampler2D texSampler;
      |                                         ^
t.cpp:5:58: error: expected ';' after top level declarator
    5 | descriptor_set(0) descriptor_binding(1) uniform sampler2D texSampler;
      |                                                          ^
      |                                                          ;
t.cpp:7:24: error: no matching constructor for initialization of 'input vec3' (aka '__attribute__((address_space(389))) vec3_impl<native_vec3, float>')
    7 | location(0) input vec3 fragColor;
      |                        ^
/usr/local/bin/../share/vcc/include/shady_vec.h:57:5: note: candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(389)))'
   57 |     vec3_impl() {}
      |     ^
/usr/local/bin/../share/vcc/include/shady_vec.h:58:5: note: candidate constructor not viable: requires single argument 'scalar', but no arguments were provided
   58 |     vec3_impl(T scalar) : x(scalar), y(scalar), z(scalar) {}
      |     ^         ~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:60:5: note: candidate constructor not viable: requires single argument 'n', but no arguments were provided
   60 |     vec3_impl(Native n) : x(n.x), y(n.y), z(n.z) {}
      |     ^         ~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:53:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
   53 | struct vec3_impl {
      |        ^~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:53:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided
   53 | struct vec3_impl {
      |        ^~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:59:5: note: candidate constructor not viable: requires 3 arguments, but 0 were provided
   59 |     vec3_impl(T x, T y, T z) : x(x), y(y), z(z) {}
      |     ^         ~~~~~~~~~~~~~
t.cpp:8:24: error: no matching constructor for initialization of 'input vec2' (aka '__attribute__((address_space(389))) vec2_impl<native_vec2, float>')
    8 | location(1) input vec2 fragTexCoord;
      |                        ^
/usr/local/bin/../share/vcc/include/shady_vec.h:91:5: note: candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(389)))'
   91 |     vec2_impl() {}
      |     ^
/usr/local/bin/../share/vcc/include/shady_vec.h:92:5: note: candidate constructor not viable: requires single argument 'scalar', but no arguments were provided
   92 |     vec2_impl(T scalar) : x(scalar), y(scalar) {}
      |     ^         ~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:94:5: note: candidate constructor not viable: requires single argument 'n', but no arguments were provided
   94 |     vec2_impl(Native n) : x(n.x), y(n.y) {}
      |     ^         ~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:87:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
   87 | struct vec2_impl {
      |        ^~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:87:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided
   87 | struct vec2_impl {
      |        ^~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:93:5: note: candidate constructor not viable: requires 2 arguments, but 0 were provided
   93 |     vec2_impl(T x, T y) : x(x), y(y) {}
      |     ^         ~~~~~~~~
t.cpp:10:25: error: no matching constructor for initialization of 'output vec4' (aka '__attribute__((address_space(390))) vec4_impl<native_vec4, float>')
   10 | location(0) output vec4 outColor;
      |                         ^
/usr/local/bin/../share/vcc/include/shady_vec.h:23:5: note: candidate constructor ignored: cannot be used to construct an object in address space '__attribute__((address_space(390)))'
   23 |     vec4_impl() {}
      |     ^
/usr/local/bin/../share/vcc/include/shady_vec.h:24:5: note: candidate constructor not viable: requires single argument 'scalar', but no arguments were provided
   24 |     vec4_impl(T scalar) : x(scalar), y(scalar), z(scalar), w(scalar) {}
      |     ^         ~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:26:5: note: candidate constructor not viable: requires single argument 'n', but no arguments were provided
   26 |     vec4_impl(Native n) : x(n.x), y(n.y), z(n.z), w(n.w) {}
      |     ^         ~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:19:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
   19 | struct vec4_impl {
      |        ^~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:19:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided
   19 | struct vec4_impl {
      |        ^~~~~~~~~
/usr/local/bin/../share/vcc/include/shady_vec.h:25:5: note: candidate constructor not viable: requires 4 arguments, but 0 were provided
   25 |     vec4_impl(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {}
      |     ^         ~~~~~~~~~~~~~~~~~~
t.cpp:13:26: error: use of undeclared identifier 'texSampler'
   13 |     outColor = texture2D(texSampler, fragTexCoord) * (vec4) { fragColor.x * 2.5f, fragColor.y * 2.5f, fragColor.z * 2.5f, 1.0f };
      |                          ^
6 errors generated.
Clang returned 256 and replied:

Honestly, I'm not surprised by the first message since "uniform" is nowhere to be found in the header.

Hugobros3 commented 6 days ago

We've gotten rid of uniform in favor of uniform_constant and uniform_block respectively. I need to fix the website, thanks for reporting!

Hugobros3 commented 5 days ago

Should be fixed on the live website.