Coder Social home page Coder Social logo

Comments (2)

CptPotato avatar CptPotato commented on August 22, 2024

I'm wondering how this even works. I'm 99% sure that graphics APIs don't let you bind the same image as render attachment and another input image in the same pass, unless working with storage images in compute.

Does bevy implicitly copy the texture in the background? Otherwise you could try rendering to a separate texture (essentially double buffering) to see if that resolves the issue. Though I'm not positive that this is the source of the problem.

from bevy.

mxple avatar mxple commented on August 22, 2024

I did a bunch of testing and I'm still not completely sure what the issue is. Here's what I found though:
On WASM/WebGL:

  • Draw image STRAIGHT to the screen
    • On frame 0+, the initial image is drawn clearly to the screen
  • Draw image via custom material to the SCREEN
    • On frame 0-4, the image is not drawn (?) but there IS clear color from the camera
    • On frame 4+, the image is drawn to the screen
  • Pass image through custom shader/material and render to ITSELF, then draw the image to the screen
    • On frame 0+, a solid rectangle of red (#2A0000) is drawn to the screen

On native:

  • Draw image STRAIGHT to the screen
    • On frame 0, nothing is drawn. The screen is black.
    • On frame 1+, the image is drawn to the screen
  • Draw image via custom material to the SCREEN
    • On frame 0, nothing is drawn. The screen is black.
    • On frame 1+, the image is drawn to the screen
  • Pass image through custom shader/material and render to ITSELF, then draw the image to the screen
    • On frame 0, nothing is drawn. The screen is black.
    • On frame 1+, the image is drawn to the screen normally (correct behavior)

I conducted the tests by putting a stop point after RenderApp::Cleanup.

Is it byte alignment? Code execution speed? The backend/drivers? The difference in behavior between wasm and native is very confusing.

Attached is the red rectangle of despair.

image

from bevy.

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.