poke1024 / tove2d

Animated vector graphics for LÖVE.
Other
171 stars 8 forks source link

Render artifacts with gpux/shader #1

Closed vitvakatu closed 5 years ago

vitvakatu commented 6 years ago

Hi! Just tried your library and found weird artifacts with all the examples screenshot_20180806_180901

I'm running Kubuntu with Intel integrated video card

poke1024 commented 6 years ago

Hm, this is going to be difficult to debug, esp. since I cannot reproduce this. Can you give an exact video card model?

Tove's shader renderer (i.e. the right one above) is a pretty brittle piece of GLSL programming with various texture lookups (including one binary search) depending on each other for reading out its data structures. If even one access is slightly off, the whole thing goes havoc. The turquoise color in the picture above are cases where this lookup failed. I've tested the thing with a couple of GPUs and one software renderer, but this above is some driver thing.

Here's some things you could try, which might help me understand what's going on:

pdesaulniers commented 5 years ago

I can reproduce the issue, using the latest git version of the library on Arch Linux. The artifacts look identical:

2019-02-25-18 29 26

Regarding the three tests:

2019-02-25-18 18 51

2019-02-25-18 25 28

2019-02-25-18 21 05

Hardware + driver info:

00:02.0 VGA compatible controller [0300]: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller [8086:0416] (rev 06) (prog-if 00 [VGA controller])
    Subsystem: ASUSTeK Computer Inc. 4th Gen Core Processor Integrated Graphics Controller [1043:157d]

Kernel driver in use: i915

Also, running the demo with my NVIDIA card shows an error:

Error

Cannot compile pixel shader code:
Line 382: error: ambiguous overloaded function reference "mix(ivec4, ivec4, bvec4)"

Traceback

[C]: in function 'newShader'
tove/init.lua:1324: in function 'newGeometryFillShader'
tove/init.lua:1750: in function 'newComputeFeedData'
tove/init.lua:1793: in function 'gen'
tove/init.lua:2284: in function 'shaders'
tove/init.lua:2470: in function 'f'
tove/init.lua:2502: in function '_create'
tove/init.lua:2217: in function 'draw'
assets/tovedemo.lua:109: in function 'draw'
main.lua:28: in function 'draw'
[C]: in function 'xpcall'
poke1024 commented 5 years ago

@pdesaulniers The NVIdia error is a correct error due to a GLSL call I messed up - should be fixed in top of tree (I'm planning to make an official release in the next weeks where this is included).

The artefacts problem is difficult. I can now also reproduce this with one machine here. I need to think about how to add debugging code to tackle this.

pdesaulniers commented 5 years ago

Seems like it's working now! I'm not getting any weird artifacts using either my Intel or NVIDIA card:

2019-03-17-18:19:36

poke1024 commented 5 years ago

I had hoped for this. With the last commits from today, I can no longer reproduce issues. I tested with NVidia on Windows and Linux, as well with Intel hardware drivers on macOS.

poke1024 commented 5 years ago

I tested again on all devices I own. Seems it's working everywhere now.