Code Monkey home page Code Monkey logo

Comments (7)

AndrewNelis avatar AndrewNelis commented on May 5, 2024 2

Based on the link failure, I narrowed it down to these lines:

int col = int(texture2D(u_texture[img], uv).r * 255.0);

According to this stackoverflow answer, we shouldn't be able to do this:

In GLSL 1.30 to 3.30, you can have sampler arrays, but with severe restrictions on the index. The index must be an integral constant expression. Thus, while you can declare a sampler array, you can't loop over it.

So I don't understand how this code was working ever? I suspect there's a disconnect in GL versions maybe? I worked around it by unwrapping the array access so the index is a constant and now things work:

https://gist.github.com/AndrewNelis/ea5d8780c2d6aab047b00f3f2d52aa7b

(can't attach patches to github comments 👎 )

Improvements welcome...

from pyxel.

AndrewNelis avatar AndrewNelis commented on May 5, 2024 1

Digging deeper, I added the validate argument to compileProgram and got a more useful error:

    def __init__(self, vertex_shader, fragment_shader):
        try:
            self._program = shaders.compileProgram(
                shaders.compileShader(vertex_shader, gl.GL_VERTEX_SHADER),
                shaders.compileShader(fragment_shader, gl.GL_FRAGMENT_SHADER), validate=False)
        except Exception as e:
            print(str(e).encode('utf-8').decode('unicode_escape'))
            raise SystemExit()
        self._att = None
        self._tex_list = []

Error output is now:

Link failure (0): b'Vertex info
-----------
0(32) : warning C7050: "v_max_pos" might be used before being initialized
0(31) : warning C7050: "v_min_pos" might be used before being initialized

Fragment info
-------------
0(154) : error C5208: Sampler needs to be a uniform (global or parameter to main), need to inline function or resolve conditional expression
0(155) : error C5208: Sampler needs to be a uniform (global or parameter to main), need to inline function or resolve conditional expression

I believe it's complaining about an issue with the DRAWING_FRAGMENT_SHADER, the blt() and text() functions.

from pyxel.

AndrewNelis avatar AndrewNelis commented on May 5, 2024

Hi, I'm seeing the same traceback:

  • Pyxel version: master branch.
  • OS: Fedora 27
  • Python version: 3.3.6
  • Video Driver: NVIDIA 340.107
  • Video card: VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)

I've attached glxinfo.txt in case that helps.

As above, the traceback message is empty so I can't see what's wrong.

from pyxel.

kitao avatar kitao commented on May 5, 2024

I see.
I shouldn't use variables to specify the index of the texture image array in GLSL.

I'll change to use if as your patch.

from pyxel.

kitao avatar kitao commented on May 5, 2024

Thank you!
I fixed this bug in Pyxel 0.7.5.

from pyxel.

AndrewNelis avatar AndrewNelis commented on May 5, 2024

Thanks for patching.

from pyxel.

seipy avatar seipy commented on May 5, 2024

i'm on windows 8.1 x64, Pyxel 0.9.5 but still get the same error, any help will be appreciated

from pyxel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.