3Dickulus / FragM

Derived from https://github.com/Syntopia/Fragmentarium/
GNU General Public License v3.0
344 stars 30 forks source link

jump to error line should prioritize errors over warnings #160

Closed claudeha closed 3 years ago

claudeha commented 3 years ago

Describe the bug Jump to error line jumps to a warning (listed earlier in the log) instead of an error (listed later in the log).

To Reproduce Steps to reproduce the behavior:

  1. Open Mandelbulb.frag
  2. Add error; at line 99
  3. Rebuild
  4. See error
Could not create fragment shader: 
/home/claude/opt/fragmentarium/2.5.4/Fragmentarium-2.5.4/Examples/Historical 3D Fractals/Mandelbulb.frag :142(22): warning: `floorNormal' used uninitialized
/home/claude/opt/fragmentarium/2.5.4/Fragmentarium-2.5.4/Examples/Historical 3D Fractals/Mandelbulb.frag :155(22): warning: `floorNormal' used uninitialized
/home/claude/opt/fragmentarium/2.5.4/Fragmentarium-2.5.4/Examples/Historical 3D Fractals/Mandelbulb.frag :271(28): warning: `aoEps' used uninitialized
/home/claude/opt/fragmentarium/2.5.4/Fragmentarium-2.5.4/Examples/Historical 3D Fractals/Mandelbulb.frag :271(47): warning: `aoEps' used uninitialized
/home/claude/opt/fragmentarium/2.5.4/Fragmentarium-2.5.4/Examples/Historical 3D Fractals/Mandelbulb.frag :318(14): warning: `minDist' used uninitialized
/home/claude/opt/fragmentarium/2.5.4/Fragmentarium-2.5.4/Examples/Historical 3D Fractals/Mandelbulb.frag :358(14): warning: `floorNormal' used uninitialized
/home/claude/opt/fragmentarium/2.5.4/Fragmentarium-2.5.4/Examples/Historical 3D Fractals/Mandelbulb.frag :99(1): error: `error' undeclared

Cursor jumps to line 142 (warning) instead of line 99 (error).

Expected behavior Cursor to jump to line 99 (error), and only jump to a warning if there is no error.

Desktop (please complete the following information):

Additional context Different drivers probably have different log format.

At least with amdgpu/mesa on Linux, this is also reported by the debug callback, which allows distinguishing Shader Compiler Error from Shader Compiler Other (though, I'm not sure if the string index is correct in the presence of includes?):

GL Debug message (1): Shader Stats: SGPRS: 24 VGPRS: 24 Code Size: 396 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0 Shader Compiler Other Severity: notification 
GL Debug message (1): Shader Stats: SGPRS: 64 VGPRS: 72 Code Size: 20448 LDS: 0 Scratch: 0 Max Waves: 3 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0 Shader Compiler Other Severity: notification 
GL Debug message (1): Shader Stats: SGPRS: 16 VGPRS: 8 Code Size: 116 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0 Shader Compiler Other Severity: notification 
GL Debug message (1): Shader Stats: SGPRS: 24 VGPRS: 28 Code Size: 1452 LDS: 0 Scratch: 0 Max Waves: 8 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0 Shader Compiler Other Severity: notification 
GL Debug message (118): 0:142(22): warning: `floorNormal' used uninitialized Shader Compiler Other Severity: high 
GL Debug message (119): 0:155(22): warning: `floorNormal' used uninitialized Shader Compiler Other Severity: high 
GL Debug message (120): 0:271(28): warning: `aoEps' used uninitialized Shader Compiler Other Severity: high 
GL Debug message (121): 0:271(47): warning: `aoEps' used uninitialized Shader Compiler Other Severity: high 
GL Debug message (122): 0:318(14): warning: `minDist' used uninitialized Shader Compiler Other Severity: high 
GL Debug message (123): 0:358(14): warning: `floorNormal' used uninitialized Shader Compiler Other Severity: high 
GL Debug message (124): 0:99(1): error: `error' undeclared Shader Compiler Error Severity: high 
claudeha commented 3 years ago

I also note that the relevant line 142 is not in Mandelbulb.frag but in DE-Raytracer.frag

claudeha commented 3 years ago

Don't worry about the wrong source number: seems to be a Mesa bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/804

3Dickulus commented 3 years ago

Screenshot_20201209_175601

is the option checked in Edit/Preferences ?

3Dickulus commented 3 years ago

...and why are you getting those warnings? I don't see them here.

Could not create fragment shader: 
Examples/Historical 3D Fractals/Mandelbulb.frag (99) : error C1503: undefined variable "error"
Failed to compile script (41 ms).
  1. Open Mandelbulb.frag
  2. Add error; at line 99
  3. Rebuild
  4. Cursor jumps to line 99 in editor

the 2 numbers in an error line, n(n) as parsed from the error log, are in my case, file number and line number, Mesa is giving n:n(n) which is not the pattern parsed.

solution: test for Mesa vs nVidia glsl compiler and parse error log accordingly?

3Dickulus commented 3 years ago

uniform vec3 FloorNormal; slider[(-1,-1,-1),(0,0,1),(1,1,1)] ...

vec3 color(vec3 from, vec3 dir) {
    // placed here for GLES
    floorNormal = normalize(FloorNormal);
        ....

When using ES profile I get error on vec3 floorNormal = FloorNormal; the above in DE-Raytracer.frag allows it to compile on all profiles here.

3Dickulus commented 3 years ago

current status : when following the instructions in OP I get...

Could not create fragment shader: 
/home/toonfish/Fragmentarium/Examples/Historical 3D Fractals/Mandelbulb.frag (99) : error C1503: undefined variable "error"

Failed to compile script (43 ms).

...cursor jumps to line 99 in the editor

3Dickulus commented 3 years ago

I think a few things might be since Fragmentarium Examples commit 30eea327e380640388dc454bdfe95626de0b4b21

claudeha commented 3 years ago

is the option checked in Edit/Preferences ?

Jump to line on Warn is deselected.

3Dickulus commented 3 years ago

Reverted to errors only, leaving warns for the programmer to figure out, if they can't figure it out then a little more programming knowledge will be required.