Giter Club home page Giter Club logo

Comments (9)

ivoflipse avatar ivoflipse commented on May 30, 2024

I think it would at least be great for pygfx if pyshader was optional. If you already have a shader, then you should be able to use it.

from pyshader.

almarklein avatar almarklein commented on May 30, 2024

Yes, this is already the case. As in, the given shader must be SpirV, it's up to you how to get there. But now (or soon, I'm not 100% sure) you can also pass WGSL shaders, which solves at least one of the above issues.

from pyshader.

almarklein avatar almarklein commented on May 30, 2024

But perhaps we should give it a bit more time:
image
(this was 16-02-2021)

from pyshader.

Korijn avatar Korijn commented on May 30, 2024

On its own, pyshader is a cool toy. But I don't think it's more than that and I would prefer to follow the industry standard in pygfx, whatever that may be. GLSL seems to be the most widely used, I don't know about WGSL yet, but I think both can compile to SpirV and should be most familiar to developers.

However, there are other cases of code-reuse, more in the range of templating, that are need to make writing shaders not a pain.

For me, this in particular totally defeated the point of pyshader, sadly. I had hoped to see this problem vanish (as was originally your expectation/vision, right?). But now that we can see it is unavoidable, it's not worthwhile for me anymore to learn another shading language + tool when I already know how to work with existing languages like GLSL.

I would prefer canning this and switching to a standard toolchain. From wgpu-rs, that seems to be:

Currently, shaders in the examples are written in GLSL 4.50 and compiled to SPIR-V manually. In the future WGSL will be the shader language for WebGPU, but support is not implemented yet.

For now, the shaders can be compiled to SPIR-V by running make, which requires you to have glslangs glslangValidator binary.

from pyshader.

almarklein avatar almarklein commented on May 30, 2024

I had hoped to see this problem vanish (as was originally your expectation/vision, right?).

Indeed it was. I had thought the ability to just call other functions would be enough, but this does not help introducing small variations in shaders, e.g. w.r.t. rgb/rgba/grayscale, texture formats, etc. Perhaps this needs a bit of though to see if we did not miss a possible avenue ...

But even then, using a shader language that nobody else knows, and having to maintain the compiler comes at a cost.

For me, the fact that WGSL seems to become the shading language for WebGPU, which was not so clear a year ago, I think, is the main reason to reconsider the viability of this tool.

... but support is not implemented yet.

I think this is changing right now. The examples in wgpu-rs now use WGSL! (since like a few weeks ago)

from pyshader.

Korijn avatar Korijn commented on May 30, 2024

For me, the fact that WGSL seems to become the shading language for WebGPU, which was not so clear a year ago, I think, is the main reason to reconsider the viability of this tool.

Can you explain what you think WGSL brings to the table that GLSL does not? Just curious :)

from pyshader.

almarklein avatar almarklein commented on May 30, 2024

Well, eventually it will be a very widely used shader format, since the intend is for this to be THE way to write shaders for the web. One of the ideas is that it maps rather directly to SpirV, so it may feel quite "clean". Shaders won't need to be compiled beforehand, though that may be true for glsl too, since that seems to be the on the roadmap: https://github.com/gfx-rs/naga

Once wgpu-py is updated to the latest wgpu-native, we can start playing with WGSL and see how well it works.

from pyshader.

Korijn avatar Korijn commented on May 30, 2024

I hope it doesn't have the same limitations as the web :) but it's looking promising indeed. I can also see how people would see it as a much more worthwhile exercise to learn WGSL, since it would be a skill they can apply outside pygfx as well.

from pyshader.

Korijn avatar Korijn commented on May 30, 2024

I think we've reached the conclusion on this one: we are going to stop pyshader development and switch wgpu-py and pygfx over to WGSL.

We should probably put a big notice at the top of the readme and archive this repo.

from pyshader.

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.