gpu.js icon indicating copy to clipboard operation
gpu.js copied to clipboard

ERROR Error: Error compiling fragment shader: ERROR: 0:145: 'pow' : no matching overloaded function found

Open konradst opened this issue 7 years ago • 5 comments

Do I understand correctly that in 2.x you're writing matching functions from scratch?

konradst avatar Mar 12 '19 22:03 konradst

No, that is incorrect. What is likely happening is that a type isn't being correctly detected and casted. We use standard functions where possible, and only use non-standard when absolutely needed.

Can you share a snippet of what you have that reproduces this?

robertleeplummerjr avatar Mar 13 '19 16:03 robertleeplummerjr

Sure. The gpu.js files are downloaded from bin folder and renamed for the purpose of easily switching versions. When you uncomment 1.10.2, the script works. in 2.x it doesn't.

<!doctype html>

<html lang="en">

<head>

    <script src="gpu-browser-2.0.0-rc2.js"></script>

    <!-- <script src="gpu-browser-2.0.0-rc3.js"></script> -->

    <!-- <script src="gpu-1.10.2.js"></script> -->

    <script>
        function task () {
            let result = 0;
            for (let t = 10; t > 0; t--) {
                for (let i = 5000000; i > 0; i--) {
                    result += Math.pow(i, -i);
                }
            }
            return result;
        };

        const gpu = new GPU({ mode: 'gpu' });

        const kernel = gpu.createKernel(task, {
            output: [1]
        });

        const result = kernel();

        alert(result[0]);
    </script>
</head>
<body></body>
</html>


konradst avatar Mar 13 '19 18:03 konradst

I know what this issue is here, and will be adding a fix in the next day or two.

robertleeplummerjr avatar Mar 14 '19 20:03 robertleeplummerjr

thank you:)

konradst avatar Mar 16 '19 09:03 konradst

I believe this has been resolved in v2.0.0 rc 4 and I as well added unit tests to prevent this from popping up in the future. Ty for bringing this to my attention!

Let me know if that doesn't work for you, and as well if this or anything resembling it come up in the future.

robertleeplummerjr avatar Mar 18 '19 02:03 robertleeplummerjr