HackerPoet / PySpace

GLSL Fractal Ray Marcher in Python
MIT License
1.15k stars 147 forks source link

Fragment shader failed to compile #1

Closed Vuldraq closed 5 years ago

Vuldraq commented 6 years ago

Upon running, I receive the following error message:

Compiling Vertex Shader...
Compiling Fragment Shader...
Fragment shader failed to compile with the following errors:
ERROR: 0:66: error(#132) Syntax error: "=" parse error
ERROR: error(#273) 1 compilation errors.  No code generated

Traceback (most recent call last):
  File "ray_marcher_demo.py", line 253, in <module>
    program = shader.compile(camera)
  File "shader.py", line 73, in compile
    program = self.compile_program(v_shader, f_shader)
  File "shader.py", line 106, in compile_program
    fragment_shader = self.compile_shader(fragment_source, GL_FRAGMENT_SHADER)
  File "shader.py", line 92, in compile_shader
    raise ValueError, 'Shader compilation failed'
ValueError: Shader compilation failed

No idea if i'm doing something wrong here, (still relatively new to coding and GitHub), although I haven't altered the file in any way, and have all the required dependencies, but thought i would bring it up anyway.

HackerPoet commented 6 years ago

Is this just running the demo app unmodified, or have you made changes?

Try uncommenting line 70 of 'shader.py' under where it says 'Debugging the shader'. After running again, check the new 'frag_gen.glsl' file and see what the error looks like on line 66.

Vuldraq commented 6 years ago

Yes, this is using all the files unmodified, using the demo file, even after re-downloading the problem persists. After uncommenting that line of code, line 66 of the new 'frag_gen.glsl' file is: void planeFold(inout vec4 z, vec3 n, float d=0.0) { Here is the full method: void planeFold(inout vec4 z, vec3 n, float d=0.0) { z.xyz -= 2.0 * min(0.0, dot(z.xyz, n) - d) * n; }

HackerPoet commented 6 years ago

Found an identical issue here: https://community.amd.com/thread/167874 I guess this feature is not officially supported on all GLSL compilers. I'll try to make a workaround for this.

EDIT: Can you test if just removing the '=0.0' on that line fixes everything? I think that's all you need. To be precise, its line 31 of frag.glsl, NOT frag_gen.glsl

Nikateen commented 5 years ago
screenshot 2019-01-15 at 10 32 20 am

line 31 Is just a bunch of ####, I have pretty much the same error PySpace-master/pyspace/shader.py", line 92, in compile_shader /PySpace-master/pyspace/shader.py", line 102, in compile_program PySpace-master/pyspace/shader.py", line 73, in compile /PySpace-master/ray_marcher_demo.py", line 253, in

Quruzz commented 5 years ago

I have been trying to run the bat file and it's not working. It's not compiling. image I tried fixing it as it suggested and ended up with a new error. image

cohaereo commented 5 years ago

@Quruzz open a new issue (and use python 2, or the python 3 PR)

slowkow commented 5 years ago

I get the same error, just running the script after cloning from github:

$ python ray_marcher_demo.py
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Compiling Vertex Shader...
ERROR: 0:1: '' :  version '330' is not supported
ERROR: 0:1: '' : syntax error: #version
ERROR: 0:2: '(' : syntax error: Array size must appear after variable name

Traceback (most recent call last):
  File "ray_marcher_demo.py", line 253, in <module>
    program = shader.compile(camera)
  File "github.com/HackerPoet/PySpace/pyspace/shader.py", line 73, in compile
    program = self.compile_program(v_shader, f_shader)
  File "github.com/HackerPoet/PySpace/pyspace/shader.py", line 102, in compile_program
    vertex_shader = self.compile_shader(vertex_source, GL_VERTEX_SHADER)
  File "github.com/HackerPoet/PySpace/pyspace/shader.py", line 92, in compile_shader
    raise ValueError, 'Shader compilation failed'
ValueError: Shader compilation failed
(
$ conda list
# packages in environment at miniconda3/envs/py27:
#
# Name                    Version                   Build  Channel
ca-certificates           2018.03.07                    0
certifi                   2018.11.29               py27_0
libcxx                    4.0.1                hcfea43d_1
libcxxabi                 4.0.1                hcfea43d_1
libedit                   3.1.20170329         hb402a30_2
libffi                    3.2.1                h475c297_4
ncurses                   6.1                  h0a44026_1
numpy                     1.16.0                    <pip>
openssl                   1.1.1a               h1de35cc_0
pip                       18.1                     py27_0
pygame                    1.9.4                     <pip>
pyopengl                  3.1.1a1                  py27_0
python                    2.7.15               h8f8e585_6
readline                  7.0                  h1de35cc_5
setuptools                40.6.3                   py27_0
sqlite                    3.26.0               ha441bb4_0
tk                        8.6.8                ha441bb4_0
wheel                     0.32.3                   py27_0
zlib                      1.2.11               h1de35cc_3

$ python2 --version
Python 2.7.15 :: Anaconda, Inc.
sharad-s commented 5 years ago

receiving the same issue when trying to run this script unmodified on python2 and python3 on MacOS Mojave

HackerPoet commented 5 years ago

I'm pretty sure this issue is the same as #8 and should be resolved now.