Now the destination texture's size is retrieved from viewportSize, and we might rename this for consistency.
CC @kyeett
This would be useful
The tricky thing is that texture variables are different from regular variables in GLSL. You cannot define or use a local texture variable for example. Then, I'm thinking to define these functions (or global variables)
func destinationTextureSize() vec2func source0TextureSize() vec2func source1TextureSize() vec2func source2TextureSize() vec2func source3TextureSize() vec2This is how it looks in shadertoy, if you want a reference
uniform vec3 iResolution;
uniform float iTime;
uniform float iTimeDelta;
uniform float iFrame;
uniform float iChannelTime[4];
uniform vec4 iMouse;
uniform vec4 iDate;
uniform float iSampleRate;
uniform vec3 iChannelResolution[4];
uniform samplerXX iChanneli;
Not sure how they map to the ebiten concepts
https://www.shadertoy.com/howto
Now Ebiten stopped to treat textures as a variable in order to avoid confusion.
Instead of texture2D, you have to call texture[N]At like texture0At. This name might be renamed later.
I think I'll add these functions:
textureDestinationInternalSize() // a.k.a. viewportSize() nowtexture0InternalSize()texture1InternalSize()texture2InternalSize()texture3InternalSize()I adopted Internal because the size indicates the backend size of the images. For example, an image might be a part of a texture atlas. Even though an image is not on a texture atlas, the image might be a part of a bigger image, that size is power of 2.
For 'actual' sizes, users can pass them as uniform variables if necessary. I don't think there are use cases to use them though.
@kyeett @nanoslayer Any thoughts?
I'll omit 'Internal' since 'textures' are already internal things. Also, Destination seems verbose. Then
textureDstSize() // a.k.a. viewportSize() nowtexture0Size()texture1Size()texture2Size()texture3Size()Maybe texture should be renamed to image? texture is fine, but image is more consistent with the rest of Ebiten. I guess texture is more universal, and makes sense in contexts other than Ebiten.
Maybe texture should be renamed to image?
Good point. Ebiten's image is a part of an internal texture atlas. In the shader's level, the texture atlases are 'textures'. I'm not confident using 'image' is correct in the shader layer. The notions of 'size' are different anyway. Let me think...
Ebiten's image is a part of an internal texture atlas. In the shader's level, the texture atlases are 'textures'. I'm not confident using 'image' is correct in the shader layer. The notions of 'size' are different anyway.
In that case I would stick with texture.
Most helpful comment
In that case I would stick with
texture.