Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Fragment shader functions not in working order

未关闭
#727 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript

调研方向

首先运行链接的 gpgpuTest 示例,并将生成的着色器与 reorganizedFragmentShader.js 和 originalFragmentShader.js 进行比较,尤其要关注 issue 中引用的函数范围。跟踪 GPU.js 如何组装片段着色器,并复现 WebGL 编译失败。完成的标准是示例能够编译并运行,而无需手动重新排列函数。

由索引模型根据 Issue 内容生成。

描述

What is wrong?

I have a problem with a shader. The functions in the shader are not in the correct order. I am trying to add roughly 20 functions, and they are breaking the compiled fragment shader. The problematic shader has some functions defined before functions it depends on, which apparently does not work in webGL. I rearranged the shader functions by hand and it works fine.

Where does it happen?

A website running GPU.js on my desktop Mac mini (specifically this website https://m0ose.github.io/jsSketches/gpgpuTest/index2.html)

How do we replicate the issue?

I put the example webpage here https://m0ose.github.io/jsSketches/gpgpuTest/index2.html , and the source code for it is here https://github.com/m0ose/jsSketches/tree/master/gpgpuTest .
The first time it tries to run the kernel it uses the compiled shader, and throws an error. Then, it sets the shader to the hand edited one(with the functions in a different order) and it works.
Specifically, I had to change the order of these functions to get it to work, https://github.com/m0ose/jsSketches/blob/master/gpgpuTest/reorganizedFragmentShader.js#L473-L531 .
Here is the original runtime compiled shader for reference, https://github.com/m0ose/jsSketches/blob/master/gpgpuTest/originalFragmentShader.js#L540-L545 .

How important is this (1-5)?

𝜋

Expected behavior (i.e. solution)

I am not sure what is causing this bug. I was not able to extract a smaller example, which might show the problem better. Could it be caused by the function names?

Other Comments

This is an Amazing library.

主要语言
JavaScript
星标
15.5k
派生
663
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

gpujs/gpu.js 的其他 Issue

查看 gpujs/gpu.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。