-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS app crashes on creating Texture #814
Comments
Which backend are you using, OpenGL? I think there were some changes recently to mipmap generation, but it's possible this is specific to iOS. Is there any particular message logged before crashing? |
if format is RGB8 then log is 019-02-14 10:35:51.922809+0530 FilamentDemo[291:12092] [DYMTLInitPlatform] platform initialization successful if format is SRGB8 then log is 2019-02-14 10:38:53.261018+0530 FilamentDemo[297:13117] [DYMTLInitPlatform] platform initialization successful |
I don't think iOS supports RGB colorbuffers, hence the "Texture format must be color renderable." assertion. Can you try with a RGBA texture and see if that succeeds? |
tried with format 2019-02-14 10:47:16.609869+0530 FilamentDemo[302:15292] [DYMTLInitPlatform] platform initialization successful with format 2019-02-14 10:49:25.732349+0530 FilamentDemo[308:16078] [DYMTLInitPlatform] platform initialization successful |
Okay, potentially something else going on- will take a closer look. |
This error triggers when |
@Raki just merged a fix- can pull and try again? Note that sRGB textures (correctly) do not support mipmap generation on iOS. |
Hi @bejado , I tried with latest code, no crashes so far. While debugging i can see like, the texture is being updated with current frame. |
Does that only happen when you generate mipmaps? Can you show your material file? |
@bejado , I tried disabling mipmaps but no change in output.
|
I don't see anything wrong with the material. Are you creating a sampler and setting it as a parameter on your material instance?
It would help if you could post all the changes you've made to HelloTriangle. |
@bejado The following are the changes I made to HelloTriangle Demo.
|
Can you try replacing
with
This might be a bug on our side. |
@bejado Yes, it worked with |
Sure thing! Note that you should be able to use |
I'm trying to render a texture quad by following the "hello-triangle" example on iOS. My new material to render the quad is proper as it is drawing a black quad if I didn't bind any texture to material instance. But when I call this function to create texture, it is crashing at
generateMipmaps(*engine)
void loadTexture(Engine* engine, const std::string& filePath, Texture** map, bool sRGB)
{
int w, h, n;
unsigned char* data = stbi_load(path.c_str(), &w, &h, &n, 3);
if (data != nullptr) {
*map = Texture::Builder()
.width(uint32_t(w))
.height(uint32_t(h))
.levels(0xff)
.format(sRGB?driver::TextureFormat::SRGB8:driver::TextureFormat::RGB8)
.build(*engine);
Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3),
Texture::Format::RGB, Texture::Type::UBYTE,
(driver::BufferDescriptor::Callback) &stbi_image_free);
(*map)->setImage(*engine, 0, std::move(buffer));
(*map)->generateMipmaps(*engine);
}
I pulled this function from Desktop samples of filament.
I tried tweaking png compression options on xCode but no luck.
The text was updated successfully, but these errors were encountered: