Giter Club home page Giter Club logo

Comments (9)

ruby0x1 avatar ruby0x1 commented on August 17, 2024

Hmm, first off - the TextureType and TextureSubmitTarget function as Int, meaning you can use GL_TEXTURE_EXTERNAL_OES (0x8D65) in place of a typed value as an Int and it will work just fine. Secondly, submit is only called in new, you haven't described the usage pattern enough to see the problem yet.

So if you call submit yourself with the right arguments, they don't have to be part of the enum to be passed in, what is the issue? Are you calling new every time or something?

from alpha.

kevinresol avatar kevinresol commented on August 17, 2024

ok, I didn't investigate thoroughly before posting. Here it is "real problem"

Basically the offending code is as simple as:

renderTexture = new RenderTexture({
	id: 'rt',
	width: 512,
	height: 512,
	type: 0x8D65, // GL_TEXTURE_EXTERNAL_OES
});

In the constructor of RenderTexture, it calls submit(null)

And then fails here

Basically the options.texture == null check is useless, because one is always created in the super() call.

And there is no way to make it call submit with a the correct target, which is the problem.

Point 1 & 3 of OP can be mitigated by user code. But point 2 is not, as described above.

from alpha.

ruby0x1 avatar ruby0x1 commented on August 17, 2024

right so, the texture handle needs to exist, so the call to super is ok. Call submit yourself immediately after new?

from alpha.

ruby0x1 avatar ruby0x1 commented on August 17, 2024

I'm trying to understand the actual problem you see, not the conceptual issue in the code, but the side effect of it.

from alpha.

kevinresol avatar kevinresol commented on August 17, 2024

The actual problem is, write this piece of code, then it crashes.

new RenderTexture({
	id: 'rt',
	width: 512,
	height: 512,
	type: 0x8D65, // GL_TEXTURE_EXTERNAL_OES
});

from alpha.

ruby0x1 avatar ruby0x1 commented on August 17, 2024

I tidied up the submit in this branch but since I can't test it with that texture type you'll have to test

from alpha.

kevinresol avatar kevinresol commented on August 17, 2024

Sure I will test it. Thanks!
But I also wonder isn't adding a submitTarget field to TextureOption more convenient?

from alpha.

ruby0x1 avatar ruby0x1 commented on August 17, 2024

Not really, the type is meant to be inferred from the TextureType, and TextureType is supposed to be (but isn't yet) an abstraction, which would mean that having GL concepts hardcoded in the API which I was trying to avoid

from alpha.

kevinresol avatar kevinresol commented on August 17, 2024

I tidied up the submit in this branch but since I can't test it with that texture type you'll have to test

Yes I can confirm it works now, thanks!

from alpha.

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.