tyanyuy3125 / Erics-MagicaVoxel-Shaders

Shaders for MagicaVoxel including Terrain Generator, Game of Life, Waterflow Simulator, Progressive Flood Shader etc.
MIT License
210 stars 20 forks source link

Compatibility issues running in GLSL 1.10 or lower #2

Closed tyanyuy3125 closed 5 years ago

tyanyuy3125 commented 5 years ago

Basic Info

Tested MagicaVoxel Version: 0.99.2

GLSL version: 1.10

Behavior: Simply cannot execute

Target Platform: Linux wine, macOS and Windows with lower GLSL version.

Log

In fact all the shaders in this project cannot avoid the mentioned problem. The log below belongs to the Terrain Generator.

[Cmd] : xs : tergen 19260817 50 20 1 [Log] cache model [Log] compute model ==== [GL:Shader] ==== 0:19(10): warning: Float suffixes are invalid in GLSL 1.10 0:19(84): warning: Float suffixes are invalid in GLSL 1.10 0:24(75): warning: Float suffixes are invalid in GLSL 1.10 0:25(67): warning: Float suffixes are invalid in GLSL 1.10 0:26(24): warning: Float suffixes are invalid in GLSL 1.10 0:31(31): warning: Float suffixes are invalid in GLSL 1.10 0:49(33): warning: Float suffixes are invalid in GLSL 1.10 0:15(2): error: operator '%' is reserved in GLSL 1.10 (GLSL 1.30 or GLSL ES 3.00 required) 0:15(2): error: could not implicitly convert error to int 0:16(2): error: operator '%' is reserved in GLSL 1.10 (GLSL 1.30 or GLSL ES 3.00 required) 0:16(2): error: could not implicitly convert error to int 0:18(7): error: bit-wise operations are forbidden in GLSL 1.10 (GLSL 1.30 or GLSL ES 3.00 required) 0:18(7): error: bit-wise operations are forbidden in GLSL 1.10 (GLSL 1.30 or GLSL ES 3.00 required) 0:18(7): error: type mismatch 0:18(6): error: bit-wise operations are forbidden in GLSL 1.10 (GLSL 1.30 or GLSL ES 3.00 required) 0:19(22): error: bit-wise operations are forbidden in GLSL 1.10 (GLSL 1.30 or GLSL ES 3.00 required) 0:19(22): error: type mismatch 0:19(16): error: cannot construct `float' from a non-numeric data type 0:19(16): error: operands to arithmetic operators must be numeric 0:19(10): error: operands to arithmetic operators must be numeric 0:20(9): warning: `o' used uninitialized 0:31(11): error: could not implicitly convert operands to arithmetic operator 0:31(10): error: operands to arithmetic operators must be numeric 0:32(14): warning: `f' used uninitialized 0:32(12): error: could not implicitly convert operands to arithmetic operator 0:32(9): error: operands to arithmetic operators must be numeric 0:32(19): warning: `f' used uninitialized 0:32(9): error: operands to arithmetic operators must be numeric 0:32(2): error: `return' with wrong type error, in function `cosini' returning float 0:37(13): error: could not implicitly convert operands to arithmetic operator 0:39(13): error: could not implicitly convert operands to arithmetic operator 0:40(56): warning: `fraX' used uninitialized 0:41(60): warning: `fraX' used uninitialized 0:42(22): warning: `fraY' used uninitialized 0:48(13): error: no matching function for call to `pow(float, int)'; candidates are: 0:48(13): error: float pow(float, float) 0:48(13): error: vec2 pow(vec2, vec2) 0:48(13): error: vec3 pow(vec3, vec3) 0:48(13): error: vec4 pow(vec4, vec4) 0:49(16): warning: `freq' used uninitialized 0:49(23): warning: `freq' used uninitialized 0:49(29): error: no matching function for call to `pow(float, int)'; candidates are: 0:49(29): error: float pow(float, float) 0:49(29): error: vec2 pow(vec2, vec2) 0:49(29): error: vec3 pow(vec3, vec3) 0:49(29): error: vec4 pow(vec4, vec4) 0:49(9): error: operands to arithmetic operators must be numeric 0:49(2): error: operands to arithmetic operators must be numeric 0:49(2): error: could not implicitly convert error to float 0:55(17): error: could not implicitly convert operands to arithmetic operator 0:56(25): warning: `height' used uninitialized 0:56(44): error: operands of `==' must have the same type [Error] cmd failed to parse parms: MV_CMD_VoxelShader

