Code Monkey home page Code Monkey logo

webgl-memory's People

Contributors

christurnbull avatar dmtaub avatar erjanmx avatar greggman avatar lojjic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

webgl-memory's Issues

Wrong module output on package.json

Context

I'm using the framework vite for the first time in the version 2.7.2 and am trying to use [email protected] in my project.

Problem

"module": "src/webgl-memory.js",

This does not work properly on my vite setup.
The package served from npm does not contain /src/webgl-memory.js, it's just /webgl-memory.js .

Here's the error: [vite:resolve] Failed to resolve entry for package "webgl-memory". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "webgl-memory". The package may have incorrect main/module/exports specified in its package.json.

I'm not sure what is the intention that you set here /src/webgl-memory.js but it will work by changing here to /webgl-memory.js by my hand.

Since it's my first time using vite, I have no idea why vite complains about it honestly, I'm sorry.

Here's how the current package look like: https://www.unpkg.com/browse/[email protected]/

Also

This package really saved my life so far.

Garbage collector problem

Garbage collector cannot delete textures from gpu memory when using this extension!
Is this a bug or is it normal?
If this is normal, can't the problem be fixed using WeakRef?

Crash when using Cesium.js

Error message:

An error occurred while rendering.  Rendering has stopped.
Error: unsupported bufferData src type [object ArrayBuffer]
Error: unsupported bufferData src type [object ArrayBuffer]

it seems that the bufferData method should accept data of type ArrayBuffer, syntax copy from https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData:

// WebGL1:
void gl.bufferData(target, size, usage);
void gl.bufferData(target, ArrayBuffer? srcData, usage);
void gl.bufferData(target, ArrayBufferView srcData, usage);

// WebGL2:
void gl.bufferData(target, ArrayBufferView srcData, usage, srcOffset, length);

With minor modifications, it works fine:

       // WebGL1
       //   void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
       //   void bufferData(GLenum target, [AllowShared] BufferSource? srcData, GLenum usage);
       // WebGL2:
       //   void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage, GLuint srcOffset,
       //                   optional GLuint length = 0);
       bufferData(gl, funcName, args) {
           const [target, src, /* usage */, srcOffset = 0, length = undefined] = args;
           const obj = bindings.get(target);
           if (!obj) {
             throw new Error(`no buffer bound to ${target}`);
           }
           let newSize = 0;
           if (length !== undefined) {
             newSize = length;
           } else if (isTypedArray(src)) {
             newSize = src.byteLength;
           } else if (isNumber(src)) {
             newSize = src;
+          } else if (src instanceof ArrayBuffer) {
+             newSize = src.byteLength;
           } else {
             throw new Error(`unsupported bufferData src type ${src}`);
           }
  

Crash when using Posenet (TensorFlowJS)

I use ThreeJS and TensorFlowJS.

https://github.com/tensorflow/tfjs-models/tree/master/pose-detection

After initalizing Posnet webgl-memory crashes

webgl-memory.js:772 Uncaught (in promise) ReferenceError: obj is not defined
at webgl-memory.js:772
at WebGL2RenderingContext.ctx. [as fenceSync] (webgl-memory.js:921)
at t.e.createFence (tfjs.js:17)
at t.e.createAndWaitForFence (tfjs.js:17)
at e. (tfjs.js:17)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at Wm (tfjs.js:17)
at o (tfjs.js:17)
at tfjs.js:17
at new Promise ()
at e. (tfjs.js:17)
at e.read (tfjs.js:17)
at t.e.read (tfjs.js:17)
at t. (tfjs.js:17)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at Wm (tfjs.js:17)
at o (tfjs.js:17)
at tfjs.js:17
at new Promise ()
at t. (tfjs.js:17)
at t.data (tfjs.js:17)
at t. (tfjs.js:17)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at Wm (tfjs.js:17)
at o (tfjs.js:17)
at tfjs.js:17
at new Promise ()
at t. (tfjs.js:17)
at t.buffer (tfjs.js:17)
at posenet.js:17
at Array.map ()
at posenet.js:17
at posenet.js:17
at Object.next (posenet.js:17)
at posenet.js:17
at new Promise ()
at u (posenet.js:17)
at posenet.js:17
at t. (posenet.js:17)
at posenet.js:17
at Object.next (posenet.js:17)
at posenet.js:17
at new Promise ()
at u (posenet.js:17)
grafik

Have you any hint for me. Thanks.

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.