Giter Site home page Giter Site logo

Comments (5)

MartinSStewart avatar MartinSStewart commented on July 28, 2024 2

Interesting! It seems like a worthwhile tradeoff then to keep track of the GPU state and reduce redundant calls at the expense of complexity?

from webgl.

w0rm avatar w0rm commented on July 28, 2024 1

@ianmackenzie shared this article, that indicates that avoiding redundant WebGL calls can be a big win: https://emscripten.org/docs/optimizing/Optimizing-WebGL.html#avoid-redundant-calls

from webgl.

w0rm avatar w0rm commented on July 28, 2024

@MartinSStewart thanks! I am aware of this happening. Basically each entity assumes it starts with a clean state, and then sets all the needed settings by making the function calls, and then resets them after the draw call.

Alternatively, we could store a virtual copy of the current gl state and diff each setting against that. This is a possible optimisation, but it assumes that diffing would be performing better than the redundant function calls. Is there any information on how slow these kind of calls are?

from webgl.

MartinSStewart avatar MartinSStewart commented on July 28, 2024

I counted up the duration of all the redundant draw calls for this specific capture and got approximately 0.845 (for some baffling reason sceptor's UI doesn't say what unit that's in but I'm guessing it's milliseconds). I don't know how reliable that value is though.

My gut feeling is that yes it's worthwhile to diff on the CPU rather than send redundant calls to the GPU. I can't find any direct evidence to support this though. I think the best approach is to try it and benchmark the results. If you'd like I can provide the source code for my game if you need something to profile.

from webgl.

MartinSStewart avatar MartinSStewart commented on July 28, 2024

Saw the pull request. Thanks for all the hard work! I'll go ahead and close this issue then.

from webgl.

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.