Fixing status

Now project tergen flow lifegame flow2 tergen2 cave drop cubefill shaders work in GLSL 1.10.

Swivelgames commented 5 years ago

Bummer! I was racking my brain as to why they wouldn't execute.

By the way, how did you get this log? I was trying to find a console output of some kind to see if the scripts were failing, but couldn't find one.

capnslipp commented 5 years ago

@Swivelgames I'm also curious where you found MagicaVoxel's logfile. I'd like to fix some shaders for the latest version of MV, but don't know what it's getting caught up on.

tyanyuy3125 commented 5 years ago

To view the logging file:

capnslipp commented 5 years ago

That makes too much sense.

For macOS:

For long term use, you can create a macOS-friendly bash script (text file with extension .command that has been chmod +x-ed) and drop it in the same directory as MagicaVoxel.app:

Run MagicaVoxel With Log.command

#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd "$DIR"

./MagicaVoxel.app/Contents/MacOS/MagicaVoxel
tyanyuy3125 commented 5 years ago

@capnslipp Well done. I do not use macOS so couldn't provide a solution to it. Your reply is of great help to those macOS users. :) Thank you.

my-little-bunny commented 5 years ago

Hi!

On my mac I'm getting:

[Cmd] : xs : tergen 19260817 50 20 1 0 -10 10 10 [Log] cache model [Log] compute model ==== [GL:Shader] ==== ERROR: 0:19: 'f' : syntax error: syntax error

[Error] cmd failed to parse parms: MV_CMD_VoxelShader

And, naturally, shader produces nothing. I'm not a developer, so I don't know if this might help, but I'd very much like to get this shader to work.

tyanyuy3125 commented 5 years ago

@my-little-bunny

I have to say that this is a weird issue and it's disappointing that for me locating the bug through the log is nearly impossible.

At present without further investigating I can only guess that the problem comes from the 'f' mark for the float number. I've removed the mark in the latest build, please check it out and see if the problem disappears. If the problem still exists, welcome to comment in this issue.

Hope to help.

my-little-bunny commented 5 years ago

Thank you for your reply. Sadly, shader (and all of the others) still doesn't work. New log:

[Log] compute model ==== [GL:Shader] ==== ERROR: 0:18: '<<' does not operate on 'int' and 'int' ERROR: 0:19: '&' does not operate on 'int' and 'int' ERROR: 0:20: Use of undeclared identifier 'o'

[Error] cmd failed to parse parms: MV_CMD_VoxelShader

my-little-bunny commented 5 years ago

I've copied your command: xs tergen 19260817 50 20 1 0 -10 10 10, so I don't think there were any 'o's.

my-little-bunny commented 5 years ago

It may also be worth noting that this shader, xs height, also doesn't work on mac, and ephtracy said it was some sort of problem with mac recognising UTF-8 encoding: https://twitter.com/ephtracy/status/956999681132974082

Although other shaders (https://github.com/lachlanmcdonald/magicavoxel-shaders) work perfectly fine with no problems at all.

tyanyuy3125 commented 5 years ago

Thank you for your reply. Sadly, shader (and all of the others) still doesn't work. New log: [Log] compute model ==== [GL:Shader] ==== ERROR: 0:18: '<<' does not operate on 'int' and 'int' ERROR: 0:19: '&' does not operate on 'int' and 'int' ERROR: 0:20: Use of undeclared identifier 'o' [Error] cmd failed to parse parms: MV_CMD_VoxelShader

This is actually a compatibility problem now, for the OpenGL in your mac does not support the bitwise-based random generator. To fix it I have to change the algorithm of the generator, which cannot be fixed in a short period of time. I'll manage to do some tests in osx to improve the experience of those users working on non-Windows platforms like you.

I am so sorry for wasting your precious time. I promise the next release will fix mentioned problems.

my-little-bunny commented 5 years ago

Thank you! No need to be sorry, I just wanted to contribute to this issue, sorry I couldn't do more.

tyanyuy3125 commented 5 years ago

It is worth concerning that the bug of the generator has been fixed at present. Feel free to have a try.

my-little-bunny commented 5 years ago

OH MY GOD IT FINALLY WORKS!!!! Thank you so much!!!!

tyanyuy3125 commented 5 years ago

All fixed. Close the issue.